Bläddra i källkod

Optimized Ray a bit more.

It's enough to clone just for hits, no need to do it for every face.
alteredq 13 år sedan
förälder
incheckning
b6e7ad88af
7 ändrade filer med 395 tillägg och 395 borttagningar
  1. 178 178
      build/Three.js
  2. 34 34
      build/custom/ThreeCanvas.js
  3. 18 18
      build/custom/ThreeDOM.js
  4. 4 4
      build/custom/ThreeExtras.js
  5. 26 26
      build/custom/ThreeSVG.js
  6. 131 131
      build/custom/ThreeWebGL.js
  7. 4 4
      src/core/Ray.js

+ 178 - 178
build/Three.js

@@ -1,6 +1,6 @@
 // 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 c=Date.now(),a=0.001*(c-this.oldTime);this.oldTime=c;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 c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;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,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var d,g,e;if(b===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),g=a*6-d,a=b*(1-c),e=b*(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,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var d,g,e;if(b===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),g=a*6-d,a=b*(1-c),e=b*(1-
 c*g),c=b*(1-c*(1-g)),d){case 1:this.r=e;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=e;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=e;break;case 6:case 0:this.r=b,this.g=c,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("+
 c*g),c=b*(1-c*(1-g)),d){case 1:this.r=e;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=e;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=e;break;case 6:case 0:this.r=b,this.g=c,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,c){this.x=a||0;this.y=c||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,c){this.x=a||0;this.y=c||0};
@@ -15,31 +15,31 @@ this.y=Math.asin(a.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-a.n23/c,a.n33/c),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
 c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){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())},
 c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){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,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};
-THREE.Ray=function(a,c){function b(a,b,c){l=l.copy(c).subSelf(a);m=l.dot(b);if(m<=0)return null;r=n.copy(a).addSelf(o.copy(b).multiplyScalar(m));return p=c.distanceTo(r)}function d(a,b,c,d){l.copy(d).subSelf(b);n.copy(c).subSelf(b);o.copy(a).subSelf(b);s=l.dot(l);u=l.dot(n);x=l.dot(o);q=n.dot(n);t=n.dot(o);v=1/(s*q-u*u);y=(q*x-u*t)*v;H=(s*t-u*x)*v;return y>=0&&H>=0&&y+H<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+THREE.Ray=function(a,c){function b(a,b,c){l=l.copy(c).subSelf(a);m=l.dot(b);if(m<=0)return null;t=n.copy(a).addSelf(o.copy(b).multiplyScalar(m));return p=c.distanceTo(t)}function d(a,b,c,d){l.copy(d).subSelf(b);n.copy(c).subSelf(b);o.copy(a).subSelf(b);r=l.dot(l);u=l.dot(n);x=l.dot(o);q=n.dot(n);s=n.dot(o);v=1/(r*q-u*u);y=(q*x-u*s)*v;H=(r*s-u*x)*v;return y>=0&&H>=0&&y+H<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
 this.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};var g=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,c=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(m){for(var l,n=[],p=0,o=m.children.length;p<o;p++)Array.prototype.push.apply(n,this.intersectObject(m.children[p]));
 this.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};var g=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,c=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(m){for(var l,n=[],p=0,o=m.children.length;p<o;p++)Array.prototype.push.apply(n,this.intersectObject(m.children[p]));
-if(m instanceof THREE.Particle){p=b(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.scale.x)return[];l={distance:p,point:m.position,face:null,object:m};n.push(l)}else if(m instanceof THREE.Mesh){p=b(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return n;var r,s=m.geometry,q=s.vertices,u;m.matrixRotationWorld.extractRotation(m.matrixWorld);p=0;for(o=s.faces.length;p<
-o;p++)if(l=s.faces[p],a=a.copy(this.origin),c=c.copy(this.direction),u=m.matrixWorld,i=u.multiplyVector3(i.copy(l.centroid)).subSelf(a),r=i.dot(c),!(r<=0)&&(g=u.multiplyVector3(g.copy(q[l.a].position)),e=u.multiplyVector3(e.copy(q[l.b].position)),f=u.multiplyVector3(f.copy(q[l.c].position)),h=l instanceof THREE.Face4?u.multiplyVector3(h.copy(q[l.d].position)):null,k=m.matrixRotationWorld.multiplyVector3(k.copy(l.normal)),r=c.dot(k),m.doubleSided||(m.flipSided?r>0:r<0)))if(r=k.dot(i.sub(g,a))/r,r=
-a.clone().addSelf(c.multiplyScalar(r)),l instanceof THREE.Face3)d(r,g,e,f)&&(l={distance:a.distanceTo(r),point:r,face:l,object:m},n.push(l));else if(l instanceof THREE.Face4&&(d(r,g,e,h)||d(r,e,f,h)))l={distance:a.distanceTo(r),point:r,face:l,object:m},n.push(l)}return n};var l=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,m,r,p,s,u,x,q,t,v,y,H};
+if(m instanceof THREE.Particle){p=b(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.scale.x)return[];l={distance:p,point:m.position,face:null,object:m};n.push(l)}else if(m instanceof THREE.Mesh){p=b(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return n;var t,r=m.geometry,q=r.vertices,u,x=new THREE.Vector3;m.matrixRotationWorld.extractRotation(m.matrixWorld);p=0;for(o=
+r.faces.length;p<o;p++)if(l=r.faces[p],a=a.copy(this.origin),c=c.copy(this.direction),u=m.matrixWorld,i=u.multiplyVector3(i.copy(l.centroid)).subSelf(a),t=i.dot(c),!(t<=0)&&(g=u.multiplyVector3(g.copy(q[l.a].position)),e=u.multiplyVector3(e.copy(q[l.b].position)),f=u.multiplyVector3(f.copy(q[l.c].position)),h=l instanceof THREE.Face4?u.multiplyVector3(h.copy(q[l.d].position)):null,k=m.matrixRotationWorld.multiplyVector3(k.copy(l.normal)),t=c.dot(k),m.doubleSided||(m.flipSided?t>0:t<0)))if(t=k.dot(i.sub(g,
+a))/t,x.add(a,c.multiplyScalar(t)),l instanceof THREE.Face3)d(x,g,e,f)&&(l={distance:a.distanceTo(x),point:x.clone(),face:l,object:m},n.push(l));else if(l instanceof THREE.Face4&&(d(x,g,e,h)||d(x,e,f,h)))l={distance:a.distanceTo(x),point:x.clone(),face:l,object:m},n.push(l)}return n};var l=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,m,t,p,r,u,x,q,s,v,y,H};
 THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,n){h=!1;c=e;b=f;d=l;g=n;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
 THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,n){h=!1;c=e;b=f;d=l;g=n;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
 function(e,f,l,n,o,m){h?(h=!1,c=e<l?e<o?e:o:l<o?l:o,b=f<n?f<m?f:m:n<m?n:m,d=e>l?e>o?e:o:l>o?l:o,g=f>n?f>m?f:m:n>m?n:m):(c=e<l?e<o?e<c?e:c:o<c?o:c:l<o?l<c?l:c:o<c?o:c,b=f<n?f<m?f<b?f:b:m<b?m:b:n<m?n<b?n:b:m<b?m:b,d=e>l?e>o?e>d?e:d:o>d?o:d:l>o?l>d?l:d:o>d?o:d,g=f>n?f>m?f>g?f:g:m>g?m:g:n>m?n>g?n:g:m>g?m:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
 function(e,f,l,n,o,m){h?(h=!1,c=e<l?e<o?e:o:l<o?l:o,b=f<n?f<m?f:m:n<m?n:m,d=e>l?e>o?e:o:l>o?l:o,g=f>n?f>m?f:m:n>m?n:m):(c=e<l?e<o?e<c?e:c:o<c?o:c:l<o?l<c?l:c:o<c?o:c,b=f<n?f<m?f<b?f:b:m<b?m:b:n<m?n<b?n:b:m<b?m:b,d=e>l?e>o?e>d?e:d:o>d?o:d:l>o?l>d?l:d:o>d?o:d,g=f>n?f>m?f>g?f:g:m>g?m:g:n>m?n>g?n:g:m>g?m:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
 e.getBottom()?g:e.getBottom());a()};this.inflate=function(e){c-=e;b-=e;d+=e;g+=e;a()};this.minSelf=function(e){c=c>e.getLeft()?c:e.getLeft();b=b>e.getTop()?b:e.getTop();d=d<e.getRight()?d:e.getRight();g=g<e.getBottom()?g:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){h=!0;g=d=b=c=0;a()};this.isEmpty=function(){return h}};
 e.getBottom()?g:e.getBottom());a()};this.inflate=function(e){c-=e;b-=e;d+=e;g+=e;a()};this.minSelf=function(e){c=c>e.getLeft()?c:e.getLeft();b=b>e.getTop()?b:e.getTop();d=d<e.getRight()?d:e.getRight();g=g<e.getBottom()?g:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){h=!0;g=d=b=c=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,d,g){return d+(a-c)*(g-d)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,d,g){return d+(a-c)*(g-d)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,k,l,n,o,m,r,p){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,k||0,l!==void 0?l:1,n||0,o||0,m||0,r||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,k,l,n,o,m,r,p){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=n;this.n41=o;this.n42=m;this.n43=r;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,n=a.n32,o=a.n33,m=a.n34,r=a.n41,p=a.n42,s=a.n43,
-u=a.n44,x=c.n11,q=c.n12,t=c.n13,v=c.n14,y=c.n21,H=c.n22,J=c.n23,F=c.n24,z=c.n31,D=c.n32,P=c.n33,G=c.n34,$=c.n41,L=c.n42,Q=c.n43,da=c.n44;this.n11=b*x+d*y+g*z+e*$;this.n12=b*q+d*H+g*D+e*L;this.n13=b*t+d*J+g*P+e*Q;this.n14=b*v+d*F+g*G+e*da;this.n21=f*x+h*y+i*z+k*$;this.n22=f*q+h*H+i*D+k*L;this.n23=f*t+h*J+i*P+k*Q;this.n24=f*v+h*F+i*G+k*da;this.n31=l*x+n*y+o*z+m*$;this.n32=l*q+n*H+o*D+m*L;this.n33=l*t+n*J+o*P+m*Q;this.n34=l*v+n*F+o*G+m*da;this.n41=r*x+p*y+s*z+u*$;this.n42=r*q+p*H+s*D+u*L;this.n43=r*
-t+p*J+s*P+u*Q;this.n44=r*v+p*F+s*G+u*da;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;
+THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,k,l,n,o,m,t,p){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,k||0,l!==void 0?l:1,n||0,o||0,m||0,t||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,k,l,n,o,m,t,p){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=n;this.n41=o;this.n42=m;this.n43=t;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,n=a.n32,o=a.n33,m=a.n34,t=a.n41,p=a.n42,r=a.n43,
+u=a.n44,x=c.n11,q=c.n12,s=c.n13,v=c.n14,y=c.n21,H=c.n22,J=c.n23,F=c.n24,z=c.n31,D=c.n32,P=c.n33,G=c.n34,$=c.n41,L=c.n42,Q=c.n43,da=c.n44;this.n11=b*x+d*y+g*z+e*$;this.n12=b*q+d*H+g*D+e*L;this.n13=b*s+d*J+g*P+e*Q;this.n14=b*v+d*F+g*G+e*da;this.n21=f*x+h*y+i*z+k*$;this.n22=f*q+h*H+i*D+k*L;this.n23=f*s+h*J+i*P+k*Q;this.n24=f*v+h*F+i*G+k*da;this.n31=l*x+n*y+o*z+m*$;this.n32=l*q+n*H+o*D+m*L;this.n33=l*s+n*J+o*P+m*Q;this.n34=l*v+n*F+o*G+m*da;this.n41=t*x+p*y+r*z+u*$;this.n42=t*q+p*H+r*D+u*L;this.n43=t*
+s+p*J+r*P+u*Q;this.n44=t*v+p*F+r*G+u*da;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;
 this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*
 this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*
 c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*
 c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*
-a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,n=this.n34,o=this.n41,m=this.n42,r=this.n43,p=this.n44;return d*f*k*o-b*h*k*o-d*e*l*o+c*h*l*o+b*e*n*o-c*f*n*o-d*f*i*m+b*h*i*m+d*g*l*m-a*h*l*m-b*g*n*m+a*f*n*m+d*e*i*r-c*h*i*r-d*g*k*r+a*h*k*r+c*g*n*r-a*e*n*r-b*e*i*p+c*f*i*p+b*g*k*p-a*f*k*p-c*g*l*p+a*e*l*
+a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,n=this.n34,o=this.n41,m=this.n42,t=this.n43,p=this.n44;return d*f*k*o-b*h*k*o-d*e*l*o+c*h*l*o+b*e*n*o-c*f*n*o-d*f*i*m+b*h*i*m+d*g*l*m-a*h*l*m-b*g*n*m+a*f*n*m+d*e*i*t-c*h*i*t-d*g*k*t+a*h*k*t+c*g*n*t-a*e*n*t-b*e*i*p+c*f*i*p+b*g*k*p-a*f*k*p-c*g*l*p+a*e*l*
 p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
 p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
 a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;
 a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;
 a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;
 a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;
 a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,
 a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,
 0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,k=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+b,k*h-d*e,0,i*h-d*f,k*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
 0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,k=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+b,k*h-d*e,0,i*h-d*f,k*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,n=a.n33,o=a.n34,m=a.n41,r=a.n42,p=a.n43,s=a.n44;this.n11=h*o*r-i*n*r+i*l*p-f*o*p-h*l*s+f*n*s;this.n12=g*n*r-d*o*r-g*l*p+b*o*p+d*l*s-b*n*s;this.n13=d*i*r-g*h*r+g*f*p-b*i*p-d*f*s+b*h*s;this.n14=g*h*l-d*i*l-g*f*n+b*i*n+d*f*o-b*h*o;this.n21=i*n*m-h*o*m-i*k*p+e*o*p+h*k*s-e*n*s;this.n22=d*o*m-g*n*m+
-g*k*p-c*o*p-d*k*s+c*n*s;this.n23=g*h*m-d*i*m-g*e*p+c*i*p+d*e*s-c*h*s;this.n24=d*i*k-g*h*k+g*e*n-c*i*n-d*e*o+c*h*o;this.n31=f*o*m-i*l*m+i*k*r-e*o*r-f*k*s+e*l*s;this.n32=g*l*m-b*o*m-g*k*r+c*o*r+b*k*s-c*l*s;this.n33=d*i*m-g*f*m+g*e*r-c*i*r-b*e*s+c*f*s;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*o-c*f*o;this.n41=h*l*m-f*n*m-h*k*r+e*n*r+f*k*p-e*l*p;this.n42=b*n*m-d*l*m+d*k*r-c*n*r-b*k*p+c*l*p;this.n43=d*f*m-b*h*m-d*e*r+c*h*r+b*e*p-c*f*p;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*n+c*f*n;this.multiplyScalar(1/a.determinant());
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,n=a.n33,o=a.n34,m=a.n41,t=a.n42,p=a.n43,r=a.n44;this.n11=h*o*t-i*n*t+i*l*p-f*o*p-h*l*r+f*n*r;this.n12=g*n*t-d*o*t-g*l*p+b*o*p+d*l*r-b*n*r;this.n13=d*i*t-g*h*t+g*f*p-b*i*p-d*f*r+b*h*r;this.n14=g*h*l-d*i*l-g*f*n+b*i*n+d*f*o-b*h*o;this.n21=i*n*m-h*o*m-i*k*p+e*o*p+h*k*r-e*n*r;this.n22=d*o*m-g*n*m+
+g*k*p-c*o*p-d*k*r+c*n*r;this.n23=g*h*m-d*i*m-g*e*p+c*i*p+d*e*r-c*h*r;this.n24=d*i*k-g*h*k+g*e*n-c*i*n-d*e*o+c*h*o;this.n31=f*o*m-i*l*m+i*k*t-e*o*t-f*k*r+e*l*r;this.n32=g*l*m-b*o*m-g*k*t+c*o*t+b*k*r-c*l*r;this.n33=d*i*m-g*f*m+g*e*t-c*i*t-b*e*r+c*f*r;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*o-c*f*o;this.n41=h*l*m-f*n*m-h*k*t+e*n*t+f*k*p-e*l*p;this.n42=b*n*m-d*l*m+d*k*t-c*n*t-b*k*p+c*l*p;this.n43=d*f*m-b*h*m-d*e*t+c*h*t+b*e*p-c*f*p;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*n+c*f*n;this.multiplyScalar(1/a.determinant());
 return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,k=f*g,l=d*h,n=d*g;this.n11=i+n*b;this.n12=l*b-k;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=k*b-l;this.n32=n+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;n=d*g;this.n11=i-n*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=n-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
 return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,k=f*g,l=d*h,n=d*g;this.n11=i+n*b;this.n12=l*b-k;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=k*b-l;this.n32=n+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;n=d*g;this.n11=i-n*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=n-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
 e*h;k=e*g;l=b*h;n=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+n;this.n21=f*g;this.n22=n*d+i;this.n23=k*d-l;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;k=e*d;l=b*f;n=b*d;this.n11=f*h;this.n12=n-i*g;this.n13=l*g+k;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=k*g+l;this.n33=i-n*g;break;case "XZY":i=e*f;k=e*d;l=b*f;n=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+n;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=n*g+i;break;default:i=e*h,k=e*
 e*h;k=e*g;l=b*h;n=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+n;this.n21=f*g;this.n22=n*d+i;this.n23=k*d-l;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;k=e*d;l=b*f;n=b*d;this.n11=f*h;this.n12=n-i*g;this.n13=l*g+k;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=k*g+l;this.n33=i-n*g;break;case "XZY":i=e*f;k=e*d;l=b*f;n=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+n;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=n*g+i;break;default:i=e*h,k=e*
 g,l=b*h,n=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-n*d,this.n23=-b*f,this.n31=n-i*d,this.n32=l+k*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var k=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(k+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+k);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
 g,l=b*h,n=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-n*d,this.n23=-b*f,this.n31=n-i*d,this.n32=l+k*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var k=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(k+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+k);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
@@ -56,24 +56,24 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi
 if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,k=[],
 THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,k=[],
-l,n,o=[],m,r=[],p,s,u=[],x,q,t=[],v={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,H=new THREE.Vector4,J=new THREE.Matrix4,F=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,P=new THREE.Vector4;this.computeFrustum=function(a){z[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+l,n,o=[],m,t=[],p,r,u=[],x,q,s=[],v={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,H=new THREE.Vector4,J=new THREE.Matrix4,F=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,P=new THREE.Vector4;this.computeFrustum=function(a){z[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
 a.n23,a.n44+a.n24);z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);z[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=z[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 a.n23,a.n44+a.n24);z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);z[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=z[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
 J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
 e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=z[h].x*d.n14+z[h].y*d.n24+z[h].z*d.n34+z[h].w,c<=e){c=!1;break a}c=!0}c?(J.multiplyVector3(y.copy(b.position)),g=a(),g.object=b,g.z=y.z,v.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(J.multiplyVector3(y.copy(b.position)),g=a(),g.object=b,g.z=y.z,v.sprites.push(g)):b instanceof THREE.Light&&v.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
 e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=z[h].x*d.n14+z[h].y*d.n24+z[h].z*d.n34+z[h].w,c<=e){c=!1;break a}c=!0}c?(J.multiplyVector3(y.copy(b.position)),g=a(),g.object=b,g.z=y.z,v.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(J.multiplyVector3(y.copy(b.position)),g=a(),g.object=b,g.z=y.z,v.sprites.push(g)):b instanceof THREE.Light&&v.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
-v.objects.sort(b);return v};this.projectScene=function(a,e,g){var f=e.near,y=e.far,z,S,A,C,K,j,O,fa,Y,R,N,ea,U,ca,Z,X;q=s=m=n=0;v.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);J.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(J);v=this.projectGraph(a,!1);a=0;for(z=v.objects.length;a<z;a++)if(Y=v.objects[a].object,R=Y.matrixWorld,
+v.objects.sort(b);return v};this.projectScene=function(a,e,g){var f=e.near,y=e.far,z,S,A,C,K,j,O,fa,Y,R,N,ea,U,ca,Z,X;q=r=m=n=0;v.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);J.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(J);v=this.projectGraph(a,!1);a=0;for(z=v.objects.length;a<z;a++)if(Y=v.objects[a].object,R=Y.matrixWorld,
 ea=Y.material,i=0,Y instanceof THREE.Mesh){N=Y.geometry;U=Y.geometry.materials;C=N.vertices;ca=N.faces;Z=N.faceVertexUvs;N=Y.matrixRotationWorld.extractRotation(R);S=0;for(A=C.length;S<A;S++)h=c(),h.positionWorld.copy(C[S].position),R.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),J.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<y;C=0;for(S=ca.length;C<S;C++){A=
 ea=Y.material,i=0,Y instanceof THREE.Mesh){N=Y.geometry;U=Y.geometry.materials;C=N.vertices;ca=N.faces;Z=N.faceVertexUvs;N=Y.matrixRotationWorld.extractRotation(R);S=0;for(A=C.length;S<A;S++)h=c(),h.positionWorld.copy(C[S].position),R.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),J.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<y;C=0;for(S=ca.length;C<S;C++){A=
 ca[C];if(A instanceof THREE.Face3)if(K=k[A.a],j=k[A.b],O=k[A.c],K.visible&&j.visible&&O.visible&&(Y.doubleSided||Y.flipSided!=(O.positionScreen.x-K.positionScreen.x)*(j.positionScreen.y-K.positionScreen.y)-(O.positionScreen.y-K.positionScreen.y)*(j.positionScreen.x-K.positionScreen.x)<0))fa=o[n]=o[n]||new THREE.RenderableFace3,n++,l=fa,l.v1.copy(K),l.v2.copy(j),l.v3.copy(O);else continue;else if(A instanceof THREE.Face4)if(K=k[A.a],j=k[A.b],O=k[A.c],fa=k[A.d],K.visible&&j.visible&&O.visible&&fa.visible&&
 ca[C];if(A instanceof THREE.Face3)if(K=k[A.a],j=k[A.b],O=k[A.c],K.visible&&j.visible&&O.visible&&(Y.doubleSided||Y.flipSided!=(O.positionScreen.x-K.positionScreen.x)*(j.positionScreen.y-K.positionScreen.y)-(O.positionScreen.y-K.positionScreen.y)*(j.positionScreen.x-K.positionScreen.x)<0))fa=o[n]=o[n]||new THREE.RenderableFace3,n++,l=fa,l.v1.copy(K),l.v2.copy(j),l.v3.copy(O);else continue;else if(A instanceof THREE.Face4)if(K=k[A.a],j=k[A.b],O=k[A.c],fa=k[A.d],K.visible&&j.visible&&O.visible&&fa.visible&&
-(Y.doubleSided||Y.flipSided!=((fa.positionScreen.x-K.positionScreen.x)*(j.positionScreen.y-K.positionScreen.y)-(fa.positionScreen.y-K.positionScreen.y)*(j.positionScreen.x-K.positionScreen.x)<0||(j.positionScreen.x-O.positionScreen.x)*(fa.positionScreen.y-O.positionScreen.y)-(j.positionScreen.y-O.positionScreen.y)*(fa.positionScreen.x-O.positionScreen.x)<0)))X=r[m]=r[m]||new THREE.RenderableFace4,m++,l=X,l.v1.copy(K),l.v2.copy(j),l.v3.copy(O),l.v4.copy(fa);else continue;l.normalWorld.copy(A.normal);
+(Y.doubleSided||Y.flipSided!=((fa.positionScreen.x-K.positionScreen.x)*(j.positionScreen.y-K.positionScreen.y)-(fa.positionScreen.y-K.positionScreen.y)*(j.positionScreen.x-K.positionScreen.x)<0||(j.positionScreen.x-O.positionScreen.x)*(fa.positionScreen.y-O.positionScreen.y)-(j.positionScreen.y-O.positionScreen.y)*(fa.positionScreen.x-O.positionScreen.x)<0)))X=t[m]=t[m]||new THREE.RenderableFace4,m++,l=X,l.v1.copy(K),l.v2.copy(j),l.v3.copy(O),l.v4.copy(fa);else continue;l.normalWorld.copy(A.normal);
 N.multiplyVector3(l.normalWorld);l.centroidWorld.copy(A.centroid);R.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);J.multiplyVector3(l.centroidScreen);O=A.vertexNormals;K=0;for(j=O.length;K<j;K++)fa=l.vertexNormalsWorld[K],fa.copy(O[K]),N.multiplyVector3(fa);K=0;for(j=Z.length;K<j;K++)if(X=Z[K][C]){O=0;for(fa=X.length;O<fa;O++)l.uvs[K][O]=X[O]}l.material=ea;l.faceMaterial=A.materialIndex!==null?U[A.materialIndex]:null;l.z=l.centroidScreen.z;v.elements.push(l)}}else if(Y instanceof
 N.multiplyVector3(l.normalWorld);l.centroidWorld.copy(A.centroid);R.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);J.multiplyVector3(l.centroidScreen);O=A.vertexNormals;K=0;for(j=O.length;K<j;K++)fa=l.vertexNormalsWorld[K],fa.copy(O[K]),N.multiplyVector3(fa);K=0;for(j=Z.length;K<j;K++)if(X=Z[K][C]){O=0;for(fa=X.length;O<fa;O++)l.uvs[K][O]=X[O]}l.material=ea;l.faceMaterial=A.materialIndex!==null?U[A.materialIndex]:null;l.z=l.centroidScreen.z;v.elements.push(l)}}else if(Y instanceof
-THREE.Line){F.multiply(J,R);C=Y.geometry.vertices;K=c();K.positionScreen.copy(C[0].position);F.multiplyVector4(K.positionScreen);S=1;for(A=C.length;S<A;S++)if(K=c(),K.positionScreen.copy(C[S].position),F.multiplyVector4(K.positionScreen),j=k[i-2],D.copy(K.positionScreen),P.copy(j.positionScreen),d(D,P))D.multiplyScalar(1/D.w),P.multiplyScalar(1/P.w),Y=u[s]=u[s]||new THREE.RenderableLine,s++,p=Y,p.v1.positionScreen.copy(D),p.v2.positionScreen.copy(P),p.z=Math.max(D.z,P.z),p.material=ea,v.elements.push(p)}a=
-0;for(z=v.sprites.length;a<z;a++)if(Y=v.sprites[a].object,R=Y.matrixWorld,Y instanceof THREE.Particle&&(H.set(R.n14,R.n24,R.n34,1),J.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<1))f=t[q]=t[q]||new THREE.RenderableParticle,q++,x=f,x.x=H.x/H.w,x.y=H.y/H.w,x.z=H.z,x.rotation=Y.rotation.z,x.scale.x=Y.scale.x*Math.abs(x.x-(H.x+e.projectionMatrix.n11)/(H.w+e.projectionMatrix.n14)),x.scale.y=Y.scale.y*Math.abs(x.y-(H.y+e.projectionMatrix.n22)/(H.w+e.projectionMatrix.n24)),x.material=Y.material,v.elements.push(x);
+THREE.Line){F.multiply(J,R);C=Y.geometry.vertices;K=c();K.positionScreen.copy(C[0].position);F.multiplyVector4(K.positionScreen);S=1;for(A=C.length;S<A;S++)if(K=c(),K.positionScreen.copy(C[S].position),F.multiplyVector4(K.positionScreen),j=k[i-2],D.copy(K.positionScreen),P.copy(j.positionScreen),d(D,P))D.multiplyScalar(1/D.w),P.multiplyScalar(1/P.w),Y=u[r]=u[r]||new THREE.RenderableLine,r++,p=Y,p.v1.positionScreen.copy(D),p.v2.positionScreen.copy(P),p.z=Math.max(D.z,P.z),p.material=ea,v.elements.push(p)}a=
+0;for(z=v.sprites.length;a<z;a++)if(Y=v.sprites[a].object,R=Y.matrixWorld,Y instanceof THREE.Particle&&(H.set(R.n14,R.n24,R.n34,1),J.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<1))f=s[q]=s[q]||new THREE.RenderableParticle,q++,x=f,x.x=H.x/H.w,x.y=H.y/H.w,x.z=H.z,x.rotation=Y.rotation.z,x.scale.x=Y.scale.x*Math.abs(x.x-(H.x+e.projectionMatrix.n11)/(H.w+e.projectionMatrix.n14)),x.scale.y=Y.scale.y*Math.abs(x.y-(H.y+e.projectionMatrix.n22)/(H.w+e.projectionMatrix.n24)),x.material=Y.material,v.elements.push(x);
 g&&v.elements.sort(b);return v}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
 g&&v.elements.sort(b);return v}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;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 c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;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 c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-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(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-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 c=
 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 c=
 this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,k=i*b+f*g-h*d,l=i*d+h*b-e*g,n=i*g+e*d-f*b,b=-e*
 this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,k=i*b+f*g-h*d,l=i*d+h*b-e*g,n=i*g+e*d-f*b,b=-e*
 b-f*d-h*g;c.x=k*i+b*-e+l*-h-n*-f;c.y=l*i+b*-f+n*-e-k*-h;c.z=n*i+b*-h+k*-f-l*-e;return c}};
 b-f*d-h*g;c.x=k*i+b*-e+l*-h-n*-f;c.y=l*i+b*-f+n*-e-k*-h;c.z=n*i+b*-h+k*-f-l*-e;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.001)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,b,d,g,e){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,c,b,d,g,e){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,c,b,d,g,e,f){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
 THREE.Face4=function(a,c,b,d,g,e,f){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -83,8 +83,8 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
 b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<g;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);c=0;for(b=e.vertexNormals.length;c<b;c++)h.addSelf(e.vertexNormals[c]);h.divideScalar(3)}else c=this.vertices[e.a],b=this.vertices[e.b],f=this.vertices[e.c],h.sub(f.position,b.position),i.sub(c.position,b.position),h.crossSelf(i);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<g;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);c=0;for(b=e.vertexNormals.length;c<b;c++)h.addSelf(e.vertexNormals[c]);h.divideScalar(3)}else c=this.vertices[e.a],b=this.vertices[e.b],f=this.vertices[e.c],h.sub(f.position,b.position),i.sub(c.position,b.position),h.crossSelf(i);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
 Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
 THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),
 THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),
-b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];n=f[g];o=f[j];m=i.x-h.x;r=k.x-h.x;p=i.y-h.y;s=k.y-h.y;u=i.z-h.z;x=k.z-h.z;q=n.u-l.u;t=o.u-l.u;v=n.v-l.v;y=o.v-l.v;H=1/(q*y-t*v);D.set((y*m-v*r)*H,(y*p-v*s)*H,(y*u-v*x)*H);P.set((q*r-t*m)*H,(q*s-t*p)*H,(q*x-t*u)*H);F[b].addSelf(D);F[c].addSelf(D);F[d].addSelf(D);z[b].addSelf(P);
-z[c].addSelf(P);z[d].addSelf(P)}var c,b,d,g,e,f,h,i,k,l,n,o,m,r,p,s,u,x,q,t,v,y,H,J,F=[],z=[],D=new THREE.Vector3,P=new THREE.Vector3,G=new THREE.Vector3,$=new THREE.Vector3,L=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)F[c]=new THREE.Vector3,z[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var Q=["a","b",
+b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];n=f[g];o=f[j];m=i.x-h.x;t=k.x-h.x;p=i.y-h.y;r=k.y-h.y;u=i.z-h.z;x=k.z-h.z;q=n.u-l.u;s=o.u-l.u;v=n.v-l.v;y=o.v-l.v;H=1/(q*y-s*v);D.set((y*m-v*t)*H,(y*p-v*r)*H,(y*u-v*x)*H);P.set((q*t-s*m)*H,(q*r-s*p)*H,(q*x-s*u)*H);F[b].addSelf(D);F[c].addSelf(D);F[d].addSelf(D);z[b].addSelf(P);
+z[c].addSelf(P);z[d].addSelf(P)}var c,b,d,g,e,f,h,i,k,l,n,o,m,t,p,r,u,x,q,s,v,y,H,J,F=[],z=[],D=new THREE.Vector3,P=new THREE.Vector3,G=new THREE.Vector3,$=new THREE.Vector3,L=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)F[c]=new THREE.Vector3,z[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var Q=["a","b",
 "c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)L.copy(e.vertexNormals[d]),g=e[Q[d]],J=F[g],G.copy(J),G.subSelf(L.multiplyScalar(L.dot(J))).normalize(),$.cross(e.vertexNormals[d],J),g=$.dot(z[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(G.x,G.y,G.z,g)}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"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)L.copy(e.vertexNormals[d]),g=e[Q[d]],J=F[g],G.copy(J),G.subSelf(L.multiplyScalar(L.dot(J))).normalize(),$.cross(e.vertexNormals[d],J),g=$.dot(z[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(G.x,G.y,G.z,g)}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 c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];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 c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];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,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.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,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.push(this.vertices[e]),
@@ -148,16 +148,16 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
 THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
 THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,k,l,n,o,m,r,p;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(o=a[i],o instanceof THREE.RenderableParticle){r=o.x*g+g;p=o.y*e+e;l=0;for(n=o.material.length;l<n;l++)if(m=o.material[l],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=r+"px",m.style.top=p+"px"}}};
-THREE.CanvasRenderer=function(a){function c(a){if(x!=a)p.globalAlpha=x=a}function b(a){if(q!=a){switch(a){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}q=a}}function d(a){if(t!=a)p.strokeStyle=t=a}function g(a){if(v!=a)p.fillStyle=v=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-n,o,m,r,p=l.getContext("2d"),s=new THREE.Color(0),u=0,x=1,q=0,t=null,v=null,y=null,H=null,J=null,F,z,D,P,G=new THREE.RenderableVertex,$=new THREE.RenderableVertex,L,Q,da,ja,S,A,C,K,j,O,fa,Y,R=new THREE.Color,N=new THREE.Color,ea=new THREE.Color,U=new THREE.Color,ca=new THREE.Color,Z=[],X,ka,qa,ma,sa,ua,pa,ra,wa,T,w=new THREE.Rectangle,I=new THREE.Rectangle,ba=new THREE.Rectangle,ga=!1,la=new THREE.Color,W=new THREE.Color,ha=new THREE.Color,aa=new THREE.Vector3,ia,xa,M,na,ta,V,a=16;ia=document.createElement("canvas");
-ia.width=ia.height=2;xa=ia.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);M=xa.getImageData(0,0,2,2);na=M.data;ta=document.createElement("canvas");ta.width=ta.height=a;V=ta.getContext("2d");V.translate(-a/2,-a/2);V.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;o=b;m=Math.floor(n/2);r=Math.floor(o/2);l.width=n;l.height=o;w.set(-m,-r,m,r);I.set(-m,-r,m,r);x=1;q=0;J=H=y=
-v=t=null};this.setClearColor=function(a,b){s.copy(a);u=b;I.set(-m,-r,m,r)};this.setClearColorHex=function(a,b){s.setHex(a);u=b;I.set(-m,-r,m,r)};this.clear=function(){p.setTransform(1,0,0,-1,m,r);I.isEmpty()||(I.minSelf(w),I.inflate(2),u<1&&p.clearRect(Math.floor(I.getX()),Math.floor(I.getY()),Math.floor(I.getWidth()),Math.floor(I.getHeight())),u>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+u+")"),p.fillRect(Math.floor(I.getX()),
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,k,l,n,o,m,t,p;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(o=a[i],o instanceof THREE.RenderableParticle){t=o.x*g+g;p=o.y*e+e;l=0;for(n=o.material.length;l<n;l++)if(m=o.material[l],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=t+"px",m.style.top=p+"px"}}};
+THREE.CanvasRenderer=function(a){function c(a){if(x!=a)p.globalAlpha=x=a}function b(a){if(q!=a){switch(a){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}q=a}}function d(a){if(s!=a)p.strokeStyle=s=a}function g(a){if(v!=a)p.fillStyle=v=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+n,o,m,t,p=l.getContext("2d"),r=new THREE.Color(0),u=0,x=1,q=0,s=null,v=null,y=null,H=null,J=null,F,z,D,P,G=new THREE.RenderableVertex,$=new THREE.RenderableVertex,L,Q,da,ja,S,A,C,K,j,O,fa,Y,R=new THREE.Color,N=new THREE.Color,ea=new THREE.Color,U=new THREE.Color,ca=new THREE.Color,Z=[],X,ka,qa,ma,sa,ua,pa,ra,wa,T,w=new THREE.Rectangle,I=new THREE.Rectangle,ba=new THREE.Rectangle,ga=!1,la=new THREE.Color,W=new THREE.Color,ha=new THREE.Color,aa=new THREE.Vector3,ia,xa,M,na,ta,V,a=16;ia=document.createElement("canvas");
+ia.width=ia.height=2;xa=ia.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);M=xa.getImageData(0,0,2,2);na=M.data;ta=document.createElement("canvas");ta.width=ta.height=a;V=ta.getContext("2d");V.translate(-a/2,-a/2);V.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;o=b;m=Math.floor(n/2);t=Math.floor(o/2);l.width=n;l.height=o;w.set(-m,-t,m,t);I.set(-m,-t,m,t);x=1;q=0;J=H=y=
+v=s=null};this.setClearColor=function(a,b){r.copy(a);u=b;I.set(-m,-t,m,t)};this.setClearColorHex=function(a,b){r.setHex(a);u=b;I.set(-m,-t,m,t)};this.clear=function(){p.setTransform(1,0,0,-1,m,t);I.isEmpty()||(I.minSelf(w),I.inflate(2),u<1&&p.clearRect(Math.floor(I.getX()),Math.floor(I.getY()),Math.floor(I.getWidth()),Math.floor(I.getHeight())),u>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+u+")"),p.fillRect(Math.floor(I.getX()),
 Math.floor(I.getY()),Math.floor(I.getWidth()),Math.floor(I.getHeight()))),I.empty())};this.render=function(a,l){function n(a){var b,c,d,e;la.setRGB(0,0,0);W.setRGB(0,0,0);ha.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(la.r+=e.r,la.g+=e.g,la.b+=e.b):d instanceof THREE.DirectionalLight?(W.r+=e.r,W.g+=e.g,W.b+=e.b):d instanceof THREE.PointLight&&(ha.r+=e.r,ha.g+=e.g,ha.b+=e.b)}function o(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
 Math.floor(I.getY()),Math.floor(I.getWidth()),Math.floor(I.getHeight()))),I.empty())};this.render=function(a,l){function n(a){var b,c,d,e;la.setRGB(0,0,0);W.setRGB(0,0,0);ha.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(la.r+=e.r,la.g+=e.g,la.b+=e.b):d instanceof THREE.DirectionalLight?(W.r+=e.r,W.g+=e.g,W.b+=e.b):d instanceof THREE.PointLight&&(ha.r+=e.r,ha.g+=e.g,ha.b+=e.b)}function o(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
 f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(aa.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function q(a,e,f){c(f.opacity);b(f.blending);var j,h,i,l,k,V;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)l=f.map.image,k=l.width>>1,V=l.height>>
 f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(aa.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function q(a,e,f){c(f.opacity);b(f.blending);var j,h,i,l,k,V;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)l=f.map.image,k=l.width>>1,V=l.height>>
-1,f=e.scale.x*m,i=e.scale.y*r,j=f*k,h=i*V,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),w.intersects(ba)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-k,-V),p.drawImage(l,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*r,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),w.intersects(ba)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function s(a,
+1,f=e.scale.x*m,i=e.scale.y*t,j=f*k,h=i*V,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),w.intersects(ba)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-k,-V),p.drawImage(l,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*t,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),w.intersects(ba)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function r(a,
 e,g,f){c(f.opacity);b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(y!=a)p.lineWidth=y=a;a=f.linecap;if(H!=a)p.lineCap=H=a;a=f.linejoin;if(J!=a)p.lineJoin=J=a;d(f.color.getContextStyle());p.stroke();ba.inflate(f.linewidth*2)}}function u(a,d,f,g,j,h,m,k){e.info.render.vertices+=3;e.info.render.faces++;c(k.opacity);b(k.blending);L=a.positionScreen.x;Q=a.positionScreen.y;
 e,g,f){c(f.opacity);b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(y!=a)p.lineWidth=y=a;a=f.linecap;if(H!=a)p.lineCap=H=a;a=f.linejoin;if(J!=a)p.lineJoin=J=a;d(f.color.getContextStyle());p.stroke();ba.inflate(f.linewidth*2)}}function u(a,d,f,g,j,h,m,k){e.info.render.vertices+=3;e.info.render.faces++;c(k.opacity);b(k.blending);L=a.positionScreen.x;Q=a.positionScreen.y;
-da=d.positionScreen.x;ja=d.positionScreen.y;S=f.positionScreen.x;A=f.positionScreen.y;t(L,Q,da,ja,S,A);if(k instanceof THREE.MeshBasicMaterial)if(k.map)k.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],Ga(L,Q,da,ja,S,A,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,k.map));else if(k.envMap){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,aa.copy(m.vertexNormalsWorld[g]),sa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ua=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*
+da=d.positionScreen.x;ja=d.positionScreen.y;S=f.positionScreen.x;A=f.positionScreen.y;s(L,Q,da,ja,S,A);if(k instanceof THREE.MeshBasicMaterial)if(k.map)k.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],Ga(L,Q,da,ja,S,A,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,k.map));else if(k.envMap){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,aa.copy(m.vertexNormalsWorld[g]),sa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ua=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*
 0.5+0.5,aa.copy(m.vertexNormalsWorld[j]),pa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ra=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,aa.copy(m.vertexNormalsWorld[h]),wa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,T=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,Ga(L,Q,da,ja,S,A,sa,ua,pa,ra,wa,T,k.envMap)}else k.wireframe?ya(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):v(k.color);else if(k instanceof THREE.MeshLambertMaterial)k.map&&!k.wireframe&&(k.map.mapping instanceof THREE.UVMapping&&
 0.5+0.5,aa.copy(m.vertexNormalsWorld[j]),pa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ra=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,aa.copy(m.vertexNormalsWorld[h]),wa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,T=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,Ga(L,Q,da,ja,S,A,sa,ua,pa,ra,wa,T,k.envMap)}else k.wireframe?ya(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):v(k.color);else if(k instanceof THREE.MeshLambertMaterial)k.map&&!k.wireframe&&(k.map.mapping instanceof THREE.UVMapping&&
 (ma=m.uvs[0],Ga(L,Q,da,ja,S,A,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,k.map)),b(THREE.SubtractiveBlending)),ga?!k.wireframe&&k.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(N.r=ea.r=U.r=la.r,N.g=ea.g=U.g=la.g,N.b=ea.b=U.b=la.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],N),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ea),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],U),N.r=Math.max(0,Math.min(k.color.r*N.r,1)),N.g=Math.max(0,Math.min(k.color.g*N.g,1)),N.b=Math.max(0,
 (ma=m.uvs[0],Ga(L,Q,da,ja,S,A,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,k.map)),b(THREE.SubtractiveBlending)),ga?!k.wireframe&&k.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(N.r=ea.r=U.r=la.r,N.g=ea.g=U.g=la.g,N.b=ea.b=U.b=la.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],N),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ea),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],U),N.r=Math.max(0,Math.min(k.color.r*N.r,1)),N.g=Math.max(0,Math.min(k.color.g*N.g,1)),N.b=Math.max(0,
 Math.min(k.color.b*N.b,1)),ea.r=Math.max(0,Math.min(k.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(k.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(k.color.b*ea.b,1)),U.r=Math.max(0,Math.min(k.color.r*U.r,1)),U.g=Math.max(0,Math.min(k.color.g*U.g,1)),U.b=Math.max(0,Math.min(k.color.b*U.b,1)),ca.r=(ea.r+U.r)*0.5,ca.g=(ea.g+U.g)*0.5,ca.b=(ea.b+U.b)*0.5,qa=Da(N,ea,U,ca),Ba(L,Q,da,ja,S,A,0,0,1,0,0,1,qa)):(R.r=la.r,R.g=la.g,R.b=la.b,o(i,m.centroidWorld,m.normalWorld,R),R.r=Math.max(0,Math.min(k.color.r*R.r,1)),
 Math.min(k.color.b*N.b,1)),ea.r=Math.max(0,Math.min(k.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(k.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(k.color.b*ea.b,1)),U.r=Math.max(0,Math.min(k.color.r*U.r,1)),U.g=Math.max(0,Math.min(k.color.g*U.g,1)),U.b=Math.max(0,Math.min(k.color.b*U.b,1)),ca.r=(ea.r+U.r)*0.5,ca.g=(ea.g+U.g)*0.5,ca.b=(ea.b+U.b)*0.5,qa=Da(N,ea,U,ca),Ba(L,Q,da,ja,S,A,0,0,1,0,0,1,qa)):(R.r=la.r,R.g=la.g,R.b=la.b,o(i,m.centroidWorld,m.normalWorld,R),R.r=Math.max(0,Math.min(k.color.r*R.r,1)),
@@ -165,29 +165,29 @@ R.g=Math.max(0,Math.min(k.color.g*R.g,1)),R.b=Math.max(0,Math.min(k.color.b*R.b,
 U.b)*0.5,qa=Da(N,ea,U,ca),Ba(L,Q,da,ja,S,A,0,0,1,0,0,1,qa);else if(k instanceof THREE.MeshNormalMaterial)R.r=Ca(m.normalWorld.x),R.g=Ca(m.normalWorld.y),R.b=Ca(m.normalWorld.z),k.wireframe?ya(R,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):v(R)}function x(a,d,f,g,h,k,m,V,n){e.info.render.vertices+=4;e.info.render.faces++;c(V.opacity);b(V.blending);if(V.map||V.envMap)u(a,d,g,0,1,3,m,V,n),u(h,f,k,1,2,3,m,V,n);else if(L=a.positionScreen.x,Q=a.positionScreen.y,da=d.positionScreen.x,ja=
 U.b)*0.5,qa=Da(N,ea,U,ca),Ba(L,Q,da,ja,S,A,0,0,1,0,0,1,qa);else if(k instanceof THREE.MeshNormalMaterial)R.r=Ca(m.normalWorld.x),R.g=Ca(m.normalWorld.y),R.b=Ca(m.normalWorld.z),k.wireframe?ya(R,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):v(R)}function x(a,d,f,g,h,k,m,V,n){e.info.render.vertices+=4;e.info.render.faces++;c(V.opacity);b(V.blending);if(V.map||V.envMap)u(a,d,g,0,1,3,m,V,n),u(h,f,k,1,2,3,m,V,n);else if(L=a.positionScreen.x,Q=a.positionScreen.y,da=d.positionScreen.x,ja=
 d.positionScreen.y,S=f.positionScreen.x,A=f.positionScreen.y,C=g.positionScreen.x,K=g.positionScreen.y,j=h.positionScreen.x,O=h.positionScreen.y,fa=k.positionScreen.x,Y=k.positionScreen.y,V instanceof THREE.MeshBasicMaterial)Ea(L,Q,da,ja,S,A,C,K),V.wireframe?ya(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):v(V.color);else if(V instanceof THREE.MeshLambertMaterial)ga?!V.wireframe&&V.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(N.r=ea.r=U.r=ca.r=la.r,N.g=ea.g=
 d.positionScreen.y,S=f.positionScreen.x,A=f.positionScreen.y,C=g.positionScreen.x,K=g.positionScreen.y,j=h.positionScreen.x,O=h.positionScreen.y,fa=k.positionScreen.x,Y=k.positionScreen.y,V instanceof THREE.MeshBasicMaterial)Ea(L,Q,da,ja,S,A,C,K),V.wireframe?ya(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):v(V.color);else if(V instanceof THREE.MeshLambertMaterial)ga?!V.wireframe&&V.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(N.r=ea.r=U.r=ca.r=la.r,N.g=ea.g=
 U.g=ca.g=la.g,N.b=ea.b=U.b=ca.b=la.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],N),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ea),o(i,m.v4.positionWorld,m.vertexNormalsWorld[3],U),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ca),N.r=Math.max(0,Math.min(V.color.r*N.r,1)),N.g=Math.max(0,Math.min(V.color.g*N.g,1)),N.b=Math.max(0,Math.min(V.color.b*N.b,1)),ea.r=Math.max(0,Math.min(V.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(V.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(V.color.b*ea.b,1)),U.r=
 U.g=ca.g=la.g,N.b=ea.b=U.b=ca.b=la.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],N),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ea),o(i,m.v4.positionWorld,m.vertexNormalsWorld[3],U),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ca),N.r=Math.max(0,Math.min(V.color.r*N.r,1)),N.g=Math.max(0,Math.min(V.color.g*N.g,1)),N.b=Math.max(0,Math.min(V.color.b*N.b,1)),ea.r=Math.max(0,Math.min(V.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(V.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(V.color.b*ea.b,1)),U.r=
-Math.max(0,Math.min(V.color.r*U.r,1)),U.g=Math.max(0,Math.min(V.color.g*U.g,1)),U.b=Math.max(0,Math.min(V.color.b*U.b,1)),ca.r=Math.max(0,Math.min(V.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(V.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(V.color.b*ca.b,1)),qa=Da(N,ea,U,ca),t(L,Q,da,ja,C,K),Ba(L,Q,da,ja,C,K,0,0,1,0,0,1,qa),t(j,O,S,A,fa,Y),Ba(j,O,S,A,fa,Y,1,0,1,1,0,1,qa)):(R.r=la.r,R.g=la.g,R.b=la.b,o(i,m.centroidWorld,m.normalWorld,R),R.r=Math.max(0,Math.min(V.color.r*R.r,1)),R.g=Math.max(0,Math.min(V.color.g*
+Math.max(0,Math.min(V.color.r*U.r,1)),U.g=Math.max(0,Math.min(V.color.g*U.g,1)),U.b=Math.max(0,Math.min(V.color.b*U.b,1)),ca.r=Math.max(0,Math.min(V.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(V.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(V.color.b*ca.b,1)),qa=Da(N,ea,U,ca),s(L,Q,da,ja,C,K),Ba(L,Q,da,ja,C,K,0,0,1,0,0,1,qa),s(j,O,S,A,fa,Y),Ba(j,O,S,A,fa,Y,1,0,1,1,0,1,qa)):(R.r=la.r,R.g=la.g,R.b=la.b,o(i,m.centroidWorld,m.normalWorld,R),R.r=Math.max(0,Math.min(V.color.r*R.r,1)),R.g=Math.max(0,Math.min(V.color.g*
 R.g,1)),R.b=Math.max(0,Math.min(V.color.b*R.b,1)),Ea(L,Q,da,ja,S,A,C,K),V.wireframe?ya(R,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):v(R)):(Ea(L,Q,da,ja,S,A,C,K),V.wireframe?ya(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):v(V.color));else if(V instanceof THREE.MeshNormalMaterial)R.r=Ca(m.normalWorld.x),R.g=Ca(m.normalWorld.y),R.b=Ca(m.normalWorld.z),Ea(L,Q,da,ja,S,A,C,K),V.wireframe?ya(R,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):v(R);else if(V instanceof
 R.g,1)),R.b=Math.max(0,Math.min(V.color.b*R.b,1)),Ea(L,Q,da,ja,S,A,C,K),V.wireframe?ya(R,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):v(R)):(Ea(L,Q,da,ja,S,A,C,K),V.wireframe?ya(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):v(V.color));else if(V instanceof THREE.MeshNormalMaterial)R.r=Ca(m.normalWorld.x),R.g=Ca(m.normalWorld.y),R.b=Ca(m.normalWorld.z),Ea(L,Q,da,ja,S,A,C,K),V.wireframe?ya(R,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):v(R);else if(V instanceof
-THREE.MeshDepthMaterial)X=l.near,ka=l.far,N.r=N.g=N.b=1-Aa(a.positionScreen.z,X,ka),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,X,ka),U.r=U.g=U.b=1-Aa(g.positionScreen.z,X,ka),ca.r=ca.g=ca.b=1-Aa(f.positionScreen.z,X,ka),qa=Da(N,ea,U,ca),t(L,Q,da,ja,C,K),Ba(L,Q,da,ja,C,K,0,0,1,0,0,1,qa),t(j,O,S,A,fa,Y),Ba(j,O,S,A,fa,Y,1,0,1,1,0,1,qa)}function t(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function Ea(a,b,c,d,e,f,g,j){p.beginPath();p.moveTo(a,b);p.lineTo(c,
+THREE.MeshDepthMaterial)X=l.near,ka=l.far,N.r=N.g=N.b=1-Aa(a.positionScreen.z,X,ka),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,X,ka),U.r=U.g=U.b=1-Aa(g.positionScreen.z,X,ka),ca.r=ca.g=ca.b=1-Aa(f.positionScreen.z,X,ka),qa=Da(N,ea,U,ca),s(L,Q,da,ja,C,K),Ba(L,Q,da,ja,C,K,0,0,1,0,0,1,qa),s(j,O,S,A,fa,Y),Ba(j,O,S,A,fa,Y,1,0,1,1,0,1,qa)}function s(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function Ea(a,b,c,d,e,f,g,j){p.beginPath();p.moveTo(a,b);p.lineTo(c,
 d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function ya(a,b,c,e){if(y!=b)p.lineWidth=y=b;if(H!=c)p.lineCap=H=c;if(J!=e)p.lineJoin=J=e;d(a.getContextStyle());p.stroke();ba.inflate(b*2)}function v(a){g(a.getContextStyle());p.fill()}function Ga(a,b,c,d,e,f,j,h,i,m,k,l,V){if(V.image.width!=0){if(V.needsUpdate==!0||Z[V.id]==void 0){var n=V.wrapS==THREE.RepeatWrapping,o=V.wrapT==THREE.RepeatWrapping;Z[V.id]=p.createPattern(V.image,n&&o?"repeat":n&&!o?"repeat-x":!n&&o?"repeat-y":"no-repeat");
 d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function ya(a,b,c,e){if(y!=b)p.lineWidth=y=b;if(H!=c)p.lineCap=H=c;if(J!=e)p.lineJoin=J=e;d(a.getContextStyle());p.stroke();ba.inflate(b*2)}function v(a){g(a.getContextStyle());p.fill()}function Ga(a,b,c,d,e,f,j,h,i,m,k,l,V){if(V.image.width!=0){if(V.needsUpdate==!0||Z[V.id]==void 0){var n=V.wrapS==THREE.RepeatWrapping,o=V.wrapT==THREE.RepeatWrapping;Z[V.id]=p.createPattern(V.image,n&&o?"repeat":n&&!o?"repeat-x":!n&&o?"repeat-y":"no-repeat");
 V.needsUpdate=!1}g(Z[V.id]);var n=V.offset.x/V.repeat.x,o=V.offset.y/V.repeat.y,T=(V.image.width-1)*V.repeat.x,V=(V.image.height-1)*V.repeat.y,j=(j+n)*T,h=(h+o)*V,i=(i+n)*T,m=(m+o)*V,k=(k+n)*T,l=(l+o)*V;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;k-=j;l-=h;n=1/(i*l-k*m);V=(l*c-m*e)*n;m=(l*d-m*f)*n;c=(i*e-k*c)*n;d=(i*f-k*d)*n;a=a-V*j-c*h;b=b-m*j-d*h;p.save();p.transform(V,m,c,d,a,b);p.fill();p.restore()}}function Ba(a,b,c,d,e,f,g,j,h,i,m,k,V){var l,n;l=V.width-1;n=V.height-1;g*=l;j*=n;h*=l;i*=n;m*=l;k*=n;c-=a;d-=
 V.needsUpdate=!1}g(Z[V.id]);var n=V.offset.x/V.repeat.x,o=V.offset.y/V.repeat.y,T=(V.image.width-1)*V.repeat.x,V=(V.image.height-1)*V.repeat.y,j=(j+n)*T,h=(h+o)*V,i=(i+n)*T,m=(m+o)*V,k=(k+n)*T,l=(l+o)*V;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;k-=j;l-=h;n=1/(i*l-k*m);V=(l*c-m*e)*n;m=(l*d-m*f)*n;c=(i*e-k*c)*n;d=(i*f-k*d)*n;a=a-V*j-c*h;b=b-m*j-d*h;p.save();p.transform(V,m,c,d,a,b);p.fill();p.restore()}}function Ba(a,b,c,d,e,f,g,j,h,i,m,k,V){var l,n;l=V.width-1;n=V.height-1;g*=l;j*=n;h*=l;i*=n;m*=l;k*=n;c-=a;d-=
 b;e-=a;f-=b;h-=g;i-=j;m-=g;k-=j;n=1/(h*k-m*i);l=(k*c-i*e)*n;i=(k*d-i*f)*n;c=(h*e-m*c)*n;d=(h*f-m*d)*n;a=a-l*g-c*j;b=b-i*g-d*j;p.save();p.transform(l,i,c,d,a,b);p.clip();p.drawImage(V,0,0);p.restore()}function Da(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);na[0]=e<0?0:e>255?255:e;na[1]=f<0?0:f>255?255:f;na[2]=a<0?0:a>255?255:a;na[4]=g<0?0:g>255?255:g;na[5]=j<0?0:
 b;e-=a;f-=b;h-=g;i-=j;m-=g;k-=j;n=1/(h*k-m*i);l=(k*c-i*e)*n;i=(k*d-i*f)*n;c=(h*e-m*c)*n;d=(h*f-m*d)*n;a=a-l*g-c*j;b=b-i*g-d*j;p.save();p.transform(l,i,c,d,a,b);p.clip();p.drawImage(V,0,0);p.restore()}function Da(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);na[0]=e<0?0:e>255?255:e;na[1]=f<0?0:f>255?255:f;na[2]=a<0?0:a>255?255:a;na[4]=g<0?0:g>255?255:g;na[5]=j<0?0:
 j>255?255:j;na[6]=b<0?0:b>255?255:b;na[8]=h<0?0:h>255?255:h;na[9]=i<0?0:i>255?255:i;na[10]=c<0?0:c>255?255:c;na[12]=m<0?0:m>255?255:m;na[13]=k<0?0:k>255?255:k;na[14]=d<0?0:d>255?255:d;xa.putImageData(M,0,0);V.drawImage(ia,0,0);return ta}function Aa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function za(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ha,oa,va;this.autoClear?this.clear():p.setTransform(1,
 j>255?255:j;na[6]=b<0?0:b>255?255:b;na[8]=h<0?0:h>255?255:h;na[9]=i<0?0:i>255?255:i;na[10]=c<0?0:c>255?255:c;na[12]=m<0?0:m>255?255:m;na[13]=k<0?0:k>255?255:k;na[14]=d<0?0:d>255?255:d;xa.putImageData(M,0,0);V.drawImage(ia,0,0);return ta}function Aa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function za(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ha,oa,va;this.autoClear?this.clear():p.setTransform(1,
-0,0,-1,m,r);e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ga=i.length>0)&&n(i);Fa=0;for(Ha=h.length;Fa<Ha;Fa++)if(oa=h[Fa],va=oa.material,va=va instanceof THREE.MeshFaceMaterial?oa.faceMaterial:va,!(va==null||va.opacity==0)){ba.empty();if(oa instanceof THREE.RenderableParticle)F=oa,F.x*=m,F.y*=r,q(F,oa,va,a);else if(oa instanceof THREE.RenderableLine)F=oa.v1,z=oa.v2,F.positionScreen.x*=m,F.positionScreen.y*=r,z.positionScreen.x*=m,
-z.positionScreen.y*=r,ba.addPoint(F.positionScreen.x,F.positionScreen.y),ba.addPoint(z.positionScreen.x,z.positionScreen.y),w.intersects(ba)&&s(F,z,oa,va,a);else if(oa instanceof THREE.RenderableFace3)F=oa.v1,z=oa.v2,D=oa.v3,F.positionScreen.x*=m,F.positionScreen.y*=r,z.positionScreen.x*=m,z.positionScreen.y*=r,D.positionScreen.x*=m,D.positionScreen.y*=r,va.overdraw&&(za(F.positionScreen,z.positionScreen),za(z.positionScreen,D.positionScreen),za(D.positionScreen,F.positionScreen)),ba.add3Points(F.positionScreen.x,
-F.positionScreen.y,z.positionScreen.x,z.positionScreen.y,D.positionScreen.x,D.positionScreen.y),w.intersects(ba)&&u(F,z,D,0,1,2,oa,va,a);else if(oa instanceof THREE.RenderableFace4)F=oa.v1,z=oa.v2,D=oa.v3,P=oa.v4,F.positionScreen.x*=m,F.positionScreen.y*=r,z.positionScreen.x*=m,z.positionScreen.y*=r,D.positionScreen.x*=m,D.positionScreen.y*=r,P.positionScreen.x*=m,P.positionScreen.y*=r,G.positionScreen.copy(z.positionScreen),$.positionScreen.copy(P.positionScreen),va.overdraw&&(za(F.positionScreen,
+0,0,-1,m,t);e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ga=i.length>0)&&n(i);Fa=0;for(Ha=h.length;Fa<Ha;Fa++)if(oa=h[Fa],va=oa.material,va=va instanceof THREE.MeshFaceMaterial?oa.faceMaterial:va,!(va==null||va.opacity==0)){ba.empty();if(oa instanceof THREE.RenderableParticle)F=oa,F.x*=m,F.y*=t,q(F,oa,va,a);else if(oa instanceof THREE.RenderableLine)F=oa.v1,z=oa.v2,F.positionScreen.x*=m,F.positionScreen.y*=t,z.positionScreen.x*=m,
+z.positionScreen.y*=t,ba.addPoint(F.positionScreen.x,F.positionScreen.y),ba.addPoint(z.positionScreen.x,z.positionScreen.y),w.intersects(ba)&&r(F,z,oa,va,a);else if(oa instanceof THREE.RenderableFace3)F=oa.v1,z=oa.v2,D=oa.v3,F.positionScreen.x*=m,F.positionScreen.y*=t,z.positionScreen.x*=m,z.positionScreen.y*=t,D.positionScreen.x*=m,D.positionScreen.y*=t,va.overdraw&&(za(F.positionScreen,z.positionScreen),za(z.positionScreen,D.positionScreen),za(D.positionScreen,F.positionScreen)),ba.add3Points(F.positionScreen.x,
+F.positionScreen.y,z.positionScreen.x,z.positionScreen.y,D.positionScreen.x,D.positionScreen.y),w.intersects(ba)&&u(F,z,D,0,1,2,oa,va,a);else if(oa instanceof THREE.RenderableFace4)F=oa.v1,z=oa.v2,D=oa.v3,P=oa.v4,F.positionScreen.x*=m,F.positionScreen.y*=t,z.positionScreen.x*=m,z.positionScreen.y*=t,D.positionScreen.x*=m,D.positionScreen.y*=t,P.positionScreen.x*=m,P.positionScreen.y*=t,G.positionScreen.copy(z.positionScreen),$.positionScreen.copy(P.positionScreen),va.overdraw&&(za(F.positionScreen,
 z.positionScreen),za(z.positionScreen,P.positionScreen),za(P.positionScreen,F.positionScreen),za(D.positionScreen,G.positionScreen),za(D.positionScreen,$.positionScreen)),ba.addPoint(F.positionScreen.x,F.positionScreen.y),ba.addPoint(z.positionScreen.x,z.positionScreen.y),ba.addPoint(D.positionScreen.x,D.positionScreen.y),ba.addPoint(P.positionScreen.x,P.positionScreen.y),w.intersects(ba)&&x(F,z,D,P,G,$,oa,va,a);I.addRectangle(ba)}p.setTransform(1,0,0,1,0,0)}};
 z.positionScreen),za(z.positionScreen,P.positionScreen),za(P.positionScreen,F.positionScreen),za(D.positionScreen,G.positionScreen),za(D.positionScreen,$.positionScreen)),ba.addPoint(F.positionScreen.x,F.positionScreen.y),ba.addPoint(z.positionScreen.x,z.positionScreen.y),ba.addPoint(D.positionScreen.x,D.positionScreen.y),ba.addPoint(P.positionScreen.x,P.positionScreen.y),w.intersects(ba)&&x(F,z,D,P,G,$,oa,va,a);I.addRectangle(ba)}p.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(F.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){z[a]==null&&(z[a]=document.createElementNS("http://www.w3.org/2000/svg",
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(F.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){z[a]==null&&(z[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),L==0&&z[a].setAttribute("shape-rendering","crispEdges"));return z[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,n,o,m,r,p,s,u=new THREE.Rectangle,x=new THREE.Rectangle,q=!1,t=new THREE.Color,v=new THREE.Color,y=new THREE.Color,H=new THREE.Color,J,F=new THREE.Vector3,z=[],D=[],P,G,$,L=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+"path"),L==0&&z[a].setAttribute("shape-rendering","crispEdges"));return z[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,n,o,m,t,p,r,u=new THREE.Rectangle,x=new THREE.Rectangle,q=!1,s=new THREE.Color,v=new THREE.Color,y=new THREE.Color,H=new THREE.Color,J,F=new THREE.Vector3,z=[],D=[],P,G,$,L=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
 faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){k=a;l=b;n=k/2;o=l/2;i.setAttribute("viewBox",-n+" "+-o+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);u.set(-n,-o,n,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var F,z,A,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements;
 faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){k=a;l=b;n=k/2;o=l/2;i.setAttribute("viewBox",-n+" "+-o+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);u.set(-n,-o,n,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var F,z,A,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements;
 f=g.lights;$=G=0;if(q=f.length>0){v.setRGB(0,0,0);y.setRGB(0,0,0);H.setRGB(0,0,0);F=0;for(z=f.length;F<z;F++)C=f[F],A=C.color,C instanceof THREE.AmbientLight?(v.r+=A.r,v.g+=A.g,v.b+=A.b):C instanceof THREE.DirectionalLight?(y.r+=A.r,y.g+=A.g,y.b+=A.b):C instanceof THREE.PointLight&&(H.r+=A.r,H.g+=A.g,H.b+=A.b)}F=0;for(z=e.length;F<z;F++)if(A=e[F],C=A.material,C=C instanceof THREE.MeshFaceMaterial?A.faceMaterial:C,!(C==null||C.opacity==0))if(x.empty(),A instanceof THREE.RenderableParticle)m=A,m.x*=
 f=g.lights;$=G=0;if(q=f.length>0){v.setRGB(0,0,0);y.setRGB(0,0,0);H.setRGB(0,0,0);F=0;for(z=f.length;F<z;F++)C=f[F],A=C.color,C instanceof THREE.AmbientLight?(v.r+=A.r,v.g+=A.g,v.b+=A.b):C instanceof THREE.DirectionalLight?(y.r+=A.r,y.g+=A.g,y.b+=A.b):C instanceof THREE.PointLight&&(H.r+=A.r,H.g+=A.g,H.b+=A.b)}F=0;for(z=e.length;F<z;F++)if(A=e[F],C=A.material,C=C instanceof THREE.MeshFaceMaterial?A.faceMaterial:C,!(C==null||C.opacity==0))if(x.empty(),A instanceof THREE.RenderableParticle)m=A,m.x*=
-n,m.y*=-o;else if(A instanceof THREE.RenderableLine){if(m=A.v1,r=A.v2,m.positionScreen.x*=n,m.positionScreen.y*=-o,r.positionScreen.x*=n,r.positionScreen.y*=-o,x.addPoint(m.positionScreen.x,m.positionScreen.y),x.addPoint(r.positionScreen.x,r.positionScreen.y),u.intersects(x)){A=m;var K=r,j=$++;D[j]==null&&(D[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&D[j].setAttribute("shape-rendering","crispEdges"));P=D[j];P.setAttribute("x1",A.positionScreen.x);P.setAttribute("y1",A.positionScreen.y);
-P.setAttribute("x2",K.positionScreen.x);P.setAttribute("y2",K.positionScreen.y);C instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin),i.appendChild(P))}}else if(A instanceof THREE.RenderableFace3){if(m=A.v1,r=A.v2,p=A.v3,m.positionScreen.x*=n,m.positionScreen.y*=-o,r.positionScreen.x*=n,r.positionScreen.y*=-o,p.positionScreen.x*=
-n,p.positionScreen.y*=-o,x.addPoint(m.positionScreen.x,m.positionScreen.y),x.addPoint(r.positionScreen.x,r.positionScreen.y),x.addPoint(p.positionScreen.x,p.positionScreen.y),u.intersects(x)){var K=m,j=r,O=p;d.info.render.vertices+=3;d.info.render.faces++;P=c(G++);P.setAttribute("d","M "+K.positionScreen.x+" "+K.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?t.copy(C.color):C instanceof THREE.MeshLambertMaterial?
-q?(t.r=v.r,t.g=v.g,t.b=v.b,a(f,A.centroidWorld,A.normalWorld,t),t.r=Math.max(0,Math.min(C.color.r*t.r,1)),t.g=Math.max(0,Math.min(C.color.g*t.g,1)),t.b=Math.max(0,Math.min(C.color.b*t.b,1))):t.copy(C.color):C instanceof THREE.MeshDepthMaterial?(J=1-C.__2near/(C.__farPlusNear-A.z*C.__farMinusNear),t.setRGB(J,J,J)):C instanceof THREE.MeshNormalMaterial&&t.setRGB(b(A.normalWorld.x),b(A.normalWorld.y),b(A.normalWorld.z));C.wireframe?P.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+
-C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):P.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(P)}}else if(A instanceof THREE.RenderableFace4&&(m=A.v1,r=A.v2,p=A.v3,s=A.v4,m.positionScreen.x*=n,m.positionScreen.y*=-o,r.positionScreen.x*=n,r.positionScreen.y*=-o,p.positionScreen.x*=n,p.positionScreen.y*=-o,s.positionScreen.x*=n,s.positionScreen.y*=-o,x.addPoint(m.positionScreen.x,
-m.positionScreen.y),x.addPoint(r.positionScreen.x,r.positionScreen.y),x.addPoint(p.positionScreen.x,p.positionScreen.y),x.addPoint(s.positionScreen.x,s.positionScreen.y),u.intersects(x))){var K=m,j=r,O=p,fa=s;d.info.render.vertices+=4;d.info.render.faces++;P=c(G++);P.setAttribute("d","M "+K.positionScreen.x+" "+K.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?
-t.copy(C.color):C instanceof THREE.MeshLambertMaterial?q?(t.r=v.r,t.g=v.g,t.b=v.b,a(f,A.centroidWorld,A.normalWorld,t),t.r=Math.max(0,Math.min(C.color.r*t.r,1)),t.g=Math.max(0,Math.min(C.color.g*t.g,1)),t.b=Math.max(0,Math.min(C.color.b*t.b,1))):t.copy(C.color):C instanceof THREE.MeshDepthMaterial?(J=1-C.__2near/(C.__farPlusNear-A.z*C.__farMinusNear),t.setRGB(J,J,J)):C instanceof THREE.MeshNormalMaterial&&t.setRGB(b(A.normalWorld.x),b(A.normalWorld.y),b(A.normalWorld.z));C.wireframe?P.setAttribute("style",
-"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):P.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(P)}}};
+n,m.y*=-o;else if(A instanceof THREE.RenderableLine){if(m=A.v1,t=A.v2,m.positionScreen.x*=n,m.positionScreen.y*=-o,t.positionScreen.x*=n,t.positionScreen.y*=-o,x.addPoint(m.positionScreen.x,m.positionScreen.y),x.addPoint(t.positionScreen.x,t.positionScreen.y),u.intersects(x)){A=m;var K=t,j=$++;D[j]==null&&(D[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&D[j].setAttribute("shape-rendering","crispEdges"));P=D[j];P.setAttribute("x1",A.positionScreen.x);P.setAttribute("y1",A.positionScreen.y);
+P.setAttribute("x2",K.positionScreen.x);P.setAttribute("y2",K.positionScreen.y);C instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin),i.appendChild(P))}}else if(A instanceof THREE.RenderableFace3){if(m=A.v1,t=A.v2,p=A.v3,m.positionScreen.x*=n,m.positionScreen.y*=-o,t.positionScreen.x*=n,t.positionScreen.y*=-o,p.positionScreen.x*=
+n,p.positionScreen.y*=-o,x.addPoint(m.positionScreen.x,m.positionScreen.y),x.addPoint(t.positionScreen.x,t.positionScreen.y),x.addPoint(p.positionScreen.x,p.positionScreen.y),u.intersects(x)){var K=m,j=t,O=p;d.info.render.vertices+=3;d.info.render.faces++;P=c(G++);P.setAttribute("d","M "+K.positionScreen.x+" "+K.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?s.copy(C.color):C instanceof THREE.MeshLambertMaterial?
+q?(s.r=v.r,s.g=v.g,s.b=v.b,a(f,A.centroidWorld,A.normalWorld,s),s.r=Math.max(0,Math.min(C.color.r*s.r,1)),s.g=Math.max(0,Math.min(C.color.g*s.g,1)),s.b=Math.max(0,Math.min(C.color.b*s.b,1))):s.copy(C.color):C instanceof THREE.MeshDepthMaterial?(J=1-C.__2near/(C.__farPlusNear-A.z*C.__farMinusNear),s.setRGB(J,J,J)):C instanceof THREE.MeshNormalMaterial&&s.setRGB(b(A.normalWorld.x),b(A.normalWorld.y),b(A.normalWorld.z));C.wireframe?P.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):P.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(P)}}else if(A instanceof THREE.RenderableFace4&&(m=A.v1,t=A.v2,p=A.v3,r=A.v4,m.positionScreen.x*=n,m.positionScreen.y*=-o,t.positionScreen.x*=n,t.positionScreen.y*=-o,p.positionScreen.x*=n,p.positionScreen.y*=-o,r.positionScreen.x*=n,r.positionScreen.y*=-o,x.addPoint(m.positionScreen.x,
+m.positionScreen.y),x.addPoint(t.positionScreen.x,t.positionScreen.y),x.addPoint(p.positionScreen.x,p.positionScreen.y),x.addPoint(r.positionScreen.x,r.positionScreen.y),u.intersects(x))){var K=m,j=t,O=p,fa=r;d.info.render.vertices+=4;d.info.render.faces++;P=c(G++);P.setAttribute("d","M "+K.positionScreen.x+" "+K.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?
+s.copy(C.color):C instanceof THREE.MeshLambertMaterial?q?(s.r=v.r,s.g=v.g,s.b=v.b,a(f,A.centroidWorld,A.normalWorld,s),s.r=Math.max(0,Math.min(C.color.r*s.r,1)),s.g=Math.max(0,Math.min(C.color.g*s.g,1)),s.b=Math.max(0,Math.min(C.color.b*s.b,1))):s.copy(C.color):C instanceof THREE.MeshDepthMaterial?(J=1-C.__2near/(C.__farPlusNear-A.z*C.__farMinusNear),s.setRGB(J,J,J)):C instanceof THREE.MeshNormalMaterial&&s.setRGB(b(A.normalWorld.x),b(A.normalWorld.y),b(A.normalWorld.z));C.wireframe?P.setAttribute("style",
+"fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):P.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(P)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -228,7 +228,7 @@ h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=n[d
 h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,
 h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,
 g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(T){i=0;for(m=T.length;i<m;i++)if(h=T[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
 g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(T){i=0;for(m=T.length;i<m;i++)if(h=T[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
 a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,m,k,l,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],g=c[n+2],f=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],m=c[n+7],l=c[n+8],d=(d+f+h)/3,e=(e+i+m)/3,g=
 a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,m,k,l,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],g=c[n+2],f=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],m=c[n+7],l=c[n+8],d=(d+f+h)/3,e=(e+i+m)/3,g=
-(g+k+l)/3,c[n]=d,c[n+1]=e,c[n+2]=g,c[n+3]=d,c[n+4]=e,c[n+5]=g,c[n+6]=d,c[n+7]=e,c[n+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=s(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==N&&(N=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
+(g+k+l)/3,c[n]=d,c[n+1]=e,c[n+2]=g,c[n+3]=d,c[n+4]=e,c[n+5]=g,c[n+6]=d,c[n+7]=e,c[n+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=r(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==N&&(N=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
 e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&
 e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&
 f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],m=-1,k=0;h=g.morphTargetInfluences;var l,n=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<n;l++)!i[l]&&h[l]>m&&(k=l,m=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
 f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],m=-1,k=0;h=g.morphTargetInfluences;var l,n=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<n;l++)!i[l]&&h[l]>m&&(k=l,m=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
 m;i[k]=1;m=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
 m;i[k]=1;m=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
@@ -240,13 +240,13 @@ a.n13,a.n44-a.n14);w[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);w[2
 a.scale.z)),d=0;d<6;d++)if(a=w[d].x*b.n14+w[d].y*b.n24+w[d].z*b.n34+w[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function k(a){var b,c,d,i,m,k,l,n,p=0,o=a.lights;ha||(ha=new THREE.PerspectiveCamera(K.shadowCameraFov,K.shadowMapWidth/K.shadowMapHeight,K.shadowCameraNear,K.shadowCameraFar));b=0;for(c=o.length;b<c;b++)if(n=o[b],n.castShadow&&n instanceof THREE.SpotLight){R=-1;K.shadowMap[p]||(K.shadowMap[p]=new THREE.WebGLRenderTarget(K.shadowMapWidth,K.shadowMapHeight,{minFilter:THREE.LinearFilter,
 a.scale.z)),d=0;d<6;d++)if(a=w[d].x*b.n14+w[d].y*b.n24+w[d].z*b.n34+w[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function k(a){var b,c,d,i,m,k,l,n,p=0,o=a.lights;ha||(ha=new THREE.PerspectiveCamera(K.shadowCameraFov,K.shadowMapWidth/K.shadowMapHeight,K.shadowCameraNear,K.shadowCameraFar));b=0;for(c=o.length;b<c;b++)if(n=o[b],n.castShadow&&n instanceof THREE.SpotLight){R=-1;K.shadowMap[p]||(K.shadowMap[p]=new THREE.WebGLRenderTarget(K.shadowMapWidth,K.shadowMapHeight,{minFilter:THREE.LinearFilter,
 magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),aa[p]=new THREE.Matrix4);d=K.shadowMap[p];i=aa[p];ha.position.copy(n.position);ha.lookAt(n.target.position);ha.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ha));this.autoUpdateScene&&a.updateMatrixWorld();ha.matrixWorldInverse.getInverse(ha.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(ha.projectionMatrix);i.multiplySelf(ha.matrixWorldInverse);ha.matrixWorldInverse.flattenToArray(ga);
 magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),aa[p]=new THREE.Matrix4);d=K.shadowMap[p];i=aa[p];ha.position.copy(n.position);ha.lookAt(n.target.position);ha.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ha));this.autoUpdateScene&&a.updateMatrixWorld();ha.matrixWorldInverse.getInverse(ha.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(ha.projectionMatrix);i.multiplySelf(ha.matrixWorldInverse);ha.matrixWorldInverse.flattenToArray(ga);
 ha.projectionMatrix.flattenToArray(ba);I.multiply(ha.projectionMatrix,ha.matrixWorldInverse);f(I);D(d);j.clearColor(1,1,1,1);K.clear();j.clearColor(S.r,S.g,S.b,A);i=a.__webglObjects.length;for(d=0;d<i;d++)if(k=a.__webglObjects[d],n=k.object,k.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||h(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),u(n,ha,!1),k.render=!0;q(!0);y(THREE.NormalBlending);for(d=0;d<i;d++)if(k=a.__webglObjects[d],k.render)n=k.object,k=k.buffer,
 ha.projectionMatrix.flattenToArray(ba);I.multiply(ha.projectionMatrix,ha.matrixWorldInverse);f(I);D(d);j.clearColor(1,1,1,1);K.clear();j.clearColor(S.r,S.g,S.b,A);i=a.__webglObjects.length;for(d=0;d<i;d++)if(k=a.__webglObjects[d],n=k.object,k.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||h(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),u(n,ha,!1),k.render=!0;q(!0);y(THREE.NormalBlending);for(d=0;d<i;d++)if(k=a.__webglObjects[d],k.render)n=k.object,k=k.buffer,
-x(n),l=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?xa:ia,e(ha,o,null,l,k,n);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)k=a.__webglObjectsImmediate[d],n=k.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),N=-1,u(n,ha,!1),x(n),m=s(ha,o,null,ia,n),n.immediateRenderCallback?n.immediateRenderCallback(m,j,w):n.render(function(a){g(a,m,ia.shading)}));p++}}function l(a,b,c,d,g,f,h,j){var i,k,m,l;b?(k=a.length-1,l=
-b=-1):(k=0,b=a.length,l=1);for(var n=k;n!==b;n+=l)if(i=a[n],i.render){k=i.object;m=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&y(i.blending);q(i.depthTest);t(i.depthWrite);v(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}x(k);e(d,g,f,i,m,k)}}function n(a,b,c,d,e,f,h){for(var i,k,m,l,n=0,p=a.length;n<p;n++)if(i=a[n],k=i.object,k.visible){N=-1;if(h)m=h;else{m=i[b];if(!m)continue;f&&y(m.blending);q(m.depthTest);t(m.depthWrite);v(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}x(k);
-l=s(c,d,e,m,k);k.immediateRenderCallback?k.immediateRenderCallback(l,j,w):k.render(function(a){g(a,l,m.shading)})}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function r(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function s(a,b,c,d,e){d.program||K.initMaterial(d,b,c,e);if(d.morphTargets&&
+x(n),l=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?xa:ia,e(ha,o,null,l,k,n);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)k=a.__webglObjectsImmediate[d],n=k.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),N=-1,u(n,ha,!1),x(n),m=r(ha,o,null,ia,n),n.immediateRenderCallback?n.immediateRenderCallback(m,j,w):n.render(function(a){g(a,m,ia.shading)}));p++}}function l(a,b,c,d,g,f,h,j){var i,k,m,l;b?(k=a.length-1,l=
+b=-1):(k=0,b=a.length,l=1);for(var n=k;n!==b;n+=l)if(i=a[n],i.render){k=i.object;m=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&y(i.blending);q(i.depthTest);s(i.depthWrite);v(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}x(k);e(d,g,f,i,m,k)}}function n(a,b,c,d,e,f,h){for(var i,k,m,l,n=0,p=a.length;n<p;n++)if(i=a[n],k=i.object,k.visible){N=-1;if(h)m=h;else{m=i[b];if(!m)continue;f&&y(m.blending);q(m.depthTest);s(m.depthWrite);v(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}x(k);
+l=r(c,d,e,m,k);k.immediateRenderCallback?k.immediateRenderCallback(l,j,w):k.render(function(a){g(a,l,m.shading)})}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,b,c,d,e){d.program||K.initMaterial(d,b,c,e);if(d.morphTargets&&
 !e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets);for(var g=0,f=K.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==fa&&(j.useProgram(g),fa=g,h=!0);if(d.id!==R)R=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,ba);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;
 !e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets);for(var g=0,f=K.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==fa&&(j.useProgram(g),fa=g,h=!0);if(d.id!==R)R=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,ba);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;
-if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,m,l=0,n=0,p=0,o,T,r,I=W,q=I.directional.colors,s=I.directional.positions,u=I.point.colors,w=I.point.positions,x=I.point.distances,t=0,C=0,c=k=r=0,h=b.length;c<h;c++)if(k=b[c],m=k.color,o=k.position,T=k.intensity,r=k.distance,k instanceof THREE.AmbientLight)K.gammaInput?(l+=m.r*m.r,n+=m.g*m.g,p+=m.b*m.b):(l+=m.r,n+=m.g,p+=m.b);else if(k instanceof THREE.DirectionalLight)r=t*3,K.gammaInput?(q[r]=m.r*
-m.r*T*T,q[r+1]=m.g*m.g*T*T,q[r+2]=m.b*m.b*T*T):(q[r]=m.r*T,q[r+1]=m.g*T,q[r+2]=m.b*T),s[r]=o.x,s[r+1]=o.y,s[r+2]=o.z,t+=1;else if(k instanceof THREE.SpotLight)r=t*3,K.gammaInput?(q[r]=m.r*m.r*T*T,q[r+1]=m.g*m.g*T*T,q[r+2]=m.b*m.b*T*T):(q[r]=m.r*T,q[r+1]=m.g*T,q[r+2]=m.b*T),m=1/o.length(),s[r]=o.x*m,s[r+1]=o.y*m,s[r+2]=o.z*m,t+=1;else if(k instanceof THREE.PointLight)k=C*3,K.gammaInput?(u[k]=m.r*m.r*T*T,u[k+1]=m.g*m.g*T*T,u[k+2]=m.b*m.b*T*T):(u[k]=m.r*T,u[k+1]=m.g*T,u[k+2]=m.b*T),w[k]=o.x,w[k+1]=o.y,
-w[k+2]=o.z,x[C]=r,C+=1;c=t*3;for(h=q.length;c<h;c++)q[c]=0;c=C*3;for(h=u.length;c<h;c++)u[c]=0;I.point.length=C;I.directional.length=t;I.ambient[0]=l;I.ambient[1]=n;I.ambient[2]=p;b=W;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof
+if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,m,l=0,n=0,p=0,o,T,t,I=W,q=I.directional.colors,r=I.directional.positions,u=I.point.colors,w=I.point.positions,x=I.point.distances,s=0,C=0,c=k=t=0,h=b.length;c<h;c++)if(k=b[c],m=k.color,o=k.position,T=k.intensity,t=k.distance,k instanceof THREE.AmbientLight)K.gammaInput?(l+=m.r*m.r,n+=m.g*m.g,p+=m.b*m.b):(l+=m.r,n+=m.g,p+=m.b);else if(k instanceof THREE.DirectionalLight)t=s*3,K.gammaInput?(q[t]=m.r*
+m.r*T*T,q[t+1]=m.g*m.g*T*T,q[t+2]=m.b*m.b*T*T):(q[t]=m.r*T,q[t+1]=m.g*T,q[t+2]=m.b*T),r[t]=o.x,r[t+1]=o.y,r[t+2]=o.z,s+=1;else if(k instanceof THREE.SpotLight)t=s*3,K.gammaInput?(q[t]=m.r*m.r*T*T,q[t+1]=m.g*m.g*T*T,q[t+2]=m.b*m.b*T*T):(q[t]=m.r*T,q[t+1]=m.g*T,q[t+2]=m.b*T),m=1/o.length(),r[t]=o.x*m,r[t+1]=o.y*m,r[t+2]=o.z*m,s+=1;else if(k instanceof THREE.PointLight)k=C*3,K.gammaInput?(u[k]=m.r*m.r*T*T,u[k+1]=m.g*m.g*T*T,u[k+2]=m.b*m.b*T*T):(u[k]=m.r*T,u[k+1]=m.g*T,u[k+2]=m.b*T),w[k]=o.x,w[k+1]=o.y,
+w[k+2]=o.z,x[C]=t,C+=1;c=s*3;for(h=q.length;c<h;c++)q[c]=0;c=C*3;for(h=u.length;c<h;c++)u[c]=0;I.point.length=C;I.directional.length=s;I.ambient[0]=l;I.ambient[1]=n;I.ambient[2]=p;b=W;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof
 THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=
 THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=
 d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=$.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,K.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
 d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=$.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,K.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
 (i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)K.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<aa.length;b++)i.shadowMatrix.value[b]=aa[b],i.shadowMap.texture[b]=K.shadowMap[b];
 (i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)K.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<aa.length;b++)i.shadowMatrix.value[b]=aa[b],i.shadowMap.texture[b]=K.shadowMap[b];
@@ -256,7 +256,7 @@ Array&&n.image.length===6){if(l=n,l.image.length===6)if(l.needsUpdate){if(!l.ima
 THREE.WebGLRenderTargetCube?(l=n,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):F(n,h)}else if(p==="tv"){if(!l._array){l._array=[];p=0;for(o=l.texture.length;p<o;p++)l._array[p]=h+p}j.uniform1iv(n,l._array);p=0;for(o=l.texture.length;p<o;p++)(n=l.texture[p])&&F(n,l._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof
 THREE.WebGLRenderTargetCube?(l=n,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):F(n,h)}else if(p==="tv"){if(!l._array){l._array=[];p=0;for(o=l.texture.length;p<o;p++)l._array[p]=h+p}j.uniform1iv(n,l._array);p=0;for(o=l.texture.length;p<o;p++)(n=l.texture[p])&&F(n,l._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof
 THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&j.uniformMatrix4fv(f.viewMatrix,!1,ga);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,ga),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&
 THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&j.uniformMatrix4fv(f.viewMatrix,!1,ga);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,ga),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&
 f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function u(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function x(a){if(U!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),U=a.doubleSided;if(ca!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ca=a.flipSided}function q(a){X!==
 f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function u(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function x(a){if(U!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),U=a.doubleSided;if(ca!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ca=a.flipSided}function q(a){X!==
-a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),X=a)}function t(a){ka!==a&&(j.depthMask(a),ka=a)}function v(a,b,c){qa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),qa=a);if(a&&(ma!==b||sa!==c))j.polygonOffset(b,c),ma=b,sa=c}function y(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);
+a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),X=a)}function s(a){ka!==a&&(j.depthMask(a),ka=a)}function v(a,b,c){qa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),qa=a);if(a&&(ma!==b||sa!==c))j.polygonOffset(b,c),ma=b,sa=c}function y(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);
 j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}Z=a}}function H(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function J(a,b,c){(c.width&c.width-1)===
 j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}Z=a}}function H(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function J(a,b,c){(c.width&c.width-1)===
 0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,G(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,G(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,G(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,G(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,P(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,P(b.minFilter)))}function F(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
 0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,G(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,G(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,G(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,G(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,P(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,P(b.minFilter)))}function F(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
 !0,a.__webglTexture=j.createTexture(),K.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,G(a.format),a.image.width,a.image.height,0,G(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);J(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}
 !0,a.__webglTexture=j.createTexture(),K.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,G(a.format),a.image.width,a.image.height,0,G(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);J(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}
@@ -279,57 +279,57 @@ ia._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.M
 this.setClearColorHex=function(a,b){S.setHex(a);A=b;j.clearColor(S.r,S.g,S.b,A)};this.setClearColor=function(a,b){S.copy(a);A=b;j.clearColor(S.r,S.g,S.b,A)};this.getClearColor=function(){return S};this.getClearAlpha=function(){return A};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){D(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
 this.setClearColorHex=function(a,b){S.setHex(a);A=b;j.clearColor(S.r,S.g,S.b,A)};this.setClearColor=function(a,b){S.copy(a);A=b;j.clearColor(S.r,S.g,S.b,A)};this.getClearColor=function(){return S};this.getClearAlpha=function(){return A};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){D(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
 !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
 !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
 j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);K.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
 j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);K.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
-j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),K.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var e,g,m,p,o=a.lights,r=a.fog;R=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
+j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),K.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var e,g,m,p,o=a.lights,t=a.fog;R=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
 this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ga);b.projectionMatrix.flattenToArray(ba);I.multiply(b.projectionMatrix,b.matrixWorldInverse);f(I);D(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
 this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ga);b.projectionMatrix.flattenToArray(ba);I.multiply(b.projectionMatrix,b.matrixWorldInverse);f(I);D(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);p=a.__webglObjects;d=0;for(e=p.length;d<e;d++)if(g=p[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);u(m,b,!0);var s=g,w=s.object,x=s.buffer,C=void 0,C=C=void 0,C=w.material;if(C instanceof THREE.MeshFaceMaterial){if(C=x.materialIndex,C>=0)C=w.geometry.materials[C],C.transparent?(s.transparent=C,s.opaque=null):(s.opaque=C,s.transparent=null)}else if(C)C.transparent?
-(s.transparent=C,s.opaque=null):(s.opaque=C,s.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(la.copy(m.position),I.multiplyVector3(la),g.z=la.z)}this.sortObjects&&p.sort(i);p=a.__webglObjectsImmediate;d=0;for(e=p.length;d<e;d++)if(g=p[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),u(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(y(a.overrideMaterial.blending),
-q(a.overrideMaterial.depthTest),t(a.overrideMaterial.depthWrite),v(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,o,r,!0,a.overrideMaterial),n(a.__webglObjectsImmediate,"",b,o,r,!1,a.overrideMaterial)):(y(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,o,r,!1),n(a.__webglObjectsImmediate,"opaque",b,o,r,!1),l(a.__webglObjects,!1,"transparent",b,o,r,!0),n(a.__webglObjectsImmediate,"transparent",b,o,r,!0));
-if(a.__webglSprites.length){m=M.attributes;o=M.uniforms;r=T/wa;d=[];e=wa*0.5;p=T*0.5;g=!0;j.useProgram(M.program);fa=M.program;N=X=Z=-1;na||(j.enableVertexAttribArray(M.attributes.position),j.enableVertexAttribArray(M.attributes.uv),na=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,M.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,M.elementBuffer);j.uniformMatrix4fv(o.projectionMatrix,
-!1,ba);j.activeTexture(j.TEXTURE0);j.uniform1i(o.map,0);m=0;for(s=a.__webglSprites.length;m<s;m++)if(w=a.__webglSprites[m],w.visible&&w.opacity!==0)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(s=a.__webglSprites.length;m<s;m++)w=a.__webglSprites[m],w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(j.uniform1i(o.useScreenCoordinates,
-1),j.uniform3f(o.screenPosition,(w.position.x-e)/e,(p-w.position.y)/p,Math.max(0,Math.min(1,w.position.z)))):(j.uniform1i(o.useScreenCoordinates,0),j.uniform1i(o.affectedByDistance,w.affectedByDistance?1:0),j.uniformMatrix4fv(o.modelViewMatrix,!1,w._modelViewMatrixArray)),b=w.map.image.width/(w.scaleByViewport?T:1),d[0]=b*r*w.scale.x,d[1]=b*w.scale.y,j.uniform2f(o.uvScale,w.uvScale.x,w.uvScale.y),j.uniform2f(o.uvOffset,w.uvOffset.x,w.uvOffset.y),j.uniform2f(o.alignment,w.alignment.x,w.alignment.y),
+this.autoClearDepth,this.autoClearStencil);p=a.__webglObjects;d=0;for(e=p.length;d<e;d++)if(g=p[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);u(m,b,!0);var r=g,w=r.object,x=r.buffer,C=void 0,C=C=void 0,C=w.material;if(C instanceof THREE.MeshFaceMaterial){if(C=x.materialIndex,C>=0)C=w.geometry.materials[C],C.transparent?(r.transparent=C,r.opaque=null):(r.opaque=C,r.transparent=null)}else if(C)C.transparent?
+(r.transparent=C,r.opaque=null):(r.opaque=C,r.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(la.copy(m.position),I.multiplyVector3(la),g.z=la.z)}this.sortObjects&&p.sort(i);p=a.__webglObjectsImmediate;d=0;for(e=p.length;d<e;d++)if(g=p[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),u(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(y(a.overrideMaterial.blending),
+q(a.overrideMaterial.depthTest),s(a.overrideMaterial.depthWrite),v(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,o,t,!0,a.overrideMaterial),n(a.__webglObjectsImmediate,"",b,o,t,!1,a.overrideMaterial)):(y(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,o,t,!1),n(a.__webglObjectsImmediate,"opaque",b,o,t,!1),l(a.__webglObjects,!1,"transparent",b,o,t,!0),n(a.__webglObjectsImmediate,"transparent",b,o,t,!0));
+if(a.__webglSprites.length){m=M.attributes;o=M.uniforms;t=T/wa;d=[];e=wa*0.5;p=T*0.5;g=!0;j.useProgram(M.program);fa=M.program;N=X=Z=-1;na||(j.enableVertexAttribArray(M.attributes.position),j.enableVertexAttribArray(M.attributes.uv),na=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,M.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,M.elementBuffer);j.uniformMatrix4fv(o.projectionMatrix,
+!1,ba);j.activeTexture(j.TEXTURE0);j.uniform1i(o.map,0);m=0;for(r=a.__webglSprites.length;m<r;m++)if(w=a.__webglSprites[m],w.visible&&w.opacity!==0)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(r=a.__webglSprites.length;m<r;m++)w=a.__webglSprites[m],w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(j.uniform1i(o.useScreenCoordinates,
+1),j.uniform3f(o.screenPosition,(w.position.x-e)/e,(p-w.position.y)/p,Math.max(0,Math.min(1,w.position.z)))):(j.uniform1i(o.useScreenCoordinates,0),j.uniform1i(o.affectedByDistance,w.affectedByDistance?1:0),j.uniformMatrix4fv(o.modelViewMatrix,!1,w._modelViewMatrixArray)),b=w.map.image.width/(w.scaleByViewport?T:1),d[0]=b*t*w.scale.x,d[1]=b*w.scale.y,j.uniform2f(o.uvScale,w.uvScale.x,w.uvScale.y),j.uniform2f(o.uvOffset,w.uvOffset.x,w.uvOffset.y),j.uniform2f(o.alignment,w.alignment.x,w.alignment.y),
 j.uniform1f(o.opacity,w.opacity),j.uniform3f(o.color,w.color.r,w.color.g,w.color.b),j.uniform1f(o.rotation,w.rotation),j.uniform2fv(o.scale,d),w.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!w.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),y(w.blending),F(w.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ka)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
 j.uniform1f(o.opacity,w.opacity),j.uniform3f(o.color,w.color.r,w.color.g,w.color.b),j.uniform1f(o.rotation,w.rotation),j.uniform2fv(o.scale,d),w.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!w.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),y(w.blending),F(w.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ka)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
 c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=
 c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=
-new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,n=void 0,T=void 0,w=void 0,I=void 0,q=void 0,s={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)n=i.faces[k],T=n.materialIndex,I=T!==void 0?T:-1,s[I]===void 0&&(s[I]={hash:I,counter:0}),q=s[I].hash+"_"+s[I].counter,i.geometryGroups[q]===
-void 0&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:T,vertices:0,numMorphTargets:u}),w=n instanceof THREE.Face3?3:4,i.geometryGroups[q].vertices+w>65535&&(s[I].counter+=1,q=s[I].hash+"_"+s[I].counter,i.geometryGroups[q]===void 0&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:T,vertices:0,numMorphTargets:u})),n instanceof THREE.Face3?i.geometryGroups[q].faces3.push(k):i.geometryGroups[q].faces4.push(k),i.geometryGroups[q].vertices+=w;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
+new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,n=void 0,T=void 0,w=void 0,I=void 0,q=void 0,r={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)n=i.faces[k],T=n.materialIndex,I=T!==void 0?T:-1,r[I]===void 0&&(r[I]={hash:I,counter:0}),q=r[I].hash+"_"+r[I].counter,i.geometryGroups[q]===
+void 0&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:T,vertices:0,numMorphTargets:u}),w=n instanceof THREE.Face3?3:4,i.geometryGroups[q].vertices+w>65535&&(r[I].counter+=1,q=r[I].hash+"_"+r[I].counter,i.geometryGroups[q]===void 0&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:T,vertices:0,numMorphTargets:u})),n instanceof THREE.Face3?i.geometryGroups[q].faces3.push(k):i.geometryGroups[q].faces4.push(k),i.geometryGroups[q].vertices+=w;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
 ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=
 ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=
-j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){n=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(n=k.numMorphTargets;l<n;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}K.info.memory.geometries++;T=e;w=T.geometry;l=i.faces3;I=i.faces4;k=l.length*3+I.length*4;n=l.length*1+I.length*2;I=l.length*3+I.length*4;l=b(T,i);q=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;s=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
-l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(s)i.__normalArray=new Float32Array(k*3);if(w.hasTangents)i.__tangentArray=new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(q){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
-2)}if(T.geometry.skinWeights.length&&T.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(n*3);i.__lineArray=new Uint16Array(I*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];T=0;for(w=i.numMorphTargets;T<w;T++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=s===THREE.SmoothShading;i.__uvType=q;
-i.__vertexColorType=u;i.__normalType=s;i.__webglFaceCount=n*3;i.__webglLineCount=I*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];n=void 0;for(n in l.attributes){var T=l.attributes[n],w={},x;for(x in T)w[x]=T[x];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,I=1,w.type==="v2"?I=2:w.type==="v3"?I=3:w.type==="v4"?I=4:w.type==="c"&&(I=3),w.size=I,w.array=new Float32Array(k*I),w.buffer=j.createBuffer(),w.buffer.belongsToAttribute=
+j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){n=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(n=k.numMorphTargets;l<n;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}K.info.memory.geometries++;T=e;w=T.geometry;l=i.faces3;I=i.faces4;k=l.length*3+I.length*4;n=l.length*1+I.length*2;I=l.length*3+I.length*4;l=b(T,i);q=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;r=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
+l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(r)i.__normalArray=new Float32Array(k*3);if(w.hasTangents)i.__tangentArray=new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(q){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
+2)}if(T.geometry.skinWeights.length&&T.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(n*3);i.__lineArray=new Uint16Array(I*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];T=0;for(w=i.numMorphTargets;T<w;T++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=r===THREE.SmoothShading;i.__uvType=q;
+i.__vertexColorType=u;i.__normalType=r;i.__webglFaceCount=n*3;i.__webglLineCount=I*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];n=void 0;for(n in l.attributes){var T=l.attributes[n],w={},x;for(x in T)w[x]=T[x];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,I=1,w.type==="v2"?I=2:w.type==="v3"?I=3:w.type==="v4"?I=4:w.type==="c"&&(I=3),w.size=I,w.array=new Float32Array(k*I),w.buffer=j.createBuffer(),w.buffer.belongsToAttribute=
 n,T.needsUpdate=!0,w.__original=T;i.__webglCustomAttributesList.push(w)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),K.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*
 n,T.needsUpdate=!0,w.__original=T;i.__webglCustomAttributesList.push(w)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),K.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*
 3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),K.info.memory.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,
 3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),K.info.memory.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,
 i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),K.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],o(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
 i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),K.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],o(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
 (h=e.geometry,o(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)p(g.__webglObjects,e);else if(e instanceof
 (h=e.geometry,o(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)p(g.__webglObjects,e);else if(e instanceof
 THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&p(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(x=a.__webglObjects[e].object,f=x.geometry,h=n=l=void 0,x instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(x,l),n=h.attributes&&m(h),f.__dirtyVertices||f.__dirtyMorphTargets||
 THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&p(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(x=a.__webglObjects[e].object,f=x.geometry,h=n=l=void 0,x instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(x,l),n=h.attributes&&m(h),f.__dirtyVertices||f.__dirtyMorphTargets||
-f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||n)if(n=j.DYNAMIC_DRAW,T=!f.dynamic,l.__inittedArrays){var C=I=w=void 0,t=void 0,ba=void 0,ca=void 0,v=void 0,D=void 0,F=void 0,la=void 0,H=void 0,Z=C=ca=void 0,y=void 0,A=void 0,z=void 0,ga=t=void 0,M=void 0,O=t=F=H=void 0,X=void 0,ha=z=A=y=v=void 0,G=t=z=A=y=ha=z=A=y=ha=z=A=y=void 0,J=void 0,L=ca=void 0,P=void 0,R=void 0,ka=void 0,Q=void 0,W=Z=R=J=0,Y=0,aa=G=C=0,N=v=ga=0,E=0,S=void 0,N=l.__vertexArray,P=l.__uvArray,
-E=l.__uv2Array,L=l.__normalArray,ba=l.__tangentArray,M=l.__colorArray,O=l.__skinVertexAArray,X=l.__skinVertexBArray,D=l.__skinIndexArray,U=l.__skinWeightArray,ha=l.__morphTargetsArrays,q=l.__webglCustomAttributesList,B=void 0,B=l.__faceArray,S=l.__lineArray,da=l.__needsSmoothNormals,H=l.__vertexColorType,la=l.__uvType,ca=l.__normalType,F=x.geometry,fa=F.__dirtyElements,$=F.__dirtyUvs,qa=F.__dirtyNormals,ja=F.__dirtyTangents,xa=F.__dirtyColors,ka=F.__dirtyMorphTargets,Q=F.vertices,s=l.faces3,u=l.faces4,
-ia=F.faces,ma=F.faceVertexUvs[0],ua=F.faceVertexUvs[1],ta=F.skinVerticesA,sa=F.skinVerticesB,ra=F.skinIndices,na=F.skinWeights,pa=F.morphTargets;if(F.__dirtyVertices){w=0;for(I=s.length;w<I;w++)t=ia[s[w]],y=Q[t.a].position,A=Q[t.b].position,z=Q[t.c].position,N[R]=y.x,N[R+1]=y.y,N[R+2]=y.z,N[R+3]=A.x,N[R+4]=A.y,N[R+5]=A.z,N[R+6]=z.x,N[R+7]=z.y,N[R+8]=z.z,R+=9;w=0;for(I=u.length;w<I;w++)t=ia[u[w]],y=Q[t.a].position,A=Q[t.b].position,z=Q[t.c].position,t=Q[t.d].position,N[R]=y.x,N[R+1]=y.y,N[R+2]=y.z,
-N[R+3]=A.x,N[R+4]=A.y,N[R+5]=A.z,N[R+6]=z.x,N[R+7]=z.y,N[R+8]=z.z,N[R+9]=t.x,N[R+10]=t.y,N[R+11]=t.z,R+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,N,n)}if(ka){R=0;for(ka=pa.length;R<ka;R++){w=N=0;for(I=s.length;w<I;w++)t=ia[s[w]],y=pa[R].vertices[t.a].position,A=pa[R].vertices[t.b].position,z=pa[R].vertices[t.c].position,Q=ha[R],Q[N]=y.x,Q[N+1]=y.y,Q[N+2]=y.z,Q[N+3]=A.x,Q[N+4]=A.y,Q[N+5]=A.z,Q[N+6]=z.x,Q[N+7]=z.y,Q[N+8]=z.z,N+=9;w=0;for(I=u.length;w<I;w++)t=
-ia[u[w]],y=pa[R].vertices[t.a].position,A=pa[R].vertices[t.b].position,z=pa[R].vertices[t.c].position,t=pa[R].vertices[t.d].position,Q=ha[R],Q[N]=y.x,Q[N+1]=y.y,Q[N+2]=y.z,Q[N+3]=A.x,Q[N+4]=A.y,Q[N+5]=A.z,Q[N+6]=z.x,Q[N+7]=z.y,Q[N+8]=z.z,Q[N+9]=t.x,Q[N+10]=t.y,Q[N+11]=t.z,N+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[R]);j.bufferData(j.ARRAY_BUFFER,ha[R],n)}}if(na.length){w=0;for(I=s.length;w<I;w++)t=ia[s[w]],y=na[t.a],A=na[t.b],z=na[t.c],U[v]=y.x,U[v+1]=y.y,U[v+2]=y.z,U[v+3]=y.w,
-U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=A.w,U[v+8]=z.x,U[v+9]=z.y,U[v+10]=z.z,U[v+11]=z.w,y=ra[t.a],A=ra[t.b],z=ra[t.c],D[v]=y.x,D[v+1]=y.y,D[v+2]=y.z,D[v+3]=y.w,D[v+4]=A.x,D[v+5]=A.y,D[v+6]=A.z,D[v+7]=A.w,D[v+8]=z.x,D[v+9]=z.y,D[v+10]=z.z,D[v+11]=z.w,y=ta[t.a],A=ta[t.b],z=ta[t.c],O[v]=y.x,O[v+1]=y.y,O[v+2]=y.z,O[v+3]=1,O[v+4]=A.x,O[v+5]=A.y,O[v+6]=A.z,O[v+7]=1,O[v+8]=z.x,O[v+9]=z.y,O[v+10]=z.z,O[v+11]=1,y=sa[t.a],A=sa[t.b],z=sa[t.c],X[v]=y.x,X[v+1]=y.y,X[v+2]=y.z,X[v+3]=1,X[v+4]=A.x,X[v+5]=A.y,X[v+
-6]=A.z,X[v+7]=1,X[v+8]=z.x,X[v+9]=z.y,X[v+10]=z.z,X[v+11]=1,v+=12;w=0;for(I=u.length;w<I;w++)t=ia[u[w]],y=na[t.a],A=na[t.b],z=na[t.c],ha=na[t.d],U[v]=y.x,U[v+1]=y.y,U[v+2]=y.z,U[v+3]=y.w,U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=A.w,U[v+8]=z.x,U[v+9]=z.y,U[v+10]=z.z,U[v+11]=z.w,U[v+12]=ha.x,U[v+13]=ha.y,U[v+14]=ha.z,U[v+15]=ha.w,y=ra[t.a],A=ra[t.b],z=ra[t.c],ha=ra[t.d],D[v]=y.x,D[v+1]=y.y,D[v+2]=y.z,D[v+3]=y.w,D[v+4]=A.x,D[v+5]=A.y,D[v+6]=A.z,D[v+7]=A.w,D[v+8]=z.x,D[v+9]=z.y,D[v+10]=z.z,D[v+11]=z.w,
-D[v+12]=ha.x,D[v+13]=ha.y,D[v+14]=ha.z,D[v+15]=ha.w,y=ta[t.a],A=ta[t.b],z=ta[t.c],ha=ta[t.d],O[v]=y.x,O[v+1]=y.y,O[v+2]=y.z,O[v+3]=1,O[v+4]=A.x,O[v+5]=A.y,O[v+6]=A.z,O[v+7]=1,O[v+8]=z.x,O[v+9]=z.y,O[v+10]=z.z,O[v+11]=1,O[v+12]=ha.x,O[v+13]=ha.y,O[v+14]=ha.z,O[v+15]=1,y=sa[t.a],A=sa[t.b],z=sa[t.c],t=sa[t.d],X[v]=y.x,X[v+1]=y.y,X[v+2]=y.z,X[v+3]=1,X[v+4]=A.x,X[v+5]=A.y,X[v+6]=A.z,X[v+7]=1,X[v+8]=z.x,X[v+9]=z.y,X[v+10]=z.z,X[v+11]=1,X[v+12]=t.x,X[v+13]=t.y,X[v+14]=t.z,X[v+15]=1,v+=16;v>0&&(j.bindBuffer(j.ARRAY_BUFFER,
-l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,O,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,X,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,D,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,U,n))}if(xa&&H){w=0;for(I=s.length;w<I;w++)t=ia[s[w]],v=t.vertexColors,D=t.color,v.length===3&&H===THREE.VertexColors?(t=v[0],O=v[1],X=v[2]):X=O=t=D,M[ga]=t.r,M[ga+1]=t.g,M[ga+2]=
-t.b,M[ga+3]=O.r,M[ga+4]=O.g,M[ga+5]=O.b,M[ga+6]=X.r,M[ga+7]=X.g,M[ga+8]=X.b,ga+=9;w=0;for(I=u.length;w<I;w++)t=ia[u[w]],v=t.vertexColors,D=t.color,v.length===4&&H===THREE.VertexColors?(t=v[0],O=v[1],X=v[2],v=v[3]):v=X=O=t=D,M[ga]=t.r,M[ga+1]=t.g,M[ga+2]=t.b,M[ga+3]=O.r,M[ga+4]=O.g,M[ga+5]=O.b,M[ga+6]=X.r,M[ga+7]=X.g,M[ga+8]=X.b,M[ga+9]=v.r,M[ga+10]=v.g,M[ga+11]=v.b,ga+=12;ga>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,M,n))}if(ja&&F.hasTangents){w=0;for(I=s.length;w<
-I;w++)t=ia[s[w]],F=t.vertexTangents,ga=F[0],M=F[1],H=F[2],ba[G]=ga.x,ba[G+1]=ga.y,ba[G+2]=ga.z,ba[G+3]=ga.w,ba[G+4]=M.x,ba[G+5]=M.y,ba[G+6]=M.z,ba[G+7]=M.w,ba[G+8]=H.x,ba[G+9]=H.y,ba[G+10]=H.z,ba[G+11]=H.w,G+=12;w=0;for(I=u.length;w<I;w++)t=ia[u[w]],F=t.vertexTangents,ga=F[0],M=F[1],H=F[2],F=F[3],ba[G]=ga.x,ba[G+1]=ga.y,ba[G+2]=ga.z,ba[G+3]=ga.w,ba[G+4]=M.x,ba[G+5]=M.y,ba[G+6]=M.z,ba[G+7]=M.w,ba[G+8]=H.x,ba[G+9]=H.y,ba[G+10]=H.z,ba[G+11]=H.w,ba[G+12]=F.x,ba[G+13]=F.y,ba[G+14]=F.z,ba[G+15]=F.w,G+=
-16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ba,n)}if(qa&&ca){w=0;for(I=s.length;w<I;w++)if(t=ia[s[w]],ba=t.vertexNormals,ca=t.normal,ba.length===3&&da)for(G=0;G<3;G++)ca=ba[G],L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;else for(G=0;G<3;G++)L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;w=0;for(I=u.length;w<I;w++)if(t=ia[u[w]],ba=t.vertexNormals,ca=t.normal,ba.length===4&&da)for(G=0;G<4;G++)ca=ba[G],L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;else for(G=0;G<4;G++)L[C]=ca.x,L[C+
-1]=ca.y,L[C+2]=ca.z,C+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,L,n)}if($&&ma&&la){w=0;for(I=s.length;w<I;w++)if(C=s[w],C=ma[C],C!==void 0)for(G=0;G<3;G++)L=C[G],P[Z]=L.u,P[Z+1]=L.v,Z+=2;w=0;for(I=u.length;w<I;w++)if(C=u[w],C=ma[C],C!==void 0)for(G=0;G<4;G++)L=C[G],P[Z]=L.u,P[Z+1]=L.v,Z+=2;Z>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,P,n))}if($&&ua&&la){w=0;for(I=s.length;w<I;w++)if(C=s[w],Z=ua[C],Z!==void 0)for(G=0;G<3;G++)P=
-Z[G],E[W]=P.u,E[W+1]=P.v,W+=2;w=0;for(I=u.length;w<I;w++)if(C=u[w],Z=ua[C],Z!==void 0)for(G=0;G<4;G++)P=Z[G],E[W]=P.u,E[W+1]=P.v,W+=2;W>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,E,n))}if(fa){w=0;for(I=s.length;w<I;w++)B[Y]=J,B[Y+1]=J+1,B[Y+2]=J+2,Y+=3,S[aa]=J,S[aa+1]=J+1,S[aa+2]=J,S[aa+3]=J+2,S[aa+4]=J+1,S[aa+5]=J+2,aa+=6,J+=3;w=0;for(I=u.length;w<I;w++)B[Y]=J,B[Y+1]=J+1,B[Y+2]=J+3,B[Y+3]=J+1,B[Y+4]=J+2,B[Y+5]=J+3,Y+=6,S[aa]=J,S[aa+1]=J+1,S[aa+2]=J,S[aa+3]=J+
-3,S[aa+4]=J+1,S[aa+5]=J+2,S[aa+6]=J+2,S[aa+7]=J+3,aa+=8,J+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,B,n);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,S,n)}if(q){G=0;for(J=q.length;G<J;G++)if(B=q[G],B.__original.needsUpdate){E=0;if(B.size===1)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(I=s.length;w<I;w++)t=ia[s[w]],B.array[E]=B.value[t.a],B.array[E+1]=B.value[t.b],B.array[E+2]=B.value[t.c],
-E+=3;w=0;for(I=u.length;w<I;w++)t=ia[u[w]],B.array[E]=B.value[t.a],B.array[E+1]=B.value[t.b],B.array[E+2]=B.value[t.c],B.array[E+3]=B.value[t.d],E+=4}else{if(B.boundTo==="faces"){w=0;for(I=s.length;w<I;w++)S=B.value[s[w]],B.array[E]=S,B.array[E+1]=S,B.array[E+2]=S,E+=3;w=0;for(I=u.length;w<I;w++)S=B.value[u[w]],B.array[E]=S,B.array[E+1]=S,B.array[E+2]=S,B.array[E+3]=S,E+=4}}else if(B.size===2)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(I=s.length;w<I;w++)t=ia[s[w]],y=B.value[t.a],A=B.value[t.b],
-z=B.value[t.c],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,E+=6;w=0;for(I=u.length;w<I;w++)t=ia[u[w]],y=B.value[t.a],A=B.value[t.b],z=B.value[t.c],t=B.value[t.d],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,B.array[E+6]=t.x,B.array[E+7]=t.y,E+=8}else{if(B.boundTo==="faces"){w=0;for(I=s.length;w<I;w++)z=A=y=S=B.value[s[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,
-B.array[E+4]=z.x,B.array[E+5]=z.y,E+=6;w=0;for(I=u.length;w<I;w++)t=z=A=y=S=B.value[u[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,B.array[E+6]=t.x,B.array[E+7]=t.y,E+=8}}else if(B.size===3)if(W=B.type==="c"?["r","g","b"]:["x","y","z"],B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(I=s.length;w<I;w++)t=ia[s[w]],y=B.value[t.a],A=B.value[t.b],z=B.value[t.c],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],
-B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],E+=9;w=0;for(I=u.length;w<I;w++)t=ia[u[w]],y=B.value[t.a],A=B.value[t.b],z=B.value[t.c],t=B.value[t.d],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],B.array[E+9]=t[W[0]],B.array[E+10]=t[W[1]],B.array[E+11]=t[W[2]],E+=12}else{if(B.boundTo==="faces"){w=0;for(I=
-s.length;w<I;w++)z=A=y=S=B.value[s[w]],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],E+=9;w=0;for(I=u.length;w<I;w++)t=z=A=y=S=B.value[u[w]],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],B.array[E+9]=t[W[0]],B.array[E+10]=
-t[W[1]],B.array[E+11]=t[W[2]],E+=12}}else if(B.size===4)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(I=s.length;w<I;w++)t=ia[s[w]],y=B.value[t.a],A=B.value[t.b],z=B.value[t.c],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,E+=12;w=0;for(I=u.length;w<I;w++)t=ia[u[w]],y=B.value[t.a],A=B.value[t.b],z=B.value[t.c],t=B.value[t.d],B.array[E]=
-y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,B.array[E+12]=t.x,B.array[E+13]=t.y,B.array[E+14]=t.z,B.array[E+15]=t.w,E+=16}else if(B.boundTo==="faces"){w=0;for(I=s.length;w<I;w++)z=A=y=S=B.value[s[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+
-9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,E+=12;w=0;for(I=u.length;w<I;w++)t=z=A=y=S=B.value[u[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,B.array[E+12]=t.x,B.array[E+13]=t.y,B.array[E+14]=t.z,B.array[E+15]=t.w,E+=16}j.bindBuffer(j.ARRAY_BUFFER,B.buffer);j.bufferData(j.ARRAY_BUFFER,B.array,n)}}T&&(delete l.__inittedArrays,delete l.__colorArray,
-delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&r(h)}else if(x instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;
-x=j.DYNAMIC_DRAW;w=i=w=T=T=void 0;I=h.vertices;k=h.colors;q=I.length;l=k.length;s=h.__vertexArray;n=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(T=0;T<q;T++)w=I[T].position,i=T*3,s[i]=w.x,s[i+1]=w.y,s[i+2]=w.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,x)}if(u){for(T=0;T<l;T++)w=k[T],i=T*3,n[i]=w.r,n[i+1]=w.g,n[i+2]=w.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,n,x)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(x instanceof
-THREE.Line){h=b(x,l);n=h.attributes&&m(h);if(f.__dirtyVertices||f.__dirtyColors||n){x=f;i=j.DYNAMIC_DRAW;q=k=J=I=ia=void 0;I=x.vertices;l=x.colors;q=I.length;n=l.length;s=x.__vertexArray;T=x.__colorArray;u=x.__dirtyColors;w=x.__webglCustomAttributesList;Z=aa=Y=W=J=ia=void 0;if(x.__dirtyVertices){for(ia=0;ia<q;ia++)J=I[ia].position,k=ia*3,s[k]=J.x,s[k+1]=J.y,s[k+2]=J.z;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,i)}if(u){for(I=0;I<n;I++)q=l[I],k=I*3,T[k]=q.r,T[k+
+f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||n)if(n=j.DYNAMIC_DRAW,T=!f.dynamic,l.__inittedArrays){var C=I=w=void 0,s=void 0,ba=void 0,ca=void 0,v=void 0,D=void 0,F=void 0,la=void 0,H=void 0,Z=C=ca=void 0,y=void 0,A=void 0,z=void 0,ga=s=void 0,M=void 0,O=s=F=H=void 0,X=void 0,ha=z=A=y=v=void 0,G=s=z=A=y=ha=z=A=y=ha=z=A=y=void 0,J=void 0,L=ca=void 0,P=void 0,R=void 0,ka=void 0,Q=void 0,W=Z=R=J=0,Y=0,aa=G=C=0,N=v=ga=0,E=0,S=void 0,N=l.__vertexArray,P=l.__uvArray,
+E=l.__uv2Array,L=l.__normalArray,ba=l.__tangentArray,M=l.__colorArray,O=l.__skinVertexAArray,X=l.__skinVertexBArray,D=l.__skinIndexArray,U=l.__skinWeightArray,ha=l.__morphTargetsArrays,q=l.__webglCustomAttributesList,B=void 0,B=l.__faceArray,S=l.__lineArray,da=l.__needsSmoothNormals,H=l.__vertexColorType,la=l.__uvType,ca=l.__normalType,F=x.geometry,fa=F.__dirtyElements,$=F.__dirtyUvs,qa=F.__dirtyNormals,ja=F.__dirtyTangents,xa=F.__dirtyColors,ka=F.__dirtyMorphTargets,Q=F.vertices,r=l.faces3,u=l.faces4,
+ia=F.faces,ma=F.faceVertexUvs[0],ua=F.faceVertexUvs[1],ta=F.skinVerticesA,sa=F.skinVerticesB,ra=F.skinIndices,na=F.skinWeights,pa=F.morphTargets;if(F.__dirtyVertices){w=0;for(I=r.length;w<I;w++)s=ia[r[w]],y=Q[s.a].position,A=Q[s.b].position,z=Q[s.c].position,N[R]=y.x,N[R+1]=y.y,N[R+2]=y.z,N[R+3]=A.x,N[R+4]=A.y,N[R+5]=A.z,N[R+6]=z.x,N[R+7]=z.y,N[R+8]=z.z,R+=9;w=0;for(I=u.length;w<I;w++)s=ia[u[w]],y=Q[s.a].position,A=Q[s.b].position,z=Q[s.c].position,s=Q[s.d].position,N[R]=y.x,N[R+1]=y.y,N[R+2]=y.z,
+N[R+3]=A.x,N[R+4]=A.y,N[R+5]=A.z,N[R+6]=z.x,N[R+7]=z.y,N[R+8]=z.z,N[R+9]=s.x,N[R+10]=s.y,N[R+11]=s.z,R+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,N,n)}if(ka){R=0;for(ka=pa.length;R<ka;R++){w=N=0;for(I=r.length;w<I;w++)s=ia[r[w]],y=pa[R].vertices[s.a].position,A=pa[R].vertices[s.b].position,z=pa[R].vertices[s.c].position,Q=ha[R],Q[N]=y.x,Q[N+1]=y.y,Q[N+2]=y.z,Q[N+3]=A.x,Q[N+4]=A.y,Q[N+5]=A.z,Q[N+6]=z.x,Q[N+7]=z.y,Q[N+8]=z.z,N+=9;w=0;for(I=u.length;w<I;w++)s=
+ia[u[w]],y=pa[R].vertices[s.a].position,A=pa[R].vertices[s.b].position,z=pa[R].vertices[s.c].position,s=pa[R].vertices[s.d].position,Q=ha[R],Q[N]=y.x,Q[N+1]=y.y,Q[N+2]=y.z,Q[N+3]=A.x,Q[N+4]=A.y,Q[N+5]=A.z,Q[N+6]=z.x,Q[N+7]=z.y,Q[N+8]=z.z,Q[N+9]=s.x,Q[N+10]=s.y,Q[N+11]=s.z,N+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[R]);j.bufferData(j.ARRAY_BUFFER,ha[R],n)}}if(na.length){w=0;for(I=r.length;w<I;w++)s=ia[r[w]],y=na[s.a],A=na[s.b],z=na[s.c],U[v]=y.x,U[v+1]=y.y,U[v+2]=y.z,U[v+3]=y.w,
+U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=A.w,U[v+8]=z.x,U[v+9]=z.y,U[v+10]=z.z,U[v+11]=z.w,y=ra[s.a],A=ra[s.b],z=ra[s.c],D[v]=y.x,D[v+1]=y.y,D[v+2]=y.z,D[v+3]=y.w,D[v+4]=A.x,D[v+5]=A.y,D[v+6]=A.z,D[v+7]=A.w,D[v+8]=z.x,D[v+9]=z.y,D[v+10]=z.z,D[v+11]=z.w,y=ta[s.a],A=ta[s.b],z=ta[s.c],O[v]=y.x,O[v+1]=y.y,O[v+2]=y.z,O[v+3]=1,O[v+4]=A.x,O[v+5]=A.y,O[v+6]=A.z,O[v+7]=1,O[v+8]=z.x,O[v+9]=z.y,O[v+10]=z.z,O[v+11]=1,y=sa[s.a],A=sa[s.b],z=sa[s.c],X[v]=y.x,X[v+1]=y.y,X[v+2]=y.z,X[v+3]=1,X[v+4]=A.x,X[v+5]=A.y,X[v+
+6]=A.z,X[v+7]=1,X[v+8]=z.x,X[v+9]=z.y,X[v+10]=z.z,X[v+11]=1,v+=12;w=0;for(I=u.length;w<I;w++)s=ia[u[w]],y=na[s.a],A=na[s.b],z=na[s.c],ha=na[s.d],U[v]=y.x,U[v+1]=y.y,U[v+2]=y.z,U[v+3]=y.w,U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=A.w,U[v+8]=z.x,U[v+9]=z.y,U[v+10]=z.z,U[v+11]=z.w,U[v+12]=ha.x,U[v+13]=ha.y,U[v+14]=ha.z,U[v+15]=ha.w,y=ra[s.a],A=ra[s.b],z=ra[s.c],ha=ra[s.d],D[v]=y.x,D[v+1]=y.y,D[v+2]=y.z,D[v+3]=y.w,D[v+4]=A.x,D[v+5]=A.y,D[v+6]=A.z,D[v+7]=A.w,D[v+8]=z.x,D[v+9]=z.y,D[v+10]=z.z,D[v+11]=z.w,
+D[v+12]=ha.x,D[v+13]=ha.y,D[v+14]=ha.z,D[v+15]=ha.w,y=ta[s.a],A=ta[s.b],z=ta[s.c],ha=ta[s.d],O[v]=y.x,O[v+1]=y.y,O[v+2]=y.z,O[v+3]=1,O[v+4]=A.x,O[v+5]=A.y,O[v+6]=A.z,O[v+7]=1,O[v+8]=z.x,O[v+9]=z.y,O[v+10]=z.z,O[v+11]=1,O[v+12]=ha.x,O[v+13]=ha.y,O[v+14]=ha.z,O[v+15]=1,y=sa[s.a],A=sa[s.b],z=sa[s.c],s=sa[s.d],X[v]=y.x,X[v+1]=y.y,X[v+2]=y.z,X[v+3]=1,X[v+4]=A.x,X[v+5]=A.y,X[v+6]=A.z,X[v+7]=1,X[v+8]=z.x,X[v+9]=z.y,X[v+10]=z.z,X[v+11]=1,X[v+12]=s.x,X[v+13]=s.y,X[v+14]=s.z,X[v+15]=1,v+=16;v>0&&(j.bindBuffer(j.ARRAY_BUFFER,
+l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,O,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,X,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,D,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,U,n))}if(xa&&H){w=0;for(I=r.length;w<I;w++)s=ia[r[w]],v=s.vertexColors,D=s.color,v.length===3&&H===THREE.VertexColors?(s=v[0],O=v[1],X=v[2]):X=O=s=D,M[ga]=s.r,M[ga+1]=s.g,M[ga+2]=
+s.b,M[ga+3]=O.r,M[ga+4]=O.g,M[ga+5]=O.b,M[ga+6]=X.r,M[ga+7]=X.g,M[ga+8]=X.b,ga+=9;w=0;for(I=u.length;w<I;w++)s=ia[u[w]],v=s.vertexColors,D=s.color,v.length===4&&H===THREE.VertexColors?(s=v[0],O=v[1],X=v[2],v=v[3]):v=X=O=s=D,M[ga]=s.r,M[ga+1]=s.g,M[ga+2]=s.b,M[ga+3]=O.r,M[ga+4]=O.g,M[ga+5]=O.b,M[ga+6]=X.r,M[ga+7]=X.g,M[ga+8]=X.b,M[ga+9]=v.r,M[ga+10]=v.g,M[ga+11]=v.b,ga+=12;ga>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,M,n))}if(ja&&F.hasTangents){w=0;for(I=r.length;w<
+I;w++)s=ia[r[w]],F=s.vertexTangents,ga=F[0],M=F[1],H=F[2],ba[G]=ga.x,ba[G+1]=ga.y,ba[G+2]=ga.z,ba[G+3]=ga.w,ba[G+4]=M.x,ba[G+5]=M.y,ba[G+6]=M.z,ba[G+7]=M.w,ba[G+8]=H.x,ba[G+9]=H.y,ba[G+10]=H.z,ba[G+11]=H.w,G+=12;w=0;for(I=u.length;w<I;w++)s=ia[u[w]],F=s.vertexTangents,ga=F[0],M=F[1],H=F[2],F=F[3],ba[G]=ga.x,ba[G+1]=ga.y,ba[G+2]=ga.z,ba[G+3]=ga.w,ba[G+4]=M.x,ba[G+5]=M.y,ba[G+6]=M.z,ba[G+7]=M.w,ba[G+8]=H.x,ba[G+9]=H.y,ba[G+10]=H.z,ba[G+11]=H.w,ba[G+12]=F.x,ba[G+13]=F.y,ba[G+14]=F.z,ba[G+15]=F.w,G+=
+16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ba,n)}if(qa&&ca){w=0;for(I=r.length;w<I;w++)if(s=ia[r[w]],ba=s.vertexNormals,ca=s.normal,ba.length===3&&da)for(G=0;G<3;G++)ca=ba[G],L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;else for(G=0;G<3;G++)L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;w=0;for(I=u.length;w<I;w++)if(s=ia[u[w]],ba=s.vertexNormals,ca=s.normal,ba.length===4&&da)for(G=0;G<4;G++)ca=ba[G],L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;else for(G=0;G<4;G++)L[C]=ca.x,L[C+
+1]=ca.y,L[C+2]=ca.z,C+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,L,n)}if($&&ma&&la){w=0;for(I=r.length;w<I;w++)if(C=r[w],C=ma[C],C!==void 0)for(G=0;G<3;G++)L=C[G],P[Z]=L.u,P[Z+1]=L.v,Z+=2;w=0;for(I=u.length;w<I;w++)if(C=u[w],C=ma[C],C!==void 0)for(G=0;G<4;G++)L=C[G],P[Z]=L.u,P[Z+1]=L.v,Z+=2;Z>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,P,n))}if($&&ua&&la){w=0;for(I=r.length;w<I;w++)if(C=r[w],Z=ua[C],Z!==void 0)for(G=0;G<3;G++)P=
+Z[G],E[W]=P.u,E[W+1]=P.v,W+=2;w=0;for(I=u.length;w<I;w++)if(C=u[w],Z=ua[C],Z!==void 0)for(G=0;G<4;G++)P=Z[G],E[W]=P.u,E[W+1]=P.v,W+=2;W>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,E,n))}if(fa){w=0;for(I=r.length;w<I;w++)B[Y]=J,B[Y+1]=J+1,B[Y+2]=J+2,Y+=3,S[aa]=J,S[aa+1]=J+1,S[aa+2]=J,S[aa+3]=J+2,S[aa+4]=J+1,S[aa+5]=J+2,aa+=6,J+=3;w=0;for(I=u.length;w<I;w++)B[Y]=J,B[Y+1]=J+1,B[Y+2]=J+3,B[Y+3]=J+1,B[Y+4]=J+2,B[Y+5]=J+3,Y+=6,S[aa]=J,S[aa+1]=J+1,S[aa+2]=J,S[aa+3]=J+
+3,S[aa+4]=J+1,S[aa+5]=J+2,S[aa+6]=J+2,S[aa+7]=J+3,aa+=8,J+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,B,n);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,S,n)}if(q){G=0;for(J=q.length;G<J;G++)if(B=q[G],B.__original.needsUpdate){E=0;if(B.size===1)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(I=r.length;w<I;w++)s=ia[r[w]],B.array[E]=B.value[s.a],B.array[E+1]=B.value[s.b],B.array[E+2]=B.value[s.c],
+E+=3;w=0;for(I=u.length;w<I;w++)s=ia[u[w]],B.array[E]=B.value[s.a],B.array[E+1]=B.value[s.b],B.array[E+2]=B.value[s.c],B.array[E+3]=B.value[s.d],E+=4}else{if(B.boundTo==="faces"){w=0;for(I=r.length;w<I;w++)S=B.value[r[w]],B.array[E]=S,B.array[E+1]=S,B.array[E+2]=S,E+=3;w=0;for(I=u.length;w<I;w++)S=B.value[u[w]],B.array[E]=S,B.array[E+1]=S,B.array[E+2]=S,B.array[E+3]=S,E+=4}}else if(B.size===2)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(I=r.length;w<I;w++)s=ia[r[w]],y=B.value[s.a],A=B.value[s.b],
+z=B.value[s.c],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,E+=6;w=0;for(I=u.length;w<I;w++)s=ia[u[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],s=B.value[s.d],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,B.array[E+6]=s.x,B.array[E+7]=s.y,E+=8}else{if(B.boundTo==="faces"){w=0;for(I=r.length;w<I;w++)z=A=y=S=B.value[r[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,
+B.array[E+4]=z.x,B.array[E+5]=z.y,E+=6;w=0;for(I=u.length;w<I;w++)s=z=A=y=S=B.value[u[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,B.array[E+6]=s.x,B.array[E+7]=s.y,E+=8}}else if(B.size===3)if(W=B.type==="c"?["r","g","b"]:["x","y","z"],B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(I=r.length;w<I;w++)s=ia[r[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],
+B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],E+=9;w=0;for(I=u.length;w<I;w++)s=ia[u[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],s=B.value[s.d],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],B.array[E+9]=s[W[0]],B.array[E+10]=s[W[1]],B.array[E+11]=s[W[2]],E+=12}else{if(B.boundTo==="faces"){w=0;for(I=
+r.length;w<I;w++)z=A=y=S=B.value[r[w]],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],E+=9;w=0;for(I=u.length;w<I;w++)s=z=A=y=S=B.value[u[w]],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],B.array[E+9]=s[W[0]],B.array[E+10]=
+s[W[1]],B.array[E+11]=s[W[2]],E+=12}}else if(B.size===4)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(I=r.length;w<I;w++)s=ia[r[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,E+=12;w=0;for(I=u.length;w<I;w++)s=ia[u[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],s=B.value[s.d],B.array[E]=
+y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,B.array[E+12]=s.x,B.array[E+13]=s.y,B.array[E+14]=s.z,B.array[E+15]=s.w,E+=16}else if(B.boundTo==="faces"){w=0;for(I=r.length;w<I;w++)z=A=y=S=B.value[r[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+
+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,E+=12;w=0;for(I=u.length;w<I;w++)s=z=A=y=S=B.value[u[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,B.array[E+12]=s.x,B.array[E+13]=s.y,B.array[E+14]=s.z,B.array[E+15]=s.w,E+=16}j.bindBuffer(j.ARRAY_BUFFER,B.buffer);j.bufferData(j.ARRAY_BUFFER,B.array,n)}}T&&(delete l.__inittedArrays,delete l.__colorArray,
+delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&t(h)}else if(x instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;
+x=j.DYNAMIC_DRAW;w=i=w=T=T=void 0;I=h.vertices;k=h.colors;q=I.length;l=k.length;r=h.__vertexArray;n=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(T=0;T<q;T++)w=I[T].position,i=T*3,r[i]=w.x,r[i+1]=w.y,r[i+2]=w.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,r,x)}if(u){for(T=0;T<l;T++)w=k[T],i=T*3,n[i]=w.r,n[i+1]=w.g,n[i+2]=w.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,n,x)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(x instanceof
+THREE.Line){h=b(x,l);n=h.attributes&&m(h);if(f.__dirtyVertices||f.__dirtyColors||n){x=f;i=j.DYNAMIC_DRAW;q=k=J=I=ia=void 0;I=x.vertices;l=x.colors;q=I.length;n=l.length;r=x.__vertexArray;T=x.__colorArray;u=x.__dirtyColors;w=x.__webglCustomAttributesList;Z=aa=Y=W=J=ia=void 0;if(x.__dirtyVertices){for(ia=0;ia<q;ia++)J=I[ia].position,k=ia*3,r[k]=J.x,r[k+1]=J.y,r[k+2]=J.z;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,r,i)}if(u){for(I=0;I<n;I++)q=l[I],k=I*3,T[k]=q.r,T[k+
 1]=q.g,T[k+2]=q.b;j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,T,i)}if(w){ia=0;for(J=w.length;ia<J;ia++)if(Z=w[ia],Z.needsUpdate&&(Z.boundTo===void 0||Z.boundTo==="vertices")){k=0;Y=Z.value.length;if(Z.size===1)for(W=0;W<Y;W++)Z.array[W]=Z.value[W];else if(Z.size===2)for(W=0;W<Y;W++)aa=Z.value[W],Z.array[k]=aa.x,Z.array[k+1]=aa.y,k+=2;else if(Z.size===3)if(Z.type==="c")for(W=0;W<Y;W++)aa=Z.value[W],Z.array[k]=aa.r,Z.array[k+1]=aa.g,Z.array[k+2]=aa.b,k+=3;else for(W=
 1]=q.g,T[k+2]=q.b;j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,T,i)}if(w){ia=0;for(J=w.length;ia<J;ia++)if(Z=w[ia],Z.needsUpdate&&(Z.boundTo===void 0||Z.boundTo==="vertices")){k=0;Y=Z.value.length;if(Z.size===1)for(W=0;W<Y;W++)Z.array[W]=Z.value[W];else if(Z.size===2)for(W=0;W<Y;W++)aa=Z.value[W],Z.array[k]=aa.x,Z.array[k+1]=aa.y,k+=2;else if(Z.size===3)if(Z.type==="c")for(W=0;W<Y;W++)aa=Z.value[W],Z.array[k]=aa.r,Z.array[k+1]=aa.g,Z.array[k+2]=aa.b,k+=3;else for(W=
-0;W<Y;W++)aa=Z.value[W],Z.array[k]=aa.x,Z.array[k+1]=aa.y,Z.array[k+2]=aa.z,k+=3;else if(Z.size===4)for(W=0;W<Y;W++)aa=Z.value[W],Z.array[k]=aa.x,Z.array[k+1]=aa.y,Z.array[k+2]=aa.z,Z.array[k+3]=aa.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,Z.buffer);j.bufferData(j.ARRAY_BUFFER,Z.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&r(h)}else if(x instanceof THREE.ParticleSystem)h=b(x,l),n=h.attributes&&m(h),(f.__dirtyVertices||f.__dirtyColors||x.sortParticles||n)&&d(f,j.DYNAMIC_DRAW,x),f.__dirtyVertices=
-!1,f.__dirtyColors=!1,h.attributes&&r(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);
+0;W<Y;W++)aa=Z.value[W],Z.array[k]=aa.x,Z.array[k+1]=aa.y,Z.array[k+2]=aa.z,k+=3;else if(Z.size===4)for(W=0;W<Y;W++)aa=Z.value[W],Z.array[k]=aa.x,Z.array[k+1]=aa.y,Z.array[k+2]=aa.z,Z.array[k+3]=aa.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,Z.buffer);j.bufferData(j.ARRAY_BUFFER,Z.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&t(h)}else if(x instanceof THREE.ParticleSystem)h=b(x,l),n=h.attributes&&m(h),(f.__dirtyVertices||f.__dirtyColors||x.sortParticles||n)&&d(f,j.DYNAMIC_DRAW,x),f.__dirtyVertices=
+!1,f.__dirtyColors=!1,h.attributes&&t(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);
 a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,l,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=C?k=m:(k=Math.ceil(C*m/(i+m)),i=C-k);f={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var w;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,
 a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,l,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=C?k=m:(k=Math.ceil(C*m/(i+m)),i=C-k);f={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var w;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,
 b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,
 b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,
 perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=O.length;p<d;p++)if(O[p].code===h){w=O[p].program;break a}p=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
 perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=O.length;p<d;p++)if(O[p].code===h){w=O[p].program;break a}p=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
@@ -349,9 +349,9 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,e=Math.max(Math.max(b,d),g),f=Math.min(Math.min(b,d),g);if(f===e)f=b=0;else{var h=e-f,f=h/e,b=b===e?(d-g)/h:d===e?2+(g-b)/h:4+(b-d)/h;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=f;c.v=e;return c}};
 THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,e=Math.max(Math.max(b,d),g),f=Math.min(Math.min(b,d),g);if(f===e)f=b=0;else{var h=e-f,f=h/e,b=b===e?(d-g)/h:d===e?2+(g-b)/h:4+(b-d)/h;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=f;c.v=e;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,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,k=e.faces,l=a.faceVertexUvs[0],n=e.faceVertexUvs[0],o={},m=0;m<a.materials.length;m++)o[a.materials[m].id]=m;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var m=0,r=h.length;m<r;m++){var p=new THREE.Vertex(h[m].position.clone());b&&b.multiplyVector3(p.position);f.push(p)}m=
-0;for(r=k.length;m<r;m++){var f=k[m],s,u,x=f.vertexNormals,q=f.vertexColors;f instanceof THREE.Face3?s=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(s=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));s.normal.copy(f.normal);d&&d.multiplyVector3(s.normal);h=0;for(p=x.length;h<p;h++)u=x[h].clone(),d&&d.multiplyVector3(u),s.vertexNormals.push(u);s.color.copy(f.color);h=0;for(p=q.length;h<p;h++)u=q[h],s.vertexColors.push(u.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
-p=o[h.id];if(p===void 0)p=a.materials.length,a.materials.push(h);s.materialIndex=p}s.centroid.copy(f.centroid);b&&b.multiplyVector3(s.centroid);i.push(s)}m=0;for(r=n.length;m<r;m++){b=n[m];d=[];h=0;for(p=b.length;h<p;h++)d.push(new THREE.UV(b[h].u,b[h].v));l.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,e=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var f=new THREE.Vertex(d[a].position.clone());c.vertices.push(f)}a=0;
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,k=e.faces,l=a.faceVertexUvs[0],n=e.faceVertexUvs[0],o={},m=0;m<a.materials.length;m++)o[a.materials[m].id]=m;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var m=0,t=h.length;m<t;m++){var p=new THREE.Vertex(h[m].position.clone());b&&b.multiplyVector3(p.position);f.push(p)}m=
+0;for(t=k.length;m<t;m++){var f=k[m],r,u,x=f.vertexNormals,q=f.vertexColors;f instanceof THREE.Face3?r=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(r=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));r.normal.copy(f.normal);d&&d.multiplyVector3(r.normal);h=0;for(p=x.length;h<p;h++)u=x[h].clone(),d&&d.multiplyVector3(u),r.vertexNormals.push(u);r.color.copy(f.color);h=0;for(p=q.length;h<p;h++)u=q[h],r.vertexColors.push(u.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
+p=o[h.id];if(p===void 0)p=a.materials.length,a.materials.push(h);r.materialIndex=p}r.centroid.copy(f.centroid);b&&b.multiplyVector3(r.centroid);i.push(r)}m=0;for(t=n.length;m<t;m++){b=n[m];d=[];h=0;for(p=b.length;h<p;h++)d.push(new THREE.UV(b[h].u,b[h].v));l.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,e=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var f=new THREE.Vertex(d[a].position.clone());c.vertices.push(f)}a=0;
 for(b=g.length;a<b;a++){var h=g[a],i,k,l=h.vertexNormals,n=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=l.length;d<f;d++)k=l[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=n.length;d<f;d++)k=n[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=e.length;a<b;a++){g=e[a];i=[];d=0;for(f=g.length;d<
 for(b=g.length;a<b;a++){var h=g[a],i,k,l=h.vertexNormals,n=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=l.length;d<f;d++)k=l[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=n.length;d<f;d++)k=n[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=e.length;a<b;a++){g=e[a];i=[];d=0;for(f=g.length;d<
 f;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,e,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);e=1-d-g;f.copy(a);f.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);f.addSelf(h);h.copy(b);h.multiplyScalar(e);f.addSelf(h);return f},randomPointInFace:function(a,c,b){var d,g,e;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 f;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,e,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);e=1-d-g;f.copy(a);f.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);f.addSelf(h);h.copy(b);h.multiplyScalar(e);f.addSelf(h);return f},randomPointInFace:function(a,c,b){var d,g,e;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 e=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,e);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;e=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c));return THREE.GeometryUtils.random()*(b+
 e=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,e);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;e=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c));return THREE.GeometryUtils.random()*(b+
@@ -359,9 +359,9 @@ f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.random
 THREE.Face4)l=f[d.a].position,n=f[d.b].position,o=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,n,m),d._area2=THREE.GeometryUtils.triangleArea(n,o,m),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];f={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(e[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 THREE.Face4)l=f[d.a].position,n=f[d.b].position,o=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,n,m),d._area2=THREE.GeometryUtils.triangleArea(n,o,m),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];f={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(e[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(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*(d+a+b);return Math.sqrt(c*(c-d)*(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 d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],e=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)e.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return e},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 d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],e=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)e.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return e},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 d=a.width,g=a.height,e=document.createElement("canvas");e.width=d;e.height=g;var f=e.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,g).data,i=f.createImageData(d,g),k=i.data,l=0;l<d;l++)for(var n=1;n<g;n++){var o=n-1<0?g-1:n-1,m=(n+1)%g,r=l-1<0?d-1:l-1,p=(l+1)%d,s=[],u=[0,0,h[(n*d+l)*4]/255*c];s.push([-1,0,h[(n*d+r)*4]/255*c]);s.push([-1,-1,h[(o*d+r)*4]/255*c]);s.push([0,-1,h[(o*d+l)*4]/255*c]);s.push([1,-1,h[(o*d+p)*4]/255*c]);
-s.push([1,0,h[(n*d+p)*4]/255*c]);s.push([1,1,h[(m*d+p)*4]/255*c]);s.push([0,1,h[(m*d+l)*4]/255*c]);s.push([-1,1,h[(m*d+r)*4]/255*c]);o=[];r=s.length;for(m=0;m<r;m++){var p=s[m],x=s[(m+1)%r],p=[p[0]-u[0],p[1]-u[1],p[2]-u[2]],x=[x[0]-u[0],x[1]-u[1],x[2]-u[2]];o.push(b([p[1]*x[2]-p[2]*x[1],p[2]*x[0]-p[0]*x[2],p[0]*x[1]-p[1]*x[0]]))}s=[0,0,0];for(m=0;m<o.length;m++)s[0]+=o[m][0],s[1]+=o[m][1],s[2]+=o[m][2];s[0]/=o.length;s[1]/=o.length;s[2]/=o.length;u=(n*d+l)*4;k[u]=(s[0]+1)/2*255|0;k[u+1]=(s[1]+0.5)*
-255|0;k[u+2]=s[2]*255|0;k[u+3]=255}f.putImageData(i,0,0);return e}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var e=new THREE.Mesh(a,c[b]);g.add(e)}return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,e=document.createElement("canvas");e.width=d;e.height=g;var f=e.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,g).data,i=f.createImageData(d,g),k=i.data,l=0;l<d;l++)for(var n=1;n<g;n++){var o=n-1<0?g-1:n-1,m=(n+1)%g,t=l-1<0?d-1:l-1,p=(l+1)%d,r=[],u=[0,0,h[(n*d+l)*4]/255*c];r.push([-1,0,h[(n*d+t)*4]/255*c]);r.push([-1,-1,h[(o*d+t)*4]/255*c]);r.push([0,-1,h[(o*d+l)*4]/255*c]);r.push([1,-1,h[(o*d+p)*4]/255*c]);
+r.push([1,0,h[(n*d+p)*4]/255*c]);r.push([1,1,h[(m*d+p)*4]/255*c]);r.push([0,1,h[(m*d+l)*4]/255*c]);r.push([-1,1,h[(m*d+t)*4]/255*c]);o=[];t=r.length;for(m=0;m<t;m++){var p=r[m],x=r[(m+1)%t],p=[p[0]-u[0],p[1]-u[1],p[2]-u[2]],x=[x[0]-u[0],x[1]-u[1],x[2]-u[2]];o.push(b([p[1]*x[2]-p[2]*x[1],p[2]*x[0]-p[0]*x[2],p[0]*x[1]-p[1]*x[0]]))}r=[0,0,0];for(m=0;m<o.length;m++)r[0]+=o[m][0],r[1]+=o[m][1],r[2]+=o[m][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;u=(n*d+l)*4;k[u]=(r[0]+1)/2*255|0;k[u+1]=(r[1]+0.5)*
+255|0;k[u+2]=r[2]*255|0;k[u+3]=255}f.putImageData(i,0,0);return e}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var e=new THREE.Mesh(a,c[b]);g.add(e)}return g}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -400,9 +400,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,e)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,e)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,e));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
 THREE.Path.prototype.arc=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,e));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,k,l,n,o,m,r,p;d=0;for(g=this.actions.length;d<g;d++)switch(e=this.actions[d],f=e.action,e=e.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];n=e[0];o=e[1];b.length>0?(f=b[b.length-1],m=f.x,r=f.y):(f=this.actions[d-1].args,m=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,m,n,h),p=THREE.Shape.Utils.b2(p,r,o,
-i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];n=e[0];o=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],m=f.x,r=f.y):(f=this.actions[d-1].args,m=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,m,n,k,h),p=THREE.Shape.Utils.b3(p,r,o,l,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
-for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];n=e[3];p=e[4];o=!!e[5];l=f[f.length-2];m=f[f.length-1];f.length==0&&(l=m=0);r=p-n;var s=a*2;for(f=1;f<=s;f++)p=f/s,o||(p=1-p),p=n+p*r,e=l+h+k*Math.cos(p),p=m+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,k,l,n,o,m,t,p;d=0;for(g=this.actions.length;d<g;d++)switch(e=this.actions[d],f=e.action,e=e.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];n=e[0];o=e[1];b.length>0?(f=b[b.length-1],m=f.x,t=f.y):(f=this.actions[d-1].args,m=f[f.length-2],t=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,m,n,h),p=THREE.Shape.Utils.b2(p,t,o,
+i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];n=e[0];o=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],m=f.x,t=f.y):(f=this.actions[d-1].args,m=f[f.length-2],t=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,m,n,k,h),p=THREE.Shape.Utils.b3(p,t,o,l,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
+for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];n=e[3];p=e[4];o=!!e[5];l=f[f.length-2];m=f[f.length-1];f.length==0&&(l=m=0);t=p-n;var r=a*2;for(f=1;f<=r;f++)p=f/r,o||(p=1-p),p=n+p*t,e=l+h+k*Math.cos(p),p=m+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
 THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,n;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,n=k.y,k.x=a*l+c*n+b,k.y=d*n+g*l+e;return f};
 THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,n;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,n=k.y,k.x=a*l+c*n+b,k.y=d*n+g*l+e;return f};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
 this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
@@ -410,9 +410,9 @@ THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],e=new THREE.Path;a=0;f
 d.curves):f.holes.push(d);e.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,e.push(f),f=new THREE.Shape):f.holes.push(d)}return e};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 d.curves):f.holes.push(d);e.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,e.push(f),f=new THREE.Shape):f.holes.push(d)}return e};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,k,l,n,o,m,r=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);e=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){o=k[g];m=[];for(n=0;n<b.length;n++)l=b[n],l=o.distanceToSquared(l),m.push(l),l<e&&(e=l,f=g,h=n)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];n=THREE.FontUtils.Triangulate.area(p);var s=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(s);m=h;l=f;h+=1;f+=-1;h<
-0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);s=[k[f],k[e],b[h]];s=THREE.FontUtils.Triangulate.area(s);n+o>p+s&&(h=m,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);n=b.slice(0,h);o=b.slice(h);m=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];r.push([k[f],b[h],b[g]]);r.push(e);b=n.concat(m).concat(l).concat(o)}return{shape:b,
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=e;e=0;for(f=b.length;e<f;e++){h=b[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}e=0;for(f=g.length;e<f;e++){h=g[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,k,l,n,o,m,t=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);e=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){o=k[g];m=[];for(n=0;n<b.length;n++)l=b[n],l=o.distanceToSquared(l),m.push(l),l<e&&(e=l,f=g,h=n)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];n=THREE.FontUtils.Triangulate.area(p);var r=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(r);m=h;l=f;h+=1;f+=-1;h<
+0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);r=[k[f],k[e],b[h]];r=THREE.FontUtils.Triangulate.area(r);n+o>p+r&&(h=m,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);n=b.slice(0,h);o=b.slice(h);m=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];t.push([k[f],b[h],b[g]]);t.push(e);b=n.concat(m).concat(l).concat(o)}return{shape:b,
+isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=e;e=0;for(f=b.length;e<f;e++){h=b[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}e=0;for(f=g.length;e<f;e++){h=g[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",e=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=e};
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",e=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=e};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
@@ -425,7 +425,7 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?g.skinMatrix:g.matrix;var e=g.animationCache.prevKey;g=g.animationCache.nextKey;e.pos=this.data.hierarchy[b].keys[0];e.rot=this.data.hierarchy[b].keys[0];e.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Bone?g.skinMatrix:g.matrix;var e=g.animationCache.prevKey;g=g.animationCache.nextKey;e.pos=this.data.hierarchy[b].keys[0];e.rot=this.data.hierarchy[b].keys[0];e.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,e,f,h,i,k,l=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;k=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,r=this.hierarchy.length;m<r;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&l[m][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,e,f,h,i,k,l=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;k=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,t=this.hierarchy.length;m<t;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&l[m][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
 !1):(a.matrix=l[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){b=c[p];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(n<o)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(b,m,1);h.time<n;)f=h,h=this.getNextKeyWith(b,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,m,h.index+1);while(h.time<
 !1):(a.matrix=l[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){b=c[p];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(n<o)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(b,m,1);h.time<n;)f=h,h=this.getNextKeyWith(b,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,m,h.index+1);while(h.time<
 n)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-f.time)/(h.time-f.time);g=f[b];e=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 n)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-f.time)/(h.time-f.time);g=f[b];e=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
 this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
@@ -444,7 +444,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -452,16 +452,16 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),s=g.length,u=0;f=s-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<s-1;f++)u=d*h.chunks[f]/h.total,b.keys[f]={time:u,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,u=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++)u=d*h.chunks[f]/h.total,b.keys[f]={time:u,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 !1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -470,12 +470,12 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Matrix4,f=!1,h=1,i=0,k=0,l=0,n=0,o=0,m=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Matrix4,f=!1,h=1,i=0,k=0,l=0,n=0,o=0,m=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
 this.rotateHorizontally(c*n);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*l);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
 this.rotateHorizontally(c*n);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*l);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
 g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;e.identity();e.n11=Math.cos(this.roll);e.n12=-Math.sin(this.roll);e.n21=Math.sin(this.roll);e.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;e.identity();e.n11=Math.cos(this.roll);e.n12=-Math.sin(this.roll);e.n21=Math.sin(this.roll);e.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-m)/window.innerWidth;o=(a.clientY-r)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-m)/window.innerWidth;o=(a.clientY-t)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:l=1;break;case 70:l=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:l=0;break;case 70:l=0}},!1)};
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:l=1;break;case 70:l=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:l=0;break;case 70:l=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
 THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
 new THREE.Vector3(0,0,0);var g=!1,e=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
 new THREE.Vector3(0,0,0);var g=!1,e=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
@@ -485,27 +485,27 @@ b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?n=o:n.addSelf(a.
 b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=b.getMouseOnScreen(a.clientX,a.clientY),n=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=b.getMouseOnScreen(a.clientX,
 b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=b.getMouseOnScreen(a.clientX,a.clientY),n=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=b.getMouseOnScreen(a.clientX,
 a.clientY):e===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=l=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(n=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 a.clientY):e===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=l=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(n=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
 e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,l,m){var n,o,p=d||1,r=g||1,s=h/2,q=i/2,u=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",r=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var x=p+1,A=r+1;h/=p;var C=i/r;for(o=0;o<A;o++)for(i=0;i<x;i++){var K=new THREE.Vector3;K[a]=(i*h-s)*c;K[b]=(o*C-q)*f;K[n]=l;k.vertices.push(new THREE.Vertex(K))}for(o=0;o<r;o++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
-x*o+u,i+x*(o+1)+u,i+1+x*(o+1)+u,i+1+x*o+u,null,null,m)),k.faceVertexUvs[0].push([new THREE.UV(i/p,o/r),new THREE.UV(i/p,(o+1)/r),new THREE.UV((i+1)/p,(o+1)/r),new THREE.UV((i+1)/p,o/r)])}THREE.Geometry.call(this);var k=this,l=a/2,n=c/2,o=b/2,m,r,p,s,u,x;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;s=1;r=2;u=3;p=4;x=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var q in h)this.sides[q]!=
-void 0&&(this.sides[q]=h[q]);this.sides.px&&i("z","y",-1,-1,b,c,l,m);this.sides.nx&&i("z","y",1,-1,b,c,-l,s);this.sides.py&&i("x","z",1,1,a,b,n,r);this.sides.ny&&i("x","z",1,-1,a,b,-n,u);this.sides.pz&&i("x","y",1,-1,a,c,o,p);this.sides.nz&&i("x","y",-1,-1,a,c,-o,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,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,k=[],l=[];for(i=0;i<=g;i++){var n=[],o=[],m=i/g,r=m*(c-a)+a;for(h=0;h<=d;h++){var p=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(r*Math.sin(p*Math.PI*2),-m*b+f,r*Math.cos(p*Math.PI*2))));n.push(this.vertices.length-1);o.push(new THREE.UV(p,m))}k.push(n);l.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],n=k[i+1][h],o=k[i+1][h+1],m=k[i][h+1],r=
-this.vertices[b].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),u=this.vertices[m].position.clone().setY(0).normalize(),x=l[i][h].clone(),q=l[i+1][h].clone(),t=l[i+1][h+1].clone(),v=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,n,o,m,[r,p,s,u]));this.faceVertexUvs[0].push([x,q,t,v])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=k[0][h],n=k[0][h+
-1],o=this.vertices.length-1,r=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),x=l[0][h].clone(),q=l[0][h+1].clone(),t=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,n,o,[r,p,s])),this.faceVertexUvs[0].push([x,q,t])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=k[i][h+1],n=k[i][h],o=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),x=l[i][h+1].clone(),q=l[i][h].clone(),
-t=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,n,o,[r,p,s])),this.faceVertexUvs[0].push([x,q,t])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,l,m){var n,o,p=d||1,r=g||1,t=h/2,q=i/2,u=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",r=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var x=p+1,A=r+1;h/=p;var C=i/r;for(o=0;o<A;o++)for(i=0;i<x;i++){var K=new THREE.Vector3;K[a]=(i*h-t)*c;K[b]=(o*C-q)*f;K[n]=l;k.vertices.push(new THREE.Vertex(K))}for(o=0;o<r;o++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
+x*o+u,i+x*(o+1)+u,i+1+x*(o+1)+u,i+1+x*o+u,null,null,m)),k.faceVertexUvs[0].push([new THREE.UV(i/p,o/r),new THREE.UV(i/p,(o+1)/r),new THREE.UV((i+1)/p,(o+1)/r),new THREE.UV((i+1)/p,o/r)])}THREE.Geometry.call(this);var k=this,l=a/2,n=c/2,o=b/2,m,t,p,r,u,x;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;r=1;t=2;u=3;p=4;x=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var q in h)this.sides[q]!=
+void 0&&(this.sides[q]=h[q]);this.sides.px&&i("z","y",-1,-1,b,c,l,m);this.sides.nx&&i("z","y",1,-1,b,c,-l,r);this.sides.py&&i("x","z",1,1,a,b,n,t);this.sides.ny&&i("x","z",1,-1,a,b,-n,u);this.sides.pz&&i("x","y",1,-1,a,c,o,p);this.sides.nz&&i("x","y",-1,-1,a,c,-o,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,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,k=[],l=[];for(i=0;i<=g;i++){var n=[],o=[],m=i/g,t=m*(c-a)+a;for(h=0;h<=d;h++){var p=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(p*Math.PI*2),-m*b+f,t*Math.cos(p*Math.PI*2))));n.push(this.vertices.length-1);o.push(new THREE.UV(p,m))}k.push(n);l.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],n=k[i+1][h],o=k[i+1][h+1],m=k[i][h+1],t=
+this.vertices[b].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),u=this.vertices[m].position.clone().setY(0).normalize(),x=l[i][h].clone(),q=l[i+1][h].clone(),s=l[i+1][h+1].clone(),v=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,n,o,m,[t,p,r,u]));this.faceVertexUvs[0].push([x,q,s,v])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=k[0][h],n=k[0][h+
+1],o=this.vertices.length-1,t=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),x=l[0][h].clone(),q=l[0][h+1].clone(),s=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,n,o,[t,p,r])),this.faceVertexUvs[0].push([x,q,s])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=k[i][h+1],n=k[i][h],o=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),x=l[i][h+1].clone(),q=l[i][h].clone(),
+s=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,n,o,[t,p,r])),this.faceVertexUvs[0].push([x,q,s])}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,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,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,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,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 d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.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 d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
 h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<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),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(D=a.length;--D>=0;){j=D;O=D-1;O<0&&(O=a.length-1);for(var b=
 h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<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),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(D=a.length;--D>=0;){j=D;O=D-1;O<0&&(O=a.length-1);for(var b=
-0,c=m+l*2,b=0;b<c;b++){var d=da*b,e=da*(b+1),f=fa+j+d,g=fa+j+e,k=f,d=fa+O+d,e=fa+O+e,n=g;k+=z;d+=z;e+=z;n+=z;F.faces.push(new THREE.Face4(k,d,e,n,null,null,t));t&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(F.vertices[f].position.z+i)/e,g=(F.vertices[g].position.z+i)/e,F.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=z;b+=z;c+=z;F.faces.push(new THREE.Face3(a,b,c,
+0,c=m+l*2,b=0;b<c;b++){var d=da*b,e=da*(b+1),f=fa+j+d,g=fa+j+e,k=f,d=fa+O+d,e=fa+O+e,n=g;k+=z;d+=z;e+=z;n+=z;F.faces.push(new THREE.Face4(k,d,e,n,null,null,s));s&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(F.vertices[f].position.z+i)/e,g=(F.vertices[g].position.z+i)/e,F.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=z;b+=z;c+=z;F.faces.push(new THREE.Face3(a,b,c,
 null,null,q));if(q){var d=v.maxY,e=v.maxX,f=F.vertices[b].position.x,b=F.vertices[b].position.y,g=F.vertices[c].position.x,c=F.vertices[c].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[a].position.x/e,F.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,l=c.bevelSegments!==void 0?c.bevelSegments:3,n=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
 null,null,q));if(q){var d=v.maxY,e=v.maxX,f=F.vertices[b].position.x,b=F.vertices[b].position.y,g=F.vertices[c].position.x,c=F.vertices[c].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[a].position.x/e,F.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,l=c.bevelSegments!==void 0?c.bevelSegments:3,n=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
-o=c.curveSegments!==void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,r=c.bendPath,p=c.extrudePath,s,u=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,t=c.extrudeMaterial,v=this.shapebb;if(p)s=p.getPoints(o),m=s.length,u=!0,n=!1;n||(k=i=l=0);var y,H,J,F=this,z=this.vertices.length;r&&a.addWrapPath(r);o=x?a.extractAllSpacedPoints(o):a.extractAllPoints(o);r=o.shape;o=o.holes;if(p=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();H=0;for(J=o.length;H<J;H++)y=o[H],THREE.Shape.Utils.isClockWise(y)&&
-(o[H]=y.reverse());p=!1}p=THREE.Shape.Utils.triangulateShape(r,o);x=r;H=0;for(J=o.length;H<J;H++)y=o[H],r=r.concat(y);var D,P,G,$,L,Q,da=r.length,ja=p.length,S=[];D=0;P=x.length;j=P-1;for(O=D+1;D<P;D++,j++,O++)j===P&&(j=0),O===P&&(O=0),S[D]=d(x[D],x[j],x[O]);var A=[],C,K=S.concat();H=0;for(J=o.length;H<J;H++){y=o[H];C=[];D=0;P=y.length;j=P-1;for(O=D+1;D<P;D++,j++,O++)j===P&&(j=0),O===P&&(O=0),C[D]=d(y[D],y[j],y[O]);A.push(C);K=K.concat(C)}for(G=0;G<l;G++){$=G/l;L=i*(1-$);$=k*Math.sin($*Math.PI/2);
-D=0;for(P=x.length;D<P;D++)Q=b(x[D],S[D],$),e(Q.x,Q.y,-L);H=0;for(J=o.length;H<J;H++){y=o[H];C=A[H];D=0;for(P=y.length;D<P;D++)Q=b(y[D],C[D],$),e(Q.x,Q.y,-L)}}$=k;for(D=0;D<da;D++)Q=n?b(r[D],K[D],$):r[D],u?e(Q.x,Q.y+s[0].y,s[0].x):e(Q.x,Q.y,0);for(G=1;G<=m;G++)for(D=0;D<da;D++)Q=n?b(r[D],K[D],$):r[D],u?e(Q.x,Q.y+s[G-1].y,s[G-1].x):e(Q.x,Q.y,h/m*G);for(G=l-1;G>=0;G--){$=G/l;L=i*(1-$);$=k*Math.sin($*Math.PI/2);D=0;for(P=x.length;D<P;D++)Q=b(x[D],S[D],$),e(Q.x,Q.y,h+L);H=0;for(J=o.length;H<J;H++){y=
-o[H];C=A[H];D=0;for(P=y.length;D<P;D++)Q=b(y[D],C[D],$),u?e(Q.x,Q.y+s[m-1].y,s[m-1].x+L):e(Q.x,Q.y,h+L)}}if(n){n=da*0;for(D=0;D<ja;D++)k=p[D],f(k[2]+n,k[1]+n,k[0]+n);n=da*(m+l*2);for(D=0;D<ja;D++)k=p[D],f(k[0]+n,k[1]+n,k[2]+n)}else{for(D=0;D<ja;D++)k=p[D],f(k[2],k[1],k[0]);for(D=0;D<ja;D++)k=p[D],f(k[0]+da*m,k[1]+da*m,k[2]+da*m)}var j,O,fa=0;g(x);fa+=x.length;H=0;for(J=o.length;H<J;H++)y=o[H],g(y),fa+=y.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+o=c.curveSegments!==void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,t=c.bendPath,p=c.extrudePath,r,u=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,s=c.extrudeMaterial,v=this.shapebb;if(p)r=p.getPoints(o),m=r.length,u=!0,n=!1;n||(k=i=l=0);var y,H,J,F=this,z=this.vertices.length;t&&a.addWrapPath(t);o=x?a.extractAllSpacedPoints(o):a.extractAllPoints(o);t=o.shape;o=o.holes;if(p=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();H=0;for(J=o.length;H<J;H++)y=o[H],THREE.Shape.Utils.isClockWise(y)&&
+(o[H]=y.reverse());p=!1}p=THREE.Shape.Utils.triangulateShape(t,o);x=t;H=0;for(J=o.length;H<J;H++)y=o[H],t=t.concat(y);var D,P,G,$,L,Q,da=t.length,ja=p.length,S=[];D=0;P=x.length;j=P-1;for(O=D+1;D<P;D++,j++,O++)j===P&&(j=0),O===P&&(O=0),S[D]=d(x[D],x[j],x[O]);var A=[],C,K=S.concat();H=0;for(J=o.length;H<J;H++){y=o[H];C=[];D=0;P=y.length;j=P-1;for(O=D+1;D<P;D++,j++,O++)j===P&&(j=0),O===P&&(O=0),C[D]=d(y[D],y[j],y[O]);A.push(C);K=K.concat(C)}for(G=0;G<l;G++){$=G/l;L=i*(1-$);$=k*Math.sin($*Math.PI/2);
+D=0;for(P=x.length;D<P;D++)Q=b(x[D],S[D],$),e(Q.x,Q.y,-L);H=0;for(J=o.length;H<J;H++){y=o[H];C=A[H];D=0;for(P=y.length;D<P;D++)Q=b(y[D],C[D],$),e(Q.x,Q.y,-L)}}$=k;for(D=0;D<da;D++)Q=n?b(t[D],K[D],$):t[D],u?e(Q.x,Q.y+r[0].y,r[0].x):e(Q.x,Q.y,0);for(G=1;G<=m;G++)for(D=0;D<da;D++)Q=n?b(t[D],K[D],$):t[D],u?e(Q.x,Q.y+r[G-1].y,r[G-1].x):e(Q.x,Q.y,h/m*G);for(G=l-1;G>=0;G--){$=G/l;L=i*(1-$);$=k*Math.sin($*Math.PI/2);D=0;for(P=x.length;D<P;D++)Q=b(x[D],S[D],$),e(Q.x,Q.y,h+L);H=0;for(J=o.length;H<J;H++){y=
+o[H];C=A[H];D=0;for(P=y.length;D<P;D++)Q=b(y[D],C[D],$),u?e(Q.x,Q.y+r[m-1].y,r[m-1].x+L):e(Q.x,Q.y,h+L)}}if(n){n=da*0;for(D=0;D<ja;D++)k=p[D],f(k[2]+n,k[1]+n,k[0]+n);n=da*(m+l*2);for(D=0;D<ja;D++)k=p[D],f(k[0]+n,k[1]+n,k[2]+n)}else{for(D=0;D<ja;D++)k=p[D],f(k[2],k[1],k[0]);for(D=0;D<ja;D++)k=p[D],f(k[0]+da*m,k[1]+da*m,k[2]+da*m)}var j,O,fa=0;g(x);fa+=x.length;H=0;for(J=o.length;H<J;H++)y=o[H],g(y),fa+=y.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 d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=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 d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=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,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),k=d(e.faces[h].b,e.faces[h].c),l=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,l,a);b(e.faces[h].b,k,
 -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,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),k=d(e.faces[h].b,e.faces[h].c),l=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,l,a);b(e.faces[h].b,k,
 i,a);b(e.faces[h].c,l,k,a);b(i,k,l,a)}e.faces=a.faces}g.faces=e.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 i,a);b(e.faces[h].c,l,k,a);b(i,k,l,a)}e.faces=a.faces}g.faces=e.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],e=[],f=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=f.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=e;i==0&&(e=d);
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],e=[],f=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=f.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=e;i==0&&(e=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([e(a.uv,a.position,h),e(b.uv,b.position,h),e(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function e(a,b,c){c<0&&a.u===
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([e(a.uv,a.position,h),e(b.uv,b.position,h),e(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function e(a,b,c){c<0&&a.u===
@@ -513,18 +513,18 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var k=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*k-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var k=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*k-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],l=0;for(d=0;d<e;d++){var n=2*d/e,o=i*Math.sin(n*g),n=i*Math.cos(n*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,h,o)))-1);k.push(l)}c.push(k)}for(var m,r,p,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){k=d==e-1;f=c[b][k?0:d+1];h=c[b][k?e-1:d];i=c[b-1][k?
-e-1:d];k=c[b-1][k?0:d+1];o=b/(g-1);m=(b-1)/(g-1);r=(d+1)/e;var n=d/e,l=new THREE.UV(1-r,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,m),s=new THREE.UV(1-r,m);b<c.length-1&&(m=this.vertices[f].position.clone(),r=this.vertices[h].position.clone(),p=this.vertices[i].position.clone(),m.normalize(),r.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(r.x,r.y,r.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,o,n]));b>1&&(m=
-this.vertices[f].position.clone(),r=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),m.normalize(),r.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(r.x,r.y,r.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,n,s]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],l=0;for(d=0;d<e;d++){var n=2*d/e,o=i*Math.sin(n*g),n=i*Math.cos(n*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,h,o)))-1);k.push(l)}c.push(k)}for(var m,t,p,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){k=d==e-1;f=c[b][k?0:d+1];h=c[b][k?e-1:d];i=c[b-1][k?
+e-1:d];k=c[b-1][k?0:d+1];o=b/(g-1);m=(b-1)/(g-1);t=(d+1)/e;var n=d/e,l=new THREE.UV(1-t,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,m),r=new THREE.UV(1-t,m);b<c.length-1&&(m=this.vertices[f].position.clone(),t=this.vertices[h].position.clone(),p=this.vertices[i].position.clone(),m.normalize(),t.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,o,n]));b>1&&(m=
+this.vertices[f].position.clone(),t=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),m.normalize(),t.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,n,r]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
-0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,k,l,n,o,m,r,p,s,u=c.glyphs[a]||c.glyphs["?"];if(u){if(u.o){c=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,l));g.moveTo(i,l);break;case "l":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,
-l));g.lineTo(i,l);break;case "q":i=c[a++]*b+d;l=c[a++]*b;m=c[a++]*b+d;r=c[a++]*b;g.quadraticCurveTo(m,r,i,l);if(f=e[e.length-1]){n=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var x=f/h,q=THREE.Shape.Utils.b2(x,n,m,i),x=THREE.Shape.Utils.b2(x,o,r,l);e.push(new THREE.Vector2(q,x))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,m=c[a++]*b+d,r=c[a++]*-b,p=c[a++]*b+d,s=c[a++]*-b,g.bezierCurveTo(i,l,m,r,p,s),f=e[e.length-1]){n=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)x=f/h,q=THREE.Shape.Utils.b3(x,n,m,
-p,i),x=THREE.Shape.Utils.b3(x,o,r,s,l),e.push(new THREE.Vector2(q,x))}}}return{offset:u.ha*b,points:e,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,k,l;if(c(a)>0)for(k=0;k<g;k++)f[k]=k;else for(k=0;k<g;k++)f[k]=g-1-k;var n=2*g;for(k=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var o;a:{o=a;var m=i,r=k,p=l,s=g,u=f,x=void 0,q=void 0,t=void 0,
-v=void 0,y=void 0,H=void 0,J=void 0,F=void 0,z=void 0,q=o[u[m]].x,t=o[u[m]].y,v=o[u[r]].x,y=o[u[r]].y,H=o[u[p]].x,J=o[u[p]].y;if(1.0E-10>(v-q)*(J-t)-(y-t)*(H-q))o=!1;else{for(x=0;x<s;x++)if(!(x==m||x==r||x==p)){var F=o[u[x]].x,z=o[u[x]].y,D=void 0,P=void 0,G=void 0,$=void 0,L=void 0,Q=void 0,da=void 0,ja=void 0,S=void 0,A=void 0,C=void 0,K=void 0,D=G=L=void 0,D=H-v,P=J-y,G=q-H,$=t-J,L=v-q,Q=y-t,da=F-q,ja=z-t,S=F-v,A=z-y,C=F-H,K=z-J,D=D*A-P*S,L=L*ja-Q*da,G=G*K-$*C;if(D>=0&&G>=0&&L>=0){o=!1;break a}}o=
+0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,k,l,n,o,m,t,p,r,u=c.glyphs[a]||c.glyphs["?"];if(u){if(u.o){c=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,l));g.moveTo(i,l);break;case "l":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,
+l));g.lineTo(i,l);break;case "q":i=c[a++]*b+d;l=c[a++]*b;m=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(m,t,i,l);if(f=e[e.length-1]){n=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var x=f/h,q=THREE.Shape.Utils.b2(x,n,m,i),x=THREE.Shape.Utils.b2(x,o,t,l);e.push(new THREE.Vector2(q,x))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,m=c[a++]*b+d,t=c[a++]*-b,p=c[a++]*b+d,r=c[a++]*-b,g.bezierCurveTo(i,l,m,t,p,r),f=e[e.length-1]){n=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)x=f/h,q=THREE.Shape.Utils.b3(x,n,m,
+p,i),x=THREE.Shape.Utils.b3(x,o,t,r,l),e.push(new THREE.Vector2(q,x))}}}return{offset:u.ha*b,points:e,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,k,l;if(c(a)>0)for(k=0;k<g;k++)f[k]=k;else for(k=0;k<g;k++)f[k]=g-1-k;var n=2*g;for(k=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var o;a:{o=a;var m=i,t=k,p=l,r=g,u=f,x=void 0,q=void 0,s=void 0,
+v=void 0,y=void 0,H=void 0,J=void 0,F=void 0,z=void 0,q=o[u[m]].x,s=o[u[m]].y,v=o[u[t]].x,y=o[u[t]].y,H=o[u[p]].x,J=o[u[p]].y;if(1.0E-10>(v-q)*(J-s)-(y-s)*(H-q))o=!1;else{for(x=0;x<r;x++)if(!(x==m||x==t||x==p)){var F=o[u[x]].x,z=o[u[x]].y,D=void 0,P=void 0,G=void 0,$=void 0,L=void 0,Q=void 0,da=void 0,ja=void 0,S=void 0,A=void 0,C=void 0,K=void 0,D=G=L=void 0,D=H-v,P=J-y,G=q-H,$=s-J,L=v-q,Q=y-s,da=F-q,ja=z-s,S=F-v,A=z-y,C=F-H,K=z-J,D=D*A-P*S,L=L*ja-Q*da,G=G*K-$*C;if(D>=0&&G>=0&&L>=0){o=!1;break a}}o=
 !0}}if(o){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l<g;i++,l++)f[i]=f[l];g--;n=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 !0}}if(o){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l<g;i++,l++)f[i]=f[l];g--;n=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
@@ -534,11 +534,11 @@ this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,k,l])}this.computeCentroids();
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,k,l])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
 THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<m.length;p++)l=h.vertexColors[m[p]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}g.push(k);(!f.supportUVs||o.length!=0)&&e.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
 THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<m.length;p++)l=h.vertexColors[m[p]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}g.push(k);(!f.supportUVs||o.length!=0)&&e.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},n={},o=[],m,r,p,s,u,x=a.faceVertexUvs[0];m=0;for(r=x.length;m<r;m++){p=0;for(s=x[m].length;p<s;p++)u=d[m]["abcd".charAt(p)],o[u]||(o[u]=x[m][p])}var q;m=0;for(r=d.length;m<r;m++)if(u=d[m],k.push(u.centroid),i.push(new THREE.Vertex(u.centroid)),f.supportUVs&&o.length!=0){q=new THREE.UV;if(u instanceof THREE.Face3)q.u=o[u.a].u+o[u.b].u+o[u.c].u,q.v=o[u.a].v+o[u.b].v+o[u.c].v,q.u/=3,q.v/=3;else if(u instanceof THREE.Face4)q.u=
-o[u.a].u+o[u.b].u+o[u.c].u+o[u.d].u,q.v=o[u.a].v+o[u.b].v+o[u.c].v+o[u.d].v,q.u/=4,q.v/=4;o.push(q)}r=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var t=0,x=h.length,v,y,H={},J={},F=function(a,
-b){H[a]===void 0&&(H[a]=[]);H[a].push(b)},z=function(a,b){J[a]===void 0&&(J[a]={});J[a][b]=null};for(m in r){q=r[m];v=m.split("_");y=v[0];v=v[1];F(y,[y,v]);F(v,[y,v]);p=0;for(s=q.length;p<s;p++)u=q[p],z(y,u,m),z(v,u,m);q.length<2&&(n[m]=!0)}for(m in r)if(q=r[m],u=q[0],q=q[1],v=m.split("_"),y=v[0],v=v[1],s=new THREE.Vector3,n[m]?(s.addSelf(h[y].position),s.addSelf(h[v].position),s.multiplyScalar(0.5)):(s.addSelf(k[u]),s.addSelf(k[q]),s.addSelf(h[y].position),s.addSelf(h[v].position),s.multiplyScalar(0.25)),
-l[m]=x+d.length+t,i.push(new THREE.Vertex(s)),t++,f.supportUVs&&o.length!=0)q=new THREE.UV,q.u=o[y].u+o[v].u,q.v=o[y].v+o[v].v,q.u/=2,q.v/=2,o.push(q);var D,P;v=["123","12","2","23"];s=["123","23","3","31"];var F=["123","31","1","12"],z=["1234","12","2","23"],G=["1234","23","3","34"],$=["1234","34","4","41"],L=["1234","41","1","12"];m=0;for(r=k.length;m<r;m++)u=d[m],q=x+m,u instanceof THREE.Face3?(t=b(u.a,u.b),y=b(u.b,u.c),D=b(u.c,u.a),c(q,l[t],u.b,l[y],u,v),c(q,l[y],u.c,l[D],u,s),c(q,l[D],u.a,l[t],
-u,F)):u instanceof THREE.Face4?(t=b(u.a,u.b),y=b(u.b,u.c),D=b(u.c,u.d),P=b(u.d,u.a),c(q,l[t],u.b,l[y],u,z),c(q,l[y],u.c,l[D],u,G),c(q,l[D],u.d,l[P],u,$),c(q,l[P],u.a,l[t],u,L)):console.log("face should be a face!",u);d=i;i=new THREE.Vector3;l=new THREE.Vector3;m=0;for(r=h.length;m<r;m++)if(H[m]!==void 0){i.set(0,0,0);l.set(0,0,0);u=new THREE.Vector3(0,0,0);q=0;for(p in J[m])i.addSelf(k[p]),q++;t=0;x=H[m].length;for(p=0;p<x;p++)n[b(H[m][p][0],H[m][p][1])]&&t++;if(t!=2){i.divideScalar(q);for(p=0;p<
+b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},n={},o=[],m,t,p,r,u,x=a.faceVertexUvs[0];m=0;for(t=x.length;m<t;m++){p=0;for(r=x[m].length;p<r;p++)u=d[m]["abcd".charAt(p)],o[u]||(o[u]=x[m][p])}var q;m=0;for(t=d.length;m<t;m++)if(u=d[m],k.push(u.centroid),i.push(new THREE.Vertex(u.centroid)),f.supportUVs&&o.length!=0){q=new THREE.UV;if(u instanceof THREE.Face3)q.u=o[u.a].u+o[u.b].u+o[u.c].u,q.v=o[u.a].v+o[u.b].v+o[u.c].v,q.u/=3,q.v/=3;else if(u instanceof THREE.Face4)q.u=
+o[u.a].u+o[u.b].u+o[u.c].u+o[u.d].u,q.v=o[u.a].v+o[u.b].v+o[u.c].v+o[u.d].v,q.u/=4,q.v/=4;o.push(q)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var s=0,x=h.length,v,y,H={},J={},F=function(a,
+b){H[a]===void 0&&(H[a]=[]);H[a].push(b)},z=function(a,b){J[a]===void 0&&(J[a]={});J[a][b]=null};for(m in t){q=t[m];v=m.split("_");y=v[0];v=v[1];F(y,[y,v]);F(v,[y,v]);p=0;for(r=q.length;p<r;p++)u=q[p],z(y,u,m),z(v,u,m);q.length<2&&(n[m]=!0)}for(m in t)if(q=t[m],u=q[0],q=q[1],v=m.split("_"),y=v[0],v=v[1],r=new THREE.Vector3,n[m]?(r.addSelf(h[y].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(k[u]),r.addSelf(k[q]),r.addSelf(h[y].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
+l[m]=x+d.length+s,i.push(new THREE.Vertex(r)),s++,f.supportUVs&&o.length!=0)q=new THREE.UV,q.u=o[y].u+o[v].u,q.v=o[y].v+o[v].v,q.u/=2,q.v/=2,o.push(q);var D,P;v=["123","12","2","23"];r=["123","23","3","31"];var F=["123","31","1","12"],z=["1234","12","2","23"],G=["1234","23","3","34"],$=["1234","34","4","41"],L=["1234","41","1","12"];m=0;for(t=k.length;m<t;m++)u=d[m],q=x+m,u instanceof THREE.Face3?(s=b(u.a,u.b),y=b(u.b,u.c),D=b(u.c,u.a),c(q,l[s],u.b,l[y],u,v),c(q,l[y],u.c,l[D],u,r),c(q,l[D],u.a,l[s],
+u,F)):u instanceof THREE.Face4?(s=b(u.a,u.b),y=b(u.b,u.c),D=b(u.c,u.d),P=b(u.d,u.a),c(q,l[s],u.b,l[y],u,z),c(q,l[y],u.c,l[D],u,G),c(q,l[D],u.d,l[P],u,$),c(q,l[P],u.a,l[s],u,L)):console.log("face should be a face!",u);d=i;i=new THREE.Vector3;l=new THREE.Vector3;m=0;for(t=h.length;m<t;m++)if(H[m]!==void 0){i.set(0,0,0);l.set(0,0,0);u=new THREE.Vector3(0,0,0);q=0;for(p in J[m])i.addSelf(k[p]),q++;s=0;x=H[m].length;for(p=0;p<x;p++)n[b(H[m][p][0],H[m][p][1])]&&s++;if(s!=2){i.divideScalar(q);for(p=0;p<
 x;p++)q=H[m][p],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),l.addSelf(q);l.divideScalar(x);u.addSelf(h[m].position);u.multiplyScalar(x-3);u.addSelf(i);u.addSelf(l.multiplyScalar(2));u.divideScalar(x);d[m].position=u}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 x;p++)q=H[m][p],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),l.addSelf(q);l.divideScalar(x);u.addSelf(h[m].position);u.multiplyScalar(x-3);u.addSelf(i);u.addSelf(l.multiplyScalar(2));u.divideScalar(x);d[m].position=u}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
@@ -555,29 +555,29 @@ c,d,b,e)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g,e){var f=new XMLHttpRequest,h=d+"/"+a,i=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+h+"] ["+f.status+"]"):f.readyState==3?e&&(i==0&&(i=f.getResponseHeader("Content-Length")),e({total:i,loaded:f.responseText.length})):f.readyState==2&&(i=f.getResponseHeader("Content-Length"))};f.open("GET",h,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g,e){var f=new XMLHttpRequest,h=d+"/"+a,i=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+h+"] ["+f.status+"]"):f.readyState==3?e&&(i==0&&(i=f.getResponseHeader("Content-Length")),e({total:i,loaded:f.responseText.length})):f.readyState==2&&(i=f.getResponseHeader("Content-Length"))};f.open("GET",h,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=l(a,b),e=l(a,b+1),f=l(a,b+2),g=l(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function n(b){var c,
 THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=l(a,b),e=l(a,b+1),f=l(a,b+2),g=l(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function n(b){var c,
-d,e;c=g(a,b);d=g(a,b+y);e=g(a,b+H);b=i(a,b+J);u.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+y);e=g(a,b+H);f=i(a,b+J);j=g(a,b+F);k=g(a,b+z);l=g(a,b+D);var b=t[k*3],m=t[k*3+1];k=t[k*3+2];var n=t[l*3],p=t[l*3+1];l=t[l*3+2];u.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(t[j*3],t[j*3+1],t[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,p,l)],null,f))}function m(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+G);f=g(a,b+$);b=i(a,b+L);u.faces.push(new THREE.Face4(c,
-d,e,f,null,null,b))}function r(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+P);e=g(a,b+G);f=g(a,b+$);j=i(a,b+L);k=g(a,b+Q);l=g(a,b+da);m=g(a,b+ja);n=g(a,b+S);var b=t[l*3],p=t[l*3+1];l=t[l*3+2];var o=t[m*3],w=t[m*3+1];m=t[m*3+2];var I=t[n*3],r=t[n*3+1];n=t[n*3+2];u.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(t[k*3],t[k*3+1],t[k*3+2]),new THREE.Vector3(b,p,l),new THREE.Vector3(o,w,m),new THREE.Vector3(I,r,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+A);e=g(a,b+C);b=v[c*2];f=v[c*2+
-1];c=v[d*2];var i=u.faceVertexUvs[0];d=v[d*2+1];var j=v[e*2];e=v[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function s(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+K);e=g(a,b+j);f=g(a,b+O);b=v[c*2];i=v[c*2+1];c=v[d*2];k=v[d*2+1];d=v[e*2];var l=u.faceVertexUvs[0];e=v[e*2+1];var m=v[f*2];f=v[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,k));n.push(new THREE.UV(d,e));n.push(new THREE.UV(m,f));l.push(n)}var u=this,x=0,q,t=[],v=[],y,
+d,e;c=g(a,b);d=g(a,b+y);e=g(a,b+H);b=i(a,b+J);u.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+y);e=g(a,b+H);f=i(a,b+J);j=g(a,b+F);k=g(a,b+z);l=g(a,b+D);var b=s[k*3],m=s[k*3+1];k=s[k*3+2];var n=s[l*3],p=s[l*3+1];l=s[l*3+2];u.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,p,l)],null,f))}function m(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+G);f=g(a,b+$);b=i(a,b+L);u.faces.push(new THREE.Face4(c,
+d,e,f,null,null,b))}function t(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+P);e=g(a,b+G);f=g(a,b+$);j=i(a,b+L);k=g(a,b+Q);l=g(a,b+da);m=g(a,b+ja);n=g(a,b+S);var b=s[l*3],p=s[l*3+1];l=s[l*3+2];var o=s[m*3],w=s[m*3+1];m=s[m*3+2];var I=s[n*3],r=s[n*3+1];n=s[n*3+2];u.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(s[k*3],s[k*3+1],s[k*3+2]),new THREE.Vector3(b,p,l),new THREE.Vector3(o,w,m),new THREE.Vector3(I,r,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+A);e=g(a,b+C);b=v[c*2];f=v[c*2+
+1];c=v[d*2];var i=u.faceVertexUvs[0];d=v[d*2+1];var j=v[e*2];e=v[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function r(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+K);e=g(a,b+j);f=g(a,b+O);b=v[c*2];i=v[c*2+1];c=v[d*2];k=v[d*2+1];d=v[e*2];var l=u.faceVertexUvs[0];e=v[e*2+1];var m=v[f*2];f=v[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,k));n.push(new THREE.UV(d,e));n.push(new THREE.UV(m,f));l.push(n)}var u=this,x=0,q,s=[],v=[],y,
 H,J,F,z,D,P,G,$,L,Q,da,ja,S,A,C,K,j,O,fa,Y,R,N,ea,U;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(u,d,b);q={signature:a.substr(x,8),header_bytes:l(a,x+8),vertex_coordinate_bytes:l(a,x+9),normal_coordinate_bytes:l(a,x+10),uv_coordinate_bytes:l(a,x+11),vertex_index_bytes:l(a,x+12),normal_index_bytes:l(a,x+13),uv_index_bytes:l(a,x+14),material_index_bytes:l(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,
 H,J,F,z,D,P,G,$,L,Q,da,ja,S,A,C,K,j,O,fa,Y,R,N,ea,U;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(u,d,b);q={signature:a.substr(x,8),header_bytes:l(a,x+8),vertex_coordinate_bytes:l(a,x+9),normal_coordinate_bytes:l(a,x+10),uv_coordinate_bytes:l(a,x+11),vertex_index_bytes:l(a,x+12),normal_index_bytes:l(a,x+13),uv_index_bytes:l(a,x+14),material_index_bytes:l(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,
 x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=q.header_bytes;y=q.vertex_index_bytes;H=q.vertex_index_bytes*2;J=q.vertex_index_bytes*3;F=q.vertex_index_bytes*3+q.material_index_bytes;z=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;P=q.vertex_index_bytes;G=q.vertex_index_bytes*2;$=q.vertex_index_bytes*3;L=q.vertex_index_bytes*
 x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=q.header_bytes;y=q.vertex_index_bytes;H=q.vertex_index_bytes*2;J=q.vertex_index_bytes*3;F=q.vertex_index_bytes*3+q.material_index_bytes;z=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;P=q.vertex_index_bytes;G=q.vertex_index_bytes*2;$=q.vertex_index_bytes*3;L=q.vertex_index_bytes*
 4;Q=q.vertex_index_bytes*4+q.material_index_bytes;da=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ja=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;S=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;A=q.uv_index_bytes;C=q.uv_index_bytes*2;K=q.uv_index_bytes;j=q.uv_index_bytes*2;O=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;U=q.vertex_index_bytes*4+q.material_index_bytes;fa=q.ntri_flat*b;Y=q.ntri_smooth*(b+q.normal_index_bytes*
 4;Q=q.vertex_index_bytes*4+q.material_index_bytes;da=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ja=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;S=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;A=q.uv_index_bytes;C=q.uv_index_bytes*2;K=q.uv_index_bytes;j=q.uv_index_bytes*2;O=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;U=q.vertex_index_bytes*4+q.material_index_bytes;fa=q.ntri_flat*b;Y=q.ntri_smooth*(b+q.normal_index_bytes*
 3);R=q.ntri_flat_uv*(b+q.uv_index_bytes*3);N=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ea=q.nquad_flat*U;b=q.nquad_smooth*(U+q.normal_index_bytes*4);U=q.nquad_flat_uv*(U+q.uv_index_bytes*4);x+=function(b){for(var d,e,g,h=q.vertex_coordinate_bytes*3,i=b+q.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+q.vertex_coordinate_bytes),g=c(a,b+q.vertex_coordinate_bytes*2),u.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return q.nvertices*h}(x);x+=function(b){for(var c,d,e,f=q.normal_coordinate_bytes*
 3);R=q.ntri_flat_uv*(b+q.uv_index_bytes*3);N=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ea=q.nquad_flat*U;b=q.nquad_smooth*(U+q.normal_index_bytes*4);U=q.nquad_flat_uv*(U+q.uv_index_bytes*4);x+=function(b){for(var d,e,g,h=q.vertex_coordinate_bytes*3,i=b+q.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+q.vertex_coordinate_bytes),g=c(a,b+q.vertex_coordinate_bytes*2),u.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return q.nvertices*h}(x);x+=function(b){for(var c,d,e,f=q.normal_coordinate_bytes*
-3,g=b+q.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+q.normal_coordinate_bytes),e=k(a,b+q.normal_coordinate_bytes*2),t.push(c/127,d/127,e/127);return q.nnormals*f}(x);x+=function(b){for(var d,e,g=q.uv_coordinate_bytes*2,h=b+q.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+q.uv_coordinate_bytes),v.push(d,e);return q.nuvs*g}(x);fa=x+fa;Y=fa+Y;R=Y+R;N=R+N;ea=N+ea;b=ea+b;U=b+U;(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=c+q.uv_index_bytes*3,e=a+q.ntri_flat_uv*d;for(b=a;b<e;b+=d)n(b),p(b+c);return e-
-a})(Y);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=c+q.uv_index_bytes*3,e=a+q.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),p(b+c);return e-a})(R);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=c+q.uv_index_bytes*4,e=a+q.nquad_flat_uv*d;for(b=a;b<e;b+=d)m(b),s(b+c);return e-a})(b);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,d=c+q.uv_index_bytes*4,e=a+q.nquad_smooth_uv*d;for(b=a;b<e;b+=d)r(b),
-s(b+c);return e-a})(U);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=a+q.ntri_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(x);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=a+q.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(fa);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=a+q.nquad_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(N);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*
-4,d=a+q.nquad_smooth*c;for(b=a;b<d;b+=c)r(b);return d-a})(ea);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
-THREE.ColladaLoader=function(){function a(a,d,g){Y=a;d=d||ea;g!==void 0&&(a=g.split("/"),a.pop(),ua=a.length<1?"":a.join("/")+"/");ca=c("//dae:library_images/dae:image",f,"image");qa=c("//dae:library_materials/dae:material",J,"material");ma=c("//dae:library_effects/dae:effect",G,"effect");ka=c("//dae:library_geometries/dae:geometry",s,"geometry");X=c("//dae:library_controllers/dae:controller",h,"controller");Z=c("//dae:library_animations/dae:animation",L,"animation");sa=c(".//dae:library_visual_scenes/dae:visual_scene",
+3,g=b+q.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+q.normal_coordinate_bytes),e=k(a,b+q.normal_coordinate_bytes*2),s.push(c/127,d/127,e/127);return q.nnormals*f}(x);x+=function(b){for(var d,e,g=q.uv_coordinate_bytes*2,h=b+q.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+q.uv_coordinate_bytes),v.push(d,e);return q.nuvs*g}(x);fa=x+fa;Y=fa+Y;R=Y+R;N=R+N;ea=N+ea;b=ea+b;U=b+U;(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=c+q.uv_index_bytes*3,e=a+q.ntri_flat_uv*d;for(b=a;b<e;b+=d)n(b),p(b+c);return e-
+a})(Y);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=c+q.uv_index_bytes*3,e=a+q.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),p(b+c);return e-a})(R);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=c+q.uv_index_bytes*4,e=a+q.nquad_flat_uv*d;for(b=a;b<e;b+=d)m(b),r(b+c);return e-a})(b);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,d=c+q.uv_index_bytes*4,e=a+q.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),
+r(b+c);return e-a})(U);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=a+q.ntri_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(x);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=a+q.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(fa);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=a+q.nquad_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(N);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*
+4,d=a+q.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(ea);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+THREE.ColladaLoader=function(){function a(a,d,g){Y=a;d=d||ea;g!==void 0&&(a=g.split("/"),a.pop(),ua=a.length<1?"":a.join("/")+"/");ca=c("//dae:library_images/dae:image",f,"image");qa=c("//dae:library_materials/dae:material",J,"material");ma=c("//dae:library_effects/dae:effect",G,"effect");ka=c("//dae:library_geometries/dae:geometry",r,"geometry");X=c("//dae:library_controllers/dae:controller",h,"controller");Z=c("//dae:library_animations/dae:animation",L,"animation");sa=c(".//dae:library_visual_scenes/dae:visual_scene",
 l,"visual_scene");pa=[];ra=[];(a=Y.evaluate(".//dae:scene/dae:instance_visual_scene",Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),N=sa[a]):N=null;R=new THREE.Object3D;for(a=0;a<N.nodes.length;a++)R.add(e(N.nodes[a]));b();for(var i in Z);i={scene:R,morphs:pa,skins:ra,dae:{images:ca,materials:qa,effects:ma,geometries:ka,controllers:X,animations:Z,visualScenes:sa,scene:N}};d&&d(i);return i}function c(a,b,c){for(var a=Y.evaluate(a,Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 l,"visual_scene");pa=[];ra=[];(a=Y.evaluate(".//dae:scene/dae:instance_visual_scene",Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),N=sa[a]):N=null;R=new THREE.Object3D;for(a=0;a<N.nodes.length;a++)R.add(e(N.nodes[a]));b();for(var i in Z);i={scene:R,morphs:pa,skins:ra,dae:{images:ca,materials:qa,effects:ma,geometries:ka,controllers:X,animations:Z,visualScenes:sa,scene:N}};d&&d(i);return i}function c(a,b,c){for(var a=Y.evaluate(a,Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in Z)for(var e=Z[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in Z)for(var e=Z[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
 THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=X[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=N.getChildById(c.skeleton[0],!0)||N.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
 THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=X[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=N.getChildById(c.skeleton[0],!0)||N.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<g.frames;e++){var n=[],p=[];for(h=0;h<a.vertices.length;h++)p.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var o=0;o<i.joints.length;o++)if(j.sid==i.joints[o]){m=o;break}if(m>=0){o=i.invBindMatrices[m];j.invBindMatrix=o;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,o);j.weights=[];for(o=0;o<i.weights.length;o++)for(var r=0;r<i.weights[o].length;r++){var s=i.weights[o][r];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
+for(e=0;e<g.frames;e++){var n=[],p=[];for(h=0;h<a.vertices.length;h++)p.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var o=0;o<i.joints.length;o++)if(j.sid==i.joints[o]){m=o;break}if(m>=0){o=i.invBindMatrices[m];j.invBindMatrix=o;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,o);j.weights=[];for(o=0;o<i.weights.length;o++)for(var r=0;r<i.weights[o].length;r++){var q=i.weights[o][r];q.joint==m&&j.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
 j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=p[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:p})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=X[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
 j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=p[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:p})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=X[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
 new p;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(X[i.skin.source]&&(d=i=X[i.skin.source],i.morph&&ka[i.morph.source]))j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
 new p;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(X[i.skin.source]&&(d=i=X[i.skin.source],i.morph&&ka[i.morph.source]))j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
 0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},l=0,n;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){n=j[h];var o=ma[qa[n.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;n=k[n.symbol]=o.material;l++}j=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
 0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},l=0,n;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){n=j[h];var o=ma[qa[n.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;n=k[n.symbol]=o.material;l++}j=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
 i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=X[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);else if(d!==void 0){h=i;k=d instanceof m?X[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=ka[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
 i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=X[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);else if(d!==void 0){h=i;k=d instanceof m?X[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=ka[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+pa.length;pa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+pa.length;pa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
 null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
 null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function p(){this.url="";this.instance_material=[]}function s(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function q(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function t(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function y(){this.semantic=
+"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function p(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function q(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function s(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function y(){this.semantic=
 "";this.offset=0;this.source="";this.set=0}function H(a){this.id=a;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function F(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function z(a,b){this.type=a;this.effect=b;this.material=null}function D(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
 "";this.offset=0;this.source="";this.set=0}function H(a){this.id=a;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function F(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function z(a,b){this.type=a;this.effect=b;this.material=null}function D(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
 this.source=null}function G(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function Q(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function da(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ja(a){var b=a.getAttribute("id");
 this.source=null}function G(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function Q(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function da(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ja(a){var b=a.getAttribute("id");
 if(U[b]!=void 0)return U[b];U[b]=(new H(b)).parse(a);return U[b]}function S(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function A(a){for(var a=K(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function C(a){for(var a=K(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function K(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(a===
 if(U[b]!=void 0)return U[b];U[b]=(new H(b)).parse(a);return U[b]}function S(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function A(a){for(var a=K(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function C(a){for(var a=K(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function K(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(a===
@@ -596,16 +596,16 @@ if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.en
 this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=A(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
 this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=A(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
 case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Y.evaluate(".//dae:instance_material",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};p.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=Y.evaluate(".//dae:instance_material",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};s.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Y.evaluate(".//dae:instance_material",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};p.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=Y.evaluate(".//dae:instance_material",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
 (new u(this)).parse(c)}}return this};u.prototype.parse=function(a){function b(a,c){var d=fa(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ja(d);break;case "vertices":this.vertices=(new v).parse(d);break;case "triangles":this.primitives.push((new q).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(d))}}var e=
 (new u(this)).parse(c)}}return this};u.prototype.parse=function(a){function b(a,c){var d=fa(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ja(d);break;case "vertices":this.vertices=(new v).parse(d);break;case "triangles":this.primitives.push((new q).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(d))}}var e=
 {};this.geometry3js=new THREE.Geometry;d=U[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
 {};this.geometry3js=new THREE.Geometry;d=U[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};u.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],r=[],s={},q=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=U[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=fa(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(l.data[k],
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":q.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var u;n==3?u=new THREE.Face3(p[0],p[1],p[2],[r[0],r[1],r[2]],q.length?q:new THREE.Color):n==4&&(u=new THREE.Face4(p[0],p[1],p[2],p[3],[r[0],r[1],r[2],r[3]],q.length?q:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],
+return this};u.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],r=[],q={},u=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=U[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=fa(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(l.data[k],
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":q[i.set]===void 0&&(q[i.set]=[]);q[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":u.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[r[0],r[1],r[2]],u.length?u:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[r[0],r[1],r[2],r[3]],u.length?u:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=q[o[f]],b.faceVertexUvs[f].push([e[0],
 e[1],e[2]]);d+=h.length*n}};x.prototype=new q;x.prototype.constructor=x;q.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};q.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new y).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 e[1],e[2]]);d+=h.length*n}};x.prototype=new q;x.prototype.constructor=x;q.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};q.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new y).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-C(c.textContent);break;case "p":this.p=C(c.textContent)}}return this};t.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+C(c.textContent);break;case "p":this.p=C(c.textContent)}}return this};s.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
 "input"){var c=(new y).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};y.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=K(c.textContent),
 "input"){var c=(new y).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};y.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=K(c.textContent),
-e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=A(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=C(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=K(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new t).parse(c.childNodes[d]);break}}}return this};
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=A(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=C(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=K(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new s).parse(c.childNodes[d]);break}}}return this};
 H.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};J.prototype.parse=function(a){this.id=a.getAttribute("id");
 H.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};J.prototype.parse=function(a){this.id=a.getAttribute("id");
 this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new $).parse(a.childNodes[b]);break}return this};F.prototype.isColor=function(){return this.texture==null};F.prototype.isTexture=function(){return this.texture!=null};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=A(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
 this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new $).parse(a.childNodes[b]);break}return this};F.prototype.isColor=function(){return this.texture==null};F.prototype.isTexture=function(){return this.texture!=null};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=A(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
 c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};z.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new F).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Y.evaluate(".//dae:float",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};z.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new F).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Y.evaluate(".//dae:float",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
@@ -621,45 +621,45 @@ da.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
 200))ea=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:g,geometries:ka}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 200))ea=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:g,geometries:ka}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,c,b){var d,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),d=a,a=d.model,c=d.callback,b=d.texture_path;d=new Worker(a);b=b?b:this.extractUrlbase(a);d.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();d.postMessage(Date.now())};
 THREE.JSONLoader.prototype.load=function(a,c,b){var d,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),d=a,a=d.model,c=d.callback,b=d.texture_path;d=new Worker(a);b=b?b:this.extractUrlbase(a);d.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();d.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,i,k,l,n,o,m,r,p,s,u,x,q,t=a.faces;n=a.vertices;var v=a.normals,y=a.colors,H=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&H++;for(c=0;c<H;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=n.length;k<l;)o=new THREE.Vertex,o.position.x=n[k++]*b,o.position.y=
-n[k++]*b,o.position.z=n[k++]*b,d.vertices.push(o);k=0;for(l=t.length;k<l;){b=t[k++];n=b&1;i=b&2;c=b&4;g=b&8;m=b&16;o=b&32;p=b&64;b&=128;n?(s=new THREE.Face4,s.a=t[k++],s.b=t[k++],s.c=t[k++],s.d=t[k++],n=4):(s=new THREE.Face3,s.a=t[k++],s.b=t[k++],s.c=t[k++],n=3);if(i)i=t[k++],s.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<H;c++)u=a.uvs[c],r=t[k++],q=u[r*2],r=u[r*2+1],d.faceUvs[c][i]=new THREE.UV(q,r);if(g)for(c=0;c<H;c++){u=a.uvs[c];x=[];for(g=0;g<n;g++)r=t[k++],q=u[r*2],r=u[r*2+1],x[g]=new THREE.UV(q,
-r);d.faceVertexUvs[c][i]=x}if(m)m=t[k++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],s.normal=g;if(o)for(c=0;c<n;c++)m=t[k++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],s.vertexNormals.push(g);if(p)o=t[k++],o=new THREE.Color(y[o]),s.color=o;if(b)for(c=0;c<n;c++)o=t[k++],o=new THREE.Color(y[o]),s.vertexColors.push(o);d.faces.push(s)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,
-i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,l,n,o,m,r;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;i=0;for(k=r.length;i<k;i+=3)l=r[i]*b,n=r[i+1]*
-b,o=r[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(l,n,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,i,k,l,n,o,m,t,p,r,u,x,q,s=a.faces;n=a.vertices;var v=a.normals,y=a.colors,H=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&H++;for(c=0;c<H;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=n.length;k<l;)o=new THREE.Vertex,o.position.x=n[k++]*b,o.position.y=
+n[k++]*b,o.position.z=n[k++]*b,d.vertices.push(o);k=0;for(l=s.length;k<l;){b=s[k++];n=b&1;i=b&2;c=b&4;g=b&8;m=b&16;o=b&32;p=b&64;b&=128;n?(r=new THREE.Face4,r.a=s[k++],r.b=s[k++],r.c=s[k++],r.d=s[k++],n=4):(r=new THREE.Face3,r.a=s[k++],r.b=s[k++],r.c=s[k++],n=3);if(i)i=s[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<H;c++)u=a.uvs[c],t=s[k++],q=u[t*2],t=u[t*2+1],d.faceUvs[c][i]=new THREE.UV(q,t);if(g)for(c=0;c<H;c++){u=a.uvs[c];x=[];for(g=0;g<n;g++)t=s[k++],q=u[t*2],t=u[t*2+1],x[g]=new THREE.UV(q,
+t);d.faceVertexUvs[c][i]=x}if(m)m=s[k++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],r.normal=g;if(o)for(c=0;c<n;c++)m=s[k++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],r.vertexNormals.push(g);if(p)o=s[k++],o=new THREE.Color(y[o]),r.color=o;if(b)for(c=0;c<n;c++)o=s[k++],o=new THREE.Color(y[o]),r.vertexColors.push(o);d.faces.push(r)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,
+i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,l,n,o,m,t;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;t=a.morphTargets[c].vertices;i=0;for(k=t.length;i<k;i+=3)l=t[i]*b,n=t[i+1]*
+b,o=t[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(l,n,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(m in L.objects)if(!C.objects[m])if(x=L.objects[m],x.geometry!==void 0){if(z=C.geometries[x.geometry]){a=!1;for(j=0;j<x.materials.length;j++)$=C.materials[x.materials[j]],a=$ instanceof THREE.ShaderMaterial;a&&z.computeTangents();v=x.position;y=x.rotation;H=x.quaternion;
 THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(m in L.objects)if(!C.objects[m])if(x=L.objects[m],x.geometry!==void 0){if(z=C.geometries[x.geometry]){a=!1;for(j=0;j<x.materials.length;j++)$=C.materials[x.materials[j]],a=$ instanceof THREE.ShaderMaterial;a&&z.computeTangents();v=x.position;y=x.rotation;H=x.quaternion;
 J=x.scale;H=0;$.length==0&&($=new THREE.MeshFaceMaterial);$.length>1&&($=new THREE.MeshFaceMaterial);a=new THREE.Mesh(z,$);a.name=m;a.position.set(v[0],v[1],v[2]);H?(a.quaternion.set(H[0],H[1],H[2],H[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(J[0],J[1],J[2]);a.visible=x.visible;C.scene.add(a);C.objects[m]=a;if(x.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(x.castsShadow)b=new THREE.ShadowVolume(z),C.scene.add(b),b.position=
 J=x.scale;H=0;$.length==0&&($=new THREE.MeshFaceMaterial);$.length>1&&($=new THREE.MeshFaceMaterial);a=new THREE.Mesh(z,$);a.name=m;a.position.set(v[0],v[1],v[2]);H?(a.quaternion.set(H[0],H[1],H[2],H[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(J[0],J[1],J[2]);a.visible=x.visible;C.scene.add(a);C.objects[m]=a;if(x.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(x.castsShadow)b=new THREE.ShadowVolume(z),C.scene.add(b),b.position=
 a.position,b.rotation=a.rotation,b.scale=a.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(b={type:x.trigger,object:x},C.triggers[a.name]=b)}}else v=x.position,y=x.rotation,H=x.quaternion,J=x.scale,H=0,a=new THREE.Object3D,a.name=m,a.position.set(v[0],v[1],v[2]),H?(a.quaternion.set(H[0],H[1],H[2],H[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(J[0],J[1],J[2]),a.visible=x.visible!==void 0?x.visible:!1,C.scene.add(a),C.objects[m]=a,C.empties[m]=a,x.trigger&&x.trigger.toLowerCase()!=
 a.position,b.rotation=a.rotation,b.scale=a.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(b={type:x.trigger,object:x},C.triggers[a.name]=b)}}else v=x.position,y=x.rotation,H=x.quaternion,J=x.scale,H=0,a=new THREE.Object3D,a.name=m,a.position.set(v[0],v[1],v[2]),H?(a.quaternion.set(H[0],H[1],H[2],H[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(J[0],J[1],J[2]),a.visible=x.visible!==void 0?x.visible:!1,C.scene.add(a),C.objects[m]=a,C.empties[m]=a,x.trigger&&x.trigger.toLowerCase()!=
-"none"&&(b={type:x.trigger,object:x},C.triggers[a.name]=b)}function i(a){return function(c){C.geometries[a]=c;h();da-=1;b.onLoadComplete();l()}}function k(a){return function(b){C.geometries[a]=b}}function l(){b.callbackProgress({totalModels:S,totalTextures:A,loadedModels:S-da,loadedTextures:A-ja},C);b.onLoadProgress();da==0&&ja==0&&c(C)}var n,o,m,r,p,s,u,x,q,t,v,y,H,J,F,z,D,P,G,$,L,Q,da,ja,S,A,C;L=a.data;G=new THREE.BinaryLoader;Q=new THREE.JSONLoader;ja=da=0;C={scene:new THREE.Scene,geometries:{},
+"none"&&(b={type:x.trigger,object:x},C.triggers[a.name]=b)}function i(a){return function(c){C.geometries[a]=c;h();da-=1;b.onLoadComplete();l()}}function k(a){return function(b){C.geometries[a]=b}}function l(){b.callbackProgress({totalModels:S,totalTextures:A,loadedModels:S-da,loadedTextures:A-ja},C);b.onLoadProgress();da==0&&ja==0&&c(C)}var n,o,m,t,p,r,u,x,q,s,v,y,H,J,F,z,D,P,G,$,L,Q,da,ja,S,A,C;L=a.data;G=new THREE.BinaryLoader;Q=new THREE.JSONLoader;ja=da=0;C={scene:new THREE.Scene,geometries:{},
 materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(m in L.objects)if(x=L.objects[m],x.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;q=L.transform.rotation;var K=L.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);q&&C.scene.rotation.set(q[0],q[1],q[2]);K&&C.scene.scale.set(K[0],K[1],K[2]);(a||q||K)&&C.scene.updateMatrix()}a=function(){ja-=1;l();b.onLoadComplete()};for(p in L.cameras)q=
 materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(m in L.objects)if(x=L.objects[m],x.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;q=L.transform.rotation;var K=L.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);q&&C.scene.rotation.set(q[0],q[1],q[2]);K&&C.scene.scale.set(K[0],K[1],K[2]);(a||q||K)&&C.scene.updateMatrix()}a=function(){ja-=1;l();b.onLoadComplete()};for(p in L.cameras)q=
-L.cameras[p],q.type=="perspective"?D=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):q.type=="ortho"&&(D=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),v=q.position,q=q.target,D.position.set(v[0],v[1],v[2]),D.target=new THREE.Vector3(q[0],q[1],q[2]),C.cameras[p]=D;for(r in L.lights)q=L.lights[r],p=q.color!==void 0?q.color:16777215,D=q.intensity!==void 0?q.intensity:1,q.type=="directional"?(v=q.direction,t=new THREE.DirectionalLight(p,D),t.position.set(v[0],v[1],
-v[2]),t.position.normalize()):q.type=="point"?(v=q.position,t=q.distance,t=new THREE.PointLight(p,D,t),t.position.set(v[0],v[1],v[2])):q.type=="ambient"&&(t=new THREE.AmbientLight(p)),C.scene.add(t),C.lights[r]=t;for(s in L.fogs)r=L.fogs[s],r.type=="linear"?P=new THREE.Fog(0,r.near,r.far):r.type=="exp2"&&(P=new THREE.FogExp2(0,r.density)),q=r.color,P.color.setRGB(q[0],q[1],q[2]),C.fogs[s]=P;if(C.cameras&&L.defaults.camera)C.currentCamera=C.cameras[L.defaults.camera];if(C.fogs&&L.defaults.fog)C.scene.fog=
-C.fogs[L.defaults.fog];q=L.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(q[0],q[1],q[2]);C.bgColorAlpha=L.defaults.bgalpha;for(n in L.geometries)if(s=L.geometries[n],s.type=="bin_mesh"||s.type=="ascii_mesh")da+=1,b.onLoadStart();S=da;for(n in L.geometries)s=L.geometries[n],s.type=="cube"?(z=new THREE.CubeGeometry(s.width,s.height,s.depth,s.segmentsWidth,s.segmentsHeight,s.segmentsDepth,null,s.flipped,s.sides),C.geometries[n]=z):s.type=="plane"?(z=new THREE.PlaneGeometry(s.width,s.height,
-s.segmentsWidth,s.segmentsHeight),C.geometries[n]=z):s.type=="sphere"?(z=new THREE.SphereGeometry(s.radius,s.segmentsWidth,s.segmentsHeight),C.geometries[n]=z):s.type=="cylinder"?(z=new THREE.CylinderGeometry(s.topRad,s.botRad,s.height,s.radSegs,s.heightSegs),C.geometries[n]=z):s.type=="torus"?(z=new THREE.TorusGeometry(s.radius,s.tube,s.segmentsR,s.segmentsT),C.geometries[n]=z):s.type=="icosahedron"?(z=new THREE.IcosahedronGeometry(s.subdivisions),C.geometries[n]=z):s.type=="bin_mesh"?G.load(d(s.url,
-L.urlBaseType),i(n)):s.type=="ascii_mesh"?Q.load(d(s.url,L.urlBaseType),i(n)):s.type=="embedded_mesh"&&(s=L.embeds[s.id])&&Q.createModel(s,k(n),"");for(u in L.textures)if(n=L.textures[u],n.url instanceof Array){ja+=n.url.length;for(G=0;G<n.url.length;G++)b.onLoadStart()}else ja+=1,b.onLoadStart();A=ja;for(u in L.textures){n=L.textures[u];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){G=[];for(var j=0;j<n.url.length;j++)G[j]=d(n.url[j],L.urlBaseType);
+L.cameras[p],q.type=="perspective"?D=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):q.type=="ortho"&&(D=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),v=q.position,q=q.target,D.position.set(v[0],v[1],v[2]),D.target=new THREE.Vector3(q[0],q[1],q[2]),C.cameras[p]=D;for(t in L.lights)q=L.lights[t],p=q.color!==void 0?q.color:16777215,D=q.intensity!==void 0?q.intensity:1,q.type=="directional"?(v=q.direction,s=new THREE.DirectionalLight(p,D),s.position.set(v[0],v[1],
+v[2]),s.position.normalize()):q.type=="point"?(v=q.position,s=q.distance,s=new THREE.PointLight(p,D,s),s.position.set(v[0],v[1],v[2])):q.type=="ambient"&&(s=new THREE.AmbientLight(p)),C.scene.add(s),C.lights[t]=s;for(r in L.fogs)t=L.fogs[r],t.type=="linear"?P=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(P=new THREE.FogExp2(0,t.density)),q=t.color,P.color.setRGB(q[0],q[1],q[2]),C.fogs[r]=P;if(C.cameras&&L.defaults.camera)C.currentCamera=C.cameras[L.defaults.camera];if(C.fogs&&L.defaults.fog)C.scene.fog=
+C.fogs[L.defaults.fog];q=L.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(q[0],q[1],q[2]);C.bgColorAlpha=L.defaults.bgalpha;for(n in L.geometries)if(r=L.geometries[n],r.type=="bin_mesh"||r.type=="ascii_mesh")da+=1,b.onLoadStart();S=da;for(n in L.geometries)r=L.geometries[n],r.type=="cube"?(z=new THREE.CubeGeometry(r.width,r.height,r.depth,r.segmentsWidth,r.segmentsHeight,r.segmentsDepth,null,r.flipped,r.sides),C.geometries[n]=z):r.type=="plane"?(z=new THREE.PlaneGeometry(r.width,r.height,
+r.segmentsWidth,r.segmentsHeight),C.geometries[n]=z):r.type=="sphere"?(z=new THREE.SphereGeometry(r.radius,r.segmentsWidth,r.segmentsHeight),C.geometries[n]=z):r.type=="cylinder"?(z=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),C.geometries[n]=z):r.type=="torus"?(z=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),C.geometries[n]=z):r.type=="icosahedron"?(z=new THREE.IcosahedronGeometry(r.subdivisions),C.geometries[n]=z):r.type=="bin_mesh"?G.load(d(r.url,
+L.urlBaseType),i(n)):r.type=="ascii_mesh"?Q.load(d(r.url,L.urlBaseType),i(n)):r.type=="embedded_mesh"&&(r=L.embeds[r.id])&&Q.createModel(r,k(n),"");for(u in L.textures)if(n=L.textures[u],n.url instanceof Array){ja+=n.url.length;for(G=0;G<n.url.length;G++)b.onLoadStart()}else ja+=1,b.onLoadStart();A=ja;for(u in L.textures){n=L.textures[u];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){G=[];for(var j=0;j<n.url.length;j++)G[j]=d(n.url[j],L.urlBaseType);
 G=THREE.ImageUtils.loadTextureCube(G,n.mapping,a)}else{G=THREE.ImageUtils.loadTexture(d(n.url,L.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)G.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)G.magFilter=THREE[n.magFilter];if(n.repeat){G.repeat.set(n.repeat[0],n.repeat[1]);if(n.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}n.offset&&G.offset.set(n.offset[0],n.offset[1]);if(n.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};
 G=THREE.ImageUtils.loadTextureCube(G,n.mapping,a)}else{G=THREE.ImageUtils.loadTexture(d(n.url,L.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)G.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)G.magFilter=THREE[n.magFilter];if(n.repeat){G.repeat.set(n.repeat[0],n.repeat[1]);if(n.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}n.offset&&G.offset.set(n.offset[0],n.offset[1]);if(n.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};
 if(Q[n.wrap[0]]!==void 0)G.wrapS=Q[n.wrap[0]];if(Q[n.wrap[1]]!==void 0)G.wrapT=Q[n.wrap[1]]}}C.textures[u]=G}for(o in L.materials){u=L.materials[o];for(F in u.parameters)if(F=="envMap"||F=="map"||F=="lightMap")u.parameters[F]=C.textures[u.parameters[F]];else if(F=="shading")u.parameters[F]=u.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")u.parameters[F]=THREE[u.parameters[F]]?THREE[u.parameters[F]]:THREE.NormalBlending;else if(F=="combine")u.parameters[F]=u.parameters[F]==
 if(Q[n.wrap[0]]!==void 0)G.wrapS=Q[n.wrap[0]];if(Q[n.wrap[1]]!==void 0)G.wrapT=Q[n.wrap[1]]}}C.textures[u]=G}for(o in L.materials){u=L.materials[o];for(F in u.parameters)if(F=="envMap"||F=="map"||F=="lightMap")u.parameters[F]=C.textures[u.parameters[F]];else if(F=="shading")u.parameters[F]=u.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")u.parameters[F]=THREE[u.parameters[F]]?THREE[u.parameters[F]]:THREE.NormalBlending;else if(F=="combine")u.parameters[F]=u.parameters[F]==
-"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(u.parameters[F]=="face")u.parameters[F]=THREE.FaceColors;else if(u.parameters[F])u.parameters[F]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=!0;if(u.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);G=u.parameters.color;Q=u.parameters.specular;s=u.parameters.ambient;P=u.parameters.shininess;a.tNormal.texture=C.textures[u.parameters.normalMap];
-if(u.parameters.normalMapFactor)a.uNormalScale.value=u.parameters.normalMapFactor;if(u.parameters.map)a.tDiffuse.texture=u.parameters.map,a.enableDiffuse.value=!0;if(u.parameters.lightMap)a.tAO.texture=u.parameters.lightMap,a.enableAO.value=!0;if(u.parameters.specularMap)a.tSpecular.texture=C.textures[u.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(Q);a.uAmbientColor.value.setHex(s);a.uShininess.value=P;if(u.parameters.opacity)a.uOpacity.value=
+"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(u.parameters[F]=="face")u.parameters[F]=THREE.FaceColors;else if(u.parameters[F])u.parameters[F]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=!0;if(u.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);G=u.parameters.color;Q=u.parameters.specular;r=u.parameters.ambient;P=u.parameters.shininess;a.tNormal.texture=C.textures[u.parameters.normalMap];
+if(u.parameters.normalMapFactor)a.uNormalScale.value=u.parameters.normalMapFactor;if(u.parameters.map)a.tDiffuse.texture=u.parameters.map,a.enableDiffuse.value=!0;if(u.parameters.lightMap)a.tAO.texture=u.parameters.lightMap,a.enableAO.value=!0;if(u.parameters.specularMap)a.tSpecular.texture=C.textures[u.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(Q);a.uAmbientColor.value.setHex(r);a.uShininess.value=P;if(u.parameters.opacity)a.uOpacity.value=
 u.parameters.opacity;u=new THREE.ShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else u=new THREE[u.type](u.parameters);C.materials[o]=u}h();b.callbackSync(C);l()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 u.parameters.opacity;u=new THREE.ShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else u=new THREE[u.type](u.parameters);C.materials[o]=u}h();b.callbackSync(C);l()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
 c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,f,i){for(var k,l,s,u=a.length;i<u;i+=f)k=a[i],l=a[i+1],s=a[i+2],k=k/16383*b,l=l/16383*b,s=s/16383*b,k+=d,l+=g,s+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,s)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(f[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,x,q,t,v=a.length;for(b=0;b<v;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;t=e;i=f;x=d;var y=e,H=f,J=g.materials[0],F=k[y*3],z=k[y*3+1],y=k[y*3+2],D=k[H*3],P=k[H*3+1],H=k[H*3+2];x=new THREE.Vector3(k[x*3],k[x*3+1],k[x*3+2]);y=new THREE.Vector3(F,z,y);H=new THREE.Vector3(D,P,H);g.faces.push(new THREE.Face3(q,t,i,[x,y,H],null,J));g=l[d*2];d=l[d*2+
-1];i=l[e*2];x=l[e*2+1];q=l[f*2];t=l[f*2+1];f=c.faceVertexUvs[0];e=i;i=x;x=[];x.push(new THREE.UV(g,d));x.push(new THREE.UV(e,i));x.push(new THREE.UV(q,t));f.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,f,i){for(var k,l,r,u=a.length;i<u;i+=f)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*b,l=l/16383*b,r=r/16383*b,k+=d,l+=g,r+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(f[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,x,q,s,v=a.length;for(b=0;b<v;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;s=e;i=f;x=d;var y=e,H=f,J=g.materials[0],F=k[y*3],z=k[y*3+1],y=k[y*3+2],D=k[H*3],P=k[H*3+1],H=k[H*3+2];x=new THREE.Vector3(k[x*3],k[x*3+1],k[x*3+2]);y=new THREE.Vector3(F,z,y);H=new THREE.Vector3(D,P,H);g.faces.push(new THREE.Face3(q,s,i,[x,y,H],null,J));g=l[d*2];d=l[d*2+
+1];i=l[e*2];x=l[e*2+1];q=l[f*2];s=l[f*2+1];f=c.faceVertexUvs[0];e=i;i=x;x=[];x.push(new THREE.UV(g,d));x.push(new THREE.UV(e,i));x.push(new THREE.UV(q,s));f.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 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,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=k;g[e]=this.lerp(l[a],l[a+3],f);g[e+1]=this.lerp(l[a+1],l[a+4],f);g[e+2]=this.lerp(l[a+2],l[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
 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,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=k;g[e]=this.lerp(l[a],l[a+3],f);g[e+1]=this.lerp(l[a+1],l[a+4],f);g[e+2]=this.lerp(l[a+2],l[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
 2]=k;c=a+this.yd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=k+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};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]-
 2]=k;c=a+this.yd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=k+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};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,g,e,f,h){var i=e+1,k=e+this.yd,l=e+this.zd,n=i+this.yd,o=i+this.zd,m=e+this.yd+this.zd,r=i+this.yd+this.zd,p=0,s=this.field[e],u=this.field[i],x=this.field[k],q=this.field[n],t=this.field[l],v=this.field[o],y=this.field[m],H=this.field[r];s<f&&(p|=1);u<f&&(p|=2);x<f&&(p|=8);q<f&&(p|=4);t<f&&(p|=16);v<f&&(p|=32);y<f&&(p|=128);H<f&&(p|=64);var J=THREE.edgeTable[p];if(J===0)return 0;
-var F=this.delta,z=a+F,D=c+F,F=g+F;J&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,s,u));J&2&&(this.compNorm(i),this.compNorm(n),this.VIntY(i*3,this.vlist,this.nlist,3,f,z,c,g,u,q));J&4&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,D,g,x,q));J&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,s,x));J&16&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,F,t,v));
-J&32&&(this.compNorm(o),this.compNorm(r),this.VIntY(o*3,this.vlist,this.nlist,15,f,z,c,F,v,H));J&64&&(this.compNorm(m),this.compNorm(r),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,D,F,y,H));J&128&&(this.compNorm(l),this.compNorm(m),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,F,t,y));J&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,s,t));J&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,z,c,g,u,v));J&1024&&(this.compNorm(n),
-this.compNorm(r),this.VIntZ(n*3,this.vlist,this.nlist,30,f,z,D,g,q,H));J&2048&&(this.compNorm(k),this.compNorm(m),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,D,g,x,y));p<<=4;for(f=e=0;THREE.triTable[p+f]!=-1;)a=p+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
+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,g,e,f,h){var i=e+1,k=e+this.yd,l=e+this.zd,n=i+this.yd,o=i+this.zd,m=e+this.yd+this.zd,t=i+this.yd+this.zd,p=0,r=this.field[e],u=this.field[i],x=this.field[k],q=this.field[n],s=this.field[l],v=this.field[o],y=this.field[m],H=this.field[t];r<f&&(p|=1);u<f&&(p|=2);x<f&&(p|=8);q<f&&(p|=4);s<f&&(p|=16);v<f&&(p|=32);y<f&&(p|=128);H<f&&(p|=64);var J=THREE.edgeTable[p];if(J===0)return 0;
+var F=this.delta,z=a+F,D=c+F,F=g+F;J&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,r,u));J&2&&(this.compNorm(i),this.compNorm(n),this.VIntY(i*3,this.vlist,this.nlist,3,f,z,c,g,u,q));J&4&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,D,g,x,q));J&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,r,x));J&16&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,F,s,v));
+J&32&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,15,f,z,c,F,v,H));J&64&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,D,F,y,H));J&128&&(this.compNorm(l),this.compNorm(m),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,F,s,y));J&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,r,s));J&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,z,c,g,u,v));J&1024&&(this.compNorm(n),
+this.compNorm(t),this.VIntZ(n*3,this.vlist,this.nlist,30,f,z,D,g,q,H));J&2048&&(this.compNorm(k),this.compNorm(m),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,D,g,x,y));p<<=4;for(f=e=0;THREE.triTable[p+f]!=-1;)a=p+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
 3]=a[e];this.positionArray[i+4]=a[e+1];this.positionArray[i+5]=a[e+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[e];this.normalArray[i+4]=c[e+1];this.normalArray[i+5]=c[e+2];this.normalArray[i+6]=c[f];this.normalArray[i+7]=c[f+1];this.normalArray[i+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
 3]=a[e];this.positionArray[i+4]=a[e+1];this.positionArray[i+5]=a[e+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[e];this.normalArray[i+4]=c[e+1];this.normalArray[i+5]=c[e+2];this.normalArray[i+6]=c[f];this.normalArray[i+7]=c[f+1];this.normalArray[i+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(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,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,k=c*this.size,l=a*this.size,n=Math.floor(i-h);n<1&&(n=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(l-h);m<1&&(m=1);h=Math.floor(l+h);
 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,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,k=c*this.size,l=a*this.size,n=Math.floor(i-h);n<1&&(n=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(l-h);m<1&&(m=1);h=Math.floor(l+h);
-h>this.size-1&&(h=this.size-1);for(var r,p,s,u,x,q;n<i;n++){l=this.size2*n;p=n/this.size-g;x=p*p;for(p=o;p<k;p++){s=l+this.size*p;r=p/this.size-c;q=r*r;for(r=m;r<h;r++)u=r/this.size-a,u=e/(1.0E-6+u*u+q+x)-f,u>0&&(this.field[s+r]+=u)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,n=this.zd,o=this.field,m=k*Math.sqrt(a/c);m>k&&(m=k);for(g=0;g<m;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<k;e++){i=g+e*l;for(f=0;f<k;f++)o[n*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
-i,k,l=this.size,n=this.yd,o=this.zd,m=this.field,r=l*Math.sqrt(a/c);r>l&&(r=l);for(e=0;e<r;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*n;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)m[o*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,n=this.yd,o=this.zd,m=this.field,r=l*Math.sqrt(a/c);r>l&&(r=l);for(f=0;f<r;f++)if(g=f/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*f;for(e=0;e<l;e++){k=i+e*n;for(g=0;g<l;g++)m[k+g]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
+h>this.size-1&&(h=this.size-1);for(var t,p,r,u,x,q;n<i;n++){l=this.size2*n;p=n/this.size-g;x=p*p;for(p=o;p<k;p++){r=l+this.size*p;t=p/this.size-c;q=t*t;for(t=m;t<h;t++)u=t/this.size-a,u=e/(1.0E-6+u*u+q+x)-f,u>0&&(this.field[r+t]+=u)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,n=this.zd,o=this.field,m=k*Math.sqrt(a/c);m>k&&(m=k);for(g=0;g<m;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<k;e++){i=g+e*l;for(f=0;f<k;f++)o[n*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
+i,k,l=this.size,n=this.yd,o=this.zd,m=this.field,t=l*Math.sqrt(a/c);t>l&&(t=l);for(e=0;e<t;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*n;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)m[o*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,n=this.yd,o=this.zd,m=this.field,t=l*Math.sqrt(a/c);t>l&&(t=l);for(f=0;f<t;f++)if(g=f/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*f;for(e=0;e<l;e++){k=i+e*n;for(g=0;g<l;g++)m[k+g]+=h}}};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,g,e,f,h,i,k,l,n,o=this.size-2;for(f=1;f<o;f++){n=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<o;e++){l=n+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=l+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(e){var f,h,i,k,l,n,o,m;for(f=0;f<e.count;f++)o=f*3,l=o+1,m=o+2,h=e.positionArray[o],
 this.field[a]=0};this.render=function(a){this.begin();var c,g,e,f,h,i,k,l,n,o=this.size-2;for(f=1;f<o;f++){n=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<o;e++){l=n+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=l+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(e){var f,h,i,k,l,n,o,m;for(f=0;f<e.count;f++)o=f*3,l=o+1,m=o+2,h=e.positionArray[o],
 i=e.positionArray[l],k=e.positionArray[m],n=new THREE.Vector3(h,i,k),h=e.normalArray[o],i=e.normalArray[l],k=e.normalArray[m],o=new THREE.Vector3(h,i,k),o.normalize(),l=new THREE.Vertex(n),c.vertices.push(l),g.push(o);n=e.count/3;for(f=0;f<n;f++)o=(a+f)*3,l=o+1,m=o+2,h=g[o],i=g[l],k=g[m],o=new THREE.Face3(o,l,m,[h,i,k]),c.faces.push(o);a+=n;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 i=e.positionArray[l],k=e.positionArray[m],n=new THREE.Vector3(h,i,k),h=e.normalArray[o],i=e.normalArray[l],k=e.normalArray[m],o=new THREE.Vector3(h,i,k),o.normalize(),l=new THREE.Vertex(n),c.vertices.push(l),g.push(o);n=e.count/3;for(f=0;f<n;f++)o=(a+f)*3,l=o+1,m=o+2,h=g[o],i=g[l],k=g[m],o=new THREE.Face3(o,l,m,[h,i,k]),c.faces.push(o);a+=n;e.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,
@@ -701,9 +701,9 @@ d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,n;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
-1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-p=new THREE.Scene;p.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));p.add(r);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||n!==b.fov){i=b.aspect;k=b.near;l=b.far;n=b.fov;var x=b.projectionMatrix.clone(),q=125/30*0.5,t=q*k/125,v=k*Math.tan(n*Math.PI/360),y;f.n14=q;h.n14=-q;q=-v*i+t;y=v*i+t;x.n11=2*k/(y-q);x.n13=(y+q)/(y-q);g.projectionMatrix.copy(x);q=-v*i-t;y=v*i-t;x.n11=
-2*k/(y-q);x.n13=(y+q)/(y-q);e.projectionMatrix.copy(x)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,m,!0);p.updateMatrixWorld();d.call(c,p,r)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,n;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
+1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+p=new THREE.Scene;p.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));p.add(t);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||n!==b.fov){i=b.aspect;k=b.near;l=b.far;n=b.fov;var x=b.projectionMatrix.clone(),q=125/30*0.5,s=q*k/125,v=k*Math.tan(n*Math.PI/360),y;f.n14=q;h.n14=-q;q=-v*i+s;y=v*i+s;x.n11=2*k/(y-q);x.n13=(y+q)/(y-q);g.projectionMatrix.copy(x);q=-v*i-s;y=v*i-s;x.n11=
+2*k/(y-q);x.n13=(y+q)/(y-q);e.projectionMatrix.copy(x)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,m,!0);p.updateMatrixWorld();d.call(c,p,t)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,e,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;e=d};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,e,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;e=d};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
 b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,e);d.call(c,a,f);this.setViewport(g,0,g,e);d.call(c,a,h,!1)}};
 b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,e);d.call(c,a,f);this.setViewport(g,0,g,e);d.call(c,a,h,!1)}};

+ 34 - 34
build/custom/ThreeCanvas.js

@@ -14,11 +14,11 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){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}};
 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){function c(a,b,c){h=h.copy(c).subSelf(a);l=h.dot(b);if(l<=0)return null;q=j.copy(a).addSelf(n.copy(b).multiplyScalar(l));return k=c.distanceTo(q)}function d(a,b,c,d){h.copy(d).subSelf(b);j.copy(c).subSelf(b);n.copy(a).subSelf(b);s=h.dot(h);Q=h.dot(j);E=h.dot(n);I=j.dot(j);N=j.dot(n);w=1/(s*I-Q*Q);F=(I*E-Q*N)*w;z=(s*N-Q*E)*w;return F>=0&&z>=0&&F+z<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+THREE.Ray=function(a,b){function c(a,b,c){h=h.copy(c).subSelf(a);l=h.dot(b);if(l<=0)return null;q=j.copy(a).addSelf(n.copy(b).multiplyScalar(l));return k=c.distanceTo(q)}function d(a,b,c,d){h.copy(d).subSelf(b);j.copy(c).subSelf(b);n.copy(a).subSelf(b);s=h.dot(h);Q=h.dot(j);D=h.dot(n);I=j.dot(j);N=j.dot(n);w=1/(s*I-Q*Q);F=(I*D-Q*N)*w;z=(s*N-Q*D)*w;return F>=0&&z>=0&&F+z<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
 this.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};var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(h){for(var k,j=[],l=0,n=h.children.length;l<n;l++)Array.prototype.push.apply(j,this.intersectObject(h.children[l]));
 this.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};var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(h){for(var k,j=[],l=0,n=h.children.length;l<n;l++)Array.prototype.push.apply(j,this.intersectObject(h.children[l]));
-if(h instanceof THREE.Particle){l=c(this.origin,this.direction,h.matrixWorld.getPosition());if(l===null||l>h.scale.x)return[];k={distance:l,point:h.position,face:null,object:h};j.push(k)}else if(h instanceof THREE.Mesh){l=c(this.origin,this.direction,h.matrixWorld.getPosition());if(l===null||l>h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)))return j;var D,q=h.geometry,G=q.vertices,H;h.matrixRotationWorld.extractRotation(h.matrixWorld);l=0;for(n=q.faces.length;l<
-n;l++)if(k=q.faces[l],a=a.copy(this.origin),b=b.copy(this.direction),H=h.matrixWorld,m=H.multiplyVector3(m.copy(k.centroid)).subSelf(a),D=m.dot(b),!(D<=0)&&(f=H.multiplyVector3(f.copy(G[k.a].position)),e=H.multiplyVector3(e.copy(G[k.b].position)),g=H.multiplyVector3(g.copy(G[k.c].position)),i=k instanceof THREE.Face4?H.multiplyVector3(i.copy(G[k.d].position)):null,o=h.matrixRotationWorld.multiplyVector3(o.copy(k.normal)),D=b.dot(o),h.doubleSided||(h.flipSided?D>0:D<0)))if(D=o.dot(m.sub(f,a))/D,D=
-a.clone().addSelf(b.multiplyScalar(D)),k instanceof THREE.Face3)d(D,f,e,g)&&(k={distance:a.distanceTo(D),point:D,face:k,object:h},j.push(k));else if(k instanceof THREE.Face4&&(d(D,f,e,i)||d(D,e,g,i)))k={distance:a.distanceTo(D),point:D,face:k,object:h},j.push(k)}return j};var h=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,l,q,k,s,Q,E,I,N,w,F,z};
+if(h instanceof THREE.Particle){l=c(this.origin,this.direction,h.matrixWorld.getPosition());if(l===null||l>h.scale.x)return[];k={distance:l,point:h.position,face:null,object:h};j.push(k)}else if(h instanceof THREE.Mesh){l=c(this.origin,this.direction,h.matrixWorld.getPosition());if(l===null||l>h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)))return j;var S,q=h.geometry,E=q.vertices,G,H=new THREE.Vector3;h.matrixRotationWorld.extractRotation(h.matrixWorld);l=0;for(n=
+q.faces.length;l<n;l++)if(k=q.faces[l],a=a.copy(this.origin),b=b.copy(this.direction),G=h.matrixWorld,m=G.multiplyVector3(m.copy(k.centroid)).subSelf(a),S=m.dot(b),!(S<=0)&&(f=G.multiplyVector3(f.copy(E[k.a].position)),e=G.multiplyVector3(e.copy(E[k.b].position)),g=G.multiplyVector3(g.copy(E[k.c].position)),i=k instanceof THREE.Face4?G.multiplyVector3(i.copy(E[k.d].position)):null,o=h.matrixRotationWorld.multiplyVector3(o.copy(k.normal)),S=b.dot(o),h.doubleSided||(h.flipSided?S>0:S<0)))if(S=o.dot(m.sub(f,
+a))/S,H.add(a,b.multiplyScalar(S)),k instanceof THREE.Face3)d(H,f,e,g)&&(k={distance:a.distanceTo(H),point:H.clone(),face:k,object:h},j.push(k));else if(k instanceof THREE.Face4&&(d(H,f,e,i)||d(H,e,g,i)))k={distance:a.distanceTo(H),point:H.clone(),face:k,object:h},j.push(k)}return j};var h=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,l,q,k,s,Q,D,I,N,w,F,z};
 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,h,j){i=!1;b=e;c=g;d=h;f=j;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,h,j){i=!1;b=e;c=g;d=h;f=j;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,h,j,n,l){i?(i=!1,b=e<h?e<n?e:n:h<n?h:n,c=g<j?g<l?g:l:j<l?j:l,d=e>h?e>n?e:n:h>n?h:n,f=g>j?g>l?g:l:j>l?j:l):(b=e<h?e<n?e<b?e:b:n<b?n:b:h<n?h<b?h:b:n<b?n:b,c=g<j?g<l?g<c?g:c:l<c?l:c:j<l?j<c?j:c:l<c?l:c,d=e>h?e>n?e>d?e:d:n>d?n:d:h>n?h>d?h:d:n>d?n:d,f=g>j?g>l?g>f?g:f:l>f?l:f:j>l?j>f?j: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,h,j,n,l){i?(i=!1,b=e<h?e<n?e:n:h<n?h:n,c=g<j?g<l?g:l:j<l?j:l,d=e>h?e>n?e:n:h>n?h:n,f=g>j?g>l?g:l:j>l?j:l):(b=e<h?e<n?e<b?e:b:n<b?n:b:h<n?h<b?h:b:n<b?n:b,c=g<j?g<l?g<c?g:c:l<c?l:c:j<l?j<c?j:c:l<c?l:c,d=e>h?e>n?e>d?e:d:n>d?n:d:h>n?h>d?h:d:n>d?n:d,f=g>j?g>l?g>f?g:f:l>f?l:f:j>l?j>f?j: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>
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=d=c=b=0;a()};this.isEmpty=function(){return i}};
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=d=c=b=0;a()};this.isEmpty=function(){return i}};
@@ -27,8 +27,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,f,e,g,i,m,o,h,j,n,l,q,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,i||0,m||0,o||0,h!==void 0?h:1,j||0,n||0,l||0,q||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4=function(a,b,c,d,f,e,g,i,m,o,h,j,n,l,q,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,i||0,m||0,o||0,h!==void 0?h:1,j||0,n||0,l||0,q||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,i,m,o,h,j,n,l,q,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=i;this.n31=m;this.n32=o;this.n33=h;this.n34=j;this.n41=n;this.n42=l;this.n43=q;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,i,m,o,h,j,n,l,q,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=i;this.n31=m;this.n32=o;this.n33=h;this.n34=j;this.n41=n;this.n42=l;this.n43=q;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,i=a.n22,m=a.n23,o=a.n24,h=a.n31,j=a.n32,n=a.n33,l=a.n34,q=a.n41,k=a.n42,s=a.n43,
 b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,i=a.n22,m=a.n23,o=a.n24,h=a.n31,j=a.n32,n=a.n33,l=a.n34,q=a.n41,k=a.n42,s=a.n43,
-Q=a.n44,E=b.n11,I=b.n12,N=b.n13,w=b.n14,F=b.n21,z=b.n22,J=b.n23,u=b.n24,r=b.n31,C=b.n32,O=b.n33,D=b.n34,ea=b.n41,G=b.n42,H=b.n43,U=b.n44;this.n11=c*E+d*F+f*r+e*ea;this.n12=c*I+d*z+f*C+e*G;this.n13=c*N+d*J+f*O+e*H;this.n14=c*w+d*u+f*D+e*U;this.n21=g*E+i*F+m*r+o*ea;this.n22=g*I+i*z+m*C+o*G;this.n23=g*N+i*J+m*O+o*H;this.n24=g*w+i*u+m*D+o*U;this.n31=h*E+j*F+n*r+l*ea;this.n32=h*I+j*z+n*C+l*G;this.n33=h*N+j*J+n*O+l*H;this.n34=h*w+j*u+n*D+l*U;this.n41=q*E+k*F+s*r+Q*ea;this.n42=q*I+k*z+s*C+Q*G;this.n43=q*
-N+k*J+s*O+Q*H;this.n44=q*w+k*u+s*D+Q*U;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+Q=a.n44,D=b.n11,I=b.n12,N=b.n13,w=b.n14,F=b.n21,z=b.n22,J=b.n23,u=b.n24,r=b.n31,C=b.n32,O=b.n33,S=b.n34,ea=b.n41,E=b.n42,G=b.n43,H=b.n44;this.n11=c*D+d*F+f*r+e*ea;this.n12=c*I+d*z+f*C+e*E;this.n13=c*N+d*J+f*O+e*G;this.n14=c*w+d*u+f*S+e*H;this.n21=g*D+i*F+m*r+o*ea;this.n22=g*I+i*z+m*C+o*E;this.n23=g*N+i*J+m*O+o*G;this.n24=g*w+i*u+m*S+o*H;this.n31=h*D+j*F+n*r+l*ea;this.n32=h*I+j*z+n*C+l*E;this.n33=h*N+j*J+n*O+l*G;this.n34=h*w+j*u+n*S+l*H;this.n41=q*D+k*F+s*r+Q*ea;this.n42=q*I+k*z+s*C+Q*E;this.n43=q*
+N+k*J+s*O+Q*G;this.n44=q*w+k*u+s*S+Q*H;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,i=this.n24,m=this.n31,o=this.n32,h=this.n33,j=this.n34,n=this.n41,l=this.n42,q=this.n43,k=this.n44;return d*g*o*n-c*i*o*n-d*e*h*n+b*i*h*n+c*e*j*n-b*g*j*n-d*g*m*l+c*i*m*l+d*f*h*l-a*i*h*l-c*f*j*l+a*g*j*l+d*e*m*q-b*i*m*q-d*f*o*q+a*i*o*q+b*f*j*q-a*e*j*q-c*e*m*k+b*g*m*k+c*f*o*k-a*g*o*k-b*f*h*k+a*e*h*k},transpose:function(){var a;
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,i=this.n24,m=this.n31,o=this.n32,h=this.n33,j=this.n34,n=this.n41,l=this.n42,q=this.n43,k=this.n44;return d*g*o*n-c*i*o*n-d*e*h*n+b*i*h*n+c*e*j*n-b*g*j*n-d*g*m*l+c*i*m*l+d*f*h*l-a*i*h*l-c*f*j*l+a*g*j*l+d*e*m*q-b*i*m*q-d*f*o*q+a*i*o*q+b*f*j*q-a*e*j*q-c*e*m*k+b*g*m*k+c*f*o*k-a*g*o*k-b*f*h*k+a*e*h*k},transpose:function(){var a;
@@ -55,24 +55,24 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=o[m]=o[m]||new THREE.RenderableVertex;m++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],i,m,o=[],
 THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=o[m]=o[m]||new THREE.RenderableVertex;m++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],i,m,o=[],
-h,j,n=[],l,q=[],k,s,Q=[],E,I,N=[],w={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,z=new THREE.Vector4,J=new THREE.Matrix4,u=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,O=new THREE.Vector4;this.computeFrustum=function(a){r[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);r[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);r[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+h,j,n=[],l,q=[],k,s,Q=[],D,I,N=[],w={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,z=new THREE.Vector4,J=new THREE.Matrix4,u=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,O=new THREE.Vector4;this.computeFrustum=function(a){r[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);r[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);r[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
 a.n23,a.n44+a.n24);r[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);r[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);r[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=r[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 a.n23,a.n44+a.n24);r[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);r[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);r[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=r[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
 J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
 e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=r[h].x*d.n14+r[h].y*d.n24+r[h].z*d.n34+r[h].w,c<=e){c=!1;break a}c=!0}c?(J.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(J.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.sprites.push(f)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
 e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=r[h].x*d.n14+r[h].y*d.n24+r[h].z*d.n34+r[h].w,c<=e){c=!1;break a}c=!0}c?(J.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(J.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.sprites.push(f)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,r=e.far,F,L,B,S,v,R,P,W,K,t,A,x,y,M,ka,aa;I=s=l=j=0;w.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);J.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(J);w=this.projectGraph(a,!1);a=0;for(F=w.objects.length;a<F;a++)if(K=w.objects[a].object,t=K.matrixWorld,
-x=K.material,m=0,K instanceof THREE.Mesh){A=K.geometry;y=K.geometry.materials;S=A.vertices;M=A.faces;ka=A.faceVertexUvs;A=K.matrixRotationWorld.extractRotation(t);L=0;for(B=S.length;L<B;L++)i=b(),i.positionWorld.copy(S[L].position),t.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),J.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<r;S=0;for(L=M.length;S<L;S++){B=
-M[S];if(B instanceof THREE.Face3)if(v=o[B.a],R=o[B.b],P=o[B.c],v.visible&&R.visible&&P.visible&&(K.doubleSided||K.flipSided!=(P.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(P.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0))W=n[j]=n[j]||new THREE.RenderableFace3,j++,h=W,h.v1.copy(v),h.v2.copy(R),h.v3.copy(P);else continue;else if(B instanceof THREE.Face4)if(v=o[B.a],R=o[B.b],P=o[B.c],W=o[B.d],v.visible&&R.visible&&P.visible&&W.visible&&
+w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,r=e.far,F,L,B,T,v,R,P,W,K,t,A,x,y,M,ka,aa;I=s=l=j=0;w.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);J.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(J);w=this.projectGraph(a,!1);a=0;for(F=w.objects.length;a<F;a++)if(K=w.objects[a].object,t=K.matrixWorld,
+x=K.material,m=0,K instanceof THREE.Mesh){A=K.geometry;y=K.geometry.materials;T=A.vertices;M=A.faces;ka=A.faceVertexUvs;A=K.matrixRotationWorld.extractRotation(t);L=0;for(B=T.length;L<B;L++)i=b(),i.positionWorld.copy(T[L].position),t.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),J.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<r;T=0;for(L=M.length;T<L;T++){B=
+M[T];if(B instanceof THREE.Face3)if(v=o[B.a],R=o[B.b],P=o[B.c],v.visible&&R.visible&&P.visible&&(K.doubleSided||K.flipSided!=(P.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(P.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0))W=n[j]=n[j]||new THREE.RenderableFace3,j++,h=W,h.v1.copy(v),h.v2.copy(R),h.v3.copy(P);else continue;else if(B instanceof THREE.Face4)if(v=o[B.a],R=o[B.b],P=o[B.c],W=o[B.d],v.visible&&R.visible&&P.visible&&W.visible&&
 (K.doubleSided||K.flipSided!=((W.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(W.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0||(R.positionScreen.x-P.positionScreen.x)*(W.positionScreen.y-P.positionScreen.y)-(R.positionScreen.y-P.positionScreen.y)*(W.positionScreen.x-P.positionScreen.x)<0)))aa=q[l]=q[l]||new THREE.RenderableFace4,l++,h=aa,h.v1.copy(v),h.v2.copy(R),h.v3.copy(P),h.v4.copy(W);else continue;h.normalWorld.copy(B.normal);
 (K.doubleSided||K.flipSided!=((W.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(W.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0||(R.positionScreen.x-P.positionScreen.x)*(W.positionScreen.y-P.positionScreen.y)-(R.positionScreen.y-P.positionScreen.y)*(W.positionScreen.x-P.positionScreen.x)<0)))aa=q[l]=q[l]||new THREE.RenderableFace4,l++,h=aa,h.v1.copy(v),h.v2.copy(R),h.v3.copy(P),h.v4.copy(W);else continue;h.normalWorld.copy(B.normal);
-A.multiplyVector3(h.normalWorld);h.centroidWorld.copy(B.centroid);t.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);J.multiplyVector3(h.centroidScreen);P=B.vertexNormals;v=0;for(R=P.length;v<R;v++)W=h.vertexNormalsWorld[v],W.copy(P[v]),A.multiplyVector3(W);v=0;for(R=ka.length;v<R;v++)if(aa=ka[v][S]){P=0;for(W=aa.length;P<W;P++)h.uvs[v][P]=aa[P]}h.material=x;h.faceMaterial=B.materialIndex!==null?y[B.materialIndex]:null;h.z=h.centroidScreen.z;w.elements.push(h)}}else if(K instanceof
-THREE.Line){u.multiply(J,t);S=K.geometry.vertices;v=b();v.positionScreen.copy(S[0].position);u.multiplyVector4(v.positionScreen);L=1;for(B=S.length;L<B;L++)if(v=b(),v.positionScreen.copy(S[L].position),u.multiplyVector4(v.positionScreen),R=o[m-2],C.copy(v.positionScreen),O.copy(R.positionScreen),d(C,O))C.multiplyScalar(1/C.w),O.multiplyScalar(1/O.w),K=Q[s]=Q[s]||new THREE.RenderableLine,s++,k=K,k.v1.positionScreen.copy(C),k.v2.positionScreen.copy(O),k.z=Math.max(C.z,O.z),k.material=x,w.elements.push(k)}a=
-0;for(F=w.sprites.length;a<F;a++)if(K=w.sprites[a].object,t=K.matrixWorld,K instanceof THREE.Particle&&(z.set(t.n14,t.n24,t.n34,1),J.multiplyVector4(z),z.z/=z.w,z.z>0&&z.z<1))g=N[I]=N[I]||new THREE.RenderableParticle,I++,E=g,E.x=z.x/z.w,E.y=z.y/z.w,E.z=z.z,E.rotation=K.rotation.z,E.scale.x=K.scale.x*Math.abs(E.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),E.scale.y=K.scale.y*Math.abs(E.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),E.material=K.material,w.elements.push(E);
+A.multiplyVector3(h.normalWorld);h.centroidWorld.copy(B.centroid);t.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);J.multiplyVector3(h.centroidScreen);P=B.vertexNormals;v=0;for(R=P.length;v<R;v++)W=h.vertexNormalsWorld[v],W.copy(P[v]),A.multiplyVector3(W);v=0;for(R=ka.length;v<R;v++)if(aa=ka[v][T]){P=0;for(W=aa.length;P<W;P++)h.uvs[v][P]=aa[P]}h.material=x;h.faceMaterial=B.materialIndex!==null?y[B.materialIndex]:null;h.z=h.centroidScreen.z;w.elements.push(h)}}else if(K instanceof
+THREE.Line){u.multiply(J,t);T=K.geometry.vertices;v=b();v.positionScreen.copy(T[0].position);u.multiplyVector4(v.positionScreen);L=1;for(B=T.length;L<B;L++)if(v=b(),v.positionScreen.copy(T[L].position),u.multiplyVector4(v.positionScreen),R=o[m-2],C.copy(v.positionScreen),O.copy(R.positionScreen),d(C,O))C.multiplyScalar(1/C.w),O.multiplyScalar(1/O.w),K=Q[s]=Q[s]||new THREE.RenderableLine,s++,k=K,k.v1.positionScreen.copy(C),k.v2.positionScreen.copy(O),k.z=Math.max(C.z,O.z),k.material=x,w.elements.push(k)}a=
+0;for(F=w.sprites.length;a<F;a++)if(K=w.sprites[a].object,t=K.matrixWorld,K instanceof THREE.Particle&&(z.set(t.n14,t.n24,t.n34,1),J.multiplyVector4(z),z.z/=z.w,z.z>0&&z.z<1))g=N[I]=N[I]||new THREE.RenderableParticle,I++,D=g,D.x=z.x/z.w,D.y=z.y/z.w,D.z=z.z,D.rotation=K.rotation.z,D.scale.x=K.scale.x*Math.abs(D.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),D.scale.y=K.scale.y*Math.abs(D.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),D.material=K.material,w.elements.push(D);
 f&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 f&&w.elements.sort(c);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,m=this.w,o=m*c+g*f-i*d,h=m*d+i*c-e*f,j=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,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,m=this.w,o=m*c+g*f-i*d,h=m*d+i*c-e*f,j=m*f+e*d-g*c,c=-e*
 c-g*d-i*f;b.x=o*m+c*-e+h*-i-j*-g;b.y=h*m+c*-g+j*-e-o*-i;b.z=j*m+c*-i+o*-g-h*-e;return b}};
 c-g*d-i*f;b.x=o*m+c*-e+h*-i-j*-g;b.y=h*m+c*-g+j*-e-o*-i;b.z=j*m+c*-i+o*-g-h*-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;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);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),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)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;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+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;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);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),f=Math.sqrt(1-f*f);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;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.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.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.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];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.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];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.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -82,9 +82,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 c,d,f,e,g,i=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){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),m.sub(b.position,c.position),i.crossSelf(m);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,m=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),m.sub(b.position,c.position),i.crossSelf(m);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,D){i=a.vertices[b].position;m=a.vertices[c].position;o=a.vertices[d].position;h=g[e];j=g[f];n=g[D];l=m.x-i.x;q=o.x-i.x;k=m.y-i.y;s=o.y-i.y;Q=m.z-i.z;E=o.z-i.z;I=j.u-h.u;N=n.u-h.u;w=j.v-h.v;F=n.v-h.v;z=1/(I*F-N*w);C.set((F*l-w*q)*z,(F*k-w*s)*z,(F*Q-w*E)*z);O.set((I*q-N*l)*z,(I*s-N*k)*z,(I*E-N*Q)*z);u[b].addSelf(C);u[c].addSelf(C);u[d].addSelf(C);r[b].addSelf(O);
-r[c].addSelf(O);r[d].addSelf(O)}var b,c,d,f,e,g,i,m,o,h,j,n,l,q,k,s,Q,E,I,N,w,F,z,J,u=[],r=[],C=new THREE.Vector3,O=new THREE.Vector3,D=new THREE.Vector3,ea=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,r[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var H=["a",
-"b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)G.copy(e.vertexNormals[d]),f=e[H[d]],J=u[f],D.copy(J),D.subSelf(G.multiplyScalar(G.dot(J))).normalize(),ea.cross(e.vertexNormals[d],J),f=ea.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(D.x,D.y,D.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.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,E){i=a.vertices[b].position;m=a.vertices[c].position;o=a.vertices[d].position;h=g[e];j=g[f];n=g[E];l=m.x-i.x;q=o.x-i.x;k=m.y-i.y;s=o.y-i.y;Q=m.z-i.z;D=o.z-i.z;I=j.u-h.u;N=n.u-h.u;w=j.v-h.v;F=n.v-h.v;z=1/(I*F-N*w);C.set((F*l-w*q)*z,(F*k-w*s)*z,(F*Q-w*D)*z);O.set((I*q-N*l)*z,(I*s-N*k)*z,(I*D-N*Q)*z);u[b].addSelf(C);u[c].addSelf(C);u[d].addSelf(C);r[b].addSelf(O);
+r[c].addSelf(O);r[d].addSelf(O)}var b,c,d,f,e,g,i,m,o,h,j,n,l,q,k,s,Q,D,I,N,w,F,z,J,u=[],r=[],C=new THREE.Vector3,O=new THREE.Vector3,S=new THREE.Vector3,ea=new THREE.Vector3,E=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,r[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var G=["a",
+"b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)E.copy(e.vertexNormals[d]),f=e[G[d]],J=u[f],S.copy(J),S.subSelf(E.multiplyScalar(E.dot(J))).normalize(),ea.cross(e.vertexNormals[d],J),f=ea.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(S.x,S.y,S.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++)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;
 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;
@@ -128,33 +128,33 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
-THREE.CanvasRenderer=function(a){function b(a){if(E!=a)k.globalAlpha=E=a}function c(a){if(I!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}I=a}}function d(a){if(N!=a)k.strokeStyle=N=a}function f(a){if(w!=a)k.fillStyle=w=a}var e=this,g,i,m,o=new THREE.Projector,a=a||{},h=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-j,n,l,q,k=h.getContext("2d"),s=new THREE.Color(0),Q=0,E=1,I=0,N=null,w=null,F=null,z=null,J=null,u,r,C,O,D=new THREE.RenderableVertex,ea=new THREE.RenderableVertex,G,H,U,Y,L,B,S,v,R,P,W,K,t=new THREE.Color,A=new THREE.Color,x=new THREE.Color,y=new THREE.Color,M=new THREE.Color,ka=[],aa,ga,fa,ba,Aa,Ba,Ca,Da,Ea,Fa,la=new THREE.Rectangle,Z=new THREE.Rectangle,X=new THREE.Rectangle,xa=!1,$=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,T=new THREE.Vector3,pa,qa,ya,ca,ra,ua,a=16;pa=document.createElement("canvas");
-pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);ya=qa.getImageData(0,0,2,2);ca=ya.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){j=a;n=b;l=Math.floor(j/2);q=Math.floor(n/2);h.width=j;h.height=n;la.set(-l,-q,l,q);Z.set(-l,-q,l,q);E=1;I=0;
+THREE.CanvasRenderer=function(a){function b(a){if(D!=a)k.globalAlpha=D=a}function c(a){if(I!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}I=a}}function d(a){if(N!=a)k.strokeStyle=N=a}function f(a){if(w!=a)k.fillStyle=w=a}var e=this,g,i,m,o=new THREE.Projector,a=a||{},h=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+j,n,l,q,k=h.getContext("2d"),s=new THREE.Color(0),Q=0,D=1,I=0,N=null,w=null,F=null,z=null,J=null,u,r,C,O,S=new THREE.RenderableVertex,ea=new THREE.RenderableVertex,E,G,H,Y,L,B,T,v,R,P,W,K,t=new THREE.Color,A=new THREE.Color,x=new THREE.Color,y=new THREE.Color,M=new THREE.Color,ka=[],aa,ga,fa,ba,Aa,Ba,Ca,Da,Ea,Fa,la=new THREE.Rectangle,Z=new THREE.Rectangle,X=new THREE.Rectangle,xa=!1,$=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,U=new THREE.Vector3,pa,qa,ya,ca,ra,ua,a=16;pa=document.createElement("canvas");
+pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);ya=qa.getImageData(0,0,2,2);ca=ya.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){j=a;n=b;l=Math.floor(j/2);q=Math.floor(n/2);h.width=j;h.height=n;la.set(-l,-q,l,q);Z.set(-l,-q,l,q);D=1;I=0;
 J=z=F=w=N=null};this.setClearColor=function(a,b){s.copy(a);Q=b;Z.set(-l,-q,l,q)};this.setClearColorHex=function(a,b){s.setHex(a);Q=b;Z.set(-l,-q,l,q)};this.clear=function(){k.setTransform(1,0,0,-1,l,q);Z.isEmpty()||(Z.minSelf(la),Z.inflate(2),Q<1&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),Q>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+Q+")"),k.fillRect(Math.floor(Z.getX()),
 J=z=F=w=N=null};this.setClearColor=function(a,b){s.copy(a);Q=b;Z.set(-l,-q,l,q)};this.setClearColorHex=function(a,b){s.setHex(a);Q=b;Z.set(-l,-q,l,q)};this.clear=function(){k.setTransform(1,0,0,-1,l,q);Z.isEmpty()||(Z.minSelf(la),Z.inflate(2),Q<1&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),Q>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+Q+")"),k.fillRect(Math.floor(Z.getX()),
 Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,h){function j(a){var b,c,d,e;$.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?($.r+=e.r,$.g+=e.g,$.b+=e.b):d instanceof THREE.DirectionalLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.PointLight&&(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b)}function n(a,b,c,d){var e,f,g,h,i,k;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
 Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,h){function j(a){var b,c,d,e;$.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?($.r+=e.r,$.g+=e.g,$.b+=e.b):d instanceof THREE.DirectionalLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.PointLight&&(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b)}function n(a,b,c,d){var e,f,g,h,i,k;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
-g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),k<=0||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(T.sub(i,b).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),k!=0&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function s(a,e,g){b(g.opacity);c(g.blending);var h,i,m,j,p,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)j=g.map.image,p=j.width>>1,o=j.height>>
+g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),k<=0||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(U.sub(i,b).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),k!=0&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function s(a,e,g){b(g.opacity);c(g.blending);var h,i,m,j,p,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)j=g.map.image,p=j.width>>1,o=j.height>>
 1,g=e.scale.x*l,m=e.scale.y*q,h=g*p,i=m*o,X.set(a.x-h,a.y-i,a.x+h,a.y+i),la.intersects(X)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-m),k.translate(-p,-o),k.drawImage(j,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*l,i=e.scale.y*q,X.set(a.x-h,a.y-i,a.x+h,a.y+i),la.intersects(X)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,i),g.program(k),k.restore()))}function w(a,e,
 1,g=e.scale.x*l,m=e.scale.y*q,h=g*p,i=m*o,X.set(a.x-h,a.y-i,a.x+h,a.y+i),la.intersects(X)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-m),k.translate(-p,-o),k.drawImage(j,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*l,i=e.scale.y*q,X.set(a.x-h,a.y-i,a.x+h,a.y+i),la.intersects(X)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,i),g.program(k),k.restore()))}function w(a,e,
-f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)k.lineWidth=F=a;a=g.linecap;if(z!=a)k.lineCap=z=a;a=g.linejoin;if(J!=a)k.lineJoin=J=a;d(g.color.getContextStyle());k.stroke();X.inflate(g.linewidth*2)}}function E(a,d,f,g,i,k,j,p){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);G=a.positionScreen.x;H=a.positionScreen.y;
-U=d.positionScreen.x;Y=d.positionScreen.y;L=f.positionScreen.x;B=f.positionScreen.y;I(G,H,U,Y,L,B);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],za(G,H,U,Y,L,B,ba[g].u,ba[g].v,ba[i].u,ba[i].v,ba[k].u,ba[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=h.matrixWorldInverse,T.copy(j.vertexNormalsWorld[g]),Aa=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ba=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(j.vertexNormalsWorld[i]),
-Ca=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Da=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(j.vertexNormalsWorld[k]),Ea=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Fa=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,za(G,H,U,Y,L,B,Aa,Ba,Ca,Da,Ea,Fa,p.envMap)}else p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],za(G,H,U,Y,L,B,ba[g].u,ba[g].v,
+f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)k.lineWidth=F=a;a=g.linecap;if(z!=a)k.lineCap=z=a;a=g.linejoin;if(J!=a)k.lineJoin=J=a;d(g.color.getContextStyle());k.stroke();X.inflate(g.linewidth*2)}}function D(a,d,f,g,i,k,j,p){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);E=a.positionScreen.x;G=a.positionScreen.y;
+H=d.positionScreen.x;Y=d.positionScreen.y;L=f.positionScreen.x;B=f.positionScreen.y;I(E,G,H,Y,L,B);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],za(E,G,H,Y,L,B,ba[g].u,ba[g].v,ba[i].u,ba[i].v,ba[k].u,ba[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=h.matrixWorldInverse,U.copy(j.vertexNormalsWorld[g]),Aa=(U.x*a.n11+U.y*a.n12+U.z*a.n13)*0.5+0.5,Ba=-(U.x*a.n21+U.y*a.n22+U.z*a.n23)*0.5+0.5,U.copy(j.vertexNormalsWorld[i]),
+Ca=(U.x*a.n11+U.y*a.n12+U.z*a.n13)*0.5+0.5,Da=-(U.x*a.n21+U.y*a.n22+U.z*a.n23)*0.5+0.5,U.copy(j.vertexNormalsWorld[k]),Ea=(U.x*a.n11+U.y*a.n12+U.z*a.n13)*0.5+0.5,Fa=-(U.x*a.n21+U.y*a.n22+U.z*a.n23)*0.5+0.5,za(E,G,H,Y,L,B,Aa,Ba,Ca,Da,Ea,Fa,p.envMap)}else p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],za(E,G,H,Y,L,B,ba[g].u,ba[g].v,
 ba[i].u,ba[i].v,ba[k].u,ba[k].v,p.map)),c(THREE.SubtractiveBlending)),xa?!p.wireframe&&p.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?(A.r=x.r=y.r=$.r,A.g=x.g=y.g=$.g,A.b=x.b=y.b=$.b,n(m,j.v1.positionWorld,j.vertexNormalsWorld[0],A),n(m,j.v2.positionWorld,j.vertexNormalsWorld[1],x),n(m,j.v3.positionWorld,j.vertexNormalsWorld[2],y),A.r=Math.max(0,Math.min(p.color.r*A.r,1)),A.g=Math.max(0,Math.min(p.color.g*A.g,1)),A.b=Math.max(0,Math.min(p.color.b*A.b,1)),x.r=Math.max(0,Math.min(p.color.r*
 ba[i].u,ba[i].v,ba[k].u,ba[k].v,p.map)),c(THREE.SubtractiveBlending)),xa?!p.wireframe&&p.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?(A.r=x.r=y.r=$.r,A.g=x.g=y.g=$.g,A.b=x.b=y.b=$.b,n(m,j.v1.positionWorld,j.vertexNormalsWorld[0],A),n(m,j.v2.positionWorld,j.vertexNormalsWorld[1],x),n(m,j.v3.positionWorld,j.vertexNormalsWorld[2],y),A.r=Math.max(0,Math.min(p.color.r*A.r,1)),A.g=Math.max(0,Math.min(p.color.g*A.g,1)),A.b=Math.max(0,Math.min(p.color.b*A.b,1)),x.r=Math.max(0,Math.min(p.color.r*
-x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.b,1)),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,fa=va(A,x,y,M),na(G,H,U,Y,L,B,0,0,1,0,0,1,fa)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,j.centroidWorld,j.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,
-1)),p.wireframe?ha(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(t)):p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshDepthMaterial)aa=h.near,ga=h.far,A.r=A.g=A.b=1-ma(a.positionScreen.z,aa,ga),x.r=x.g=x.b=1-ma(d.positionScreen.z,aa,ga),y.r=y.g=y.b=1-ma(f.positionScreen.z,aa,ga),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,fa=va(A,x,y,M),na(G,H,U,Y,L,B,0,0,1,0,0,1,fa);else if(p instanceof THREE.MeshNormalMaterial)t.r=
-oa(j.normalWorld.x),t.g=oa(j.normalWorld.y),t.b=oa(j.normalWorld.z),p.wireframe?ha(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(t)}function Q(a,d,f,g,i,k,j,p,l){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)E(a,d,g,0,1,3,j,p,l),E(i,f,k,1,2,3,j,p,l);else if(G=a.positionScreen.x,H=a.positionScreen.y,U=d.positionScreen.x,Y=d.positionScreen.y,L=f.positionScreen.x,B=f.positionScreen.y,S=g.positionScreen.x,v=g.positionScreen.y,R=i.positionScreen.x,
-P=i.positionScreen.y,W=k.positionScreen.x,K=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)N(G,H,U,Y,L,B,S,v),p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshLambertMaterial)xa?!p.wireframe&&p.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4?(A.r=x.r=y.r=M.r=$.r,A.g=x.g=y.g=M.g=$.g,A.b=x.b=y.b=M.b=$.b,n(m,j.v1.positionWorld,j.vertexNormalsWorld[0],A),n(m,j.v2.positionWorld,j.vertexNormalsWorld[1],x),
+x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.b,1)),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,fa=va(A,x,y,M),na(E,G,H,Y,L,B,0,0,1,0,0,1,fa)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,j.centroidWorld,j.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,
+1)),p.wireframe?ha(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(t)):p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshDepthMaterial)aa=h.near,ga=h.far,A.r=A.g=A.b=1-ma(a.positionScreen.z,aa,ga),x.r=x.g=x.b=1-ma(d.positionScreen.z,aa,ga),y.r=y.g=y.b=1-ma(f.positionScreen.z,aa,ga),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,fa=va(A,x,y,M),na(E,G,H,Y,L,B,0,0,1,0,0,1,fa);else if(p instanceof THREE.MeshNormalMaterial)t.r=
+oa(j.normalWorld.x),t.g=oa(j.normalWorld.y),t.b=oa(j.normalWorld.z),p.wireframe?ha(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(t)}function Q(a,d,f,g,i,k,j,p,l){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)D(a,d,g,0,1,3,j,p,l),D(i,f,k,1,2,3,j,p,l);else if(E=a.positionScreen.x,G=a.positionScreen.y,H=d.positionScreen.x,Y=d.positionScreen.y,L=f.positionScreen.x,B=f.positionScreen.y,T=g.positionScreen.x,v=g.positionScreen.y,R=i.positionScreen.x,
+P=i.positionScreen.y,W=k.positionScreen.x,K=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)N(E,G,H,Y,L,B,T,v),p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshLambertMaterial)xa?!p.wireframe&&p.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4?(A.r=x.r=y.r=M.r=$.r,A.g=x.g=y.g=M.g=$.g,A.b=x.b=y.b=M.b=$.b,n(m,j.v1.positionWorld,j.vertexNormalsWorld[0],A),n(m,j.v2.positionWorld,j.vertexNormalsWorld[1],x),
 n(m,j.v4.positionWorld,j.vertexNormalsWorld[3],y),n(m,j.v3.positionWorld,j.vertexNormalsWorld[2],M),A.r=Math.max(0,Math.min(p.color.r*A.r,1)),A.g=Math.max(0,Math.min(p.color.g*A.g,1)),A.b=Math.max(0,Math.min(p.color.b*A.b,1)),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.b,1)),M.r=Math.max(0,Math.min(p.color.r*
 n(m,j.v4.positionWorld,j.vertexNormalsWorld[3],y),n(m,j.v3.positionWorld,j.vertexNormalsWorld[2],M),A.r=Math.max(0,Math.min(p.color.r*A.r,1)),A.g=Math.max(0,Math.min(p.color.g*A.g,1)),A.b=Math.max(0,Math.min(p.color.b*A.b,1)),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.b,1)),M.r=Math.max(0,Math.min(p.color.r*
-M.r,1)),M.g=Math.max(0,Math.min(p.color.g*M.g,1)),M.b=Math.max(0,Math.min(p.color.b*M.b,1)),fa=va(A,x,y,M),I(G,H,U,Y,S,v),na(G,H,U,Y,S,v,0,0,1,0,0,1,fa),I(R,P,L,B,W,K),na(R,P,L,B,W,K,1,0,1,1,0,1,fa)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,j.centroidWorld,j.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1)),N(G,H,U,Y,L,B,S,v),p.wireframe?ha(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(t)):(N(G,H,U,
-Y,L,B,S,v),p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color));else if(p instanceof THREE.MeshNormalMaterial)t.r=oa(j.normalWorld.x),t.g=oa(j.normalWorld.y),t.b=oa(j.normalWorld.z),N(G,H,U,Y,L,B,S,v),p.wireframe?ha(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(t);else if(p instanceof THREE.MeshDepthMaterial)aa=h.near,ga=h.far,A.r=A.g=A.b=1-ma(a.positionScreen.z,aa,ga),x.r=x.g=x.b=1-ma(d.positionScreen.z,aa,ga),y.r=y.g=y.b=1-ma(g.positionScreen.z,
-aa,ga),M.r=M.g=M.b=1-ma(f.positionScreen.z,aa,ga),fa=va(A,x,y,M),I(G,H,U,Y,S,v),na(G,H,U,Y,S,v,0,0,1,0,0,1,fa),I(R,P,L,B,W,K),na(R,P,L,B,W,K,1,0,1,1,0,1,fa)}function I(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function N(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ha(a,b,c,e){if(F!=b)k.lineWidth=F=b;if(z!=c)k.lineCap=z=c;if(J!=e)k.lineJoin=J=e;d(a.getContextStyle());
+M.r,1)),M.g=Math.max(0,Math.min(p.color.g*M.g,1)),M.b=Math.max(0,Math.min(p.color.b*M.b,1)),fa=va(A,x,y,M),I(E,G,H,Y,T,v),na(E,G,H,Y,T,v,0,0,1,0,0,1,fa),I(R,P,L,B,W,K),na(R,P,L,B,W,K,1,0,1,1,0,1,fa)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,j.centroidWorld,j.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1)),N(E,G,H,Y,L,B,T,v),p.wireframe?ha(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(t)):(N(E,G,H,
+Y,L,B,T,v),p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color));else if(p instanceof THREE.MeshNormalMaterial)t.r=oa(j.normalWorld.x),t.g=oa(j.normalWorld.y),t.b=oa(j.normalWorld.z),N(E,G,H,Y,L,B,T,v),p.wireframe?ha(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(t);else if(p instanceof THREE.MeshDepthMaterial)aa=h.near,ga=h.far,A.r=A.g=A.b=1-ma(a.positionScreen.z,aa,ga),x.r=x.g=x.b=1-ma(d.positionScreen.z,aa,ga),y.r=y.g=y.b=1-ma(g.positionScreen.z,
+aa,ga),M.r=M.g=M.b=1-ma(f.positionScreen.z,aa,ga),fa=va(A,x,y,M),I(E,G,H,Y,T,v),na(E,G,H,Y,T,v,0,0,1,0,0,1,fa),I(R,P,L,B,W,K),na(R,P,L,B,W,K,1,0,1,1,0,1,fa)}function I(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function N(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ha(a,b,c,e){if(F!=b)k.lineWidth=F=b;if(z!=c)k.lineCap=z=c;if(J!=e)k.lineJoin=J=e;d(a.getContextStyle());
 k.stroke();X.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,i,j,l,m,o,n){if(n.image.width!=0){if(n.needsUpdate==!0||ka[n.id]==void 0){var q=n.wrapS==THREE.RepeatWrapping,r=n.wrapT==THREE.RepeatWrapping;ka[n.id]=k.createPattern(n.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");n.needsUpdate=!1}f(ka[n.id]);var q=n.offset.x/n.repeat.x,r=n.offset.y/n.repeat.y,s=(n.image.width-1)*n.repeat.x,n=(n.image.height-1)*n.repeat.y,h=(h+q)*s,i=(i+r)*n,j=
 k.stroke();X.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,i,j,l,m,o,n){if(n.image.width!=0){if(n.needsUpdate==!0||ka[n.id]==void 0){var q=n.wrapS==THREE.RepeatWrapping,r=n.wrapT==THREE.RepeatWrapping;ka[n.id]=k.createPattern(n.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");n.needsUpdate=!1}f(ka[n.id]);var q=n.offset.x/n.repeat.x,r=n.offset.y/n.repeat.y,s=(n.image.width-1)*n.repeat.x,n=(n.image.height-1)*n.repeat.y,h=(h+q)*s,i=(i+r)*n,j=
 (j+q)*s,l=(l+r)*n,m=(m+q)*s,o=(o+r)*n;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;m-=h;o-=i;q=1/(j*o-m*l);n=(o*c-l*e)*q;l=(o*d-l*g)*q;c=(j*e-m*c)*q;d=(j*g-m*d)*q;a=a-n*h-c*i;b=b-l*h-d*i;k.save();k.transform(n,l,c,d,a,b);k.fill();k.restore()}}function na(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;j*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);o=(m*c-j*e)*q;j=(m*d-j*f)*q;c=(i*e-l*c)*q;d=(i*f-l*d)*q;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();
 (j+q)*s,l=(l+r)*n,m=(m+q)*s,o=(o+r)*n;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;m-=h;o-=i;q=1/(j*o-m*l);n=(o*c-l*e)*q;l=(o*d-l*g)*q;c=(j*e-m*c)*q;d=(j*g-m*d)*q;a=a-n*h-c*i;b=b-l*h-d*i;k.save();k.transform(n,l,c,d,a,b);k.fill();k.restore()}}function na(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;j*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);o=(m*c-j*e)*q;j=(m*d-j*f)*q;c=(i*e-l*c)*q;d=(i*f-l*d)*q;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();
 k.drawImage(n,0,0);k.restore()}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ca[0]=e<0?0:e>255?255:e;ca[1]=f<0?0:f>255?255:f;ca[2]=a<0?0:a>255?255:a;ca[4]=g<0?0:g>255?255:g;ca[5]=h<0?0:h>255?255:h;ca[6]=b<0?0:b>255?255:b;ca[8]=i<0?0:i>255?255:i;ca[9]=j<0?0:j>255?255:j;ca[10]=c<0?0:c>255?255:c;ca[12]=k<0?0:k>255?255:k;ca[13]=l<0?0:l>255?255:l;ca[14]=d<0?
 k.drawImage(n,0,0);k.restore()}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ca[0]=e<0?0:e>255?255:e;ca[1]=f<0?0:f>255?255:f;ca[2]=a<0?0:a>255?255:a;ca[4]=g<0?0:g>255?255:g;ca[5]=h<0?0:h>255?255:h;ca[6]=b<0?0:b>255?255:b;ca[8]=i<0?0:i>255?255:i;ca[9]=j<0?0:j>255?255:j;ca[10]=c<0?0:c>255?255:c;ca[12]=k<0?0:k>255?255:k;ca[13]=l<0?0:l>255?255:l;ca[14]=d<0?
 0:d>255?255:d;qa.putImageData(ya,0,0);ua.drawImage(pa,0,0);return ra}function ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function oa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ja(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var wa,Ga,V,da;this.autoClear?this.clear():k.setTransform(1,0,0,-1,l,q);e.info.render.vertices=0;e.info.render.faces=0;g=o.projectScene(a,h,this.sortElements);i=g.elements;m=g.lights;(xa=m.length>0)&&j(m);wa=0;for(Ga=i.length;wa<
 0:d>255?255:d;qa.putImageData(ya,0,0);ua.drawImage(pa,0,0);return ra}function ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function oa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ja(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var wa,Ga,V,da;this.autoClear?this.clear():k.setTransform(1,0,0,-1,l,q);e.info.render.vertices=0;e.info.render.faces=0;g=o.projectScene(a,h,this.sortElements);i=g.elements;m=g.lights;(xa=m.length>0)&&j(m);wa=0;for(Ga=i.length;wa<
 Ga;wa++)if(V=i[wa],da=V.material,da=da instanceof THREE.MeshFaceMaterial?V.faceMaterial:da,!(da==null||da.opacity==0)){X.empty();if(V instanceof THREE.RenderableParticle)u=V,u.x*=l,u.y*=q,s(u,V,da,a);else if(V instanceof THREE.RenderableLine)u=V.v1,r=V.v2,u.positionScreen.x*=l,u.positionScreen.y*=q,r.positionScreen.x*=l,r.positionScreen.y*=q,X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),la.intersects(X)&&w(u,r,V,da,a);else if(V instanceof THREE.RenderableFace3)u=
 Ga;wa++)if(V=i[wa],da=V.material,da=da instanceof THREE.MeshFaceMaterial?V.faceMaterial:da,!(da==null||da.opacity==0)){X.empty();if(V instanceof THREE.RenderableParticle)u=V,u.x*=l,u.y*=q,s(u,V,da,a);else if(V instanceof THREE.RenderableLine)u=V.v1,r=V.v2,u.positionScreen.x*=l,u.positionScreen.y*=q,r.positionScreen.x*=l,r.positionScreen.y*=q,X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),la.intersects(X)&&w(u,r,V,da,a);else if(V instanceof THREE.RenderableFace3)u=
-V.v1,r=V.v2,C=V.v3,u.positionScreen.x*=l,u.positionScreen.y*=q,r.positionScreen.x*=l,r.positionScreen.y*=q,C.positionScreen.x*=l,C.positionScreen.y*=q,da.overdraw&&(ja(u.positionScreen,r.positionScreen),ja(r.positionScreen,C.positionScreen),ja(C.positionScreen,u.positionScreen)),X.add3Points(u.positionScreen.x,u.positionScreen.y,r.positionScreen.x,r.positionScreen.y,C.positionScreen.x,C.positionScreen.y),la.intersects(X)&&E(u,r,C,0,1,2,V,da,a);else if(V instanceof THREE.RenderableFace4)u=V.v1,r=V.v2,
-C=V.v3,O=V.v4,u.positionScreen.x*=l,u.positionScreen.y*=q,r.positionScreen.x*=l,r.positionScreen.y*=q,C.positionScreen.x*=l,C.positionScreen.y*=q,O.positionScreen.x*=l,O.positionScreen.y*=q,D.positionScreen.copy(r.positionScreen),ea.positionScreen.copy(O.positionScreen),da.overdraw&&(ja(u.positionScreen,r.positionScreen),ja(r.positionScreen,O.positionScreen),ja(O.positionScreen,u.positionScreen),ja(C.positionScreen,D.positionScreen),ja(C.positionScreen,ea.positionScreen)),X.addPoint(u.positionScreen.x,
-u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),X.addPoint(C.positionScreen.x,C.positionScreen.y),X.addPoint(O.positionScreen.x,O.positionScreen.y),la.intersects(X)&&Q(u,r,C,O,D,ea,V,da,a);Z.addRectangle(X)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+V.v1,r=V.v2,C=V.v3,u.positionScreen.x*=l,u.positionScreen.y*=q,r.positionScreen.x*=l,r.positionScreen.y*=q,C.positionScreen.x*=l,C.positionScreen.y*=q,da.overdraw&&(ja(u.positionScreen,r.positionScreen),ja(r.positionScreen,C.positionScreen),ja(C.positionScreen,u.positionScreen)),X.add3Points(u.positionScreen.x,u.positionScreen.y,r.positionScreen.x,r.positionScreen.y,C.positionScreen.x,C.positionScreen.y),la.intersects(X)&&D(u,r,C,0,1,2,V,da,a);else if(V instanceof THREE.RenderableFace4)u=V.v1,r=V.v2,
+C=V.v3,O=V.v4,u.positionScreen.x*=l,u.positionScreen.y*=q,r.positionScreen.x*=l,r.positionScreen.y*=q,C.positionScreen.x*=l,C.positionScreen.y*=q,O.positionScreen.x*=l,O.positionScreen.y*=q,S.positionScreen.copy(r.positionScreen),ea.positionScreen.copy(O.positionScreen),da.overdraw&&(ja(u.positionScreen,r.positionScreen),ja(r.positionScreen,O.positionScreen),ja(O.positionScreen,u.positionScreen),ja(C.positionScreen,S.positionScreen),ja(C.positionScreen,ea.positionScreen)),X.addPoint(u.positionScreen.x,
+u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),X.addPoint(C.positionScreen.x,C.positionScreen.y),X.addPoint(O.positionScreen.x,O.positionScreen.y),la.intersects(X)&&Q(u,r,C,O,S,ea,V,da,a);Z.addRectangle(X)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;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.faceMaterial=this.material=null;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.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=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.faceMaterial=this.material=null;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.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};

+ 18 - 18
build/custom/ThreeDOM.js

@@ -14,11 +14,11 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){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}};
 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){function c(a,b,c){h=h.copy(c).subSelf(a);n=h.dot(b);if(n<=0)return null;p=j.copy(a).addSelf(m.copy(b).multiplyScalar(n));return o=c.distanceTo(p)}function d(a,b,c,d){h.copy(d).subSelf(b);j.copy(c).subSelf(b);m.copy(a).subSelf(b);q=h.dot(h);E=h.dot(j);w=h.dot(m);F=j.dot(j);I=j.dot(m);s=1/(q*F-E*E);A=(F*w-E*I)*s;t=(q*I-E*w)*s;return A>=0&&t>=0&&A+t<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+THREE.Ray=function(a,b){function c(a,b,c){h=h.copy(c).subSelf(a);n=h.dot(b);if(n<=0)return null;p=j.copy(a).addSelf(m.copy(b).multiplyScalar(n));return o=c.distanceTo(p)}function d(a,b,c,d){h.copy(d).subSelf(b);j.copy(c).subSelf(b);m.copy(a).subSelf(b);q=h.dot(h);D=h.dot(j);v=h.dot(m);E=j.dot(j);J=j.dot(m);s=1/(q*E-D*D);z=(E*v-D*J)*s;t=(q*J-D*v)*s;return z>=0&&t>=0&&z+t<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
 this.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};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(h){for(var j,n=[],m=0,o=h.children.length;m<o;m++)Array.prototype.push.apply(n,this.intersectObject(h.children[m]));
 this.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};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(h){for(var j,n=[],m=0,o=h.children.length;m<o;m++)Array.prototype.push.apply(n,this.intersectObject(h.children[m]));
-if(h instanceof THREE.Particle){m=c(this.origin,this.direction,h.matrixWorld.getPosition());if(m===null||m>h.scale.x)return[];j={distance:m,point:h.position,face:null,object:h};n.push(j)}else if(h instanceof THREE.Mesh){m=c(this.origin,this.direction,h.matrixWorld.getPosition());if(m===null||m>h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)))return n;var v,O=h.geometry,p=O.vertices,K;h.matrixRotationWorld.extractRotation(h.matrixWorld);m=0;for(o=O.faces.length;m<
-o;m++)if(j=O.faces[m],a=a.copy(this.origin),b=b.copy(this.direction),K=h.matrixWorld,k=K.multiplyVector3(k.copy(j.centroid)).subSelf(a),v=k.dot(b),!(v<=0)&&(e=K.multiplyVector3(e.copy(p[j.a].position)),f=K.multiplyVector3(f.copy(p[j.b].position)),g=K.multiplyVector3(g.copy(p[j.c].position)),i=j instanceof THREE.Face4?K.multiplyVector3(i.copy(p[j.d].position)):null,l=h.matrixRotationWorld.multiplyVector3(l.copy(j.normal)),v=b.dot(l),h.doubleSided||(h.flipSided?v>0:v<0)))if(v=l.dot(k.sub(e,a))/v,v=
-a.clone().addSelf(b.multiplyScalar(v)),j instanceof THREE.Face3)d(v,e,f,g)&&(j={distance:a.distanceTo(v),point:v,face:j,object:h},n.push(j));else if(j instanceof THREE.Face4&&(d(v,e,f,i)||d(v,f,g,i)))j={distance:a.distanceTo(v),point:v,face:j,object:h},n.push(j)}return n};var h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,n,p,o,q,E,w,F,I,s,A,t};
+if(h instanceof THREE.Particle){m=c(this.origin,this.direction,h.matrixWorld.getPosition());if(m===null||m>h.scale.x)return[];j={distance:m,point:h.position,face:null,object:h};n.push(j)}else if(h instanceof THREE.Mesh){m=c(this.origin,this.direction,h.matrixWorld.getPosition());if(m===null||m>h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)))return n;var F,P=h.geometry,p=P.vertices,L,G=new THREE.Vector3;h.matrixRotationWorld.extractRotation(h.matrixWorld);m=0;for(o=
+P.faces.length;m<o;m++)if(j=P.faces[m],a=a.copy(this.origin),b=b.copy(this.direction),L=h.matrixWorld,k=L.multiplyVector3(k.copy(j.centroid)).subSelf(a),F=k.dot(b),!(F<=0)&&(e=L.multiplyVector3(e.copy(p[j.a].position)),f=L.multiplyVector3(f.copy(p[j.b].position)),g=L.multiplyVector3(g.copy(p[j.c].position)),i=j instanceof THREE.Face4?L.multiplyVector3(i.copy(p[j.d].position)):null,l=h.matrixRotationWorld.multiplyVector3(l.copy(j.normal)),F=b.dot(l),h.doubleSided||(h.flipSided?F>0:F<0)))if(F=l.dot(k.sub(e,
+a))/F,G.add(a,b.multiplyScalar(F)),j instanceof THREE.Face3)d(G,e,f,g)&&(j={distance:a.distanceTo(G),point:G.clone(),face:j,object:h},n.push(j));else if(j instanceof THREE.Face4&&(d(G,e,f,i)||d(G,f,g,i)))j={distance:a.distanceTo(G),point:G.clone(),face:j,object:h},n.push(j)}return n};var h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,n,p,o,q,D,v,E,J,s,z,t};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,f,g,j){i=!1;b=k;c=f;d=g;e=j;a()};this.addPoint=function(f,g){i?(i=!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(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,f,g,j){i=!1;b=k;c=f;d=g;e=j;a()};this.addPoint=function(f,g){i?(i=!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,h,j,m,n){i?(i=!1,b=f<h?f<m?f:m:h<m?h:m,c=g<j?g<n?g:n:j<n?j:n,d=f>h?f>m?f:m:h>m?h:m,e=g>j?g>n?g:n:j>n?j:n):(b=f<h?f<m?f<b?f:b:m<b?m:b:h<m?h<b?h:b:m<b?m:b,c=g<j?g<n?g<c?g:c:n<c?n:c:j<n?j<c?j:c:n<c?n:c,d=f>h?f>m?f>d?f:d:m>d?m:d:h>m?h>d?h:d:m>d?m:d,e=g>j?g>n?g>e?g:e:n>e?n:e:j>n?j>e?j:e:n>e?n:e);a()};this.addRectangle=function(f){i?(i=!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,h,j,m,n){i?(i=!1,b=f<h?f<m?f:m:h<m?h:m,c=g<j?g<n?g:n:j<n?j:n,d=f>h?f>m?f:m:h>m?h:m,e=g>j?g>n?g:n:j>n?j:n):(b=f<h?f<m?f<b?f:b:m<b?m:b:h<m?h<b?h:b:m<b?m:b,c=g<j?g<n?g<c?g:c:n<c?n:c:j<n?j<c?j:c:n<c?n:c,d=f>h?f>m?f>d?f:d:m>d?m:d:h>m?h>d?h:d:m>d?m:d,e=g>j?g>n?g>e?g:e:n>e?n:e:j>n?j>e?j:e:n>e?n:e);a()};this.addRectangle=function(f){i?(i=!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>
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
@@ -27,8 +27,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,e,f,g,i,k,l,h,j,m,n,p,o){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,i||0,k||0,l||0,h!==void 0?h:1,j||0,m||0,n||0,p||0,o!==void 0?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4=function(a,b,c,d,e,f,g,i,k,l,h,j,m,n,p,o){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,i||0,k||0,l||0,h!==void 0?h:1,j||0,m||0,n||0,p||0,o!==void 0?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,k,l,h,j,m,n,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=k;this.n32=l;this.n33=h;this.n34=j;this.n41=m;this.n42=n;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,k,l,h,j,m,n,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=k;this.n32=l;this.n33=h;this.n34=j;this.n41=m;this.n42=n;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,k=a.n23,l=a.n24,h=a.n31,j=a.n32,m=a.n33,n=a.n34,p=a.n41,o=a.n42,q=a.n43,
 b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,k=a.n23,l=a.n24,h=a.n31,j=a.n32,m=a.n33,n=a.n34,p=a.n41,o=a.n42,q=a.n43,
-E=a.n44,w=b.n11,F=b.n12,I=b.n13,s=b.n14,A=b.n21,t=b.n22,C=b.n23,N=b.n24,z=b.n31,H=b.n32,J=b.n33,v=b.n34,O=b.n41,R=b.n42,K=b.n43,S=b.n44;this.n11=c*w+d*A+e*z+f*O;this.n12=c*F+d*t+e*H+f*R;this.n13=c*I+d*C+e*J+f*K;this.n14=c*s+d*N+e*v+f*S;this.n21=g*w+i*A+k*z+l*O;this.n22=g*F+i*t+k*H+l*R;this.n23=g*I+i*C+k*J+l*K;this.n24=g*s+i*N+k*v+l*S;this.n31=h*w+j*A+m*z+n*O;this.n32=h*F+j*t+m*H+n*R;this.n33=h*I+j*C+m*J+n*K;this.n34=h*s+j*N+m*v+n*S;this.n41=p*w+o*A+q*z+E*O;this.n42=p*F+o*t+q*H+E*R;this.n43=p*I+o*
-C+q*J+E*K;this.n44=p*s+o*N+q*v+E*S;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+D=a.n44,v=b.n11,E=b.n12,J=b.n13,s=b.n14,z=b.n21,t=b.n22,B=b.n23,O=b.n24,y=b.n31,I=b.n32,K=b.n33,F=b.n34,P=b.n41,S=b.n42,L=b.n43,G=b.n44;this.n11=c*v+d*z+e*y+f*P;this.n12=c*E+d*t+e*I+f*S;this.n13=c*J+d*B+e*K+f*L;this.n14=c*s+d*O+e*F+f*G;this.n21=g*v+i*z+k*y+l*P;this.n22=g*E+i*t+k*I+l*S;this.n23=g*J+i*B+k*K+l*L;this.n24=g*s+i*O+k*F+l*G;this.n31=h*v+j*z+m*y+n*P;this.n32=h*E+j*t+m*I+n*S;this.n33=h*J+j*B+m*K+n*L;this.n34=h*s+j*O+m*F+n*G;this.n41=p*v+o*z+q*y+D*P;this.n42=p*E+o*t+q*I+D*S;this.n43=p*J+o*
+B+q*K+D*L;this.n44=p*s+o*O+q*F+D*G;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,k=this.n31,l=this.n32,h=this.n33,j=this.n34,m=this.n41,n=this.n42,p=this.n43,o=this.n44;return d*g*l*m-c*i*l*m-d*f*h*m+b*i*h*m+c*f*j*m-b*g*j*m-d*g*k*n+c*i*k*n+d*e*h*n-a*i*h*n-c*e*j*n+a*g*j*n+d*f*k*p-b*i*k*p-d*e*l*p+a*i*l*p+b*e*j*p-a*f*j*p-c*f*k*o+b*g*k*o+c*e*l*o-a*g*l*o-b*e*h*o+a*f*h*o},transpose:function(){var a;
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,k=this.n31,l=this.n32,h=this.n33,j=this.n34,m=this.n41,n=this.n42,p=this.n43,o=this.n44;return d*g*l*m-c*i*l*m-d*f*h*m+b*i*h*m+c*f*j*m-b*g*j*m-d*g*k*n+c*i*k*n+d*e*h*n-a*i*h*n-c*e*j*n+a*g*j*n+d*f*k*p-b*i*k*p-d*e*l*p+a*i*l*p+b*e*j*p-a*f*j*p-c*f*k*o+b*g*k*o+c*e*l*o-a*g*l*o-b*e*h*o+a*f*h*o},transpose:function(){var a;
@@ -55,24 +55,24 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[k]=l[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,f,g=[],i,k,l=[],
 THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[k]=l[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,f,g=[],i,k,l=[],
-h,j,m=[],n,p=[],o,q,E=[],w,F,I=[],s={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,t=new THREE.Vector4,C=new THREE.Matrix4,N=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,J=new THREE.Vector4;this.computeFrustum=function(a){z[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);z[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=z[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-C.multiply(b.matrixWorld,b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=z[h].x*d.n14+z[h].y*d.n24+z[h].z*d.n34+z[h].w,c<=f){c=!1;break a}c=!0}c?(C.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,s.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(C.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,s.sprites.push(e)):b instanceof THREE.Light&&s.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-s.objects.sort(c);return s};this.projectScene=function(a,e,f){var g=e.near,z=e.far,A,L,y,G,r,B,x,D,u,M,P,T,W,U,V,Q;F=q=n=j=0;s.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);C.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(C);s=this.projectGraph(a,!1);a=0;for(A=s.objects.length;a<A;a++)if(u=s.objects[a].object,M=u.matrixWorld,T=
-u.material,k=0,u instanceof THREE.Mesh){P=u.geometry;W=u.geometry.materials;G=P.vertices;U=P.faces;V=P.faceVertexUvs;P=u.matrixRotationWorld.extractRotation(M);L=0;for(y=G.length;L<y;L++)i=b(),i.positionWorld.copy(G[L].position),M.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),C.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<z;G=0;for(L=U.length;G<L;G++){y=U[G];
-if(y instanceof THREE.Face3)if(r=l[y.a],B=l[y.b],x=l[y.c],r.visible&&B.visible&&x.visible&&(u.doubleSided||u.flipSided!=(x.positionScreen.x-r.positionScreen.x)*(B.positionScreen.y-r.positionScreen.y)-(x.positionScreen.y-r.positionScreen.y)*(B.positionScreen.x-r.positionScreen.x)<0))D=m[j]=m[j]||new THREE.RenderableFace3,j++,h=D,h.v1.copy(r),h.v2.copy(B),h.v3.copy(x);else continue;else if(y instanceof THREE.Face4)if(r=l[y.a],B=l[y.b],x=l[y.c],D=l[y.d],r.visible&&B.visible&&x.visible&&D.visible&&(u.doubleSided||
-u.flipSided!=((D.positionScreen.x-r.positionScreen.x)*(B.positionScreen.y-r.positionScreen.y)-(D.positionScreen.y-r.positionScreen.y)*(B.positionScreen.x-r.positionScreen.x)<0||(B.positionScreen.x-x.positionScreen.x)*(D.positionScreen.y-x.positionScreen.y)-(B.positionScreen.y-x.positionScreen.y)*(D.positionScreen.x-x.positionScreen.x)<0)))Q=p[n]=p[n]||new THREE.RenderableFace4,n++,h=Q,h.v1.copy(r),h.v2.copy(B),h.v3.copy(x),h.v4.copy(D);else continue;h.normalWorld.copy(y.normal);P.multiplyVector3(h.normalWorld);
-h.centroidWorld.copy(y.centroid);M.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);C.multiplyVector3(h.centroidScreen);x=y.vertexNormals;r=0;for(B=x.length;r<B;r++)D=h.vertexNormalsWorld[r],D.copy(x[r]),P.multiplyVector3(D);r=0;for(B=V.length;r<B;r++)if(Q=V[r][G]){x=0;for(D=Q.length;x<D;x++)h.uvs[r][x]=Q[x]}h.material=T;h.faceMaterial=y.materialIndex!==null?W[y.materialIndex]:null;h.z=h.centroidScreen.z;s.elements.push(h)}}else if(u instanceof THREE.Line){N.multiply(C,M);G=
-u.geometry.vertices;r=b();r.positionScreen.copy(G[0].position);N.multiplyVector4(r.positionScreen);L=1;for(y=G.length;L<y;L++)if(r=b(),r.positionScreen.copy(G[L].position),N.multiplyVector4(r.positionScreen),B=l[k-2],H.copy(r.positionScreen),J.copy(B.positionScreen),d(H,J))H.multiplyScalar(1/H.w),J.multiplyScalar(1/J.w),u=E[q]=E[q]||new THREE.RenderableLine,q++,o=u,o.v1.positionScreen.copy(H),o.v2.positionScreen.copy(J),o.z=Math.max(H.z,J.z),o.material=T,s.elements.push(o)}a=0;for(A=s.sprites.length;a<
-A;a++)if(u=s.sprites[a].object,M=u.matrixWorld,u instanceof THREE.Particle&&(t.set(M.n14,M.n24,M.n34,1),C.multiplyVector4(t),t.z/=t.w,t.z>0&&t.z<1))g=I[F]=I[F]||new THREE.RenderableParticle,F++,w=g,w.x=t.x/t.w,w.y=t.y/t.w,w.z=t.z,w.rotation=u.rotation.z,w.scale.x=u.scale.x*Math.abs(w.x-(t.x+e.projectionMatrix.n11)/(t.w+e.projectionMatrix.n14)),w.scale.y=u.scale.y*Math.abs(w.y-(t.y+e.projectionMatrix.n22)/(t.w+e.projectionMatrix.n24)),w.material=u.material,s.elements.push(w);f&&s.elements.sort(c);
+h,j,m=[],n,p=[],o,q,D=[],v,E,J=[],s={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,t=new THREE.Vector4,B=new THREE.Matrix4,O=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,K=new THREE.Vector4;this.computeFrustum=function(a){y[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);y[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);y[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);y[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);y[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);y[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=y[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
+f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=y[h].x*d.n14+y[h].y*d.n24+y[h].z*d.n34+y[h].w,c<=f){c=!1;break a}c=!0}c?(B.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,s.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(B.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,s.sprites.push(e)):b instanceof THREE.Light&&s.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
+s.objects.sort(c);return s};this.projectScene=function(a,e,f){var g=e.near,y=e.far,z,M,x,H,r,A,w,C,u,N,Q,T,W,U,V,R;E=q=n=j=0;s.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(B);s=this.projectGraph(a,!1);a=0;for(z=s.objects.length;a<z;a++)if(u=s.objects[a].object,N=u.matrixWorld,T=
+u.material,k=0,u instanceof THREE.Mesh){Q=u.geometry;W=u.geometry.materials;H=Q.vertices;U=Q.faces;V=Q.faceVertexUvs;Q=u.matrixRotationWorld.extractRotation(N);M=0;for(x=H.length;M<x;M++)i=b(),i.positionWorld.copy(H[M].position),N.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),B.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<y;H=0;for(M=U.length;H<M;H++){x=U[H];
+if(x instanceof THREE.Face3)if(r=l[x.a],A=l[x.b],w=l[x.c],r.visible&&A.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-r.positionScreen.x)*(A.positionScreen.y-r.positionScreen.y)-(w.positionScreen.y-r.positionScreen.y)*(A.positionScreen.x-r.positionScreen.x)<0))C=m[j]=m[j]||new THREE.RenderableFace3,j++,h=C,h.v1.copy(r),h.v2.copy(A),h.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(r=l[x.a],A=l[x.b],w=l[x.c],C=l[x.d],r.visible&&A.visible&&w.visible&&C.visible&&(u.doubleSided||
+u.flipSided!=((C.positionScreen.x-r.positionScreen.x)*(A.positionScreen.y-r.positionScreen.y)-(C.positionScreen.y-r.positionScreen.y)*(A.positionScreen.x-r.positionScreen.x)<0||(A.positionScreen.x-w.positionScreen.x)*(C.positionScreen.y-w.positionScreen.y)-(A.positionScreen.y-w.positionScreen.y)*(C.positionScreen.x-w.positionScreen.x)<0)))R=p[n]=p[n]||new THREE.RenderableFace4,n++,h=R,h.v1.copy(r),h.v2.copy(A),h.v3.copy(w),h.v4.copy(C);else continue;h.normalWorld.copy(x.normal);Q.multiplyVector3(h.normalWorld);
+h.centroidWorld.copy(x.centroid);N.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);B.multiplyVector3(h.centroidScreen);w=x.vertexNormals;r=0;for(A=w.length;r<A;r++)C=h.vertexNormalsWorld[r],C.copy(w[r]),Q.multiplyVector3(C);r=0;for(A=V.length;r<A;r++)if(R=V[r][H]){w=0;for(C=R.length;w<C;w++)h.uvs[r][w]=R[w]}h.material=T;h.faceMaterial=x.materialIndex!==null?W[x.materialIndex]:null;h.z=h.centroidScreen.z;s.elements.push(h)}}else if(u instanceof THREE.Line){O.multiply(B,N);H=
+u.geometry.vertices;r=b();r.positionScreen.copy(H[0].position);O.multiplyVector4(r.positionScreen);M=1;for(x=H.length;M<x;M++)if(r=b(),r.positionScreen.copy(H[M].position),O.multiplyVector4(r.positionScreen),A=l[k-2],I.copy(r.positionScreen),K.copy(A.positionScreen),d(I,K))I.multiplyScalar(1/I.w),K.multiplyScalar(1/K.w),u=D[q]=D[q]||new THREE.RenderableLine,q++,o=u,o.v1.positionScreen.copy(I),o.v2.positionScreen.copy(K),o.z=Math.max(I.z,K.z),o.material=T,s.elements.push(o)}a=0;for(z=s.sprites.length;a<
+z;a++)if(u=s.sprites[a].object,N=u.matrixWorld,u instanceof THREE.Particle&&(t.set(N.n14,N.n24,N.n34,1),B.multiplyVector4(t),t.z/=t.w,t.z>0&&t.z<1))g=J[E]=J[E]||new THREE.RenderableParticle,E++,v=g,v.x=t.x/t.w,v.y=t.y/t.w,v.z=t.z,v.rotation=u.rotation.z,v.scale.x=u.scale.x*Math.abs(v.x-(t.x+e.projectionMatrix.n11)/(t.w+e.projectionMatrix.n14)),v.scale.y=u.scale.y*Math.abs(v.y-(t.y+e.projectionMatrix.n22)/(t.w+e.projectionMatrix.n24)),v.material=u.material,s.elements.push(v);f&&s.elements.sort(c);
 return s}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 return s}};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),f=Math.cos(c),c=Math.sin(c),g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-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),f=Math.cos(c),c=Math.sin(c),g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-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,f=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-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,e=a.z,f=this.x,g=this.y,i=this.z,k=this.w,l=k*c+g*e-i*d,h=k*d+i*c-f*e,j=k*e+f*d-g*c,c=-f*
 this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-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,e=a.z,f=this.x,g=this.y,i=this.z,k=this.w,l=k*c+g*e-i*d,h=k*d+i*c-f*e,j=k*e+f*d-g*c,c=-f*
 c-g*d-i*e;b.x=l*k+c*-f+h*-i-j*-g;b.y=h*k+c*-g+j*-f-l*-i;b.z=j*k+c*-i+l*-g-h*-f;return b}};
 c-g*d-i*e;b.x=l*k+c*-f+h*-i-j*-g;b.y=h*k+c*-g+j*-f-l*-i;b.z=j*k+c*-i+l*-g-h*-f;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;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)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;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+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;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<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;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){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=f;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){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=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;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=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;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=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 4 - 4
build/custom/ThreeExtras.js

@@ -96,7 +96,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -106,14 +106,14 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b)
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,p=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:c,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)p=c*h.chunks[g]/h.total,b.keys[g]={time:p,pos:f[g]};e.hierarchy[0]=
 THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,p=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:c,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)p=c*h.chunks[g]/h.total,b.keys[g]={time:p,pos:f[g]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 !1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -157,7 +157,7 @@ THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THRE
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=f.vertices[a].position,e=f.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var f=this,g=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 d=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=f.vertices[a].position,e=f.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var f=this,g=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,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),j=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);b(g.faces[h].a,i,k,a);b(g.faces[h].b,j,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),j=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);b(g.faces[h].a,i,k,a);b(g.faces[h].b,j,
 i,a);b(g.faces[h].c,k,j,a);b(i,j,k,a)}g.faces=a.faces}f.faces=g.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 i,a);b(g.faces[h].c,k,j,a);b(i,j,k,a)}g.faces=a.faces}f.faces=g.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),f[h]=this.vertices.length-1):f=g;i==0&&(g=d);
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),f[h]=this.vertices.length-1):f=g;i==0&&(g=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,f(a,b),f(a,c),h),d(f(a,b),b,f(b,c),h),d(f(a,c),f(b,c),c,h),d(f(a,b),f(b,c),f(a,c),h))}function f(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
 e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,f(a,b),f(a,c),h),d(f(a,b),b,f(b,c),h),d(f(a,c),f(b,c),c,h),d(f(a,b),f(b,c),f(a,c),h))}function f(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===

+ 26 - 26
build/custom/ThreeSVG.js

@@ -14,11 +14,11 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){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}};
 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){function c(a,b,c){h=h.copy(c).subSelf(a);m=h.dot(b);if(m<=0)return null;o=j.copy(a).addSelf(n.copy(b).multiplyScalar(m));return q=c.distanceTo(o)}function d(a,b,c,d){h.copy(d).subSelf(b);j.copy(c).subSelf(b);n.copy(a).subSelf(b);u=h.dot(h);G=h.dot(j);x=h.dot(n);F=j.dot(j);s=j.dot(n);t=1/(u*F-G*G);D=(F*x-G*s)*t;y=(u*s-G*x)*t;return D>=0&&y>=0&&D+y<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+THREE.Ray=function(a,b){function c(a,b,c){h=h.copy(c).subSelf(a);m=h.dot(b);if(m<=0)return null;o=j.copy(a).addSelf(n.copy(b).multiplyScalar(m));return q=c.distanceTo(o)}function d(a,b,c,d){h.copy(d).subSelf(b);j.copy(c).subSelf(b);n.copy(a).subSelf(b);u=h.dot(h);G=h.dot(j);x=h.dot(n);E=j.dot(j);s=j.dot(n);t=1/(u*E-G*G);C=(E*x-G*s)*t;y=(u*s-G*x)*t;return C>=0&&y>=0&&C+y<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
 this.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};var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(h){for(var j,m=[],n=0,o=h.children.length;n<o;n++)Array.prototype.push.apply(m,this.intersectObject(h.children[n]));
 this.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};var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(h){for(var j,m=[],n=0,o=h.children.length;n<o;n++)Array.prototype.push.apply(m,this.intersectObject(h.children[n]));
-if(h instanceof THREE.Particle){n=c(this.origin,this.direction,h.matrixWorld.getPosition());if(n===null||n>h.scale.x)return[];j={distance:n,point:h.position,face:null,object:h};m.push(j)}else if(h instanceof THREE.Mesh){n=c(this.origin,this.direction,h.matrixWorld.getPosition());if(n===null||n>h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)))return m;var B,q=h.geometry,s=q.vertices,M;h.matrixRotationWorld.extractRotation(h.matrixWorld);n=0;for(o=q.faces.length;n<
-o;n++)if(j=q.faces[n],a=a.copy(this.origin),b=b.copy(this.direction),M=h.matrixWorld,k=M.multiplyVector3(k.copy(j.centroid)).subSelf(a),B=k.dot(b),!(B<=0)&&(f=M.multiplyVector3(f.copy(s[j.a].position)),e=M.multiplyVector3(e.copy(s[j.b].position)),g=M.multiplyVector3(g.copy(s[j.c].position)),i=j instanceof THREE.Face4?M.multiplyVector3(i.copy(s[j.d].position)):null,l=h.matrixRotationWorld.multiplyVector3(l.copy(j.normal)),B=b.dot(l),h.doubleSided||(h.flipSided?B>0:B<0)))if(B=l.dot(k.sub(f,a))/B,B=
-a.clone().addSelf(b.multiplyScalar(B)),j instanceof THREE.Face3)d(B,f,e,g)&&(j={distance:a.distanceTo(B),point:B,face:j,object:h},m.push(j));else if(j instanceof THREE.Face4&&(d(B,f,e,i)||d(B,e,g,i)))j={distance:a.distanceTo(B),point:B,face:j,object:h},m.push(j)}return m};var h=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,m,o,q,u,G,x,F,s,t,D,y};
+if(h instanceof THREE.Particle){n=c(this.origin,this.direction,h.matrixWorld.getPosition());if(n===null||n>h.scale.x)return[];j={distance:n,point:h.position,face:null,object:h};m.push(j)}else if(h instanceof THREE.Mesh){n=c(this.origin,this.direction,h.matrixWorld.getPosition());if(n===null||n>h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)))return m;var F,q=h.geometry,s=q.vertices,M,N=new THREE.Vector3;h.matrixRotationWorld.extractRotation(h.matrixWorld);n=0;for(o=
+q.faces.length;n<o;n++)if(j=q.faces[n],a=a.copy(this.origin),b=b.copy(this.direction),M=h.matrixWorld,k=M.multiplyVector3(k.copy(j.centroid)).subSelf(a),F=k.dot(b),!(F<=0)&&(f=M.multiplyVector3(f.copy(s[j.a].position)),e=M.multiplyVector3(e.copy(s[j.b].position)),g=M.multiplyVector3(g.copy(s[j.c].position)),i=j instanceof THREE.Face4?M.multiplyVector3(i.copy(s[j.d].position)):null,l=h.matrixRotationWorld.multiplyVector3(l.copy(j.normal)),F=b.dot(l),h.doubleSided||(h.flipSided?F>0:F<0)))if(F=l.dot(k.sub(f,
+a))/F,N.add(a,b.multiplyScalar(F)),j instanceof THREE.Face3)d(N,f,e,g)&&(j={distance:a.distanceTo(N),point:N.clone(),face:j,object:h},m.push(j));else if(j instanceof THREE.Face4&&(d(N,f,e,i)||d(N,e,g,i)))j={distance:a.distanceTo(N),point:N.clone(),face:j,object:h},m.push(j)}return m};var h=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,m,o,q,u,G,x,E,s,t,C,y};
 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,h,j){i=!1;b=e;c=g;d=h;f=j;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,h,j){i=!1;b=e;c=g;d=h;f=j;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,h,j,n,m){i?(i=!1,b=e<h?e<n?e:n:h<n?h:n,c=g<j?g<m?g:m:j<m?j:m,d=e>h?e>n?e:n:h>n?h:n,f=g>j?g>m?g:m:j>m?j:m):(b=e<h?e<n?e<b?e:b:n<b?n:b:h<n?h<b?h:b:n<b?n:b,c=g<j?g<m?g<c?g:c:m<c?m:c:j<m?j<c?j:c:m<c?m:c,d=e>h?e>n?e>d?e:d:n>d?n:d:h>n?h>d?h:d:n>d?n:d,f=g>j?g>m?g>f?g:f:m>f?m:f:j>m?j>f?j:f:m>f?m: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,h,j,n,m){i?(i=!1,b=e<h?e<n?e:n:h<n?h:n,c=g<j?g<m?g:m:j<m?j:m,d=e>h?e>n?e:n:h>n?h:n,f=g>j?g>m?g:m:j>m?j:m):(b=e<h?e<n?e<b?e:b:n<b?n:b:h<n?h<b?h:b:n<b?n:b,c=g<j?g<m?g<c?g:c:m<c?m:c:j<m?j<c?j:c:m<c?m:c,d=e>h?e>n?e>d?e:d:n>d?n:d:h>n?h>d?h:d:n>d?n:d,f=g>j?g>m?g>f?g:f:m>f?m:f:j>m?j>f?j:f:m>f?m: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>
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=d=c=b=0;a()};this.isEmpty=function(){return i}};
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=d=c=b=0;a()};this.isEmpty=function(){return i}};
@@ -27,8 +27,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,f,e,g,i,k,l,h,j,n,m,o,q){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,i||0,k||0,l||0,h!==void 0?h:1,j||0,n||0,m||0,o||0,q!==void 0?q:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4=function(a,b,c,d,f,e,g,i,k,l,h,j,n,m,o,q){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,i||0,k||0,l||0,h!==void 0?h:1,j||0,n||0,m||0,o||0,q!==void 0?q:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,i,k,l,h,j,n,m,o,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=i;this.n31=k;this.n32=l;this.n33=h;this.n34=j;this.n41=n;this.n42=m;this.n43=o;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,i,k,l,h,j,n,m,o,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=i;this.n31=k;this.n32=l;this.n33=h;this.n34=j;this.n41=n;this.n42=m;this.n43=o;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply: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,l=a.n24,h=a.n31,j=a.n32,n=a.n33,m=a.n34,o=a.n41,q=a.n42,u=a.n43,
 b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply: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,l=a.n24,h=a.n31,j=a.n32,n=a.n33,m=a.n34,o=a.n41,q=a.n42,u=a.n43,
-G=a.n44,x=b.n11,F=b.n12,s=b.n13,t=b.n14,D=b.n21,y=b.n22,A=b.n23,I=b.n24,w=b.n31,J=b.n32,z=b.n33,B=b.n34,N=b.n41,L=b.n42,M=b.n43,S=b.n44;this.n11=c*x+d*D+f*w+e*N;this.n12=c*F+d*y+f*J+e*L;this.n13=c*s+d*A+f*z+e*M;this.n14=c*t+d*I+f*B+e*S;this.n21=g*x+i*D+k*w+l*N;this.n22=g*F+i*y+k*J+l*L;this.n23=g*s+i*A+k*z+l*M;this.n24=g*t+i*I+k*B+l*S;this.n31=h*x+j*D+n*w+m*N;this.n32=h*F+j*y+n*J+m*L;this.n33=h*s+j*A+n*z+m*M;this.n34=h*t+j*I+n*B+m*S;this.n41=o*x+q*D+u*w+G*N;this.n42=o*F+q*y+u*J+G*L;this.n43=o*s+q*
-A+u*z+G*M;this.n44=o*t+q*I+u*B+G*S;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+G=a.n44,x=b.n11,E=b.n12,s=b.n13,t=b.n14,C=b.n21,y=b.n22,A=b.n23,I=b.n24,w=b.n31,J=b.n32,z=b.n33,F=b.n34,O=b.n41,L=b.n42,M=b.n43,N=b.n44;this.n11=c*x+d*C+f*w+e*O;this.n12=c*E+d*y+f*J+e*L;this.n13=c*s+d*A+f*z+e*M;this.n14=c*t+d*I+f*F+e*N;this.n21=g*x+i*C+k*w+l*O;this.n22=g*E+i*y+k*J+l*L;this.n23=g*s+i*A+k*z+l*M;this.n24=g*t+i*I+k*F+l*N;this.n31=h*x+j*C+n*w+m*O;this.n32=h*E+j*y+n*J+m*L;this.n33=h*s+j*A+n*z+m*M;this.n34=h*t+j*I+n*F+m*N;this.n41=o*x+q*C+u*w+G*O;this.n42=o*E+q*y+u*J+G*L;this.n43=o*s+q*
+A+u*z+G*M;this.n44=o*t+q*I+u*F+G*N;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,i=this.n24,k=this.n31,l=this.n32,h=this.n33,j=this.n34,n=this.n41,m=this.n42,o=this.n43,q=this.n44;return d*g*l*n-c*i*l*n-d*e*h*n+b*i*h*n+c*e*j*n-b*g*j*n-d*g*k*m+c*i*k*m+d*f*h*m-a*i*h*m-c*f*j*m+a*g*j*m+d*e*k*o-b*i*k*o-d*f*l*o+a*i*l*o+b*f*j*o-a*e*j*o-c*e*k*q+b*g*k*q+c*f*l*q-a*g*l*q-b*f*h*q+a*e*h*q},transpose:function(){var a;
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,i=this.n24,k=this.n31,l=this.n32,h=this.n33,j=this.n34,n=this.n41,m=this.n42,o=this.n43,q=this.n44;return d*g*l*n-c*i*l*n-d*e*h*n+b*i*h*n+c*e*j*n-b*g*j*n-d*g*k*m+c*i*k*m+d*f*h*m-a*i*h*m-c*f*j*m+a*g*j*m+d*e*k*o-b*i*k*o-d*f*l*o+a*i*l*o+b*f*j*o-a*e*j*o-c*e*k*q+b*g*k*q+c*f*l*q-a*g*l*q-b*f*h*q+a*e*h*q},transpose:function(){var a;
@@ -55,24 +55,24 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=l[k]=l[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],i,k,l=[],
 THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=l[k]=l[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],i,k,l=[],
-h,j,n=[],m,o=[],q,u,G=[],x,F,s=[],t={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,y=new THREE.Vector4,A=new THREE.Matrix4,I=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,z=new THREE.Vector4;this.computeFrustum=function(a){w[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);w[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);w[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+h,j,n=[],m,o=[],q,u,G=[],x,E,s=[],t={objects:[],sprites:[],lights:[],elements:[]},C=new THREE.Vector3,y=new THREE.Vector4,A=new THREE.Matrix4,I=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,z=new THREE.Vector4;this.computeFrustum=function(a){w[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);w[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);w[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
 a.n23,a.n44+a.n24);w[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);w[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);w[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=w[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 a.n23,a.n44+a.n24);w[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);w[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);w[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=w[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 A.multiply(b.matrixWorld,b.projectionMatrixInverse);A.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
 A.multiply(b.matrixWorld,b.projectionMatrixInverse);A.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=w[h].x*d.n14+w[h].y*d.n24+w[h].z*d.n34+w[h].w,c<=e){c=!1;break a}c=!0}c?(A.multiplyVector3(D.copy(b.position)),f=a(),f.object=b,f.z=D.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(A.multiplyVector3(D.copy(b.position)),f=a(),f.object=b,f.z=D.z,t.sprites.push(f)):b instanceof THREE.Light&&t.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,w=e.far,D,O,r,p,v,C,E,K,H,P,Q,T,W,U,V,R;F=u=m=j=0;t.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);A.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(A);t=this.projectGraph(a,!1);a=0;for(D=t.objects.length;a<D;a++)if(H=t.objects[a].object,P=H.matrixWorld,T=
-H.material,k=0,H instanceof THREE.Mesh){Q=H.geometry;W=H.geometry.materials;p=Q.vertices;U=Q.faces;V=Q.faceVertexUvs;Q=H.matrixRotationWorld.extractRotation(P);O=0;for(r=p.length;O<r;O++)i=b(),i.positionWorld.copy(p[O].position),P.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),A.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<w;p=0;for(O=U.length;p<O;p++){r=U[p];
-if(r instanceof THREE.Face3)if(v=l[r.a],C=l[r.b],E=l[r.c],v.visible&&C.visible&&E.visible&&(H.doubleSided||H.flipSided!=(E.positionScreen.x-v.positionScreen.x)*(C.positionScreen.y-v.positionScreen.y)-(E.positionScreen.y-v.positionScreen.y)*(C.positionScreen.x-v.positionScreen.x)<0))K=n[j]=n[j]||new THREE.RenderableFace3,j++,h=K,h.v1.copy(v),h.v2.copy(C),h.v3.copy(E);else continue;else if(r instanceof THREE.Face4)if(v=l[r.a],C=l[r.b],E=l[r.c],K=l[r.d],v.visible&&C.visible&&E.visible&&K.visible&&(H.doubleSided||
-H.flipSided!=((K.positionScreen.x-v.positionScreen.x)*(C.positionScreen.y-v.positionScreen.y)-(K.positionScreen.y-v.positionScreen.y)*(C.positionScreen.x-v.positionScreen.x)<0||(C.positionScreen.x-E.positionScreen.x)*(K.positionScreen.y-E.positionScreen.y)-(C.positionScreen.y-E.positionScreen.y)*(K.positionScreen.x-E.positionScreen.x)<0)))R=o[m]=o[m]||new THREE.RenderableFace4,m++,h=R,h.v1.copy(v),h.v2.copy(C),h.v3.copy(E),h.v4.copy(K);else continue;h.normalWorld.copy(r.normal);Q.multiplyVector3(h.normalWorld);
-h.centroidWorld.copy(r.centroid);P.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);A.multiplyVector3(h.centroidScreen);E=r.vertexNormals;v=0;for(C=E.length;v<C;v++)K=h.vertexNormalsWorld[v],K.copy(E[v]),Q.multiplyVector3(K);v=0;for(C=V.length;v<C;v++)if(R=V[v][p]){E=0;for(K=R.length;E<K;E++)h.uvs[v][E]=R[E]}h.material=T;h.faceMaterial=r.materialIndex!==null?W[r.materialIndex]:null;h.z=h.centroidScreen.z;t.elements.push(h)}}else if(H instanceof THREE.Line){I.multiply(A,P);p=
-H.geometry.vertices;v=b();v.positionScreen.copy(p[0].position);I.multiplyVector4(v.positionScreen);O=1;for(r=p.length;O<r;O++)if(v=b(),v.positionScreen.copy(p[O].position),I.multiplyVector4(v.positionScreen),C=l[k-2],J.copy(v.positionScreen),z.copy(C.positionScreen),d(J,z))J.multiplyScalar(1/J.w),z.multiplyScalar(1/z.w),H=G[u]=G[u]||new THREE.RenderableLine,u++,q=H,q.v1.positionScreen.copy(J),q.v2.positionScreen.copy(z),q.z=Math.max(J.z,z.z),q.material=T,t.elements.push(q)}a=0;for(D=t.sprites.length;a<
-D;a++)if(H=t.sprites[a].object,P=H.matrixWorld,H instanceof THREE.Particle&&(y.set(P.n14,P.n24,P.n34,1),A.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))g=s[F]=s[F]||new THREE.RenderableParticle,F++,x=g,x.x=y.x/y.w,x.y=y.y/y.w,x.z=y.z,x.rotation=H.rotation.z,x.scale.x=H.scale.x*Math.abs(x.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),x.scale.y=H.scale.y*Math.abs(x.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),x.material=H.material,t.elements.push(x);f&&t.elements.sort(c);
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=w[h].x*d.n14+w[h].y*d.n24+w[h].z*d.n34+w[h].w,c<=e){c=!1;break a}c=!0}c?(A.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(A.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,t.sprites.push(f)):b instanceof THREE.Light&&t.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
+t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,w=e.far,C,P,r,p,v,B,D,K,H,Q,R,T,W,U,V,S;E=u=m=j=0;t.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);A.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(A);t=this.projectGraph(a,!1);a=0;for(C=t.objects.length;a<C;a++)if(H=t.objects[a].object,Q=H.matrixWorld,T=
+H.material,k=0,H instanceof THREE.Mesh){R=H.geometry;W=H.geometry.materials;p=R.vertices;U=R.faces;V=R.faceVertexUvs;R=H.matrixRotationWorld.extractRotation(Q);P=0;for(r=p.length;P<r;P++)i=b(),i.positionWorld.copy(p[P].position),Q.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),A.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<w;p=0;for(P=U.length;p<P;p++){r=U[p];
+if(r instanceof THREE.Face3)if(v=l[r.a],B=l[r.b],D=l[r.c],v.visible&&B.visible&&D.visible&&(H.doubleSided||H.flipSided!=(D.positionScreen.x-v.positionScreen.x)*(B.positionScreen.y-v.positionScreen.y)-(D.positionScreen.y-v.positionScreen.y)*(B.positionScreen.x-v.positionScreen.x)<0))K=n[j]=n[j]||new THREE.RenderableFace3,j++,h=K,h.v1.copy(v),h.v2.copy(B),h.v3.copy(D);else continue;else if(r instanceof THREE.Face4)if(v=l[r.a],B=l[r.b],D=l[r.c],K=l[r.d],v.visible&&B.visible&&D.visible&&K.visible&&(H.doubleSided||
+H.flipSided!=((K.positionScreen.x-v.positionScreen.x)*(B.positionScreen.y-v.positionScreen.y)-(K.positionScreen.y-v.positionScreen.y)*(B.positionScreen.x-v.positionScreen.x)<0||(B.positionScreen.x-D.positionScreen.x)*(K.positionScreen.y-D.positionScreen.y)-(B.positionScreen.y-D.positionScreen.y)*(K.positionScreen.x-D.positionScreen.x)<0)))S=o[m]=o[m]||new THREE.RenderableFace4,m++,h=S,h.v1.copy(v),h.v2.copy(B),h.v3.copy(D),h.v4.copy(K);else continue;h.normalWorld.copy(r.normal);R.multiplyVector3(h.normalWorld);
+h.centroidWorld.copy(r.centroid);Q.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);A.multiplyVector3(h.centroidScreen);D=r.vertexNormals;v=0;for(B=D.length;v<B;v++)K=h.vertexNormalsWorld[v],K.copy(D[v]),R.multiplyVector3(K);v=0;for(B=V.length;v<B;v++)if(S=V[v][p]){D=0;for(K=S.length;D<K;D++)h.uvs[v][D]=S[D]}h.material=T;h.faceMaterial=r.materialIndex!==null?W[r.materialIndex]:null;h.z=h.centroidScreen.z;t.elements.push(h)}}else if(H instanceof THREE.Line){I.multiply(A,Q);p=
+H.geometry.vertices;v=b();v.positionScreen.copy(p[0].position);I.multiplyVector4(v.positionScreen);P=1;for(r=p.length;P<r;P++)if(v=b(),v.positionScreen.copy(p[P].position),I.multiplyVector4(v.positionScreen),B=l[k-2],J.copy(v.positionScreen),z.copy(B.positionScreen),d(J,z))J.multiplyScalar(1/J.w),z.multiplyScalar(1/z.w),H=G[u]=G[u]||new THREE.RenderableLine,u++,q=H,q.v1.positionScreen.copy(J),q.v2.positionScreen.copy(z),q.z=Math.max(J.z,z.z),q.material=T,t.elements.push(q)}a=0;for(C=t.sprites.length;a<
+C;a++)if(H=t.sprites[a].object,Q=H.matrixWorld,H instanceof THREE.Particle&&(y.set(Q.n14,Q.n24,Q.n34,1),A.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))g=s[E]=s[E]||new THREE.RenderableParticle,E++,x=g,x.x=y.x/y.w,x.y=y.y/y.w,x.z=y.z,x.rotation=H.rotation.z,x.scale.x=H.scale.x*Math.abs(x.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),x.scale.y=H.scale.y*Math.abs(x.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),x.material=H.material,t.elements.push(x);f&&t.elements.sort(c);
 return t}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 return t}};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,l=k*c+g*f-i*d,h=k*d+i*c-e*f,j=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,l=k*c+g*f-i*d,h=k*d+i*c-e*f,j=k*f+e*d-g*c,c=-e*
 c-g*d-i*f;b.x=l*k+c*-e+h*-i-j*-g;b.y=h*k+c*-g+j*-e-l*-i;b.z=j*k+c*-i+l*-g-h*-e;return b}};
 c-g*d-i*f;b.x=l*k+c*-e+h*-i-j*-g;b.y=h*k+c*-g+j*-e-l*-i;b.z=j*k+c*-i+l*-g-h*-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;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);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),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)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;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+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;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);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),f=Math.sqrt(1-f*f);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;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.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.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.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];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.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];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.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -82,9 +82,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 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,C){i=a.vertices[b].position;k=a.vertices[c].position;l=a.vertices[d].position;h=g[e];j=g[f];n=g[C];m=k.x-i.x;o=l.x-i.x;q=k.y-i.y;u=l.y-i.y;G=k.z-i.z;x=l.z-i.z;F=j.u-h.u;s=n.u-h.u;t=j.v-h.v;D=n.v-h.v;y=1/(F*D-s*t);J.set((D*m-t*o)*y,(D*q-t*u)*y,(D*G-t*x)*y);z.set((F*o-s*m)*y,(F*u-s*q)*y,(F*x-s*G)*y);I[b].addSelf(J);I[c].addSelf(J);I[d].addSelf(J);w[b].addSelf(z);
-w[c].addSelf(z);w[d].addSelf(z)}var b,c,d,f,e,g,i,k,l,h,j,n,m,o,q,u,G,x,F,s,t,D,y,A,I=[],w=[],J=new THREE.Vector3,z=new THREE.Vector3,B=new THREE.Vector3,N=new THREE.Vector3,L=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)I[b]=new THREE.Vector3,w[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var M=["a","b",
-"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)L.copy(e.vertexNormals[d]),f=e[M[d]],A=I[f],B.copy(A),B.subSelf(L.multiplyScalar(L.dot(A))).normalize(),N.cross(e.vertexNormals[d],A),f=N.dot(w[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.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.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,B){i=a.vertices[b].position;k=a.vertices[c].position;l=a.vertices[d].position;h=g[e];j=g[f];n=g[B];m=k.x-i.x;o=l.x-i.x;q=k.y-i.y;u=l.y-i.y;G=k.z-i.z;x=l.z-i.z;E=j.u-h.u;s=n.u-h.u;t=j.v-h.v;C=n.v-h.v;y=1/(E*C-s*t);J.set((C*m-t*o)*y,(C*q-t*u)*y,(C*G-t*x)*y);z.set((E*o-s*m)*y,(E*u-s*q)*y,(E*x-s*G)*y);I[b].addSelf(J);I[c].addSelf(J);I[d].addSelf(J);w[b].addSelf(z);
+w[c].addSelf(z);w[d].addSelf(z)}var b,c,d,f,e,g,i,k,l,h,j,n,m,o,q,u,G,x,E,s,t,C,y,A,I=[],w=[],J=new THREE.Vector3,z=new THREE.Vector3,F=new THREE.Vector3,O=new THREE.Vector3,L=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)I[b]=new THREE.Vector3,w[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var M=["a","b",
+"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)L.copy(e.vertexNormals[d]),f=e[M[d]],A=I[f],F.copy(A),F.subSelf(L.multiplyScalar(L.dot(A))).normalize(),O.cross(e.vertexNormals[d],A),f=O.dot(w[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++)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;
 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;
@@ -124,16 +124,16 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(I.sub(i,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){w[a]==null&&(w[a]=document.createElementNS("http://www.w3.org/2000/svg",
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(I.sub(i,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){w[a]==null&&(w[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),L==0&&w[a].setAttribute("shape-rendering","crispEdges"));return w[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,i=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,h,j,n,m,o,q,u,G=new THREE.Rectangle,x=new THREE.Rectangle,F=!1,s=new THREE.Color,t=new THREE.Color,D=new THREE.Color,y=new THREE.Color,A,I=new THREE.Vector3,w=[],J=[],z,B,N,L=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+"path"),L==0&&w[a].setAttribute("shape-rendering","crispEdges"));return w[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,i=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,h,j,n,m,o,q,u,G=new THREE.Rectangle,x=new THREE.Rectangle,E=!1,s=new THREE.Color,t=new THREE.Color,C=new THREE.Color,y=new THREE.Color,A,I=new THREE.Vector3,w=[],J=[],z,F,O,L=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
 faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){l=a;h=b;j=l/2;n=h/2;k.setAttribute("viewBox",-j+" "+-n+" "+l+" "+h);k.setAttribute("width",l);k.setAttribute("height",h);G.set(-j,-n,j,n)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(h,l){var w,I,r,p;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=i.projectScene(h,l,this.sortElements);e=f.elements;
 faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){l=a;h=b;j=l/2;n=h/2;k.setAttribute("viewBox",-j+" "+-n+" "+l+" "+h);k.setAttribute("width",l);k.setAttribute("height",h);G.set(-j,-n,j,n)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(h,l){var w,I,r,p;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=i.projectScene(h,l,this.sortElements);e=f.elements;
-g=f.lights;N=B=0;if(F=g.length>0){t.setRGB(0,0,0);D.setRGB(0,0,0);y.setRGB(0,0,0);w=0;for(I=g.length;w<I;w++)p=g[w],r=p.color,p instanceof THREE.AmbientLight?(t.r+=r.r,t.g+=r.g,t.b+=r.b):p instanceof THREE.DirectionalLight?(D.r+=r.r,D.g+=r.g,D.b+=r.b):p instanceof THREE.PointLight&&(y.r+=r.r,y.g+=r.g,y.b+=r.b)}w=0;for(I=e.length;w<I;w++)if(r=e[w],p=r.material,p=p instanceof THREE.MeshFaceMaterial?r.faceMaterial:p,!(p==null||p.opacity==0))if(x.empty(),r instanceof THREE.RenderableParticle)m=r,m.x*=
-j,m.y*=-n;else if(r instanceof THREE.RenderableLine){if(m=r.v1,o=r.v2,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,x.addPoint(m.positionScreen.x,m.positionScreen.y),x.addPoint(o.positionScreen.x,o.positionScreen.y),G.intersects(x)){r=m;var v=o,C=N++;J[C]==null&&(J[C]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&J[C].setAttribute("shape-rendering","crispEdges"));z=J[C];z.setAttribute("x1",r.positionScreen.x);z.setAttribute("y1",r.positionScreen.y);
+g=f.lights;O=F=0;if(E=g.length>0){t.setRGB(0,0,0);C.setRGB(0,0,0);y.setRGB(0,0,0);w=0;for(I=g.length;w<I;w++)p=g[w],r=p.color,p instanceof THREE.AmbientLight?(t.r+=r.r,t.g+=r.g,t.b+=r.b):p instanceof THREE.DirectionalLight?(C.r+=r.r,C.g+=r.g,C.b+=r.b):p instanceof THREE.PointLight&&(y.r+=r.r,y.g+=r.g,y.b+=r.b)}w=0;for(I=e.length;w<I;w++)if(r=e[w],p=r.material,p=p instanceof THREE.MeshFaceMaterial?r.faceMaterial:p,!(p==null||p.opacity==0))if(x.empty(),r instanceof THREE.RenderableParticle)m=r,m.x*=
+j,m.y*=-n;else if(r instanceof THREE.RenderableLine){if(m=r.v1,o=r.v2,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,x.addPoint(m.positionScreen.x,m.positionScreen.y),x.addPoint(o.positionScreen.x,o.positionScreen.y),G.intersects(x)){r=m;var v=o,B=O++;J[B]==null&&(J[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&J[B].setAttribute("shape-rendering","crispEdges"));z=J[B];z.setAttribute("x1",r.positionScreen.x);z.setAttribute("y1",r.positionScreen.y);
 z.setAttribute("x2",v.positionScreen.x);z.setAttribute("y2",v.positionScreen.y);p instanceof THREE.LineBasicMaterial&&(z.setAttribute("style","fill: none; stroke: "+p.color.getContextStyle()+"; stroke-width: "+p.linewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.linecap+"; stroke-linejoin: "+p.linejoin),k.appendChild(z))}}else if(r instanceof THREE.RenderableFace3){if(m=r.v1,o=r.v2,q=r.v3,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,q.positionScreen.x*=
 z.setAttribute("x2",v.positionScreen.x);z.setAttribute("y2",v.positionScreen.y);p instanceof THREE.LineBasicMaterial&&(z.setAttribute("style","fill: none; stroke: "+p.color.getContextStyle()+"; stroke-width: "+p.linewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.linecap+"; stroke-linejoin: "+p.linejoin),k.appendChild(z))}}else if(r instanceof THREE.RenderableFace3){if(m=r.v1,o=r.v2,q=r.v3,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,q.positionScreen.x*=
-j,q.positionScreen.y*=-n,x.addPoint(m.positionScreen.x,m.positionScreen.y),x.addPoint(o.positionScreen.x,o.positionScreen.y),x.addPoint(q.positionScreen.x,q.positionScreen.y),G.intersects(x)){var v=m,C=o,E=q;d.info.render.vertices+=3;d.info.render.faces++;z=b(B++);z.setAttribute("d","M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?s.copy(p.color):p instanceof THREE.MeshLambertMaterial?
-F?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(p.color.r*s.r,1)),s.g=Math.max(0,Math.min(p.color.g*s.g,1)),s.b=Math.max(0,Math.min(p.color.b*s.b,1))):s.copy(p.color):p instanceof THREE.MeshDepthMaterial?(A=1-p.__2near/(p.__farPlusNear-r.z*p.__farMinusNear),s.setRGB(A,A,A)):p instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));p.wireframe?z.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
+j,q.positionScreen.y*=-n,x.addPoint(m.positionScreen.x,m.positionScreen.y),x.addPoint(o.positionScreen.x,o.positionScreen.y),x.addPoint(q.positionScreen.x,q.positionScreen.y),G.intersects(x)){var v=m,B=o,D=q;d.info.render.vertices+=3;d.info.render.faces++;z=b(F++);z.setAttribute("d","M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?s.copy(p.color):p instanceof THREE.MeshLambertMaterial?
+E?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(p.color.r*s.r,1)),s.g=Math.max(0,Math.min(p.color.g*s.g,1)),s.b=Math.max(0,Math.min(p.color.b*s.b,1))):s.copy(p.color):p instanceof THREE.MeshDepthMaterial?(A=1-p.__2near/(p.__farPlusNear-r.z*p.__farMinusNear),s.setRGB(A,A,A)):p instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));p.wireframe?z.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
 p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):z.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+p.opacity);k.appendChild(z)}}else if(r instanceof THREE.RenderableFace4&&(m=r.v1,o=r.v2,q=r.v3,u=r.v4,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,q.positionScreen.x*=j,q.positionScreen.y*=-n,u.positionScreen.x*=j,u.positionScreen.y*=-n,x.addPoint(m.positionScreen.x,
 p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):z.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+p.opacity);k.appendChild(z)}}else if(r instanceof THREE.RenderableFace4&&(m=r.v1,o=r.v2,q=r.v3,u=r.v4,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,q.positionScreen.x*=j,q.positionScreen.y*=-n,u.positionScreen.x*=j,u.positionScreen.y*=-n,x.addPoint(m.positionScreen.x,
-m.positionScreen.y),x.addPoint(o.positionScreen.x,o.positionScreen.y),x.addPoint(q.positionScreen.x,q.positionScreen.y),x.addPoint(u.positionScreen.x,u.positionScreen.y),G.intersects(x))){var v=m,C=o,E=q,K=u;d.info.render.vertices+=4;d.info.render.faces++;z=b(B++);z.setAttribute("d","M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?
-s.copy(p.color):p instanceof THREE.MeshLambertMaterial?F?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(p.color.r*s.r,1)),s.g=Math.max(0,Math.min(p.color.g*s.g,1)),s.b=Math.max(0,Math.min(p.color.b*s.b,1))):s.copy(p.color):p instanceof THREE.MeshDepthMaterial?(A=1-p.__2near/(p.__farPlusNear-r.z*p.__farMinusNear),s.setRGB(A,A,A)):p instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));p.wireframe?z.setAttribute("style",
+m.positionScreen.y),x.addPoint(o.positionScreen.x,o.positionScreen.y),x.addPoint(q.positionScreen.x,q.positionScreen.y),x.addPoint(u.positionScreen.x,u.positionScreen.y),G.intersects(x))){var v=m,B=o,D=q,K=u;d.info.render.vertices+=4;d.info.render.faces++;z=b(F++);z.setAttribute("d","M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?
+s.copy(p.color):p instanceof THREE.MeshLambertMaterial?E?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(p.color.r*s.r,1)),s.g=Math.max(0,Math.min(p.color.g*s.g,1)),s.b=Math.max(0,Math.min(p.color.b*s.b,1))):s.copy(p.color):p instanceof THREE.MeshDepthMaterial?(A=1-p.__2near/(p.__farPlusNear-r.z*p.__farMinusNear),s.setRGB(A,A,A)):p instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));p.wireframe?z.setAttribute("style",
 "fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):z.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+p.opacity);k.appendChild(z)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
 "fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):z.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+p.opacity);k.appendChild(z)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
 THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;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.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};

+ 131 - 131
build/custom/ThreeWebGL.js

@@ -14,31 +14,31 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){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}};
 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){function c(a,b,c){h=h.copy(c).subSelf(a);u=h.dot(b);if(u<=0)return null;I=o.copy(a).addSelf(C.copy(b).multiplyScalar(u));return L=c.distanceTo(I)}function e(a,b,c,e){h.copy(e).subSelf(b);o.copy(c).subSelf(b);C.copy(a).subSelf(b);E=h.dot(h);ja=h.dot(o);P=h.dot(C);ha=o.dot(o);la=o.dot(C);D=1/(E*ha-ja*ja);M=(ha*P-ja*la)*D;G=(E*la-ja*P)*D;return M>=0&&G>=0&&M+G<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
-this.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};var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,p=new THREE.Vector3,r=new THREE.Vector3;this.intersectObject=function(h){for(var u,o=[],I=0,C=h.children.length;I<C;I++)Array.prototype.push.apply(o,this.intersectObject(h.children[I]));
-if(h instanceof THREE.Particle){I=c(this.origin,this.direction,h.matrixWorld.getPosition());if(I===null||I>h.scale.x)return[];u={distance:I,point:h.position,face:null,object:h};o.push(u)}else if(h instanceof THREE.Mesh){I=c(this.origin,this.direction,h.matrixWorld.getPosition());if(I===null||I>h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)))return o;var K,L=h.geometry,E=L.vertices,D;h.matrixRotationWorld.extractRotation(h.matrixWorld);I=0;for(C=L.faces.length;I<
-C;I++)if(u=L.faces[I],a=a.copy(this.origin),b=b.copy(this.direction),D=h.matrixWorld,p=D.multiplyVector3(p.copy(u.centroid)).subSelf(a),K=p.dot(b),!(K<=0)&&(f=D.multiplyVector3(f.copy(E[u.a].position)),g=D.multiplyVector3(g.copy(E[u.b].position)),j=D.multiplyVector3(j.copy(E[u.c].position)),i=u instanceof THREE.Face4?D.multiplyVector3(i.copy(E[u.d].position)):null,r=h.matrixRotationWorld.multiplyVector3(r.copy(u.normal)),K=b.dot(r),h.doubleSided||(h.flipSided?K>0:K<0)))if(K=r.dot(p.sub(f,a))/K,K=
-a.clone().addSelf(b.multiplyScalar(K)),u instanceof THREE.Face3)e(K,f,g,j)&&(u={distance:a.distanceTo(K),point:K,face:u,object:h},o.push(u));else if(u instanceof THREE.Face4&&(e(K,f,g,i)||e(K,g,j,i)))u={distance:a.distanceTo(K),point:K,face:u,object:h},o.push(u)}return o};var h=new THREE.Vector3,o=new THREE.Vector3,C=new THREE.Vector3,u,I,L,E,ja,P,ha,la,D,M,G};
+THREE.Ray=function(a,b){function c(a,b,c){h=h.copy(c).subSelf(a);u=h.dot(b);if(u<=0)return null;H=o.copy(a).addSelf(C.copy(b).multiplyScalar(u));return K=c.distanceTo(H)}function e(a,b,c,e){h.copy(e).subSelf(b);o.copy(c).subSelf(b);C.copy(a).subSelf(b);E=h.dot(h);la=h.dot(o);L=h.dot(C);ha=o.dot(o);pa=o.dot(C);D=1/(E*ha-la*la);M=(ha*L-la*pa)*D;J=(E*pa-la*L)*D;return M>=0&&J>=0&&M+J<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+this.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};var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,p=new THREE.Vector3,r=new THREE.Vector3;this.intersectObject=function(h){for(var u,o=[],H=0,C=h.children.length;H<C;H++)Array.prototype.push.apply(o,this.intersectObject(h.children[H]));
+if(h instanceof THREE.Particle){H=c(this.origin,this.direction,h.matrixWorld.getPosition());if(H===null||H>h.scale.x)return[];u={distance:H,point:h.position,face:null,object:h};o.push(u)}else if(h instanceof THREE.Mesh){H=c(this.origin,this.direction,h.matrixWorld.getPosition());if(H===null||H>h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)))return o;var V,K=h.geometry,E=K.vertices,D,na=new THREE.Vector3;h.matrixRotationWorld.extractRotation(h.matrixWorld);H=0;for(C=
+K.faces.length;H<C;H++)if(u=K.faces[H],a=a.copy(this.origin),b=b.copy(this.direction),D=h.matrixWorld,p=D.multiplyVector3(p.copy(u.centroid)).subSelf(a),V=p.dot(b),!(V<=0)&&(f=D.multiplyVector3(f.copy(E[u.a].position)),g=D.multiplyVector3(g.copy(E[u.b].position)),j=D.multiplyVector3(j.copy(E[u.c].position)),i=u instanceof THREE.Face4?D.multiplyVector3(i.copy(E[u.d].position)):null,r=h.matrixRotationWorld.multiplyVector3(r.copy(u.normal)),V=b.dot(r),h.doubleSided||(h.flipSided?V>0:V<0)))if(V=r.dot(p.sub(f,
+a))/V,na.add(a,b.multiplyScalar(V)),u instanceof THREE.Face3)e(na,f,g,j)&&(u={distance:a.distanceTo(na),point:na.clone(),face:u,object:h},o.push(u));else if(u instanceof THREE.Face4&&(e(na,f,g,i)||e(na,g,j,i)))u={distance:a.distanceTo(na),point:na.clone(),face:u,object:h},o.push(u)}return o};var h=new THREE.Vector3,o=new THREE.Vector3,C=new THREE.Vector3,u,H,K,E,la,L,ha,pa,D,M,J};
 THREE.Rectangle=function(){function a(){g=e-b;j=f-c}var b,c,e,f,g,j,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,j,h,o){i=!1;b=g;c=j;e=h;f=o;a()};this.addPoint=function(g,j){i?(i=!1,b=g,c=j,e=g,f=j):(b=b<g?b:g,c=c<j?c:j,e=e>g?e:g,f=f>j?f:j);a()};this.add3Points=
 THREE.Rectangle=function(){function a(){g=e-b;j=f-c}var b,c,e,f,g,j,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,j,h,o){i=!1;b=g;c=j;e=h;f=o;a()};this.addPoint=function(g,j){i?(i=!1,b=g,c=j,e=g,f=j):(b=b<g?b:g,c=c<j?c:j,e=e>g?e:g,f=f>j?f:j);a()};this.add3Points=
 function(g,j,h,o,C,u){i?(i=!1,b=g<h?g<C?g:C:h<C?h:C,c=j<o?j<u?j:u:o<u?o:u,e=g>h?g>C?g:C:h>C?h:C,f=j>o?j>u?j:u:o>u?o:u):(b=g<h?g<C?g<b?g:b:C<b?C:b:h<C?h<b?h:b:C<b?C:b,c=j<o?j<u?j<c?j:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c,e=g>h?g>C?g>e?g:e:C>e?C:e:h>C?h>e?h:e:C>e?C:e,f=j>o?j>u?j>f?j:f:u>f?u:f:o>u?o>f?o:f:u>f?u:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
 function(g,j,h,o,C,u){i?(i=!1,b=g<h?g<C?g:C:h<C?h:C,c=j<o?j<u?j:u:o<u?o:u,e=g>h?g>C?g:C:h>C?h:C,f=j>o?j>u?j:u:o>u?o:u):(b=g<h?g<C?g<b?g:b:C<b?C:b:h<C?h<b?h:b:C<b?C:b,c=j<o?j<u?j<c?j:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c,e=g>h?g>C?g>e?g:e:C>e?C:e:h>C?h>e?h:e:C>e?C:e,f=j>o?j>u?j>f?j:f:u>f?u:f:o>u?o>f?o:f:u>f?u:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
 g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;e+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=e=c=b=0;a()};this.isEmpty=function(){return i}};
 g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;e+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=e=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,e,f){return e+(a-b)*(f-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,e,f){return e+(a-b)*(f-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,f,g,j,i,p,r,h,o,C,u,I,L){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,g!==void 0?g:1,j||0,i||0,p||0,r||0,h!==void 0?h:1,o||0,C||0,u||0,I||0,L!==void 0?L:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,g,j,i,p,r,h,o,C,u,I,L){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=i;this.n31=p;this.n32=r;this.n33=h;this.n34=o;this.n41=C;this.n42=u;this.n43=I;this.n44=L;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(c,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,g=a.n14,j=a.n21,i=a.n22,p=a.n23,r=a.n24,h=a.n31,o=a.n32,C=a.n33,u=a.n34,I=a.n41,L=a.n42,E=a.n43,
-ja=a.n44,P=b.n11,ha=b.n12,la=b.n13,D=b.n14,M=b.n21,G=b.n22,N=b.n23,oa=b.n24,Y=b.n31,pa=b.n32,sa=b.n33,K=b.n34,ma=b.n41,ua=b.n42,wa=b.n43,za=b.n44;this.n11=c*P+e*M+f*Y+g*ma;this.n12=c*ha+e*G+f*pa+g*ua;this.n13=c*la+e*N+f*sa+g*wa;this.n14=c*D+e*oa+f*K+g*za;this.n21=j*P+i*M+p*Y+r*ma;this.n22=j*ha+i*G+p*pa+r*ua;this.n23=j*la+i*N+p*sa+r*wa;this.n24=j*D+i*oa+p*K+r*za;this.n31=h*P+o*M+C*Y+u*ma;this.n32=h*ha+o*G+C*pa+u*ua;this.n33=h*la+o*N+C*sa+u*wa;this.n34=h*D+o*oa+C*K+u*za;this.n41=I*P+L*M+E*Y+ja*ma;this.n42=
-I*ha+L*G+E*pa+ja*ua;this.n43=I*la+L*N+E*sa+ja*wa;this.n44=I*D+L*oa+E*K+ja*za;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;
+THREE.Matrix4=function(a,b,c,e,f,g,j,i,p,r,h,o,C,u,H,K){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,g!==void 0?g:1,j||0,i||0,p||0,r||0,h!==void 0?h:1,o||0,C||0,u||0,H||0,K!==void 0?K:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,g,j,i,p,r,h,o,C,u,H,K){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=i;this.n31=p;this.n32=r;this.n33=h;this.n34=o;this.n41=C;this.n42=u;this.n43=H;this.n44=K;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(c,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,g=a.n14,j=a.n21,i=a.n22,p=a.n23,r=a.n24,h=a.n31,o=a.n32,C=a.n33,u=a.n34,H=a.n41,K=a.n42,E=a.n43,
+la=a.n44,L=b.n11,ha=b.n12,pa=b.n13,D=b.n14,M=b.n21,J=b.n22,R=b.n23,ra=b.n24,O=b.n31,sa=b.n32,qa=b.n33,V=b.n34,ma=b.n41,wa=b.n42,ya=b.n43,na=b.n44;this.n11=c*L+e*M+f*O+g*ma;this.n12=c*ha+e*J+f*sa+g*wa;this.n13=c*pa+e*R+f*qa+g*ya;this.n14=c*D+e*ra+f*V+g*na;this.n21=j*L+i*M+p*O+r*ma;this.n22=j*ha+i*J+p*sa+r*wa;this.n23=j*pa+i*R+p*qa+r*ya;this.n24=j*D+i*ra+p*V+r*na;this.n31=h*L+o*M+C*O+u*ma;this.n32=h*ha+o*J+C*sa+u*wa;this.n33=h*pa+o*R+C*qa+u*ya;this.n34=h*D+o*ra+C*V+u*na;this.n41=H*L+K*M+E*O+la*ma;this.n42=
+H*ha+K*J+E*sa+la*wa;this.n43=H*pa+K*R+E*qa+la*ya;this.n44=H*D+K*ra+E*V+la*na;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;
 this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*
 this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*
 c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*
 c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*
-a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,i=this.n24,p=this.n31,r=this.n32,h=this.n33,o=this.n34,C=this.n41,u=this.n42,I=this.n43,L=this.n44;return e*j*r*C-c*i*r*C-e*g*h*C+b*i*h*C+c*g*o*C-b*j*o*C-e*j*p*u+c*i*p*u+e*f*h*u-a*i*h*u-c*f*o*u+a*j*o*u+e*g*p*I-b*i*p*I-e*f*r*I+a*i*r*I+b*f*o*I-a*g*o*I-c*
-g*p*L+b*j*p*L+c*f*r*L-a*j*r*L-b*f*h*L+a*g*h*L},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;
+a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,i=this.n24,p=this.n31,r=this.n32,h=this.n33,o=this.n34,C=this.n41,u=this.n42,H=this.n43,K=this.n44;return e*j*r*C-c*i*r*C-e*g*h*C+b*i*h*C+c*g*o*C-b*j*o*C-e*j*p*u+c*i*p*u+e*f*h*u-a*i*h*u-c*f*o*u+a*j*o*u+e*g*p*H-b*i*p*H-e*f*r*H+a*i*r*H+b*f*o*H-a*g*o*H-c*
+g*p*K+b*j*p*K+c*f*r*K-a*j*r*K-b*f*h*K+a*g*h*K},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;
 a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},
 a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},
 flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=
 flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=
 this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),
 this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),
 a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,g=a.x,j=a.y,i=a.z,p=f*g,r=f*j;this.set(p*g+c,p*j-e*i,p*i+e*j,0,p*j+e*i,r*j+c,r*i-e*g,0,p*i-e*j,r*i+e*g,f*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,
 a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,g=a.x,j=a.y,i=a.z,p=f*g,r=f*j;this.set(p*g+c,p*j-e*i,p*i+e*j,0,p*j+e*i,r*j+c,r*i-e*g,0,p*i-e*j,r*i+e*g,f*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,
-this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,i=a.n23,p=a.n24,r=a.n31,h=a.n32,o=a.n33,C=a.n34,u=a.n41,I=a.n42,L=a.n43,E=a.n44;this.n11=i*C*I-p*o*I+p*h*L-j*C*L-i*h*E+j*o*E;this.n12=f*o*I-e*C*I-f*h*L+c*C*L+e*h*E-c*o*E;this.n13=e*p*I-f*i*I+f*j*L-c*p*L-e*j*E+c*i*E;this.n14=f*i*h-e*p*h-f*j*o+c*p*o+e*j*C-
-c*i*C;this.n21=p*o*u-i*C*u-p*r*L+g*C*L+i*r*E-g*o*E;this.n22=e*C*u-f*o*u+f*r*L-b*C*L-e*r*E+b*o*E;this.n23=f*i*u-e*p*u-f*g*L+b*p*L+e*g*E-b*i*E;this.n24=e*p*r-f*i*r+f*g*o-b*p*o-e*g*C+b*i*C;this.n31=j*C*u-p*h*u+p*r*I-g*C*I-j*r*E+g*h*E;this.n32=f*h*u-c*C*u-f*r*I+b*C*I+c*r*E-b*h*E;this.n33=e*p*u-f*j*u+f*g*I-b*p*I-c*g*E+b*j*E;this.n34=f*j*r-c*p*r-f*g*h+b*p*h+c*g*C-b*j*C;this.n41=i*h*u-j*o*u-i*r*I+g*o*I+j*r*L-g*h*L;this.n42=c*o*u-e*h*u+e*r*I-b*o*I-c*r*L+b*h*L;this.n43=e*j*u-c*i*u-e*g*I+b*i*I+c*g*L-b*j*L;
+this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,i=a.n23,p=a.n24,r=a.n31,h=a.n32,o=a.n33,C=a.n34,u=a.n41,H=a.n42,K=a.n43,E=a.n44;this.n11=i*C*H-p*o*H+p*h*K-j*C*K-i*h*E+j*o*E;this.n12=f*o*H-e*C*H-f*h*K+c*C*K+e*h*E-c*o*E;this.n13=e*p*H-f*i*H+f*j*K-c*p*K-e*j*E+c*i*E;this.n14=f*i*h-e*p*h-f*j*o+c*p*o+e*j*C-
+c*i*C;this.n21=p*o*u-i*C*u-p*r*K+g*C*K+i*r*E-g*o*E;this.n22=e*C*u-f*o*u+f*r*K-b*C*K-e*r*E+b*o*E;this.n23=f*i*u-e*p*u-f*g*K+b*p*K+e*g*E-b*i*E;this.n24=e*p*r-f*i*r+f*g*o-b*p*o-e*g*C+b*i*C;this.n31=j*C*u-p*h*u+p*r*H-g*C*H-j*r*E+g*h*E;this.n32=f*h*u-c*C*u-f*r*H+b*C*H+c*r*E-b*h*E;this.n33=e*p*u-f*j*u+f*g*H-b*p*H-c*g*E+b*j*E;this.n34=f*j*r-c*p*r-f*g*h+b*p*h+c*g*C-b*j*C;this.n41=i*h*u-j*o*u-i*r*H+g*o*H+j*r*K-g*h*K;this.n42=c*o*u-e*h*u+e*r*H-b*o*H-c*r*K+b*h*K;this.n43=e*j*u-c*i*u-e*g*H+b*i*H+c*g*K-b*j*K;
 this.n44=c*i*r-e*j*r+e*g*h-b*i*h-c*g*o+b*j*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),j=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var p=j*i,r=j*f,h=e*i,o=e*f;this.n11=p+o*c;this.n12=h*c-r;this.n13=g*e;this.n21=g*f;this.n22=g*i;this.n23=-c;this.n31=r*c-h;this.n32=o+p*c;this.n33=g*j;break;case "ZXY":p=j*i;r=j*f;h=e*i;o=e*f;this.n11=p-o*c;this.n12=-g*f;this.n13=h+r*c;this.n21=
 this.n44=c*i*r-e*j*r+e*g*h-b*i*h-c*g*o+b*j*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),j=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var p=j*i,r=j*f,h=e*i,o=e*f;this.n11=p+o*c;this.n12=h*c-r;this.n13=g*e;this.n21=g*f;this.n22=g*i;this.n23=-c;this.n31=r*c-h;this.n32=o+p*c;this.n33=g*j;break;case "ZXY":p=j*i;r=j*f;h=e*i;o=e*f;this.n11=p-o*c;this.n12=-g*f;this.n13=h+r*c;this.n21=
 r+h*c;this.n22=g*i;this.n23=o-p*c;this.n31=-g*e;this.n32=c;this.n33=g*j;break;case "ZYX":p=g*i;r=g*f;h=c*i;o=c*f;this.n11=j*i;this.n12=h*e-r;this.n13=p*e+o;this.n21=j*f;this.n22=o*e+p;this.n23=r*e-h;this.n31=-e;this.n32=c*j;this.n33=g*j;break;case "YZX":p=g*j;r=g*e;h=c*j;o=c*e;this.n11=j*i;this.n12=o-p*f;this.n13=h*f+r;this.n21=f;this.n22=g*i;this.n23=-c*i;this.n31=-e*i;this.n32=r*f+h;this.n33=p-o*f;break;case "XZY":p=g*j;r=g*e;h=c*j;o=c*e;this.n11=j*i;this.n12=-f;this.n13=e*i;this.n21=p*f+o;this.n22=
 r+h*c;this.n22=g*i;this.n23=o-p*c;this.n31=-g*e;this.n32=c;this.n33=g*j;break;case "ZYX":p=g*i;r=g*f;h=c*i;o=c*f;this.n11=j*i;this.n12=h*e-r;this.n13=p*e+o;this.n21=j*f;this.n22=o*e+p;this.n23=r*e-h;this.n31=-e;this.n32=c*j;this.n33=g*j;break;case "YZX":p=g*j;r=g*e;h=c*j;o=c*e;this.n11=j*i;this.n12=o-p*f;this.n13=h*f+r;this.n21=f;this.n22=g*i;this.n23=-c*i;this.n31=-e*i;this.n32=r*f+h;this.n33=p-o*f;break;case "XZY":p=g*j;r=g*e;h=c*j;o=c*e;this.n11=j*i;this.n12=-f;this.n13=e*i;this.n21=p*f+o;this.n22=
 g*i;this.n23=r*f-h;this.n31=h*f-r;this.n32=c*i;this.n33=o*f+p;break;default:p=g*i,r=g*f,h=c*i,o=c*f,this.n11=j*i,this.n12=-j*f,this.n13=e,this.n21=r+h*e,this.n22=p-o*e,this.n23=-c*j,this.n31=o-p*e,this.n32=h+r*e,this.n33=g*j}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,g=b+b,j=c+c,i=e+e,a=b*g,p=b*j;b*=i;var r=c*j;c*=i;e*=i;g*=f;j*=f;f*=i;this.n11=1-(r+e);this.n12=p-f;this.n13=b+j;this.n21=p+f;this.n22=1-(a+e);this.n23=c-g;this.n31=b-j;this.n32=c+g;this.n33=1-(a+r);
 g*i;this.n23=r*f-h;this.n31=h*f-r;this.n32=c*i;this.n33=o*f+p;break;default:p=g*i,r=g*f,h=c*i,o=c*f,this.n11=j*i,this.n12=-j*f,this.n13=e,this.n21=r+h*e,this.n22=p-o*e,this.n23=-c*j,this.n31=o-p*e,this.n32=h+r*e,this.n33=g*j}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,g=b+b,j=c+c,i=e+e,a=b*g,p=b*j;b*=i;var r=c*j;c*=i;e*=i;g*=f;j*=f;f*=i;this.n11=1-(r+e);this.n12=p-f;this.n13=b+j;this.n21=p+f;this.n22=1-(a+e);this.n23=c-g;this.n31=b-j;this.n32=c+g;this.n33=1-(a+r);
@@ -55,24 +55,24 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=j[g]=j[g]||new THREE.RenderableObject;g++;return a}function b(){var a=r[p]=r[p]||new THREE.RenderableVertex;p++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,g=a.z+a.w,f=b.z+b.w,j=-a.z+a.w,i=-b.z+b.w;return g>=0&&f>=0&&j>=0&&i>=0?!0:g<0&&f<0||j<0&&i<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(e=Math.min(e,g/(g-f))),j<0?c=Math.max(c,j/(j-i)):i<0&&(e=Math.min(e,j/(j-i))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var f,g,j=[],i,p,r=[],
 THREE.Projector=function(){function a(){var a=j[g]=j[g]||new THREE.RenderableObject;g++;return a}function b(){var a=r[p]=r[p]||new THREE.RenderableVertex;p++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,g=a.z+a.w,f=b.z+b.w,j=-a.z+a.w,i=-b.z+b.w;return g>=0&&f>=0&&j>=0&&i>=0?!0:g<0&&f<0||j<0&&i<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(e=Math.min(e,g/(g-f))),j<0?c=Math.max(c,j/(j-i)):i<0&&(e=Math.min(e,j/(j-i))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var f,g,j=[],i,p,r=[],
-h,o,C=[],u,I=[],L,E,ja=[],P,ha,la=[],D={objects:[],sprites:[],lights:[],elements:[]},M=new THREE.Vector3,G=new THREE.Vector4,N=new THREE.Matrix4,oa=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Vector4,sa=new THREE.Vector4;this.computeFrustum=function(a){Y[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);Y[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);Y[2].set(a.n41+a.n21,a.n42+a.n22,
-a.n43+a.n23,a.n44+a.n24);Y[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);Y[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);Y[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=Y[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);N.multiply(b.projectionMatrix,b.matrixWorldInverse);N.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-N.multiply(b.matrixWorld,b.projectionMatrixInverse);N.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,e){g=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var j=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
-g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),i=0;i<6;i++)if(c=Y[i].x*e.n14+Y[i].y*e.n24+Y[i].z*e.n34+Y[i].w,c<=g){c=!1;break a}c=!0}c?(N.multiplyVector3(M.copy(b.position)),f=a(),f.object=b,f.z=M.z,D.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(N.multiplyVector3(M.copy(b.position)),f=a(),f.object=b,f.z=M.z,D.sprites.push(f)):b instanceof THREE.Light&&D.lights.push(b);c=0;for(e=b.children.length;c<e;c++)j(b.children[c])}};j(b);e&&
-D.objects.sort(c);return D};this.projectScene=function(a,g,f){var j=g.near,M=g.far,Y,Q,S,ka,F,d,ba,qa,ga,na,ra,Da,Ea,Aa,xa,va;ha=E=u=o=0;D.elements.length=0;g.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(g));a.updateMatrixWorld();g.matrixWorldInverse.getInverse(g.matrixWorld);N.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(N);D=this.projectGraph(a,!1);a=0;for(Y=D.objects.length;a<Y;a++)if(ga=D.objects[a].object,na=ga.matrixWorld,
-Da=ga.material,p=0,ga instanceof THREE.Mesh){ra=ga.geometry;Ea=ga.geometry.materials;ka=ra.vertices;Aa=ra.faces;xa=ra.faceVertexUvs;ra=ga.matrixRotationWorld.extractRotation(na);Q=0;for(S=ka.length;Q<S;Q++)i=b(),i.positionWorld.copy(ka[Q].position),na.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),N.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>j&&i.positionScreen.z<M;ka=0;for(Q=
-Aa.length;ka<Q;ka++){S=Aa[ka];if(S instanceof THREE.Face3)if(F=r[S.a],d=r[S.b],ba=r[S.c],F.visible&&d.visible&&ba.visible&&(ga.doubleSided||ga.flipSided!=(ba.positionScreen.x-F.positionScreen.x)*(d.positionScreen.y-F.positionScreen.y)-(ba.positionScreen.y-F.positionScreen.y)*(d.positionScreen.x-F.positionScreen.x)<0))qa=C[o]=C[o]||new THREE.RenderableFace3,o++,h=qa,h.v1.copy(F),h.v2.copy(d),h.v3.copy(ba);else continue;else if(S instanceof THREE.Face4)if(F=r[S.a],d=r[S.b],ba=r[S.c],qa=r[S.d],F.visible&&
-d.visible&&ba.visible&&qa.visible&&(ga.doubleSided||ga.flipSided!=((qa.positionScreen.x-F.positionScreen.x)*(d.positionScreen.y-F.positionScreen.y)-(qa.positionScreen.y-F.positionScreen.y)*(d.positionScreen.x-F.positionScreen.x)<0||(d.positionScreen.x-ba.positionScreen.x)*(qa.positionScreen.y-ba.positionScreen.y)-(d.positionScreen.y-ba.positionScreen.y)*(qa.positionScreen.x-ba.positionScreen.x)<0)))va=I[u]=I[u]||new THREE.RenderableFace4,u++,h=va,h.v1.copy(F),h.v2.copy(d),h.v3.copy(ba),h.v4.copy(qa);
-else continue;h.normalWorld.copy(S.normal);ra.multiplyVector3(h.normalWorld);h.centroidWorld.copy(S.centroid);na.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);N.multiplyVector3(h.centroidScreen);ba=S.vertexNormals;F=0;for(d=ba.length;F<d;F++)qa=h.vertexNormalsWorld[F],qa.copy(ba[F]),ra.multiplyVector3(qa);F=0;for(d=xa.length;F<d;F++)if(va=xa[F][ka]){ba=0;for(qa=va.length;ba<qa;ba++)h.uvs[F][ba]=va[ba]}h.material=Da;h.faceMaterial=S.materialIndex!==null?Ea[S.materialIndex]:
-null;h.z=h.centroidScreen.z;D.elements.push(h)}}else if(ga instanceof THREE.Line){oa.multiply(N,na);ka=ga.geometry.vertices;F=b();F.positionScreen.copy(ka[0].position);oa.multiplyVector4(F.positionScreen);Q=1;for(S=ka.length;Q<S;Q++)if(F=b(),F.positionScreen.copy(ka[Q].position),oa.multiplyVector4(F.positionScreen),d=r[p-2],pa.copy(F.positionScreen),sa.copy(d.positionScreen),e(pa,sa))pa.multiplyScalar(1/pa.w),sa.multiplyScalar(1/sa.w),ga=ja[E]=ja[E]||new THREE.RenderableLine,E++,L=ga,L.v1.positionScreen.copy(pa),
-L.v2.positionScreen.copy(sa),L.z=Math.max(pa.z,sa.z),L.material=Da,D.elements.push(L)}a=0;for(Y=D.sprites.length;a<Y;a++)if(ga=D.sprites[a].object,na=ga.matrixWorld,ga instanceof THREE.Particle&&(G.set(na.n14,na.n24,na.n34,1),N.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))j=la[ha]=la[ha]||new THREE.RenderableParticle,ha++,P=j,P.x=G.x/G.w,P.y=G.y/G.w,P.z=G.z,P.rotation=ga.rotation.z,P.scale.x=ga.scale.x*Math.abs(P.x-(G.x+g.projectionMatrix.n11)/(G.w+g.projectionMatrix.n14)),P.scale.y=ga.scale.y*Math.abs(P.y-
-(G.y+g.projectionMatrix.n22)/(G.w+g.projectionMatrix.n24)),P.material=ga.material,D.elements.push(P);f&&D.elements.sort(c);return D}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
+h,o,C=[],u,H=[],K,E,la=[],L,ha,pa=[],D={objects:[],sprites:[],lights:[],elements:[]},M=new THREE.Vector3,J=new THREE.Vector4,R=new THREE.Matrix4,ra=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Vector4,qa=new THREE.Vector4;this.computeFrustum=function(a){O[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);O[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);O[2].set(a.n41+a.n21,a.n42+a.n22,
+a.n43+a.n23,a.n44+a.n24);O[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);O[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);O[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=O[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);R.multiply(b.projectionMatrix,b.matrixWorldInverse);R.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+R.multiply(b.matrixWorld,b.projectionMatrixInverse);R.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,e){g=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var j=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
+g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),i=0;i<6;i++)if(c=O[i].x*e.n14+O[i].y*e.n24+O[i].z*e.n34+O[i].w,c<=g){c=!1;break a}c=!0}c?(R.multiplyVector3(M.copy(b.position)),f=a(),f.object=b,f.z=M.z,D.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(R.multiplyVector3(M.copy(b.position)),f=a(),f.object=b,f.z=M.z,D.sprites.push(f)):b instanceof THREE.Light&&D.lights.push(b);c=0;for(e=b.children.length;c<e;c++)j(b.children[c])}};j(b);e&&
+D.objects.sort(c);return D};this.projectScene=function(a,g,f){var j=g.near,M=g.far,O,fa,ba,oa,F,d,P,ja,ia,ta,ua,Ea,Fa,Ba,za,xa;ha=E=u=o=0;D.elements.length=0;g.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(g));a.updateMatrixWorld();g.matrixWorldInverse.getInverse(g.matrixWorld);R.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(R);D=this.projectGraph(a,!1);a=0;for(O=D.objects.length;a<O;a++)if(ia=D.objects[a].object,ta=ia.matrixWorld,
+Ea=ia.material,p=0,ia instanceof THREE.Mesh){ua=ia.geometry;Fa=ia.geometry.materials;oa=ua.vertices;Ba=ua.faces;za=ua.faceVertexUvs;ua=ia.matrixRotationWorld.extractRotation(ta);fa=0;for(ba=oa.length;fa<ba;fa++)i=b(),i.positionWorld.copy(oa[fa].position),ta.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),R.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>j&&i.positionScreen.z<M;oa=0;
+for(fa=Ba.length;oa<fa;oa++){ba=Ba[oa];if(ba instanceof THREE.Face3)if(F=r[ba.a],d=r[ba.b],P=r[ba.c],F.visible&&d.visible&&P.visible&&(ia.doubleSided||ia.flipSided!=(P.positionScreen.x-F.positionScreen.x)*(d.positionScreen.y-F.positionScreen.y)-(P.positionScreen.y-F.positionScreen.y)*(d.positionScreen.x-F.positionScreen.x)<0))ja=C[o]=C[o]||new THREE.RenderableFace3,o++,h=ja,h.v1.copy(F),h.v2.copy(d),h.v3.copy(P);else continue;else if(ba instanceof THREE.Face4)if(F=r[ba.a],d=r[ba.b],P=r[ba.c],ja=r[ba.d],
+F.visible&&d.visible&&P.visible&&ja.visible&&(ia.doubleSided||ia.flipSided!=((ja.positionScreen.x-F.positionScreen.x)*(d.positionScreen.y-F.positionScreen.y)-(ja.positionScreen.y-F.positionScreen.y)*(d.positionScreen.x-F.positionScreen.x)<0||(d.positionScreen.x-P.positionScreen.x)*(ja.positionScreen.y-P.positionScreen.y)-(d.positionScreen.y-P.positionScreen.y)*(ja.positionScreen.x-P.positionScreen.x)<0)))xa=H[u]=H[u]||new THREE.RenderableFace4,u++,h=xa,h.v1.copy(F),h.v2.copy(d),h.v3.copy(P),h.v4.copy(ja);
+else continue;h.normalWorld.copy(ba.normal);ua.multiplyVector3(h.normalWorld);h.centroidWorld.copy(ba.centroid);ta.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);R.multiplyVector3(h.centroidScreen);P=ba.vertexNormals;F=0;for(d=P.length;F<d;F++)ja=h.vertexNormalsWorld[F],ja.copy(P[F]),ua.multiplyVector3(ja);F=0;for(d=za.length;F<d;F++)if(xa=za[F][oa]){P=0;for(ja=xa.length;P<ja;P++)h.uvs[F][P]=xa[P]}h.material=Ea;h.faceMaterial=ba.materialIndex!==null?Fa[ba.materialIndex]:null;
+h.z=h.centroidScreen.z;D.elements.push(h)}}else if(ia instanceof THREE.Line){ra.multiply(R,ta);oa=ia.geometry.vertices;F=b();F.positionScreen.copy(oa[0].position);ra.multiplyVector4(F.positionScreen);fa=1;for(ba=oa.length;fa<ba;fa++)if(F=b(),F.positionScreen.copy(oa[fa].position),ra.multiplyVector4(F.positionScreen),d=r[p-2],sa.copy(F.positionScreen),qa.copy(d.positionScreen),e(sa,qa))sa.multiplyScalar(1/sa.w),qa.multiplyScalar(1/qa.w),ia=la[E]=la[E]||new THREE.RenderableLine,E++,K=ia,K.v1.positionScreen.copy(sa),
+K.v2.positionScreen.copy(qa),K.z=Math.max(sa.z,qa.z),K.material=Ea,D.elements.push(K)}a=0;for(O=D.sprites.length;a<O;a++)if(ia=D.sprites[a].object,ta=ia.matrixWorld,ia instanceof THREE.Particle&&(J.set(ta.n14,ta.n24,ta.n34,1),R.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))j=pa[ha]=pa[ha]||new THREE.RenderableParticle,ha++,L=j,L.x=J.x/J.w,L.y=J.y/J.w,L.z=J.z,L.rotation=ia.rotation.z,L.scale.x=ia.scale.x*Math.abs(L.x-(J.x+g.projectionMatrix.n11)/(J.w+g.projectionMatrix.n14)),L.scale.y=ia.scale.y*Math.abs(L.y-
+(J.y+g.projectionMatrix.n22)/(J.w+g.projectionMatrix.n24)),L.material=ia.material,D.elements.push(L);f&&D.elements.sort(c);return D}};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),g=Math.cos(c),c=Math.sin(c),j=a*b,i=e*f;this.w=j*g-i*c;this.x=j*c+i*g;this.y=e*b*g+a*f*c;this.z=a*f*g-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),g=Math.cos(c),c=Math.sin(c),j=a*b,i=e*f;this.w=j*g-i*c;this.x=j*c+i*g;this.y=e*b*g+a*f*c;this.z=a*f*g-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,g=a.x,j=a.y,i=a.z,a=a.w;this.x=b*a+f*g+c*i-e*j;this.y=c*a+f*j+e*g-b*i;this.z=e*a+f*i+b*j-c*g;this.w=f*a-b*g-c*j-e*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,e=a.y,f=a.z,g=this.x,j=this.y,i=this.z,p=this.w,r=p*c+j*f-i*e,h=p*e+i*c-g*f,o=p*f+g*e-j*c,c=-g*
 this.x,c=this.y,e=this.z,f=this.w,g=a.x,j=a.y,i=a.z,a=a.w;this.x=b*a+f*g+c*i-e*j;this.y=c*a+f*j+e*g-b*i;this.z=e*a+f*i+b*j-c*g;this.w=f*a-b*g-c*j-e*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,e=a.y,f=a.z,g=this.x,j=this.y,i=this.z,p=this.w,r=p*c+j*f-i*e,h=p*e+i*c-g*f,o=p*f+g*e-j*c,c=-g*
 c-j*e-i*f;b.x=r*p+c*-g+h*-i-o*-j;b.y=h*p+c*-j+o*-g-r*-i;b.z=o*p+c*-i+r*-j-h*-g;return b}};
 c-j*e-i*f;b.x=r*p+c*-g+h*-i-o*-j;b.y=h*p+c*-j+o*-g-r*-i;b.z=o*p+c*-i+r*-j-h*-g;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;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)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;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+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;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);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;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,f,g){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=g;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,f,g){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=g;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,f,g,j){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=j;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,e,f,g,j){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=j;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -82,9 +82,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 c,e,f,g,j,i=new THREE.Vector3,p=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){i.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)i.addSelf(g.vertexNormals[b]);i.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],j=this.vertices[g.c],i.sub(j.position,c.position),p.sub(b.position,c.position),i.crossSelf(p);i.isZero()||i.normalize();g.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 c,e,f,g,j,i=new THREE.Vector3,p=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){i.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)i.addSelf(g.vertexNormals[b]);i.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],j=this.vertices[g.c],i.sub(j.position,c.position),p.sub(b.position,c.position),i.crossSelf(p);i.isZero()||i.normalize();g.normal.copy(i)}},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,b,c,e,g,f,d){i=a.vertices[b].position;p=a.vertices[c].position;r=a.vertices[e].position;h=j[g];o=j[f];C=j[d];u=p.x-i.x;I=r.x-i.x;L=p.y-i.y;E=r.y-i.y;ja=p.z-i.z;P=r.z-i.z;ha=o.u-h.u;la=C.u-h.u;D=o.v-h.v;M=C.v-h.v;G=1/(ha*M-la*D);pa.set((M*u-D*I)*G,(M*L-D*E)*G,(M*ja-D*P)*G);sa.set((ha*I-la*u)*G,(ha*E-la*L)*G,(ha*P-la*ja)*G);oa[b].addSelf(pa);oa[c].addSelf(pa);oa[e].addSelf(pa);
-Y[b].addSelf(sa);Y[c].addSelf(sa);Y[e].addSelf(sa)}var b,c,e,f,g,j,i,p,r,h,o,C,u,I,L,E,ja,P,ha,la,D,M,G,N,oa=[],Y=[],pa=new THREE.Vector3,sa=new THREE.Vector3,K=new THREE.Vector3,ma=new THREE.Vector3,ua=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)oa[b]=new THREE.Vector3,Y[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],j=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,
-g.b,g.d,0,1,3));var wa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(e=0;e<g.vertexNormals.length;e++)ua.copy(g.vertexNormals[e]),f=g[wa[e]],N=oa[f],K.copy(N),K.subSelf(ua.multiplyScalar(ua.dot(N))).normalize(),ma.cross(g.vertexNormals[e],N),f=ma.dot(Y[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(K.x,K.y,K.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],
+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,b,c,e,g,f,d){i=a.vertices[b].position;p=a.vertices[c].position;r=a.vertices[e].position;h=j[g];o=j[f];C=j[d];u=p.x-i.x;H=r.x-i.x;K=p.y-i.y;E=r.y-i.y;la=p.z-i.z;L=r.z-i.z;ha=o.u-h.u;pa=C.u-h.u;D=o.v-h.v;M=C.v-h.v;J=1/(ha*M-pa*D);sa.set((M*u-D*H)*J,(M*K-D*E)*J,(M*la-D*L)*J);qa.set((ha*H-pa*u)*J,(ha*E-pa*K)*J,(ha*L-pa*la)*J);ra[b].addSelf(sa);ra[c].addSelf(sa);ra[e].addSelf(sa);
+O[b].addSelf(qa);O[c].addSelf(qa);O[e].addSelf(qa)}var b,c,e,f,g,j,i,p,r,h,o,C,u,H,K,E,la,L,ha,pa,D,M,J,R,ra=[],O=[],sa=new THREE.Vector3,qa=new THREE.Vector3,V=new THREE.Vector3,ma=new THREE.Vector3,wa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)ra[b]=new THREE.Vector3,O[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],j=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,
+g.b,g.d,0,1,3));var ya=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(e=0;e<g.vertexNormals.length;e++)wa.copy(g.vertexNormals[e]),f=g[ya[e]],R=ra[f],V.copy(R),V.subSelf(wa.multiplyScalar(wa.dot(R))).normalize(),ma.cross(g.vertexNormals[e],R),f=ma.dot(O[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(V.x,V.y,V.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),g,j;g=0;for(j=this.vertices.length;g<j;g++)e=this.vertices[g].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),g,j;g=0;for(j=this.vertices.length;g<j;g++)e=this.vertices[g].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
 a[e]===void 0?(a[e]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[e]];g=0;for(j=this.faces.length;g<j;g++)if(a=this.faces[g],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;
 a[e]===void 0?(a[e]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[e]];g=0;for(j=this.faces.length;g<j;g++)if(a=this.faces[g],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;
@@ -177,122 +177,122 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var g in e.attributes){var f=e.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var q=1;f.type==="v2"?q=2:f.type==="v3"?q=3:f.type==="v4"?q=4:f.type==="c"&&(q=3);f.size=q;f.array=new Float32Array(c*q);f.buffer=d.createBuffer();f.buffer.belongsToAttribute=g;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var g in e.attributes){var f=e.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var q=1;f.type==="v2"?q=2:f.type==="v3"?q=3:f.type==="v4"?q=4:f.type==="c"&&(q=3);f.size=q;f.array=new Float32Array(c*q);f.buffer=d.createBuffer();f.buffer.belongsToAttribute=g;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
-function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,g,f,q,l=a.vertices;q=l.length;var j=a.colors,i=j.length,k=a.__vertexArray,m=a.__colorArray,h=a.__sortArray,y=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){ya.multiplySelf(c.matrixWorld);for(e=0;e<q;e++)g=l[e].position,Ba.copy(g),ya.multiplyVector3(Ba),h[e]=[Ba.z,e];
+function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,g,f,q,l=a.vertices;q=l.length;var j=a.colors,i=j.length,k=a.__vertexArray,m=a.__colorArray,h=a.__sortArray,y=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Aa.multiplySelf(c.matrixWorld);for(e=0;e<q;e++)g=l[e].position,Ca.copy(g),Aa.multiplyVector3(Ca),h[e]=[Ca.z,e];
 h.sort(function(a,b){return b[0]-a[0]});for(e=0;e<q;e++)g=l[h[e][1]].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;for(e=0;e<i;e++)f=e*3,g=j[h[e][1]],m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(p){j=0;for(i=p.length;j<i;j++)if(l=p[j],l.boundTo===void 0||l.boundTo==="vertices")if(f=0,g=l.value.length,l.size===1)for(e=0;e<g;e++)q=h[e][1],l.array[e]=l.value[q];else if(l.size===2)for(e=0;e<g;e++)q=h[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=h[e][1],
 h.sort(function(a,b){return b[0]-a[0]});for(e=0;e<q;e++)g=l[h[e][1]].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;for(e=0;e<i;e++)f=e*3,g=j[h[e][1]],m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(p){j=0;for(i=p.length;j<i;j++)if(l=p[j],l.boundTo===void 0||l.boundTo==="vertices")if(f=0,g=l.value.length,l.size===1)for(e=0;e<g;e++)q=h[e][1],l.array[e]=l.value[q];else if(l.size===2)for(e=0;e<g;e++)q=h[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=h[e][1],
 q=l.value[q],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=h[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=h[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+3]=q.w,f+=4}}else{if(y)for(e=0;e<q;e++)g=l[e].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;if(o)for(e=0;e<i;e++)g=j[e],f=e*3,m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(p){j=0;for(i=p.length;j<i;j++)if(l=p[j],l.needsUpdate&&(l.boundTo===
 q=l.value[q],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=h[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=h[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+3]=q.w,f+=4}}else{if(y)for(e=0;e<q;e++)g=l[e].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;if(o)for(e=0;e<i;e++)g=j[e],f=e*3,m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(p){j=0;for(i=p.length;j<i;j++)if(l=p[j],l.needsUpdate&&(l.boundTo===
 void 0||l.boundTo==="vertices"))if(g=l.value.length,f=0,l.size===1)for(e=0;e<g;e++)l.array[e]=l.value[e];else if(l.size===2)for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+
 void 0||l.boundTo==="vertices"))if(g=l.value.length,f=0,l.size===1)for(e=0;e<g;e++)l.array[e]=l.value[e];else if(l.size===2)for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+
 3]=q.w,f+=4}}if(y||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,m,b);if(p){j=0;for(i=p.length;j<i;j++)if(l=p[j],l.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,l.buffer),d.bufferData(d.ARRAY_BUFFER,l.array,b)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=
 3]=q.w,f+=4}}if(y||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,m,b);if(p){j=0;for(i=p.length;j<i;j++)if(l=p[j],l.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,l.buffer),d.bufferData(d.ARRAY_BUFFER,l.array,b)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=
 d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,g,j,l,w,i,k,m,h,y=a.count*3;for(h=0;h<y;h+=9)c=a.normalArray,e=c[h],f=c[h+1],g=c[h+2],j=c[h+3],w=c[h+4],k=c[h+5],l=c[h+6],i=c[h+7],m=c[h+8],e=(e+j+l)/
 d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,g,j,l,w,i,k,m,h,y=a.count*3;for(h=0;h<y;h+=9)c=a.normalArray,e=c[h],f=c[h+1],g=c[h+2],j=c[h+3],w=c[h+4],k=c[h+5],l=c[h+6],i=c[h+7],m=c[h+8],e=(e+j+l)/
-3,f=(f+w+i)/3,g=(g+k+m)/3,c[h]=e,c[h+1]=f,c[h+2]=g,c[h+3]=e,c[h+4]=f,c[h+5]=g,c[h+6]=e,c[h+7]=f,c[h+8]=g}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,a.count);a.count=0}function g(a,b,c,e,f,g){if(e.opacity!==0){var j,l,c=E(a,b,c,e,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==ra&&(ra=c,a=!0);if(!e.morphTargets&&b.position>=0)a&&(d.bindBuffer(d.ARRAY_BUFFER,
+3,f=(f+w+i)/3,g=(g+k+m)/3,c[h]=e,c[h+1]=f,c[h+2]=g,c[h+3]=e,c[h+4]=f,c[h+5]=g,c[h+6]=e,c[h+7]=f,c[h+8]=g}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,a.count);a.count=0}function g(a,b,c,e,f,g){if(e.opacity!==0){var j,l,c=E(a,b,c,e,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==ua&&(ua=c,a=!0);if(!e.morphTargets&&b.position>=0)a&&(d.bindBuffer(d.ARRAY_BUFFER,
 f.__webglVertexBuffer),d.vertexAttribPointer(b.position,3,d.FLOAT,!1,0,0));else if(g.morphTargetBase){c=e.program.attributes;g.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){j=0;var w=g.morphTargetForcedOrder;for(l=g.morphTargetInfluences;j<e.numSupportedMorphTargets&&
 f.__webglVertexBuffer),d.vertexAttribPointer(b.position,3,d.FLOAT,!1,0,0));else if(g.morphTargetBase){c=e.program.attributes;g.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){j=0;var w=g.morphTargetForcedOrder;for(l=g.morphTargetInfluences;j<e.numSupportedMorphTargets&&
 j<w.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[j]=l[w[j]],j++}else{var w=[],i=-1,k=0;l=g.morphTargetInfluences;var m,h=l.length;j=0;for(g.morphTargetBase!==-1&&(w[g.morphTargetBase]=!0);j<e.numSupportedMorphTargets;){for(m=0;m<h;m++)!w[m]&&l[m]>i&&(k=m,i=l[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[j]=
 j<w.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[j]=l[w[j]],j++}else{var w=[],i=-1,k=0;l=g.morphTargetInfluences;var m,h=l.length;j=0;for(g.morphTargetBase!==-1&&(w[g.morphTargetBase]=!0);j<e.numSupportedMorphTargets;){for(m=0;m<h;m++)!w[m]&&l[m]>i&&(k=m,i=l[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[j]=
 i;w[k]=1;i=-1;j++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){j=0;for(l=f.__webglCustomAttributesList.length;j<l;j++)c=f.__webglCustomAttributesList[j],b[c.buffer.belongsToAttribute]>=0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}b.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(b.color,
 i;w[k]=1;i=-1;j++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){j=0;for(l=f.__webglCustomAttributesList.length;j<l;j++)c=f.__webglCustomAttributesList[j],b[c.buffer.belongsToAttribute]>=0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}b.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(b.color,
 3,d.FLOAT,!1,0,0));b.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(b.normal,3,d.FLOAT,!1,0,0));b.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(b.tangent,4,d.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUVBuffer),d.vertexAttribPointer(b.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv)):d.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),
 3,d.FLOAT,!1,0,0));b.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(b.normal,3,d.FLOAT,!1,0,0));b.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(b.tangent,4,d.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUVBuffer),d.vertexAttribPointer(b.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv)):d.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),
 d.vertexAttribPointer(b.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv2)):d.disableVertexAttribArray(b.uv2));e.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(b.skinVertexA,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(b.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(b.skinIndex,
 d.vertexAttribPointer(b.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv2)):d.disableVertexAttribArray(b.uv2));e.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(b.skinVertexA,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(b.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(b.skinIndex,
-4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(b.skinWeight,4,d.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(e.wireframe?(e=e.wireframeLinewidth,e!==Ha&&(d.lineWidth(e),Ha=e),a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),F.info.render.calls++,F.info.render.vertices+=
-f.__webglFaceCount,F.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,e=e.linewidth,e!==Ha&&(d.lineWidth(e),Ha=e),d.drawArrays(g,0,f.__webglLineCount),F.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),F.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),F.info.render.calls++)}}function j(a){ta[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
-a.n13,a.n44-a.n14);ta[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ta[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ta[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ta[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ta[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ta[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function i(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),c=0;c<6;c++)if(a=ta[c].x*b.n14+ta[c].y*b.n24+ta[c].z*b.n34+ta[c].w,a<=d)return!1;return!0}function p(a,b){return b.z-a.z}function r(a){var b,c,e,h,La,q,l,w,o=0,k=a.lights;ia||(ia=new THREE.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar));b=0;for(c=k.length;b<c;b++)if(w=k[b],w.castShadow&&w instanceof THREE.SpotLight){na=-1;F.shadowMap[o]||(F.shadowMap[o]=new THREE.WebGLRenderTarget(F.shadowMapWidth,F.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ia[o]=new THREE.Matrix4);e=F.shadowMap[o];h=Ia[o];ia.position.copy(w.position);ia.lookAt(w.target.position);ia.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ia));this.autoUpdateScene&&a.updateMatrixWorld();ia.matrixWorldInverse.getInverse(ia.matrixWorld);h.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);h.multiplySelf(ia.projectionMatrix);h.multiplySelf(ia.matrixWorldInverse);ia.matrixWorldInverse.flattenToArray(Ja);
-ia.projectionMatrix.flattenToArray(Ka);ya.multiply(ia.projectionMatrix,ia.matrixWorldInverse);j(ya);pa(e);d.clearColor(1,1,1,1);F.clear();d.clearColor(Q.r,Q.g,Q.b,S);h=a.__webglObjects.length;for(e=0;e<h;e++)if(q=a.__webglObjects[e],w=q.object,q.render=!1,w.visible&&w.castShadow&&(!(w instanceof THREE.Mesh)||!w.frustumCulled||i(w)))w.matrixWorld.flattenToArray(w._objectMatrixArray),ja(w,ia,!1),q.render=!0;ha(!0);M(THREE.NormalBlending);for(e=0;e<h;e++)if(q=a.__webglObjects[e],q.render)w=q.object,
-q=q.buffer,P(w),l=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ma:Fa,g(ia,k,null,l,q,w);h=a.__webglObjectsImmediate.length;for(e=0;e<h;e++)q=a.__webglObjectsImmediate[e],w=q.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ra=-1,ja(w,ia,!1),P(w),La=E(ia,k,null,Fa,w),w.immediateRenderCallback?w.immediateRenderCallback(La,d,ta):w.render(function(a){f(a,La,Fa.shading)}));o++}}function h(a,b,d,c,e,f,j,l){var w,h,k,m;
-b?(h=a.length-1,m=b=-1):(h=0,b=a.length,m=1);for(var i=h;i!==b;i+=m)if(w=a[i],w.render){h=w.object;k=w.buffer;if(l)w=l;else{w=w[d];if(!w)continue;j&&M(w.blending);ha(w.depthTest);la(w.depthWrite);D(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits)}P(h);g(c,e,f,w,k,h)}}function o(a,b,c,e,g,j,h){for(var l,w,i,k,m=0,o=a.length;m<o;m++)if(l=a[m],w=l.object,w.visible){ra=-1;if(h)i=h;else{i=l[b];if(!i)continue;j&&M(i.blending);ha(i.depthTest);la(i.depthWrite);D(i.polygonOffset,i.polygonOffsetFactor,
-i.polygonOffsetUnits)}P(w);k=E(c,e,g,i,w);w.immediateRenderCallback?w.immediateRenderCallback(k,d,ta):w.render(function(a){f(a,k,i.shading)})}}function C(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function u(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function I(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function L(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function E(a,b,c,e,f){e.program||F.initMaterial(e,
-b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var g=0,j=F.maxMorphTargets;g<j;g++)f.__webglMorphTargetInfluences[g]=0}var l=!1,g=e.program,j=g.uniforms,h=e.uniforms;g!==qa&&(d.useProgram(g),qa=g,l=!0);if(e.id!==na)na=e.id,l=!0;if(l){d.uniformMatrix4fv(j.projectionMatrix,!1,Ka);if(c&&e.fog)if(h.fogColor.value=c.color,c instanceof THREE.Fog)h.fogNear.value=c.near,h.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)h.fogDensity.value=
-c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var i,k,m=0,o=0,y=0,p,r,u,s=Qa,C=s.directional.colors,x=s.directional.positions,v=s.point.colors,I=s.point.positions,L=s.point.distances,E=0,D=0,c=i=u=0,l=b.length;c<l;c++)if(i=b[c],k=i.color,p=i.position,r=i.intensity,u=i.distance,i instanceof THREE.AmbientLight)F.gammaInput?(m+=k.r*k.r,o+=k.g*k.g,y+=k.b*k.b):(m+=k.r,o+=k.g,y+=k.b);else if(i instanceof THREE.DirectionalLight)u=E*3,F.gammaInput?
-(C[u]=k.r*k.r*r*r,C[u+1]=k.g*k.g*r*r,C[u+2]=k.b*k.b*r*r):(C[u]=k.r*r,C[u+1]=k.g*r,C[u+2]=k.b*r),x[u]=p.x,x[u+1]=p.y,x[u+2]=p.z,E+=1;else if(i instanceof THREE.SpotLight)u=E*3,F.gammaInput?(C[u]=k.r*k.r*r*r,C[u+1]=k.g*k.g*r*r,C[u+2]=k.b*k.b*r*r):(C[u]=k.r*r,C[u+1]=k.g*r,C[u+2]=k.b*r),k=1/p.length(),x[u]=p.x*k,x[u+1]=p.y*k,x[u+2]=p.z*k,E+=1;else if(i instanceof THREE.PointLight)i=D*3,F.gammaInput?(v[i]=k.r*k.r*r*r,v[i+1]=k.g*k.g*r*r,v[i+2]=k.b*k.b*r*r):(v[i]=k.r*r,v[i+1]=k.g*r,v[i+2]=k.b*r),I[i]=p.x,
-I[i+1]=p.y,I[i+2]=p.z,L[D]=u,D+=1;c=E*3;for(l=C.length;c<l;c++)C[c]=0;c=D*3;for(l=v.length;c<l;c++)v[c]=0;s.point.length=D;s.directional.length=E;s.ambient[0]=m;s.ambient[1]=o;s.ambient[2]=y;b=Qa;h.ambientLightColor.value=b.ambient;h.directionalLightColor.value=b.directional.colors;h.directionalLightDirection.value=b.directional.positions;h.pointLightColor.value=b.point.colors;h.pointLightPosition.value=b.point.positions;h.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||
+4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(b.skinWeight,4,d.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(e.wireframe?(e=e.wireframeLinewidth,e!==Ia&&(d.lineWidth(e),Ia=e),a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),F.info.render.calls++,F.info.render.vertices+=
+f.__webglFaceCount,F.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,e=e.linewidth,e!==Ia&&(d.lineWidth(e),Ia=e),d.drawArrays(g,0,f.__webglLineCount),F.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),F.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),F.info.render.calls++)}}function j(a){va[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
+a.n13,a.n44-a.n14);va[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);va[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);va[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);va[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);va[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=va[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function i(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),c=0;c<6;c++)if(a=va[c].x*b.n14+va[c].y*b.n24+va[c].z*b.n34+va[c].w,a<=d)return!1;return!0}function p(a,b){return b.z-a.z}function r(a){var b,c,e,h,Ma,q,l,w,o=0,k=a.lights;ka||(ka=new THREE.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar));b=0;for(c=k.length;b<c;b++)if(w=k[b],w.castShadow&&w instanceof THREE.SpotLight){ta=-1;F.shadowMap[o]||(F.shadowMap[o]=new THREE.WebGLRenderTarget(F.shadowMapWidth,F.shadowMapHeight,{minFilter:THREE.LinearFilter,
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ja[o]=new THREE.Matrix4);e=F.shadowMap[o];h=Ja[o];ka.position.copy(w.position);ka.lookAt(w.target.position);ka.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ka));this.autoUpdateScene&&a.updateMatrixWorld();ka.matrixWorldInverse.getInverse(ka.matrixWorld);h.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);h.multiplySelf(ka.projectionMatrix);h.multiplySelf(ka.matrixWorldInverse);ka.matrixWorldInverse.flattenToArray(Ka);
+ka.projectionMatrix.flattenToArray(La);Aa.multiply(ka.projectionMatrix,ka.matrixWorldInverse);j(Aa);sa(e);d.clearColor(1,1,1,1);F.clear();d.clearColor(fa.r,fa.g,fa.b,ba);h=a.__webglObjects.length;for(e=0;e<h;e++)if(q=a.__webglObjects[e],w=q.object,q.render=!1,w.visible&&w.castShadow&&(!(w instanceof THREE.Mesh)||!w.frustumCulled||i(w)))w.matrixWorld.flattenToArray(w._objectMatrixArray),la(w,ka,!1),q.render=!0;ha(!0);M(THREE.NormalBlending);for(e=0;e<h;e++)if(q=a.__webglObjects[e],q.render)w=q.object,
+q=q.buffer,L(w),l=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Na:Ga,g(ka,k,null,l,q,w);h=a.__webglObjectsImmediate.length;for(e=0;e<h;e++)q=a.__webglObjectsImmediate[e],w=q.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ua=-1,la(w,ka,!1),L(w),Ma=E(ka,k,null,Ga,w),w.immediateRenderCallback?w.immediateRenderCallback(Ma,d,va):w.render(function(a){f(a,Ma,Ga.shading)}));o++}}function h(a,b,d,c,e,f,j,l){var w,h,k,m;
+b?(h=a.length-1,m=b=-1):(h=0,b=a.length,m=1);for(var i=h;i!==b;i+=m)if(w=a[i],w.render){h=w.object;k=w.buffer;if(l)w=l;else{w=w[d];if(!w)continue;j&&M(w.blending);ha(w.depthTest);pa(w.depthWrite);D(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits)}L(h);g(c,e,f,w,k,h)}}function o(a,b,c,e,g,j,h){for(var l,w,i,k,m=0,o=a.length;m<o;m++)if(l=a[m],w=l.object,w.visible){ua=-1;if(h)i=h;else{i=l[b];if(!i)continue;j&&M(i.blending);ha(i.depthTest);pa(i.depthWrite);D(i.polygonOffset,i.polygonOffsetFactor,
+i.polygonOffsetUnits)}L(w);k=E(c,e,g,i,w);w.immediateRenderCallback?w.immediateRenderCallback(k,d,va):w.render(function(a){f(a,k,i.shading)})}}function C(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function u(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function H(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function K(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function E(a,b,c,e,f){e.program||F.initMaterial(e,
+b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var g=0,j=F.maxMorphTargets;g<j;g++)f.__webglMorphTargetInfluences[g]=0}var l=!1,g=e.program,j=g.uniforms,h=e.uniforms;g!==ja&&(d.useProgram(g),ja=g,l=!0);if(e.id!==ta)ta=e.id,l=!0;if(l){d.uniformMatrix4fv(j.projectionMatrix,!1,La);if(c&&e.fog)if(h.fogColor.value=c.color,c instanceof THREE.Fog)h.fogNear.value=c.near,h.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)h.fogDensity.value=
+c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var i,k,m=0,o=0,y=0,p,r,u,s=Ra,C=s.directional.colors,x=s.directional.positions,v=s.point.colors,H=s.point.positions,K=s.point.distances,E=0,D=0,c=i=u=0,l=b.length;c<l;c++)if(i=b[c],k=i.color,p=i.position,r=i.intensity,u=i.distance,i instanceof THREE.AmbientLight)F.gammaInput?(m+=k.r*k.r,o+=k.g*k.g,y+=k.b*k.b):(m+=k.r,o+=k.g,y+=k.b);else if(i instanceof THREE.DirectionalLight)u=E*3,F.gammaInput?
+(C[u]=k.r*k.r*r*r,C[u+1]=k.g*k.g*r*r,C[u+2]=k.b*k.b*r*r):(C[u]=k.r*r,C[u+1]=k.g*r,C[u+2]=k.b*r),x[u]=p.x,x[u+1]=p.y,x[u+2]=p.z,E+=1;else if(i instanceof THREE.SpotLight)u=E*3,F.gammaInput?(C[u]=k.r*k.r*r*r,C[u+1]=k.g*k.g*r*r,C[u+2]=k.b*k.b*r*r):(C[u]=k.r*r,C[u+1]=k.g*r,C[u+2]=k.b*r),k=1/p.length(),x[u]=p.x*k,x[u+1]=p.y*k,x[u+2]=p.z*k,E+=1;else if(i instanceof THREE.PointLight)i=D*3,F.gammaInput?(v[i]=k.r*k.r*r*r,v[i+1]=k.g*k.g*r*r,v[i+2]=k.b*k.b*r*r):(v[i]=k.r*r,v[i+1]=k.g*r,v[i+2]=k.b*r),H[i]=p.x,
+H[i+1]=p.y,H[i+2]=p.z,K[D]=u,D+=1;c=E*3;for(l=C.length;c<l;c++)C[c]=0;c=D*3;for(l=v.length;c<l;c++)v[c]=0;s.point.length=D;s.directional.length=E;s.ambient[0]=m;s.ambient[1]=o;s.ambient[2]=y;b=Ra;h.ambientLightColor.value=b.ambient;h.directionalLightColor.value=b.directional.colors;h.directionalLightDirection.value=b.directional.positions;h.pointLightColor.value=b.point.colors;h.pointLightPosition.value=b.point.positions;h.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||
 e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)h.opacity.value=e.opacity,F.gammaInput?h.diffuse.value.copyGammaToLinear(e.color):h.diffuse.value=e.color,(h.map.texture=e.map)&&h.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),h.lightMap.texture=e.lightMap,h.envMap.texture=e.envMap,h.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,h.reflectivity.value=e.reflectivity,h.refractionRatio.value=e.refractionRatio,h.combine.value=
 e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)h.opacity.value=e.opacity,F.gammaInput?h.diffuse.value.copyGammaToLinear(e.color):h.diffuse.value=e.color,(h.map.texture=e.map)&&h.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),h.lightMap.texture=e.lightMap,h.envMap.texture=e.envMap,h.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,h.reflectivity.value=e.reflectivity,h.refractionRatio.value=e.refractionRatio,h.combine.value=
 e.combine,h.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)h.diffuse.value=e.color,h.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)h.psColor.value=e.color,h.opacity.value=e.opacity,h.size.value=e.size,h.scale.value=ma.height/2,h.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)h.shininess.value=e.shininess,F.gammaInput?(h.ambient.value.copyGammaToLinear(e.ambient),h.specular.value.copyGammaToLinear(e.specular)):
 e.combine,h.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)h.diffuse.value=e.color,h.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)h.psColor.value=e.color,h.opacity.value=e.opacity,h.size.value=e.size,h.scale.value=ma.height/2,h.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)h.shininess.value=e.shininess,F.gammaInput?(h.ambient.value.copyGammaToLinear(e.ambient),h.specular.value.copyGammaToLinear(e.specular)):
-(h.ambient.value=e.ambient,h.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)F.gammaInput?h.ambient.value.copyGammaToLinear(e.ambient):h.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)h.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&h.shadowMatrix){for(b=0;b<Ia.length;b++)h.shadowMatrix.value[b]=Ia[b],h.shadowMap.texture[b]=F.shadowMap[b];
+(h.ambient.value=e.ambient,h.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)F.gammaInput?h.ambient.value.copyGammaToLinear(e.ambient):h.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)h.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&h.shadowMatrix){for(b=0;b<Ja.length;b++)h.shadowMatrix.value[b]=Ja[b],h.shadowMap.texture[b]=F.shadowMap[b];
 h.shadowDarkness.value=F.shadowMapDarkness;h.shadowBias.value=F.shadowMapBias}b=e.uniformsList;h=0;for(c=b.length;h<c;h++)if(o=g.uniforms[b[h][1]])if(m=b[h][0],y=m.type,l=m.value,y==="i")d.uniform1i(o,l);else if(y==="f")d.uniform1f(o,l);else if(y==="v2")d.uniform2f(o,l.x,l.y);else if(y==="v3")d.uniform3f(o,l.x,l.y,l.z);else if(y==="v4")d.uniform4f(o,l.x,l.y,l.z,l.w);else if(y==="c")d.uniform3f(o,l.r,l.g,l.b);else if(y==="fv1")d.uniform1fv(o,l);else if(y==="fv")d.uniform3fv(o,l);else if(y==="v3v"){if(!m._array)m._array=
 h.shadowDarkness.value=F.shadowMapDarkness;h.shadowBias.value=F.shadowMapBias}b=e.uniformsList;h=0;for(c=b.length;h<c;h++)if(o=g.uniforms[b[h][1]])if(m=b[h][0],y=m.type,l=m.value,y==="i")d.uniform1i(o,l);else if(y==="f")d.uniform1f(o,l);else if(y==="v2")d.uniform2f(o,l.x,l.y);else if(y==="v3")d.uniform3f(o,l.x,l.y,l.z);else if(y==="v4")d.uniform4f(o,l.x,l.y,l.z,l.w);else if(y==="c")d.uniform3f(o,l.r,l.g,l.b);else if(y==="fv1")d.uniform1fv(o,l);else if(y==="fv")d.uniform3fv(o,l);else if(y==="v3v"){if(!m._array)m._array=
 new Float32Array(3*l.length);y=0;for(p=l.length;y<p;y++)s=y*3,m._array[s]=l[y].x,m._array[s+1]=l[y].y,m._array[s+2]=l[y].z;d.uniform3fv(o,m._array)}else if(y==="m4"){if(!m._array)m._array=new Float32Array(16);l.flattenToArray(m._array);d.uniformMatrix4fv(o,!1,m._array)}else if(y==="m4v"){if(!m._array)m._array=new Float32Array(16*l.length);y=0;for(p=l.length;y<p;y++)l[y].flattenToArrayOffset(m._array,y*16);d.uniformMatrix4fv(o,!1,m._array)}else if(y==="t"){if(d.uniform1i(o,l),o=m.texture)if(o.image instanceof
 new Float32Array(3*l.length);y=0;for(p=l.length;y<p;y++)s=y*3,m._array[s]=l[y].x,m._array[s+1]=l[y].y,m._array[s+2]=l[y].z;d.uniform3fv(o,m._array)}else if(y==="m4"){if(!m._array)m._array=new Float32Array(16);l.flattenToArray(m._array);d.uniformMatrix4fv(o,!1,m._array)}else if(y==="m4v"){if(!m._array)m._array=new Float32Array(16*l.length);y=0;for(p=l.length;y<p;y++)l[y].flattenToArrayOffset(m._array,y*16);d.uniformMatrix4fv(o,!1,m._array)}else if(y==="t"){if(d.uniform1i(o,l),o=m.texture)if(o.image instanceof
-Array&&o.image.length===6){if(m=o,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=d.createTexture();d.activeTexture(d.TEXTURE0+l);d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(l=0;l<6;l++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,m.image[l]);N(d.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else o instanceof
-THREE.WebGLRenderTargetCube?(m=o,d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.__webglTexture)):oa(o,l)}else if(y==="tv"){if(!m._array){m._array=[];y=0;for(p=m.texture.length;y<p;y++)m._array[y]=l+y}d.uniform1iv(o,m._array);y=0;for(p=m.texture.length;y<p;y++)(o=m.texture[y])&&oa(o,m._array[y])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&d.uniform3f(j.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof
-THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&j.viewMatrix!==null&&d.uniformMatrix4fv(j.viewMatrix,!1,Ja);e.skinning&&(d.uniformMatrix4fv(j.cameraInverseMatrix,!1,Ja),d.uniformMatrix4fv(j.boneGlobalMatrices,!1,f.boneMatrices))}d.uniformMatrix4fv(j.modelViewMatrix,!1,f._modelViewMatrixArray);j.normalMatrix&&d.uniformMatrix3fv(j.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&
-j.objectMatrix!==null&&d.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray);return g}function ja(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function P(a){if(Ea!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),Ea=a.doubleSided;if(Aa!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),Aa=a.flipSided}function ha(a){va!==
-a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),va=a)}function la(a){Na!==a&&(d.depthMask(a),Na=a)}function D(a,b,c){Ra!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Ra=a);if(a&&(Sa!==b||Ta!==c))d.polygonOffset(b,c),Sa=b,Ta=c}function M(a){if(a!==xa){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}xa=a}}function G(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function N(a,b,c){(c.width&c.width-1)===
-0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,K(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,K(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,K(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,K(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,sa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,sa(b.minFilter)))}function oa(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
-!0,a.__webglTexture=d.createTexture(),F.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,K(a.format),a.image.width,a.image.height,0,K(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);N(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}
-function Y(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function pa(a){var b=
-a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);N(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,K(a.format),
-a.width,a.height,0,K(a.format),K(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);Y(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),N(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null),
-c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),Y(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ga,a=Ca,e=Oa,
-f=Pa);b!==ga&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),ga=b)}function sa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function K(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;
+Array&&o.image.length===6){if(m=o,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=d.createTexture();d.activeTexture(d.TEXTURE0+l);d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(l=0;l<6;l++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,m.image[l]);R(d.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else o instanceof
+THREE.WebGLRenderTargetCube?(m=o,d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.__webglTexture)):ra(o,l)}else if(y==="tv"){if(!m._array){m._array=[];y=0;for(p=m.texture.length;y<p;y++)m._array[y]=l+y}d.uniform1iv(o,m._array);y=0;for(p=m.texture.length;y<p;y++)(o=m.texture[y])&&ra(o,m._array[y])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&d.uniform3f(j.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof
+THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&j.viewMatrix!==null&&d.uniformMatrix4fv(j.viewMatrix,!1,Ka);e.skinning&&(d.uniformMatrix4fv(j.cameraInverseMatrix,!1,Ka),d.uniformMatrix4fv(j.boneGlobalMatrices,!1,f.boneMatrices))}d.uniformMatrix4fv(j.modelViewMatrix,!1,f._modelViewMatrixArray);j.normalMatrix&&d.uniformMatrix3fv(j.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&
+j.objectMatrix!==null&&d.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray);return g}function la(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function L(a){if(Fa!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),Fa=a.doubleSided;if(Ba!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),Ba=a.flipSided}function ha(a){xa!==
+a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),xa=a)}function pa(a){Oa!==a&&(d.depthMask(a),Oa=a)}function D(a,b,c){Sa!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Sa=a);if(a&&(Ta!==b||Ua!==c))d.polygonOffset(b,c),Ta=b,Ua=c}function M(a){if(a!==za){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);
+d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}za=a}}function J(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function R(a,b,c){(c.width&c.width-1)===
+0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,V(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,V(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,V(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,V(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,qa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,qa(b.minFilter)))}function ra(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
+!0,a.__webglTexture=d.createTexture(),F.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,V(a.format),a.image.width,a.image.height,0,V(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);R(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}
+function O(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function sa(a){var b=
+a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);R(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,V(a.format),
+a.width,a.height,0,V(a.format),V(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);O(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),R(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,V(a.format),a.width,a.height,0,V(a.format),V(a.type),null),
+c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),O(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ha,a=Da,e=Pa,
+f=Qa);b!==ia&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),ia=b)}function qa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function V(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;
 case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;
 case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;
-case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var a=a||{},ma=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ua=a.precision!==void 0?a.precision:"highp",wa=a.antialias!==void 0?a.antialias:!1,za=a.stencil!==void 0?a.stencil:!0,Wa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,Q=a.clearColor!==void 0?new THREE.Color(a.clearColor):
-new THREE.Color(0),S=a.clearAlpha!==void 0?a.clearAlpha:0,ka=a.maxLights!==void 0?a.maxLights:4;this.domElement=ma;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=
-50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var F=this,d,ba=[],qa=null,ga=null,na=-1,ra=null,Da=0,Ea=null,Aa=null,xa=null,va=null,Na=null,Ra=null,Sa=null,Ta=null,Ha=null,Oa=0,Pa=0,Ga=0,Ca=0,ta=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ya=new THREE.Matrix4,Ka=new Float32Array(16),
-Ja=new Float32Array(16),Ba=new THREE.Vector4,Qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ia,Ia=[],Fa,Ma,x={},Ua=!1;d=function(){var a;try{if(!(a=ma.getContext("experimental-webgl",{antialias:wa,stencil:za,preserveDrawingBuffer:Wa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
-d.clearColor(0,0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(Q.r,Q.g,Q.b,S);(function(){x.vertices=new Float32Array(16);x.faces=new Uint16Array(6);var a=0;x.vertices[a++]=-1;x.vertices[a++]=-1;x.vertices[a++]=0;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=-1;x.vertices[a++]=1;x.vertices[a++]=
-1;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=0;x.vertices[a++]=-1;x.vertices[a++]=1;x.vertices[a++]=0;a=x.vertices[a++]=0;x.faces[a++]=0;x.faces[a++]=1;x.faces[a++]=2;x.faces[a++]=0;x.faces[a++]=2;x.faces[a++]=3;x.vertexBuffer=d.createBuffer();x.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,x.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,x.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,x.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,x.faces,d.STATIC_DRAW);
-x.program=d.createProgram();d.attachShader(x.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(x.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(x.program);x.attributes={};x.uniforms={};x.attributes.position=d.getAttribLocation(x.program,"position");x.attributes.uv=d.getAttribLocation(x.program,"uv");x.uniforms.uvOffset=d.getUniformLocation(x.program,"uvOffset");x.uniforms.uvScale=d.getUniformLocation(x.program,"uvScale");x.uniforms.rotation=d.getUniformLocation(x.program,
-"rotation");x.uniforms.scale=d.getUniformLocation(x.program,"scale");x.uniforms.alignment=d.getUniformLocation(x.program,"alignment");x.uniforms.color=d.getUniformLocation(x.program,"color");x.uniforms.map=d.getUniformLocation(x.program,"map");x.uniforms.opacity=d.getUniformLocation(x.program,"opacity");x.uniforms.useScreenCoordinates=d.getUniformLocation(x.program,"useScreenCoordinates");x.uniforms.affectedByDistance=d.getUniformLocation(x.program,"affectedByDistance");x.uniforms.screenPosition=
-d.getUniformLocation(x.program,"screenPosition");x.uniforms.modelViewMatrix=d.getUniformLocation(x.program,"modelViewMatrix");x.uniforms.projectionMatrix=d.getUniformLocation(x.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});Ma=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
-Fa._shadowPass=!0;Ma._shadowPass=!0})();this.context=d;var Va=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Va};this.setSize=function(a,b){ma.width=a;ma.height=b;this.setViewport(0,0,ma.width,ma.height)};this.setViewport=function(a,b,c,e){Oa=a;Pa=b;Ga=c;Ca=e;d.viewport(Oa,Pa,Ga,Ca)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};
-this.setClearColorHex=function(a,b){Q.setHex(a);S=b;d.clearColor(Q.r,Q.g,Q.b,S)};this.setClearColor=function(a,b){Q.copy(a);S=b;d.clearColor(Q.r,Q.g,Q.b,S)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return S};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){pa(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
-!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];d.deleteBuffer(c.__webglVertexBuffer);d.deleteBuffer(c.__webglNormalBuffer);d.deleteBuffer(c.__webglTangentBuffer);d.deleteBuffer(c.__webglColorBuffer);d.deleteBuffer(c.__webglUVBuffer);d.deleteBuffer(c.__webglUV2Buffer);d.deleteBuffer(c.__webglSkinVertexABuffer);d.deleteBuffer(c.__webglSkinVertexBBuffer);
-d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)d.deleteBuffer(c.__webglMorphTargetsBuffers[e]);F.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
-d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),F.info.memory.textures--};this.updateShadowMap=function(a,b){r(a,b)};this.render=function(a,b,c,e){var f,g,q,l,w=a.lights,u=a.fog;na=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
-this.shadowMapEnabled&&this.shadowMapAutoUpdate&&r(a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ja);b.projectionMatrix.flattenToArray(Ka);ya.multiply(b.projectionMatrix,b.matrixWorldInverse);j(ya);pa(c);(this.autoClear||e)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,g.render=!1,q.visible&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||i(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);ja(q,b,!0);var k=g,m=k.object,C=k.buffer,y=void 0,y=y=void 0,y=m.material;if(y instanceof THREE.MeshFaceMaterial){if(y=C.materialIndex,y>=0)y=m.geometry.materials[y],y.transparent?(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null)}else if(y)y.transparent?
-(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ba.copy(q.position),ya.multiplyVector3(Ba),g.z=Ba.z)}this.sortObjects&&l.sort(p);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,q.visible)q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),ja(q,b,!0),q=g.object.material,q.transparent?(g.transparent=q,g.opaque=null):(g.opaque=q,g.transparent=null);a.overrideMaterial?(M(a.overrideMaterial.blending),
-ha(a.overrideMaterial.depthTest),la(a.overrideMaterial.depthWrite),D(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),h(a.__webglObjects,!1,"",b,w,u,!0,a.overrideMaterial),o(a.__webglObjectsImmediate,"",b,w,u,!1,a.overrideMaterial)):(M(THREE.NormalBlending),h(a.__webglObjects,!0,"opaque",b,w,u,!1),o(a.__webglObjectsImmediate,"opaque",b,w,u,!1),h(a.__webglObjects,!1,"transparent",b,w,u,!0),o(a.__webglObjectsImmediate,"transparent",b,w,u,
-!0));if(a.__webglSprites.length){q=x.attributes;w=x.uniforms;u=Ca/Ga;e=[];f=Ga*0.5;l=Ca*0.5;g=!0;d.useProgram(x.program);qa=x.program;ra=va=xa=-1;Ua||(d.enableVertexAttribArray(x.attributes.position),d.enableVertexAttribArray(x.attributes.uv),Ua=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,x.vertexBuffer);d.vertexAttribPointer(q.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(q.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,x.elementBuffer);
-d.uniformMatrix4fv(w.projectionMatrix,!1,Ka);d.activeTexture(d.TEXTURE0);d.uniform1i(w.map,0);q=0;for(k=a.__webglSprites.length;q<k;q++)if(m=a.__webglSprites[q],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);a.__webglSprites.sort(p);q=0;for(k=a.__webglSprites.length;q<k;q++)m=a.__webglSprites[q],m.visible&&m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&
-(m.useScreenCoordinates?(d.uniform1i(w.useScreenCoordinates,1),d.uniform3f(w.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(w.useScreenCoordinates,0),d.uniform1i(w.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(w.modelViewMatrix,!1,m._modelViewMatrixArray)),b=m.map.image.width/(m.scaleByViewport?Ca:1),e[0]=b*u*m.scale.x,e[1]=b*m.scale.y,d.uniform2f(w.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(w.uvOffset,m.uvOffset.x,m.uvOffset.y),
-d.uniform2f(w.alignment,m.alignment.x,m.alignment.y),d.uniform1f(w.opacity,m.opacity),d.uniform3f(w.color,m.color.r,m.color.g,m.color.b),d.uniform1f(w.rotation,m.rotation),d.uniform2fv(w.scale,e),m.mergeWith3D&&!g?(d.enable(d.DEPTH_TEST),g=!0):!m.mergeWith3D&&g&&(d.disable(d.DEPTH_TEST),g=!1),M(m.blending),oa(m.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Na)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
-(c instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,c.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,c.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],g=a,j=void 0,h=void 0,i=void 0;if(!f.__webglInit)if(f.__webglInit=
-!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){h=f.geometry;if(h.geometryGroups===void 0){var i=h,q=void 0,l=void 0,w=void 0,o=void 0,k=void 0,m=void 0,p=void 0,y={},r=i.morphTargets.length;i.geometryGroups={};q=0;for(l=i.faces.length;q<l;q++)w=i.faces[q],o=w.materialIndex,m=o!==void 0?o:-1,y[m]===void 0&&
-(y[m]={hash:m,counter:0}),p=y[m].hash+"_"+y[m].counter,i.geometryGroups[p]===void 0&&(i.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r}),k=w instanceof THREE.Face3?3:4,i.geometryGroups[p].vertices+k>65535&&(y[m].counter+=1,p=y[m].hash+"_"+y[m].counter,i.geometryGroups[p]===void 0&&(i.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r})),w instanceof THREE.Face3?i.geometryGroups[p].faces3.push(q):i.geometryGroups[p].faces4.push(q),
-i.geometryGroups[p].vertices+=k;i.geometryGroupsList=[];q=void 0;for(q in i.geometryGroups)i.geometryGroups[q].id=Da++,i.geometryGroupsList.push(i.geometryGroups[q])}for(j in h.geometryGroups)if(i=h.geometryGroups[j],!i.__webglVertexBuffer){q=i;q.__webglVertexBuffer=d.createBuffer();q.__webglNormalBuffer=d.createBuffer();q.__webglTangentBuffer=d.createBuffer();q.__webglColorBuffer=d.createBuffer();q.__webglUVBuffer=d.createBuffer();q.__webglUV2Buffer=d.createBuffer();q.__webglSkinVertexABuffer=d.createBuffer();
-q.__webglSkinVertexBBuffer=d.createBuffer();q.__webglSkinIndicesBuffer=d.createBuffer();q.__webglSkinWeightsBuffer=d.createBuffer();q.__webglFaceBuffer=d.createBuffer();q.__webglLineBuffer=d.createBuffer();if(q.numMorphTargets){w=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(w=q.numMorphTargets;l<w;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}F.info.memory.geometries++;o=f;k=o.geometry;l=i.faces3;m=i.faces4;q=l.length*3+m.length*4;w=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(o,
-i);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;y=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;r=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(q*3);if(y)i.__normalArray=new Float32Array(q*3);if(k.hasTangents)i.__tangentArray=new Float32Array(q*4);if(r)i.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>
-0)i.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(q*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(q*4),i.__skinVertexBArray=new Float32Array(q*4),i.__skinIndexArray=new Float32Array(q*4),i.__skinWeightArray=new Float32Array(q*4);i.__faceArray=new Uint16Array(w*3);i.__lineArray=new Uint16Array(m*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];o=0;for(k=i.numMorphTargets;o<k;o++)i.__morphTargetsArrays.push(new Float32Array(q*
-3))}i.__needsSmoothNormals=y===THREE.SmoothShading;i.__uvType=p;i.__vertexColorType=r;i.__normalType=y;i.__webglFaceCount=w*3;i.__webglLineCount=m*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];w=void 0;for(w in l.attributes){var o=l.attributes[w],k={},x;for(x in o)k[x]=o[x];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,m=1,k.type==="v2"?m=2:k.type==="v3"?m=3:k.type==="v4"?m=4:k.type==="c"&&(m=3),k.size=m,k.array=new Float32Array(q*
-m),k.buffer=d.createBuffer(),k.buffer.belongsToAttribute=w,o.needsUpdate=!0,k.__original=o;i.__webglCustomAttributesList.push(k)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(h=f.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,i=h,q=i.vertices.length,
-i.__vertexArray=new Float32Array(q*3),i.__colorArray=new Float32Array(q*3),i.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,i=h,q=f,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,b(i,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof
-THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),F.info.geometries++,i=h,q=f,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,b(i,q),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(j in h=f.geometry,h.geometryGroups)i=h.geometryGroups[j],C(g.__webglObjects,i,f);else f instanceof
-THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,C(g.__webglObjects,h,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?g.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&g.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];g=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof
-THREE.Ribbon||f instanceof THREE.Line)L(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;j=f;for(h=g.length-1;h>=0;h--)g[h]===j&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&L(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(x=a.__webglObjects[f].object,j=x.geometry,h=w=l=void 0,x instanceof THREE.Mesh){i=0;for(q=j.geometryGroupsList.length;i<q;i++)if(l=j.geometryGroupsList[i],
-h=c(x,l),w=h.attributes&&u(h),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||w)if(w=d.DYNAMIC_DRAW,o=!j.dynamic,l.__inittedArrays){var E=m=k=void 0,s=void 0,D=void 0,K=void 0,v=void 0,G=void 0,Z=void 0,Y=void 0,P=void 0,R=E=K=void 0,z=void 0,A=void 0,B=void 0,X=s=void 0,$=void 0,T=s=Z=P=void 0,U=void 0,M=B=A=z=v=void 0,J=s=B=A=z=M=B=A=z=M=B=A=z=void 0,W=void 0,N=K=void 0,S=void 0,V=void 0,ba=void 0,ca=void 0,H=R=V=W=
-0,Q=0,aa=J=E=0,O=v=X=0,t=0,da=void 0,O=l.__vertexArray,S=l.__uvArray,t=l.__uv2Array,N=l.__normalArray,D=l.__tangentArray,$=l.__colorArray,T=l.__skinVertexAArray,U=l.__skinVertexBArray,G=l.__skinIndexArray,fa=l.__skinWeightArray,M=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,n=void 0,n=l.__faceArray,da=l.__lineArray,ga=l.__needsSmoothNormals,P=l.__vertexColorType,Y=l.__uvType,K=l.__normalType,Z=x.geometry,ha=Z.__dirtyElements,ja=Z.__dirtyUvs,la=Z.__dirtyNormals,pa=Z.__dirtyTangents,sa=Z.__dirtyColors,
-ba=Z.__dirtyMorphTargets,ca=Z.vertices,y=l.faces3,r=l.faces4,ea=Z.faces,oa=Z.faceVertexUvs[0],qa=Z.faceVertexUvs[1],ia=Z.skinVerticesA,ka=Z.skinVerticesB,ma=Z.skinIndices,na=Z.skinWeights,ra=Z.morphTargets;if(Z.__dirtyVertices){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=ca[s.a].position,A=ca[s.b].position,B=ca[s.c].position,O[V]=z.x,O[V+1]=z.y,O[V+2]=z.z,O[V+3]=A.x,O[V+4]=A.y,O[V+5]=A.z,O[V+6]=B.x,O[V+7]=B.y,O[V+8]=B.z,V+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=ca[s.a].position,A=ca[s.b].position,
-B=ca[s.c].position,s=ca[s.d].position,O[V]=z.x,O[V+1]=z.y,O[V+2]=z.z,O[V+3]=A.x,O[V+4]=A.y,O[V+5]=A.z,O[V+6]=B.x,O[V+7]=B.y,O[V+8]=B.z,O[V+9]=s.x,O[V+10]=s.y,O[V+11]=s.z,V+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,O,w)}if(ba){V=0;for(ba=ra.length;V<ba;V++){k=O=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=ra[V].vertices[s.a].position,A=ra[V].vertices[s.b].position,B=ra[V].vertices[s.c].position,ca=M[V],ca[O]=z.x,ca[O+1]=z.y,ca[O+2]=z.z,ca[O+3]=A.x,ca[O+4]=A.y,ca[O+
-5]=A.z,ca[O+6]=B.x,ca[O+7]=B.y,ca[O+8]=B.z,O+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=ra[V].vertices[s.a].position,A=ra[V].vertices[s.b].position,B=ra[V].vertices[s.c].position,s=ra[V].vertices[s.d].position,ca=M[V],ca[O]=z.x,ca[O+1]=z.y,ca[O+2]=z.z,ca[O+3]=A.x,ca[O+4]=A.y,ca[O+5]=A.z,ca[O+6]=B.x,ca[O+7]=B.y,ca[O+8]=B.z,ca[O+9]=s.x,ca[O+10]=s.y,ca[O+11]=s.z,O+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[V]);d.bufferData(d.ARRAY_BUFFER,M[V],w)}}if(na.length){k=0;for(m=y.length;k<
-m;k++)s=ea[y[k]],z=na[s.a],A=na[s.b],B=na[s.c],fa[v]=z.x,fa[v+1]=z.y,fa[v+2]=z.z,fa[v+3]=z.w,fa[v+4]=A.x,fa[v+5]=A.y,fa[v+6]=A.z,fa[v+7]=A.w,fa[v+8]=B.x,fa[v+9]=B.y,fa[v+10]=B.z,fa[v+11]=B.w,z=ma[s.a],A=ma[s.b],B=ma[s.c],G[v]=z.x,G[v+1]=z.y,G[v+2]=z.z,G[v+3]=z.w,G[v+4]=A.x,G[v+5]=A.y,G[v+6]=A.z,G[v+7]=A.w,G[v+8]=B.x,G[v+9]=B.y,G[v+10]=B.z,G[v+11]=B.w,z=ia[s.a],A=ia[s.b],B=ia[s.c],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+
-11]=1,z=ka[s.a],A=ka[s.b],B=ka[s.c],U[v]=z.x,U[v+1]=z.y,U[v+2]=z.z,U[v+3]=1,U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=1,U[v+8]=B.x,U[v+9]=B.y,U[v+10]=B.z,U[v+11]=1,v+=12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=na[s.a],A=na[s.b],B=na[s.c],M=na[s.d],fa[v]=z.x,fa[v+1]=z.y,fa[v+2]=z.z,fa[v+3]=z.w,fa[v+4]=A.x,fa[v+5]=A.y,fa[v+6]=A.z,fa[v+7]=A.w,fa[v+8]=B.x,fa[v+9]=B.y,fa[v+10]=B.z,fa[v+11]=B.w,fa[v+12]=M.x,fa[v+13]=M.y,fa[v+14]=M.z,fa[v+15]=M.w,z=ma[s.a],A=ma[s.b],B=ma[s.c],M=ma[s.d],G[v]=z.x,G[v+1]=z.y,
-G[v+2]=z.z,G[v+3]=z.w,G[v+4]=A.x,G[v+5]=A.y,G[v+6]=A.z,G[v+7]=A.w,G[v+8]=B.x,G[v+9]=B.y,G[v+10]=B.z,G[v+11]=B.w,G[v+12]=M.x,G[v+13]=M.y,G[v+14]=M.z,G[v+15]=M.w,z=ia[s.a],A=ia[s.b],B=ia[s.c],M=ia[s.d],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+11]=1,T[v+12]=M.x,T[v+13]=M.y,T[v+14]=M.z,T[v+15]=1,z=ka[s.a],A=ka[s.b],B=ka[s.c],s=ka[s.d],U[v]=z.x,U[v+1]=z.y,U[v+2]=z.z,U[v+3]=1,U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=1,U[v+8]=
-B.x,U[v+9]=B.y,U[v+10]=B.z,U[v+11]=1,U[v+12]=s.x,U[v+13]=s.y,U[v+14]=s.z,U[v+15]=1,v+=16;v>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,T,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,U,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,G,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,fa,w))}if(sa&&P){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],
-v=s.vertexColors,G=s.color,v.length===3&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2]):U=T=s=G,$[X]=s.r,$[X+1]=s.g,$[X+2]=s.b,$[X+3]=T.r,$[X+4]=T.g,$[X+5]=T.b,$[X+6]=U.r,$[X+7]=U.g,$[X+8]=U.b,X+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],v=s.vertexColors,G=s.color,v.length===4&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2],v=v[3]):v=U=T=s=G,$[X]=s.r,$[X+1]=s.g,$[X+2]=s.b,$[X+3]=T.r,$[X+4]=T.g,$[X+5]=T.b,$[X+6]=U.r,$[X+7]=U.g,$[X+8]=U.b,$[X+9]=v.r,$[X+10]=v.g,$[X+11]=v.b,X+=12;X>0&&(d.bindBuffer(d.ARRAY_BUFFER,
-l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,$,w))}if(pa&&Z.hasTangents){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],Z=s.vertexTangents,X=Z[0],$=Z[1],P=Z[2],D[J]=X.x,D[J+1]=X.y,D[J+2]=X.z,D[J+3]=X.w,D[J+4]=$.x,D[J+5]=$.y,D[J+6]=$.z,D[J+7]=$.w,D[J+8]=P.x,D[J+9]=P.y,D[J+10]=P.z,D[J+11]=P.w,J+=12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],Z=s.vertexTangents,X=Z[0],$=Z[1],P=Z[2],Z=Z[3],D[J]=X.x,D[J+1]=X.y,D[J+2]=X.z,D[J+3]=X.w,D[J+4]=$.x,D[J+5]=$.y,D[J+6]=$.z,D[J+7]=$.w,D[J+8]=P.x,D[J+9]=P.y,D[J+10]=P.z,D[J+
-11]=P.w,D[J+12]=Z.x,D[J+13]=Z.y,D[J+14]=Z.z,D[J+15]=Z.w,J+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,D,w)}if(la&&K){k=0;for(m=y.length;k<m;k++)if(s=ea[y[k]],D=s.vertexNormals,K=s.normal,D.length===3&&ga)for(J=0;J<3;J++)K=D[J],N[E]=K.x,N[E+1]=K.y,N[E+2]=K.z,E+=3;else for(J=0;J<3;J++)N[E]=K.x,N[E+1]=K.y,N[E+2]=K.z,E+=3;k=0;for(m=r.length;k<m;k++)if(s=ea[r[k]],D=s.vertexNormals,K=s.normal,D.length===4&&ga)for(J=0;J<4;J++)K=D[J],N[E]=K.x,N[E+1]=K.y,N[E+2]=K.z,
-E+=3;else for(J=0;J<4;J++)N[E]=K.x,N[E+1]=K.y,N[E+2]=K.z,E+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,N,w)}if(ja&&oa&&Y){k=0;for(m=y.length;k<m;k++)if(E=y[k],E=oa[E],E!==void 0)for(J=0;J<3;J++)N=E[J],S[R]=N.u,S[R+1]=N.v,R+=2;k=0;for(m=r.length;k<m;k++)if(E=r[k],E=oa[E],E!==void 0)for(J=0;J<4;J++)N=E[J],S[R]=N.u,S[R+1]=N.v,R+=2;R>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,S,w))}if(ja&&qa&&Y){k=0;for(m=y.length;k<m;k++)if(E=
-y[k],R=qa[E],R!==void 0)for(J=0;J<3;J++)S=R[J],t[H]=S.u,t[H+1]=S.v,H+=2;k=0;for(m=r.length;k<m;k++)if(E=r[k],R=qa[E],R!==void 0)for(J=0;J<4;J++)S=R[J],t[H]=S.u,t[H+1]=S.v,H+=2;H>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,w))}if(ha){k=0;for(m=y.length;k<m;k++)n[Q]=W,n[Q+1]=W+1,n[Q+2]=W+2,Q+=3,da[aa]=W,da[aa+1]=W+1,da[aa+2]=W,da[aa+3]=W+2,da[aa+4]=W+1,da[aa+5]=W+2,aa+=6,W+=3;k=0;for(m=r.length;k<m;k++)n[Q]=W,n[Q+1]=W+1,n[Q+2]=W+3,n[Q+3]=W+1,n[Q+4]=W+2,n[Q+5]=W+
-3,Q+=6,da[aa]=W,da[aa+1]=W+1,da[aa+2]=W,da[aa+3]=W+3,da[aa+4]=W+1,da[aa+5]=W+2,da[aa+6]=W+2,da[aa+7]=W+3,aa+=8,W+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,n,w);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,da,w)}if(p){J=0;for(W=p.length;J<W;J++)if(n=p[J],n.__original.needsUpdate){t=0;if(n.size===1)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],n.array[t]=n.value[s.a],
-n.array[t+1]=n.value[s.b],n.array[t+2]=n.value[s.c],t+=3;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],n.array[t]=n.value[s.a],n.array[t+1]=n.value[s.b],n.array[t+2]=n.value[s.c],n.array[t+3]=n.value[s.d],t+=4}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)da=n.value[y[k]],n.array[t]=da,n.array[t+1]=da,n.array[t+2]=da,t+=3;k=0;for(m=r.length;k<m;k++)da=n.value[r[k]],n.array[t]=da,n.array[t+1]=da,n.array[t+2]=da,n.array[t+3]=da,t+=4}}else if(n.size===2)if(n.boundTo===void 0||n.boundTo==="vertices"){k=
-0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,t+=6;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,n.array[t+6]=s.x,n.array[t+7]=s.y,t+=8}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],
-n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,t+=6;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,n.array[t+6]=s.x,n.array[t+7]=s.y,t+=8}}else if(n.size===3)if(H=n.type==="c"?["r","g","b"]:["x","y","z"],n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z[H[0]],
-n.array[t+1]=z[H[1]],n.array[t+2]=z[H[2]],n.array[t+3]=A[H[0]],n.array[t+4]=A[H[1]],n.array[t+5]=A[H[2]],n.array[t+6]=B[H[0]],n.array[t+7]=B[H[1]],n.array[t+8]=B[H[2]],t+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z[H[0]],n.array[t+1]=z[H[1]],n.array[t+2]=z[H[2]],n.array[t+3]=A[H[0]],n.array[t+4]=A[H[1]],n.array[t+5]=A[H[2]],n.array[t+6]=B[H[0]],n.array[t+7]=B[H[1]],n.array[t+8]=B[H[2]],n.array[t+9]=s[H[0]],n.array[t+10]=s[H[1]],
-n.array[t+11]=s[H[2]],t+=12}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],n.array[t]=z[H[0]],n.array[t+1]=z[H[1]],n.array[t+2]=z[H[2]],n.array[t+3]=A[H[0]],n.array[t+4]=A[H[1]],n.array[t+5]=A[H[2]],n.array[t+6]=B[H[0]],n.array[t+7]=B[H[1]],n.array[t+8]=B[H[2]],t+=9;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z[H[0]],n.array[t+1]=z[H[1]],n.array[t+2]=z[H[2]],n.array[t+3]=A[H[0]],n.array[t+4]=A[H[1]],n.array[t+5]=A[H[2]],n.array[t+6]=B[H[0]],n.array[t+
-7]=B[H[1]],n.array[t+8]=B[H[2]],n.array[t+9]=s[H[0]],n.array[t+10]=s[H[1]],n.array[t+11]=s[H[2]],t+=12}}else if(n.size===4)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,t+=12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],
-z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,n.array[t+12]=s.x,n.array[t+13]=s.y,n.array[t+14]=s.z,n.array[t+15]=s.w,t+=16}else if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,
-n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,t+=12;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,n.array[t+12]=s.x,n.array[t+13]=s.y,n.array[t+14]=s.z,n.array[t+15]=s.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,n.buffer);d.bufferData(d.ARRAY_BUFFER,
-n.array,w)}}o&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyColors=!1;j.__dirtyTangents=!1;h.attributes&&I(h)}else if(x instanceof
-THREE.Ribbon){if(j.__dirtyVertices||j.__dirtyColors){h=j;x=d.DYNAMIC_DRAW;k=i=k=o=o=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;y=h.__vertexArray;w=h.__colorArray;r=h.__dirtyColors;if(h.__dirtyVertices){for(o=0;o<p;o++)k=m[o].position,i=o*3,y[i]=k.x,y[i+1]=k.y,y[i+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,y,x)}if(r){for(o=0;o<l;o++)k=q[o],i=o*3,w[i]=k.r,w[i+1]=k.g,w[i+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,
-w,x)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(x instanceof THREE.Line){h=c(x,l);w=h.attributes&&u(h);if(j.__dirtyVertices||j.__dirtyColors||w){x=j;i=d.DYNAMIC_DRAW;p=q=W=m=ea=void 0;m=x.vertices;l=x.colors;p=m.length;w=l.length;y=x.__vertexArray;o=x.__colorArray;r=x.__dirtyColors;k=x.__webglCustomAttributesList;R=aa=Q=H=W=ea=void 0;if(x.__dirtyVertices){for(ea=0;ea<p;ea++)W=m[ea].position,q=ea*3,y[q]=W.x,y[q+1]=W.y,y[q+2]=W.z;d.bindBuffer(d.ARRAY_BUFFER,x.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
-y,i)}if(r){for(m=0;m<w;m++)p=l[m],q=m*3,o[q]=p.r,o[q+1]=p.g,o[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,x.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,o,i)}if(k){ea=0;for(W=k.length;ea<W;ea++)if(R=k[ea],R.needsUpdate&&(R.boundTo===void 0||R.boundTo==="vertices")){q=0;Q=R.value.length;if(R.size===1)for(H=0;H<Q;H++)R.array[H]=R.value[H];else if(R.size===2)for(H=0;H<Q;H++)aa=R.value[H],R.array[q]=aa.x,R.array[q+1]=aa.y,q+=2;else if(R.size===3)if(R.type==="c")for(H=0;H<Q;H++)aa=R.value[H],R.array[q]=aa.r,
-R.array[q+1]=aa.g,R.array[q+2]=aa.b,q+=3;else for(H=0;H<Q;H++)aa=R.value[H],R.array[q]=aa.x,R.array[q+1]=aa.y,R.array[q+2]=aa.z,q+=3;else if(R.size===4)for(H=0;H<Q;H++)aa=R.value[H],R.array[q]=aa.x,R.array[q+1]=aa.y,R.array[q+2]=aa.z,R.array[q+3]=aa.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,R.buffer);d.bufferData(d.ARRAY_BUFFER,R.array,i)}}}j.__dirtyVertices=!1;j.__dirtyColors=!1;h.attributes&&I(h)}else if(x instanceof THREE.ParticleSystem)h=c(x,l),w=h.attributes&&u(h),(j.__dirtyVertices||j.__dirtyColors||
-x.sortParticles||w)&&e(j,d.DYNAMIC_DRAW,x),j.__dirtyVertices=!1,j.__dirtyColors=!1,h.attributes&&I(h)};this.initMaterial=function(a,b,c,e){var f,g,i,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");
-if(h){var j=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var o,k,m;o=m=j=0;for(k=b.length;o<k;o++)i=b[o],i instanceof THREE.SpotLight&&m++,i instanceof THREE.DirectionalLight&&m++,i instanceof THREE.PointLight&&j++;j+m<=ka?o=m:(o=Math.ceil(ka*m/(j+m)),j=ka-o);i={directional:o,point:j};j=m=0;for(o=b.length;j<o;j++)k=b[j],k instanceof THREE.SpotLight&&k.castShadow&&m++;var r=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)r=
-e.bones.length;var p;a:{o=a.fragmentShader;k=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,
-maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},u,e=[];h?e.push(h):(e.push(o),e.push(k));for(u in c)e.push(u),e.push(c[u]);h=e.join();u=0;for(e=ba.length;u<e;u++)if(ba[u].code===h){p=ba[u].program;break a}u=d.createProgram();e=[Va?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,
-"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-i=["#ifdef GL_ES","precision "+ua+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(u,G("fragment",i+o));d.attachShader(u,
-G("vertex",e+k));d.linkProgram(u);d.getProgramParameter(u,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(u,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");u.uniforms={};u.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in j)e.push(x);x=e;e=0;for(j=x.length;e<j;e++)o=x[e],u.uniforms[o]=d.getUniformLocation(u,
-o);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)e.push("morphTarget"+x);for(p in b)e.push(p);p=e;x=0;for(b=p.length;x<b;x++)c=p[x],u.attributes[c]=d.getAttribLocation(u,c);u.id=ba.length;ba.push({program:u,code:h});F.info.memory.programs=ba.length;p=u}a.program=p;p=a.program.attributes;p.position>=0&&d.enableVertexAttribArray(p.position);p.color>=0&&d.enableVertexAttribArray(p.color);p.normal>=0&&d.enableVertexAttribArray(p.normal);
+case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var a=a||{},ma=a.canvas!==void 0?a.canvas:document.createElement("canvas"),wa=a.precision!==void 0?a.precision:"highp",ya=a.antialias!==void 0?a.antialias:!1,na=a.stencil!==void 0?a.stencil:!0,Xa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,fa=a.clearColor!==void 0?
+new THREE.Color(a.clearColor):new THREE.Color(0),ba=a.clearAlpha!==void 0?a.clearAlpha:0,oa=a.maxLights!==void 0?a.maxLights:4;this.domElement=ma;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
+5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var F=this,d,P=[],ja=null,ia=null,ta=-1,ua=null,Ea=0,Fa=null,Ba=null,za=null,xa=null,Oa=null,Sa=null,Ta=null,Ua=null,Ia=null,Pa=0,Qa=0,Ha=0,Da=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,
+La=new Float32Array(16),Ka=new Float32Array(16),Ca=new THREE.Vector4,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ka,Ja=[],Ga,Na,x={},Va=!1;d=function(){var a;try{if(!(a=ma.getContext("experimental-webgl",{antialias:ya,stencil:na,preserveDrawingBuffer:Xa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+
+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();d.clearColor(0,0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(fa.r,fa.g,fa.b,ba);(function(){x.vertices=new Float32Array(16);x.faces=new Uint16Array(6);var a=0;x.vertices[a++]=-1;x.vertices[a++]=-1;x.vertices[a++]=
+0;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=-1;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=0;x.vertices[a++]=-1;x.vertices[a++]=1;x.vertices[a++]=0;a=x.vertices[a++]=0;x.faces[a++]=0;x.faces[a++]=1;x.faces[a++]=2;x.faces[a++]=0;x.faces[a++]=2;x.faces[a++]=3;x.vertexBuffer=d.createBuffer();x.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,x.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,x.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
+x.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,x.faces,d.STATIC_DRAW);x.program=d.createProgram();d.attachShader(x.program,J("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(x.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(x.program);x.attributes={};x.uniforms={};x.attributes.position=d.getAttribLocation(x.program,"position");x.attributes.uv=d.getAttribLocation(x.program,"uv");x.uniforms.uvOffset=d.getUniformLocation(x.program,"uvOffset");x.uniforms.uvScale=
+d.getUniformLocation(x.program,"uvScale");x.uniforms.rotation=d.getUniformLocation(x.program,"rotation");x.uniforms.scale=d.getUniformLocation(x.program,"scale");x.uniforms.alignment=d.getUniformLocation(x.program,"alignment");x.uniforms.color=d.getUniformLocation(x.program,"color");x.uniforms.map=d.getUniformLocation(x.program,"map");x.uniforms.opacity=d.getUniformLocation(x.program,"opacity");x.uniforms.useScreenCoordinates=d.getUniformLocation(x.program,"useScreenCoordinates");x.uniforms.affectedByDistance=
+d.getUniformLocation(x.program,"affectedByDistance");x.uniforms.screenPosition=d.getUniformLocation(x.program,"screenPosition");x.uniforms.modelViewMatrix=d.getUniformLocation(x.program,"modelViewMatrix");x.uniforms.projectionMatrix=d.getUniformLocation(x.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Ga=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});Na=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});Ga._shadowPass=!0;Na._shadowPass=!0})();this.context=d;var Wa=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Wa};this.setSize=function(a,b){ma.width=a;ma.height=b;this.setViewport(0,0,ma.width,ma.height)};this.setViewport=function(a,b,c,e){Pa=a;Qa=b;Ha=c;Da=e;d.viewport(Pa,Qa,Ha,Da)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
+function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){fa.setHex(a);ba=b;d.clearColor(fa.r,fa.g,fa.b,ba)};this.setClearColor=function(a,b){fa.copy(a);ba=b;d.clearColor(fa.r,fa.g,fa.b,ba)};this.getClearColor=function(){return fa};this.getClearAlpha=function(){return ba};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,
+b,c,d){sa(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];d.deleteBuffer(c.__webglVertexBuffer);d.deleteBuffer(c.__webglNormalBuffer);d.deleteBuffer(c.__webglTangentBuffer);d.deleteBuffer(c.__webglColorBuffer);d.deleteBuffer(c.__webglUVBuffer);
+d.deleteBuffer(c.__webglUV2Buffer);d.deleteBuffer(c.__webglSkinVertexABuffer);d.deleteBuffer(c.__webglSkinVertexBBuffer);d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)d.deleteBuffer(c.__webglMorphTargetsBuffers[e]);F.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),
+F.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),F.info.memory.textures--};this.updateShadowMap=function(a,b){r(a,b)};
+this.render=function(a,b,c,e){var f,g,q,l,w=a.lights,u=a.fog;ta=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&r(a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ka);b.projectionMatrix.flattenToArray(La);
+Aa.multiply(b.projectionMatrix,b.matrixWorldInverse);j(Aa);sa(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,g.render=!1,q.visible&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||i(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);la(q,b,!0);var k=g,m=k.object,C=k.buffer,y=void 0,y=y=void 0,y=m.material;if(y instanceof THREE.MeshFaceMaterial){if(y=C.materialIndex,y>=0)y=m.geometry.materials[y],
+y.transparent?(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null)}else if(y)y.transparent?(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ca.copy(q.position),Aa.multiplyVector3(Ca),g.z=Ca.z)}this.sortObjects&&l.sort(p);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,q.visible)q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),la(q,b,!0),q=g.object.material,q.transparent?
+(g.transparent=q,g.opaque=null):(g.opaque=q,g.transparent=null);a.overrideMaterial?(M(a.overrideMaterial.blending),ha(a.overrideMaterial.depthTest),pa(a.overrideMaterial.depthWrite),D(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),h(a.__webglObjects,!1,"",b,w,u,!0,a.overrideMaterial),o(a.__webglObjectsImmediate,"",b,w,u,!1,a.overrideMaterial)):(M(THREE.NormalBlending),h(a.__webglObjects,!0,"opaque",b,w,u,!1),o(a.__webglObjectsImmediate,
+"opaque",b,w,u,!1),h(a.__webglObjects,!1,"transparent",b,w,u,!0),o(a.__webglObjectsImmediate,"transparent",b,w,u,!0));if(a.__webglSprites.length){q=x.attributes;w=x.uniforms;u=Da/Ha;e=[];f=Ha*0.5;l=Da*0.5;g=!0;d.useProgram(x.program);ja=x.program;ua=xa=za=-1;Va||(d.enableVertexAttribArray(x.attributes.position),d.enableVertexAttribArray(x.attributes.uv),Va=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,x.vertexBuffer);d.vertexAttribPointer(q.position,2,d.FLOAT,
+!1,16,0);d.vertexAttribPointer(q.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,x.elementBuffer);d.uniformMatrix4fv(w.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(w.map,0);q=0;for(k=a.__webglSprites.length;q<k;q++)if(m=a.__webglSprites[q],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);a.__webglSprites.sort(p);q=0;for(k=a.__webglSprites.length;q<
+k;q++)m=a.__webglSprites[q],m.visible&&m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&(m.useScreenCoordinates?(d.uniform1i(w.useScreenCoordinates,1),d.uniform3f(w.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(w.useScreenCoordinates,0),d.uniform1i(w.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(w.modelViewMatrix,!1,m._modelViewMatrixArray)),b=m.map.image.width/(m.scaleByViewport?Da:1),e[0]=b*u*m.scale.x,e[1]=b*m.scale.y,
+d.uniform2f(w.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(w.uvOffset,m.uvOffset.x,m.uvOffset.y),d.uniform2f(w.alignment,m.alignment.x,m.alignment.y),d.uniform1f(w.opacity,m.opacity),d.uniform3f(w.color,m.color.r,m.color.g,m.color.b),d.uniform1f(w.rotation,m.rotation),d.uniform2fv(w.scale,e),m.mergeWith3D&&!g?(d.enable(d.DEPTH_TEST),g=!0):!m.mergeWith3D&&g&&(d.disable(d.DEPTH_TEST),g=!1),M(m.blending),ra(m.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);
+d.depthMask(Oa)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,c.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,c.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=
+a.__objectsAdded[0],g=a,j=void 0,h=void 0,i=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){h=f.geometry;if(h.geometryGroups===void 0){var i=h,q=void 0,l=void 0,w=void 0,o=void 0,k=void 0,m=void 0,p=void 0,y={},r=i.morphTargets.length;i.geometryGroups={};q=0;for(l=
+i.faces.length;q<l;q++)w=i.faces[q],o=w.materialIndex,m=o!==void 0?o:-1,y[m]===void 0&&(y[m]={hash:m,counter:0}),p=y[m].hash+"_"+y[m].counter,i.geometryGroups[p]===void 0&&(i.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r}),k=w instanceof THREE.Face3?3:4,i.geometryGroups[p].vertices+k>65535&&(y[m].counter+=1,p=y[m].hash+"_"+y[m].counter,i.geometryGroups[p]===void 0&&(i.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r})),w instanceof
+THREE.Face3?i.geometryGroups[p].faces3.push(q):i.geometryGroups[p].faces4.push(q),i.geometryGroups[p].vertices+=k;i.geometryGroupsList=[];q=void 0;for(q in i.geometryGroups)i.geometryGroups[q].id=Ea++,i.geometryGroupsList.push(i.geometryGroups[q])}for(j in h.geometryGroups)if(i=h.geometryGroups[j],!i.__webglVertexBuffer){q=i;q.__webglVertexBuffer=d.createBuffer();q.__webglNormalBuffer=d.createBuffer();q.__webglTangentBuffer=d.createBuffer();q.__webglColorBuffer=d.createBuffer();q.__webglUVBuffer=
+d.createBuffer();q.__webglUV2Buffer=d.createBuffer();q.__webglSkinVertexABuffer=d.createBuffer();q.__webglSkinVertexBBuffer=d.createBuffer();q.__webglSkinIndicesBuffer=d.createBuffer();q.__webglSkinWeightsBuffer=d.createBuffer();q.__webglFaceBuffer=d.createBuffer();q.__webglLineBuffer=d.createBuffer();if(q.numMorphTargets){w=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(w=q.numMorphTargets;l<w;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}F.info.memory.geometries++;o=f;k=o.geometry;l=
+i.faces3;m=i.faces4;q=l.length*3+m.length*4;w=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(o,i);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;y=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;r=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(q*3);if(y)i.__normalArray=new Float32Array(q*3);if(k.hasTangents)i.__tangentArray=new Float32Array(q*
+4);if(r)i.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>0)i.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(q*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(q*4),i.__skinVertexBArray=new Float32Array(q*4),i.__skinIndexArray=new Float32Array(q*4),i.__skinWeightArray=new Float32Array(q*4);i.__faceArray=new Uint16Array(w*3);i.__lineArray=new Uint16Array(m*
+2);if(i.numMorphTargets){i.__morphTargetsArrays=[];o=0;for(k=i.numMorphTargets;o<k;o++)i.__morphTargetsArrays.push(new Float32Array(q*3))}i.__needsSmoothNormals=y===THREE.SmoothShading;i.__uvType=p;i.__vertexColorType=r;i.__normalType=y;i.__webglFaceCount=w*3;i.__webglLineCount=m*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];w=void 0;for(w in l.attributes){var o=l.attributes[w],k={},x;for(x in o)k[x]=o[x];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=
+!0,m=1,k.type==="v2"?m=2:k.type==="v3"?m=3:k.type==="v4"?m=4:k.type==="c"&&(m=3),k.size=m,k.array=new Float32Array(q*m),k.buffer=d.createBuffer(),k.buffer.belongsToAttribute=w,o.needsUpdate=!0,k.__original=o;i.__webglCustomAttributesList.push(k)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(h=f.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=
+d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,i=h,q=i.vertices.length,i.__vertexArray=new Float32Array(q*3),i.__colorArray=new Float32Array(q*3),i.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,i=h,q=f,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=
+new Float32Array(l*3),i.__webglLineCount=l,b(i,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),F.info.geometries++,i=h,q=f,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,b(i,q),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(j in h=
+f.geometry,h.geometryGroups)i=h.geometryGroups[j],C(g.__webglObjects,i,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,C(g.__webglObjects,h,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?g.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&g.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=
+a.__objectsRemoved[0];g=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)K(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;j=f;for(h=g.length-1;h>=0;h--)g[h]===j&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&K(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(x=a.__webglObjects[f].object,j=x.geometry,
+h=w=l=void 0,x instanceof THREE.Mesh){i=0;for(q=j.geometryGroupsList.length;i<q;i++)if(l=j.geometryGroupsList[i],h=c(x,l),w=h.attributes&&u(h),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||w)if(w=d.DYNAMIC_DRAW,o=!j.dynamic,l.__inittedArrays){var E=m=k=void 0,s=void 0,D=void 0,J=void 0,v=void 0,Y=void 0,Z=void 0,V=void 0,O=void 0,Q=E=J=void 0,z=void 0,A=void 0,B=void 0,X=s=void 0,$=void 0,S=s=Z=O=void 0,T=void 0,L=
+B=A=z=v=void 0,I=s=B=A=z=L=B=A=z=L=B=A=z=void 0,W=void 0,M=J=void 0,R=void 0,U=void 0,ba=void 0,ca=void 0,G=Q=U=W=0,P=0,aa=I=E=0,N=v=X=0,t=0,da=void 0,N=l.__vertexArray,R=l.__uvArray,t=l.__uv2Array,M=l.__normalArray,D=l.__tangentArray,$=l.__colorArray,S=l.__skinVertexAArray,T=l.__skinVertexBArray,Y=l.__skinIndexArray,ga=l.__skinWeightArray,L=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,n=void 0,n=l.__faceArray,da=l.__lineArray,fa=l.__needsSmoothNormals,O=l.__vertexColorType,V=l.__uvType,
+J=l.__normalType,Z=x.geometry,ia=Z.__dirtyElements,ha=Z.__dirtyUvs,la=Z.__dirtyNormals,pa=Z.__dirtyTangents,sa=Z.__dirtyColors,ba=Z.__dirtyMorphTargets,ca=Z.vertices,y=l.faces3,r=l.faces4,ea=Z.faces,qa=Z.faceVertexUvs[0],ra=Z.faceVertexUvs[1],ja=Z.skinVerticesA,ka=Z.skinVerticesB,oa=Z.skinIndices,ma=Z.skinWeights,na=Z.morphTargets;if(Z.__dirtyVertices){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=ca[s.a].position,A=ca[s.b].position,B=ca[s.c].position,N[U]=z.x,N[U+1]=z.y,N[U+2]=z.z,N[U+3]=A.x,N[U+4]=A.y,
+N[U+5]=A.z,N[U+6]=B.x,N[U+7]=B.y,N[U+8]=B.z,U+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=ca[s.a].position,A=ca[s.b].position,B=ca[s.c].position,s=ca[s.d].position,N[U]=z.x,N[U+1]=z.y,N[U+2]=z.z,N[U+3]=A.x,N[U+4]=A.y,N[U+5]=A.z,N[U+6]=B.x,N[U+7]=B.y,N[U+8]=B.z,N[U+9]=s.x,N[U+10]=s.y,N[U+11]=s.z,U+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,N,w)}if(ba){U=0;for(ba=na.length;U<ba;U++){k=N=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=na[U].vertices[s.a].position,A=na[U].vertices[s.b].position,
+B=na[U].vertices[s.c].position,ca=L[U],ca[N]=z.x,ca[N+1]=z.y,ca[N+2]=z.z,ca[N+3]=A.x,ca[N+4]=A.y,ca[N+5]=A.z,ca[N+6]=B.x,ca[N+7]=B.y,ca[N+8]=B.z,N+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=na[U].vertices[s.a].position,A=na[U].vertices[s.b].position,B=na[U].vertices[s.c].position,s=na[U].vertices[s.d].position,ca=L[U],ca[N]=z.x,ca[N+1]=z.y,ca[N+2]=z.z,ca[N+3]=A.x,ca[N+4]=A.y,ca[N+5]=A.z,ca[N+6]=B.x,ca[N+7]=B.y,ca[N+8]=B.z,ca[N+9]=s.x,ca[N+10]=s.y,ca[N+11]=s.z,N+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[U]);
+d.bufferData(d.ARRAY_BUFFER,L[U],w)}}if(ma.length){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=ma[s.a],A=ma[s.b],B=ma[s.c],ga[v]=z.x,ga[v+1]=z.y,ga[v+2]=z.z,ga[v+3]=z.w,ga[v+4]=A.x,ga[v+5]=A.y,ga[v+6]=A.z,ga[v+7]=A.w,ga[v+8]=B.x,ga[v+9]=B.y,ga[v+10]=B.z,ga[v+11]=B.w,z=oa[s.a],A=oa[s.b],B=oa[s.c],Y[v]=z.x,Y[v+1]=z.y,Y[v+2]=z.z,Y[v+3]=z.w,Y[v+4]=A.x,Y[v+5]=A.y,Y[v+6]=A.z,Y[v+7]=A.w,Y[v+8]=B.x,Y[v+9]=B.y,Y[v+10]=B.z,Y[v+11]=B.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],S[v]=z.x,S[v+1]=z.y,S[v+2]=z.z,S[v+3]=1,S[v+4]=
+A.x,S[v+5]=A.y,S[v+6]=A.z,S[v+7]=1,S[v+8]=B.x,S[v+9]=B.y,S[v+10]=B.z,S[v+11]=1,z=ka[s.a],A=ka[s.b],B=ka[s.c],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+11]=1,v+=12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=ma[s.a],A=ma[s.b],B=ma[s.c],L=ma[s.d],ga[v]=z.x,ga[v+1]=z.y,ga[v+2]=z.z,ga[v+3]=z.w,ga[v+4]=A.x,ga[v+5]=A.y,ga[v+6]=A.z,ga[v+7]=A.w,ga[v+8]=B.x,ga[v+9]=B.y,ga[v+10]=B.z,ga[v+11]=B.w,ga[v+12]=L.x,ga[v+13]=L.y,ga[v+14]=L.z,
+ga[v+15]=L.w,z=oa[s.a],A=oa[s.b],B=oa[s.c],L=oa[s.d],Y[v]=z.x,Y[v+1]=z.y,Y[v+2]=z.z,Y[v+3]=z.w,Y[v+4]=A.x,Y[v+5]=A.y,Y[v+6]=A.z,Y[v+7]=A.w,Y[v+8]=B.x,Y[v+9]=B.y,Y[v+10]=B.z,Y[v+11]=B.w,Y[v+12]=L.x,Y[v+13]=L.y,Y[v+14]=L.z,Y[v+15]=L.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],L=ja[s.d],S[v]=z.x,S[v+1]=z.y,S[v+2]=z.z,S[v+3]=1,S[v+4]=A.x,S[v+5]=A.y,S[v+6]=A.z,S[v+7]=1,S[v+8]=B.x,S[v+9]=B.y,S[v+10]=B.z,S[v+11]=1,S[v+12]=L.x,S[v+13]=L.y,S[v+14]=L.z,S[v+15]=1,z=ka[s.a],A=ka[s.b],B=ka[s.c],s=ka[s.d],T[v]=z.x,T[v+1]=
+z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+11]=1,T[v+12]=s.x,T[v+13]=s.y,T[v+14]=s.z,T[v+15]=1,v+=16;v>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,S,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,T,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,Y,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,
+ga,w))}if(sa&&O){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],v=s.vertexColors,Y=s.color,v.length===3&&O===THREE.VertexColors?(s=v[0],S=v[1],T=v[2]):T=S=s=Y,$[X]=s.r,$[X+1]=s.g,$[X+2]=s.b,$[X+3]=S.r,$[X+4]=S.g,$[X+5]=S.b,$[X+6]=T.r,$[X+7]=T.g,$[X+8]=T.b,X+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],v=s.vertexColors,Y=s.color,v.length===4&&O===THREE.VertexColors?(s=v[0],S=v[1],T=v[2],v=v[3]):v=T=S=s=Y,$[X]=s.r,$[X+1]=s.g,$[X+2]=s.b,$[X+3]=S.r,$[X+4]=S.g,$[X+5]=S.b,$[X+6]=T.r,$[X+7]=T.g,$[X+8]=T.b,$[X+9]=v.r,
+$[X+10]=v.g,$[X+11]=v.b,X+=12;X>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,$,w))}if(pa&&Z.hasTangents){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],Z=s.vertexTangents,X=Z[0],$=Z[1],O=Z[2],D[I]=X.x,D[I+1]=X.y,D[I+2]=X.z,D[I+3]=X.w,D[I+4]=$.x,D[I+5]=$.y,D[I+6]=$.z,D[I+7]=$.w,D[I+8]=O.x,D[I+9]=O.y,D[I+10]=O.z,D[I+11]=O.w,I+=12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],Z=s.vertexTangents,X=Z[0],$=Z[1],O=Z[2],Z=Z[3],D[I]=X.x,D[I+1]=X.y,D[I+2]=X.z,D[I+3]=X.w,D[I+4]=$.x,D[I+5]=
+$.y,D[I+6]=$.z,D[I+7]=$.w,D[I+8]=O.x,D[I+9]=O.y,D[I+10]=O.z,D[I+11]=O.w,D[I+12]=Z.x,D[I+13]=Z.y,D[I+14]=Z.z,D[I+15]=Z.w,I+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,D,w)}if(la&&J){k=0;for(m=y.length;k<m;k++)if(s=ea[y[k]],D=s.vertexNormals,J=s.normal,D.length===3&&fa)for(I=0;I<3;I++)J=D[I],M[E]=J.x,M[E+1]=J.y,M[E+2]=J.z,E+=3;else for(I=0;I<3;I++)M[E]=J.x,M[E+1]=J.y,M[E+2]=J.z,E+=3;k=0;for(m=r.length;k<m;k++)if(s=ea[r[k]],D=s.vertexNormals,J=s.normal,D.length===
+4&&fa)for(I=0;I<4;I++)J=D[I],M[E]=J.x,M[E+1]=J.y,M[E+2]=J.z,E+=3;else for(I=0;I<4;I++)M[E]=J.x,M[E+1]=J.y,M[E+2]=J.z,E+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,M,w)}if(ha&&qa&&V){k=0;for(m=y.length;k<m;k++)if(E=y[k],E=qa[E],E!==void 0)for(I=0;I<3;I++)M=E[I],R[Q]=M.u,R[Q+1]=M.v,Q+=2;k=0;for(m=r.length;k<m;k++)if(E=r[k],E=qa[E],E!==void 0)for(I=0;I<4;I++)M=E[I],R[Q]=M.u,R[Q+1]=M.v,Q+=2;Q>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,
+R,w))}if(ha&&ra&&V){k=0;for(m=y.length;k<m;k++)if(E=y[k],Q=ra[E],Q!==void 0)for(I=0;I<3;I++)R=Q[I],t[G]=R.u,t[G+1]=R.v,G+=2;k=0;for(m=r.length;k<m;k++)if(E=r[k],Q=ra[E],Q!==void 0)for(I=0;I<4;I++)R=Q[I],t[G]=R.u,t[G+1]=R.v,G+=2;G>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,w))}if(ia){k=0;for(m=y.length;k<m;k++)n[P]=W,n[P+1]=W+1,n[P+2]=W+2,P+=3,da[aa]=W,da[aa+1]=W+1,da[aa+2]=W,da[aa+3]=W+2,da[aa+4]=W+1,da[aa+5]=W+2,aa+=6,W+=3;k=0;for(m=r.length;k<m;k++)n[P]=W,
+n[P+1]=W+1,n[P+2]=W+3,n[P+3]=W+1,n[P+4]=W+2,n[P+5]=W+3,P+=6,da[aa]=W,da[aa+1]=W+1,da[aa+2]=W,da[aa+3]=W+3,da[aa+4]=W+1,da[aa+5]=W+2,da[aa+6]=W+2,da[aa+7]=W+3,aa+=8,W+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,n,w);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,da,w)}if(p){I=0;for(W=p.length;I<W;I++)if(n=p[I],n.__original.needsUpdate){t=0;if(n.size===1)if(n.boundTo===void 0||n.boundTo==="vertices"){k=
+0;for(m=y.length;k<m;k++)s=ea[y[k]],n.array[t]=n.value[s.a],n.array[t+1]=n.value[s.b],n.array[t+2]=n.value[s.c],t+=3;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],n.array[t]=n.value[s.a],n.array[t+1]=n.value[s.b],n.array[t+2]=n.value[s.c],n.array[t+3]=n.value[s.d],t+=4}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)da=n.value[y[k]],n.array[t]=da,n.array[t+1]=da,n.array[t+2]=da,t+=3;k=0;for(m=r.length;k<m;k++)da=n.value[r[k]],n.array[t]=da,n.array[t+1]=da,n.array[t+2]=da,n.array[t+3]=da,t+=4}}else if(n.size===
+2)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,t+=6;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,n.array[t+6]=s.x,n.array[t+7]=s.y,t+=8}else{if(n.boundTo==="faces"){k=
+0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,t+=6;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,n.array[t+6]=s.x,n.array[t+7]=s.y,t+=8}}else if(n.size===3)if(G=n.type==="c"?["r","g","b"]:["x","y","z"],n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],
+A=n.value[s.b],B=n.value[s.c],n.array[t]=z[G[0]],n.array[t+1]=z[G[1]],n.array[t+2]=z[G[2]],n.array[t+3]=A[G[0]],n.array[t+4]=A[G[1]],n.array[t+5]=A[G[2]],n.array[t+6]=B[G[0]],n.array[t+7]=B[G[1]],n.array[t+8]=B[G[2]],t+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z[G[0]],n.array[t+1]=z[G[1]],n.array[t+2]=z[G[2]],n.array[t+3]=A[G[0]],n.array[t+4]=A[G[1]],n.array[t+5]=A[G[2]],n.array[t+6]=B[G[0]],n.array[t+7]=B[G[1]],n.array[t+8]=B[G[2]],
+n.array[t+9]=s[G[0]],n.array[t+10]=s[G[1]],n.array[t+11]=s[G[2]],t+=12}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],n.array[t]=z[G[0]],n.array[t+1]=z[G[1]],n.array[t+2]=z[G[2]],n.array[t+3]=A[G[0]],n.array[t+4]=A[G[1]],n.array[t+5]=A[G[2]],n.array[t+6]=B[G[0]],n.array[t+7]=B[G[1]],n.array[t+8]=B[G[2]],t+=9;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z[G[0]],n.array[t+1]=z[G[1]],n.array[t+2]=z[G[2]],n.array[t+3]=A[G[0]],n.array[t+4]=A[G[1]],n.array[t+
+5]=A[G[2]],n.array[t+6]=B[G[0]],n.array[t+7]=B[G[1]],n.array[t+8]=B[G[2]],n.array[t+9]=s[G[0]],n.array[t+10]=s[G[1]],n.array[t+11]=s[G[2]],t+=12}}else if(n.size===4)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,t+=
+12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,n.array[t+12]=s.x,n.array[t+13]=s.y,n.array[t+14]=s.z,n.array[t+15]=s.w,t+=16}else if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+
+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,t+=12;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,n.array[t+12]=s.x,n.array[t+13]=s.y,n.array[t+14]=s.z,n.array[t+15]=s.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,
+n.buffer);d.bufferData(d.ARRAY_BUFFER,n.array,w)}}o&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyColors=!1;j.__dirtyTangents=
+!1;h.attributes&&H(h)}else if(x instanceof THREE.Ribbon){if(j.__dirtyVertices||j.__dirtyColors){h=j;x=d.DYNAMIC_DRAW;k=i=k=o=o=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;y=h.__vertexArray;w=h.__colorArray;r=h.__dirtyColors;if(h.__dirtyVertices){for(o=0;o<p;o++)k=m[o].position,i=o*3,y[i]=k.x,y[i+1]=k.y,y[i+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,y,x)}if(r){for(o=0;o<l;o++)k=q[o],i=o*3,w[i]=k.r,w[i+1]=k.g,w[i+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,
+h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,w,x)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(x instanceof THREE.Line){h=c(x,l);w=h.attributes&&u(h);if(j.__dirtyVertices||j.__dirtyColors||w){x=j;i=d.DYNAMIC_DRAW;p=q=W=m=ea=void 0;m=x.vertices;l=x.colors;p=m.length;w=l.length;y=x.__vertexArray;o=x.__colorArray;r=x.__dirtyColors;k=x.__webglCustomAttributesList;Q=aa=P=G=W=ea=void 0;if(x.__dirtyVertices){for(ea=0;ea<p;ea++)W=m[ea].position,q=ea*3,y[q]=W.x,y[q+1]=W.y,y[q+2]=W.z;d.bindBuffer(d.ARRAY_BUFFER,
+x.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,y,i)}if(r){for(m=0;m<w;m++)p=l[m],q=m*3,o[q]=p.r,o[q+1]=p.g,o[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,x.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,o,i)}if(k){ea=0;for(W=k.length;ea<W;ea++)if(Q=k[ea],Q.needsUpdate&&(Q.boundTo===void 0||Q.boundTo==="vertices")){q=0;P=Q.value.length;if(Q.size===1)for(G=0;G<P;G++)Q.array[G]=Q.value[G];else if(Q.size===2)for(G=0;G<P;G++)aa=Q.value[G],Q.array[q]=aa.x,Q.array[q+1]=aa.y,q+=2;else if(Q.size===3)if(Q.type===
+"c")for(G=0;G<P;G++)aa=Q.value[G],Q.array[q]=aa.r,Q.array[q+1]=aa.g,Q.array[q+2]=aa.b,q+=3;else for(G=0;G<P;G++)aa=Q.value[G],Q.array[q]=aa.x,Q.array[q+1]=aa.y,Q.array[q+2]=aa.z,q+=3;else if(Q.size===4)for(G=0;G<P;G++)aa=Q.value[G],Q.array[q]=aa.x,Q.array[q+1]=aa.y,Q.array[q+2]=aa.z,Q.array[q+3]=aa.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,Q.buffer);d.bufferData(d.ARRAY_BUFFER,Q.array,i)}}}j.__dirtyVertices=!1;j.__dirtyColors=!1;h.attributes&&H(h)}else if(x instanceof THREE.ParticleSystem)h=c(x,l),w=h.attributes&&
+u(h),(j.__dirtyVertices||j.__dirtyColors||x.sortParticles||w)&&e(j,d.DYNAMIC_DRAW,x),j.__dirtyVertices=!1,j.__dirtyColors=!1,h.attributes&&H(h)};this.initMaterial=function(a,b,c,e){var f,g,i,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&
+(h="particle_basic");if(h){var j=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var o,k,m;o=m=j=0;for(k=b.length;o<k;o++)i=b[o],i instanceof THREE.SpotLight&&m++,i instanceof THREE.DirectionalLight&&m++,i instanceof THREE.PointLight&&j++;j+m<=oa?o=m:(o=Math.ceil(oa*m/(j+m)),j=oa-o);i={directional:o,point:j};j=m=0;for(o=b.length;j<o;j++)k=b[j],k instanceof THREE.SpotLight&&k.castShadow&&m++;var r=50;if(e!==void 0&&
+e instanceof THREE.SkinnedMesh)r=e.bones.length;var p;a:{o=a.fragmentShader;k=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,
+shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},u,e=[];h?e.push(h):(e.push(o),e.push(k));for(u in c)e.push(u),e.push(c[u]);h=e.join();u=0;for(e=P.length;u<e;u++)if(P[u].code===h){p=P[u].program;break a}u=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+
+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+i=["#ifdef GL_ES","precision "+wa+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(u,J("fragment",i+o));d.attachShader(u,
+J("vertex",e+k));d.linkProgram(u);d.getProgramParameter(u,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(u,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");u.uniforms={};u.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in j)e.push(x);x=e;e=0;for(j=x.length;e<j;e++)o=x[e],u.uniforms[o]=d.getUniformLocation(u,
+o);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)e.push("morphTarget"+x);for(p in b)e.push(p);p=e;x=0;for(b=p.length;x<b;x++)c=p[x],u.attributes[c]=d.getAttribLocation(u,c);u.id=P.length;P.push({program:u,code:h});F.info.memory.programs=P.length;p=u}a.program=p;p=a.program.attributes;p.position>=0&&d.enableVertexAttribArray(p.position);p.color>=0&&d.enableVertexAttribArray(p.color);p.normal>=0&&d.enableVertexAttribArray(p.normal);
 p.tangent>=0&&d.enableVertexAttribArray(p.tangent);a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(d.enableVertexAttribArray(p.skinVertexA),d.enableVertexAttribArray(p.skinVertexB),d.enableVertexAttribArray(p.skinIndex),d.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(g in a.attributes)p[g]!==void 0&&p[g]>=0&&d.enableVertexAttribArray(p[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)x="morphTarget"+g,p[x]>=0&&(d.enableVertexAttribArray(p[x]),
 p.tangent>=0&&d.enableVertexAttribArray(p.tangent);a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(d.enableVertexAttribArray(p.skinVertexA),d.enableVertexAttribArray(p.skinVertexB),d.enableVertexAttribArray(p.skinIndex),d.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(g in a.attributes)p[g]!==void 0&&p[g]>=0&&d.enableVertexAttribArray(p[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)x="morphTarget"+g,p[x]>=0&&(d.enableVertexAttribArray(p[x]),
 a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)}};
 a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)}};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:

+ 4 - 4
src/core/Ray.js

@@ -89,7 +89,7 @@ THREE.Ray = function ( origin, direction ) {
 			geometry = object.geometry,
 			geometry = object.geometry,
 			vertices = geometry.vertices,
 			vertices = geometry.vertices,
 			objMatrix,
 			objMatrix,
-			intersectPoint;
+			intersectPoint = new THREE.Vector3();
 
 
 			object.matrixRotationWorld.extractRotation( object.matrixWorld );
 			object.matrixRotationWorld.extractRotation( object.matrixWorld );
 
 
@@ -122,7 +122,7 @@ THREE.Ray = function ( origin, direction ) {
 				if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) { // Math.abs( dot ) > 0.0001
 				if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) { // Math.abs( dot ) > 0.0001
 
 
 					scalar = normal.dot( vector.sub( a, origin ) ) / dot;
 					scalar = normal.dot( vector.sub( a, origin ) ) / dot;
-					intersectPoint = origin.clone().addSelf( direction.multiplyScalar( scalar ) );
+					intersectPoint.add( origin, direction.multiplyScalar( scalar ) );
 
 
 					if ( face instanceof THREE.Face3 ) {
 					if ( face instanceof THREE.Face3 ) {
 
 
@@ -131,7 +131,7 @@ THREE.Ray = function ( origin, direction ) {
 							intersect = {
 							intersect = {
 
 
 								distance: origin.distanceTo( intersectPoint ),
 								distance: origin.distanceTo( intersectPoint ),
-								point: intersectPoint,
+								point: intersectPoint.clone(),
 								face: face,
 								face: face,
 								object: object
 								object: object
 
 
@@ -148,7 +148,7 @@ THREE.Ray = function ( origin, direction ) {
 							intersect = {
 							intersect = {
 
 
 								distance: origin.distanceTo( intersectPoint ),
 								distance: origin.distanceTo( intersectPoint ),
-								point: intersectPoint,
+								point: intersectPoint.clone(),
 								face: face,
 								face: face,
 								object: object
 								object: object