Browse Source

Improved CubeGeometryand PlaneGeometry

Mr.doob 13 years ago
parent
commit
1b525e38c5

+ 367 - 365
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.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.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.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,65 +15,65 @@ 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){o.sub(c,a);r=o.dot(b);if(r<=0)return null;m=p.add(a,n.copy(b).multiplyScalar(r));return s=c.distanceTo(m)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);n.sub(a,b);u=o.dot(o);t=o.dot(p);q=o.dot(n);A=p.dot(p);w=p.dot(n);E=1/(u*A-t*t);x=(A*q-t*w)*E;I=(u*w-t*q)*E;return x>=0&&I>=0&&x+I<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,l=new THREE.Vector3;this.intersectObject=function(n){for(var m,o=[],p=0,r=n.children.length;p<r;p++)Array.prototype.push.apply(o,this.intersectObject(n.children[p]));if(n instanceof THREE.Particle){p=
-b(this.origin,this.direction,n.matrixWorld.getPosition());if(p===null||p>n.scale.x)return[];m={distance:p,point:n.position,face:null,object:n};o.push(m)}else if(n instanceof THREE.Mesh){p=b(this.origin,this.direction,n.matrixWorld.getPosition());if(p===null||p>n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)))return o;var s,q=n.geometry,u=q.vertices,t;n.matrixRotationWorld.extractRotation(n.matrixWorld);p=0;for(r=q.faces.length;p<r;p++)if(m=q.faces[p],a.copy(this.origin),
-c.copy(this.direction),t=n.matrixWorld,i=t.multiplyVector3(i.copy(m.centroid)).subSelf(a),s=i.dot(c),!(s<=0)&&(g=t.multiplyVector3(g.copy(u[m.a].position)),e=t.multiplyVector3(e.copy(u[m.b].position)),f=t.multiplyVector3(f.copy(u[m.c].position)),h=m instanceof THREE.Face4?t.multiplyVector3(h.copy(u[m.d].position)):null,k=n.matrixRotationWorld.multiplyVector3(k.copy(m.normal)),s=c.dot(k),n.doubleSided||(n.flipSided?s>0:s<0)))if(s=k.dot(i.sub(g,a))/s,l.add(a,c.multiplyScalar(s)),m instanceof THREE.Face3)d(l,
-g,e,f)&&(m={distance:a.distanceTo(l),point:l.clone(),face:m,object:n},o.push(m));else if(m instanceof THREE.Face4&&(d(l,g,e,h)||d(l,e,f,h)))m={distance:a.distanceTo(l),point:l.clone(),face:m,object:n},o.push(m)}return o};var o=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3,r,m,s,u,t,q,A,w,E,x,I};
-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,o){h=!1;c=e;b=f;d=l;g=o;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,o,p,n){h?(h=!1,c=e<l?e<p?e:p:l<p?l:p,b=f<o?f<n?f:n:o<n?o:n,d=e>l?e>p?e:p:l>p?l:p,g=f>o?f>n?f:n:o>n?o:n):(c=e<l?e<p?e<c?e:c:p<c?p:c:l<p?l<c?l:c:p<c?p:c,b=f<o?f<n?f<b?f:b:n<b?n:b:o<n?o<b?o:b:n<b?n:b,d=e>l?e>p?e>d?e:d:p>d?p:d:l>p?l>d?l:d:p>d?p:d,g=f>o?f>n?f>g?f:g:n>g?n:g:o>n?o>g?o:g:n>g?n: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>
+THREE.Ray=function(a,c){function b(a,b,c){o.sub(c,a);r=o.dot(b);if(r<=0)return null;m=p.add(a,n.copy(b).multiplyScalar(r));return s=c.distanceTo(m)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);n.sub(a,b);t=o.dot(o);v=o.dot(p);q=o.dot(n);A=p.dot(p);w=p.dot(n);D=1/(t*A-v*v);x=(A*q-v*w)*D;J=(t*w-v*q)*D;return x>=0&&J>=0&&x+J<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,l=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(n){for(var m,o=[],p=0,r=n.children.length;p<r;p++)Array.prototype.push.apply(o,this.intersectObject(n.children[p]));if(n instanceof THREE.Particle){p=
+b(this.origin,this.direction,n.matrixWorld.getPosition());if(p===null||p>n.scale.x)return[];m={distance:p,point:n.position,face:null,object:n};o.push(m)}else if(n instanceof THREE.Mesh){p=b(this.origin,this.direction,n.matrixWorld.getPosition());if(p===null||p>n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)))return o;var s,q=n.geometry,t=q.vertices,v;n.matrixRotationWorld.extractRotation(n.matrixWorld);p=0;for(r=q.faces.length;p<r;p++)if(m=q.faces[p],a.copy(this.origin),
+c.copy(this.direction),v=n.matrixWorld,i=v.multiplyVector3(i.copy(m.centroid)).subSelf(a),s=i.dot(c),!(s<=0)&&(g=v.multiplyVector3(g.copy(t[m.a].position)),e=v.multiplyVector3(e.copy(t[m.b].position)),f=v.multiplyVector3(f.copy(t[m.c].position)),h=m instanceof THREE.Face4?v.multiplyVector3(h.copy(t[m.d].position)):null,l=n.matrixRotationWorld.multiplyVector3(l.copy(m.normal)),s=c.dot(l),n.doubleSided||(n.flipSided?s>0:s<0)))if(s=l.dot(i.sub(g,a))/s,k.add(a,c.multiplyScalar(s)),m instanceof THREE.Face3)d(k,
+g,e,f)&&(m={distance:a.distanceTo(k),point:k.clone(),face:m,object:n},o.push(m));else if(m instanceof THREE.Face4&&(d(k,g,e,h)||d(k,e,f,h)))m={distance:a.distanceTo(k),point:k.clone(),face:m,object:n},o.push(m)}return o};var o=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3,r,m,s,t,v,q,A,w,D,x,J};
+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,k,o){h=!1;c=e;b=f;d=k;g=o;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,k,o,p,n){h?(h=!1,c=e<k?e<p?e:p:k<p?k:p,b=f<o?f<n?f:n:o<n?o:n,d=e>k?e>p?e:p:k>p?k:p,g=f>o?f>n?f:n:o>n?o:n):(c=e<k?e<p?e<c?e:c:p<c?p:c:k<p?k<c?k:c:p<c?p:c,b=f<o?f<n?f<b?f:b:n<b?n:b:o<n?o<b?o:b:n<b?n:b,d=e>k?e>p?e>d?e:d:p>d?p:d:k>p?k>d?k:d:p>d?p:d,g=f>o?f>n?f>g?f:g:n>g?n:g:o>n?o>g?o:g:n>g?n: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,o,p,n,r,m){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,o||0,p||0,n||0,r||0,m!==void 0?m: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,o,p,n,r,m){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=o;this.n41=p;this.n42=n;this.n43=r;this.n44=m;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,o=a.n32,p=a.n33,n=a.n34,r=a.n41,m=a.n42,s=a.n43,
-u=a.n44,t=c.n11,q=c.n12,A=c.n13,w=c.n14,E=c.n21,x=c.n22,I=c.n23,M=c.n24,D=c.n31,F=c.n32,P=c.n33,K=c.n34,$=c.n41,S=c.n42,R=c.n43,V=c.n44;this.n11=b*t+d*E+g*D+e*$;this.n12=b*q+d*x+g*F+e*S;this.n13=b*A+d*I+g*P+e*R;this.n14=b*w+d*M+g*K+e*V;this.n21=f*t+h*E+i*D+k*$;this.n22=f*q+h*x+i*F+k*S;this.n23=f*A+h*I+i*P+k*R;this.n24=f*w+h*M+i*K+k*V;this.n31=l*t+o*E+p*D+n*$;this.n32=l*q+o*x+p*F+n*S;this.n33=l*A+o*I+p*P+n*R;this.n34=l*w+o*M+p*K+n*V;this.n41=r*t+m*E+s*D+u*$;this.n42=r*q+m*x+s*F+u*S;this.n43=r*A+m*
-I+s*P+u*R;this.n44=r*w+m*M+s*K+u*V;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*=
+THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,l,k,o,p,n,r,m){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,l||0,k!==void 0?k:1,o||0,p||0,n||0,r||0,m!==void 0?m: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,l,k,o,p,n,r,m){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=l;this.n33=k;this.n34=o;this.n41=p;this.n42=n;this.n43=r;this.n44=m;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,l=a.n24,k=a.n31,o=a.n32,p=a.n33,n=a.n34,r=a.n41,m=a.n42,s=a.n43,
+t=a.n44,v=c.n11,q=c.n12,A=c.n13,w=c.n14,D=c.n21,x=c.n22,J=c.n23,M=c.n24,K=c.n31,E=c.n32,P=c.n33,I=c.n34,V=c.n41,Z=c.n42,R=c.n43,W=c.n44;this.n11=b*v+d*D+g*K+e*V;this.n12=b*q+d*x+g*E+e*Z;this.n13=b*A+d*J+g*P+e*R;this.n14=b*w+d*M+g*I+e*W;this.n21=f*v+h*D+i*K+l*V;this.n22=f*q+h*x+i*E+l*Z;this.n23=f*A+h*J+i*P+l*R;this.n24=f*w+h*M+i*I+l*W;this.n31=k*v+o*D+p*K+n*V;this.n32=k*q+o*x+p*E+n*Z;this.n33=k*A+o*J+p*P+n*R;this.n34=k*w+o*M+p*I+n*W;this.n41=r*v+m*D+s*K+t*V;this.n42=r*q+m*x+s*E+t*Z;this.n43=r*A+m*
+J+s*P+t*R;this.n44=r*w+m*M+s*I+t*W;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*c+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 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*a.y+this.n33*
 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,o=this.n34,p=this.n41,n=this.n42,r=this.n43,m=this.n44;return d*f*k*p-b*h*k*p-d*e*l*p+c*h*l*p+b*e*o*p-c*f*o*p-d*f*i*n+b*h*i*n+d*g*l*n-a*h*l*n-b*g*o*n+a*f*o*n+d*e*i*r-c*h*i*r-d*g*k*r+a*h*k*r+c*g*o*r-a*e*o*r-b*e*i*m+c*f*i*m+b*g*k*m-a*f*k*m-c*g*l*m+a*e*l*m},transpose:function(){var a;
+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,l=this.n32,k=this.n33,o=this.n34,p=this.n41,n=this.n42,r=this.n43,m=this.n44;return d*f*l*p-b*h*l*p-d*e*k*p+c*h*k*p+b*e*o*p-c*f*o*p-d*f*i*n+b*h*i*n+d*g*k*n-a*h*k*n-b*g*o*n+a*f*o*n+d*e*i*r-c*h*i*r-d*g*l*r+a*h*l*r+c*g*o*r-a*e*o*r-b*e*i*m+c*f*i*m+b*g*l*m-a*f*l*m-c*g*k*m+a*e*k*m},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=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[1]=this.n21;a[2]=this.n31;
 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[c+15]=this.n44;return a},
 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,0,0,1,0,0,0,0,1);return this},
 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,
-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,o=a.n33,p=a.n34,n=a.n41,r=a.n42,m=a.n43,s=a.n44;this.n11=h*p*r-i*o*r+i*l*m-f*p*m-h*l*s+f*o*s;this.n12=g*o*r-d*p*r-g*l*m+b*p*m+d*l*s-b*o*s;this.n13=d*i*r-g*h*r+g*f*m-b*i*m-d*f*s+b*h*s;this.n14=g*h*l-d*i*l-g*f*o+b*i*o+d*f*p-b*h*p;this.n21=i*o*n-h*p*n-i*k*m+e*p*m+h*k*s-e*o*s;this.n22=d*p*n-g*o*n+
-g*k*m-c*p*m-d*k*s+c*o*s;this.n23=g*h*n-d*i*n-g*e*m+c*i*m+d*e*s-c*h*s;this.n24=d*i*k-g*h*k+g*e*o-c*i*o-d*e*p+c*h*p;this.n31=f*p*n-i*l*n+i*k*r-e*p*r-f*k*s+e*l*s;this.n32=g*l*n-b*p*n-g*k*r+c*p*r+b*k*s-c*l*s;this.n33=d*i*n-g*f*n+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*p-c*f*p;this.n41=h*l*n-f*o*n-h*k*r+e*o*r+f*k*m-e*l*m;this.n42=b*o*n-d*l*n+d*k*r-c*o*r-b*k*m+c*l*m;this.n43=d*f*n-b*h*n-d*e*r+c*h*r+b*e*m-c*f*m;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*o+c*f*o;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,o=d*g;this.n11=i+o*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=o+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;o=d*g;this.n11=i-o*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=o-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;o=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+o;this.n21=f*g;this.n22=o*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;o=b*d;this.n11=f*h;this.n12=o-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-o*g;break;case "XZY":i=e*f;k=e*d;l=b*f;o=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+o;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=o*g+i;break;default:i=e*h,k=e*
-g,l=b*h,o=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-o*d,this.n23=-b*f,this.n31=o-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*=
+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,l=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+b,l*h-d*e,0,i*h-d*f,l*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,l=a.n31,k=a.n32,o=a.n33,p=a.n34,n=a.n41,r=a.n42,m=a.n43,s=a.n44;this.n11=h*p*r-i*o*r+i*k*m-f*p*m-h*k*s+f*o*s;this.n12=g*o*r-d*p*r-g*k*m+b*p*m+d*k*s-b*o*s;this.n13=d*i*r-g*h*r+g*f*m-b*i*m-d*f*s+b*h*s;this.n14=g*h*k-d*i*k-g*f*o+b*i*o+d*f*p-b*h*p;this.n21=i*o*n-h*p*n-i*l*m+e*p*m+h*l*s-e*o*s;this.n22=d*p*n-g*o*n+
+g*l*m-c*p*m-d*l*s+c*o*s;this.n23=g*h*n-d*i*n-g*e*m+c*i*m+d*e*s-c*h*s;this.n24=d*i*l-g*h*l+g*e*o-c*i*o-d*e*p+c*h*p;this.n31=f*p*n-i*k*n+i*l*r-e*p*r-f*l*s+e*k*s;this.n32=g*k*n-b*p*n-g*l*r+c*p*r+b*l*s-c*k*s;this.n33=d*i*n-g*f*n+g*e*r-c*i*r-b*e*s+c*f*s;this.n34=g*f*l-b*i*l-g*e*k+c*i*k+b*e*p-c*f*p;this.n41=h*k*n-f*o*n-h*l*r+e*o*r+f*l*m-e*k*m;this.n42=b*o*n-d*k*n+d*l*r-c*o*r-b*l*m+c*k*m;this.n43=d*f*n-b*h*n-d*e*r+c*h*r+b*e*m-c*f*m;this.n44=b*h*l-d*f*l+d*e*k-c*h*k-b*e*o+c*f*o;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,l=f*g,k=d*h,o=d*g;this.n11=i+o*b;this.n12=k*b-l;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=l*b-k;this.n32=o+i*b;this.n33=e*f;break;case "ZXY":i=f*h;l=f*g;k=d*h;o=d*g;this.n11=i-o*b;this.n12=-e*g;this.n13=k+l*b;this.n21=l+k*b;this.n22=e*h;this.n23=o-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
+e*h;l=e*g;k=b*h;o=b*g;this.n11=f*h;this.n12=k*d-l;this.n13=i*d+o;this.n21=f*g;this.n22=o*d+i;this.n23=l*d-k;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;l=e*d;k=b*f;o=b*d;this.n11=f*h;this.n12=o-i*g;this.n13=k*g+l;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=l*g+k;this.n33=i-o*g;break;case "XZY":i=e*f;l=e*d;k=b*f;o=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+o;this.n22=e*h;this.n23=l*g-k;this.n31=k*g-l;this.n32=b*h;this.n33=o*g+i;break;default:i=e*h,l=e*
+g,k=b*h,o=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=l+k*d,this.n22=i-o*d,this.n23=-b*f,this.n31=o-i*d,this.n32=k+l*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 l=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(l+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+l);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
 a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var d=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(c);g.setScale(b.x,b.y,b.z);this.multiply(d,g);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);g.set(this.n12,this.n22,this.n32);e.set(this.n13,
 a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var d=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(c);g.setScale(b.x,b.y,b.z);this.multiply(d,g);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);g.set(this.n12,this.n22,this.n32);e.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=d.length();b.y=g.length();b.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=b.x;d.n21/=b.x;d.n31/=b.x;d.n12/=b.y;d.n22/=b.y;d.n32/=b.y;d.n13/=b.z;d.n23/=b.z;d.n33/=b.z;c.setFromRotationMatrix(d);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=d.length();b.y=g.length();b.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=b.x;d.n21/=b.x;d.n31/=b.x;d.n12/=b.y;d.n22/=b.y;d.n32/=b.y;d.n13/=b.z;d.n23/=b.z;d.n33/=b.z;c.setFromRotationMatrix(d);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),d=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
 return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),d=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*d;b[1]=a*g;b[2]=a*e;b[3]=a*f;b[4]=a*h;b[5]=a*i;b[6]=a*k;b[7]=a*l;b[8]=a*o;return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*d;b[1]=a*g;b[2]=a*e;b[3]=a*f;b[4]=a*h;b[5]=a*i;b[6]=a*l;b[7]=a*k;b[8]=a*o;return c};
 THREE.Matrix4.makeFrustum=function(a,c,b,d,g,e){var f;f=new THREE.Matrix4;f.n11=2*g/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*g/(d-b);f.n23=(d+b)/(d-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(e+g)/(e-g);f.n34=-2*e*g/(e-g);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,d){var g,a=b*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,b,d)};
 THREE.Matrix4.makeFrustum=function(a,c,b,d,g,e){var f;f=new THREE.Matrix4;f.n11=2*g/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*g/(d-b);f.n23=(d+b)/(d-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(e+g)/(e-g);f.n34=-2*e*g/(e-g);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,d){var g,a=b*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,b,d)};
-THREE.Matrix4.makeOrtho=function(a,c,b,d,g,e){var f,h,i,k;f=new THREE.Matrix4;h=c-a;i=b-d;k=e-g;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((c+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((b+d)/i);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((e+g)/k);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,c,b,d,g,e){var f,h,i,l;f=new THREE.Matrix4;h=c-a;i=b-d;l=e-g;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((c+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((b+d)/i);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((e+g)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,d,g;b=0;for(d=this.children.length;b<d;b++){g=this.children[b];if(g.name===a)return g;
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,d,g;b=0;for(d=this.children.length;b<d;b++){g=this.children[b];if(g.name===a)return g;
 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=[],
-l,o,p=[],n,r=[],m,s,u=[],t,q,A=[],w={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,x=new THREE.Vector4,I=new THREE.Matrix4,M=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,P=new THREE.Vector4;this.computeFrustum=function(a){D[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);D[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);D[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);D[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);D[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);D[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=D[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);I.multiply(b.projectionMatrix,b.matrixWorldInverse);I.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-I.multiply(b.matrixWorld,b.projectionMatrixInverse);I.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;w.objects.length=0;w.sprites.length=0;w.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=D[h].x*d.n14+D[h].y*d.n24+D[h].z*d.n34+D[h].w,c<=e){c=!1;break a}c=!0}c?(I.multiplyVector3(E.copy(b.position)),g=a(),g.object=b,g.z=E.z,w.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(I.multiplyVector3(E.copy(b.position)),g=a(),g.object=b,g.z=E.z,w.sprites.push(g)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
-w.objects.sort(b);return w};this.projectScene=function(a,e,g){var f=e.near,E=e.far,D,y,H,z,L,j,aa,ga,N,W,T,ca,Q,C,ka,da;q=s=n=o=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);I.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(I);w=this.projectGraph(a,!1);a=0;for(D=w.objects.length;a<D;a++)if(N=w.objects[a].object,W=N.matrixWorld,
-ca=N.material,i=0,N instanceof THREE.Mesh){T=N.geometry;Q=N.geometry.materials;z=T.vertices;C=T.faces;ka=T.faceVertexUvs;T=N.matrixRotationWorld.extractRotation(W);y=0;for(H=z.length;y<H;y++)h=c(),h.positionWorld.copy(z[y].position),W.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),I.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<E;z=0;for(y=C.length;z<y;z++){H=
-C[z];if(H instanceof THREE.Face3)if(L=k[H.a],j=k[H.b],aa=k[H.c],L.visible&&j.visible&&aa.visible&&(N.doubleSided||N.flipSided!=(aa.positionScreen.x-L.positionScreen.x)*(j.positionScreen.y-L.positionScreen.y)-(aa.positionScreen.y-L.positionScreen.y)*(j.positionScreen.x-L.positionScreen.x)<0))ga=p[o]=p[o]||new THREE.RenderableFace3,o++,l=ga,l.v1.copy(L),l.v2.copy(j),l.v3.copy(aa);else continue;else if(H instanceof THREE.Face4)if(L=k[H.a],j=k[H.b],aa=k[H.c],ga=k[H.d],L.visible&&j.visible&&aa.visible&&
-ga.visible&&(N.doubleSided||N.flipSided!=((ga.positionScreen.x-L.positionScreen.x)*(j.positionScreen.y-L.positionScreen.y)-(ga.positionScreen.y-L.positionScreen.y)*(j.positionScreen.x-L.positionScreen.x)<0||(j.positionScreen.x-aa.positionScreen.x)*(ga.positionScreen.y-aa.positionScreen.y)-(j.positionScreen.y-aa.positionScreen.y)*(ga.positionScreen.x-aa.positionScreen.x)<0)))da=r[n]=r[n]||new THREE.RenderableFace4,n++,l=da,l.v1.copy(L),l.v2.copy(j),l.v3.copy(aa),l.v4.copy(ga);else continue;l.normalWorld.copy(H.normal);
-T.multiplyVector3(l.normalWorld);l.centroidWorld.copy(H.centroid);W.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);I.multiplyVector3(l.centroidScreen);aa=H.vertexNormals;L=0;for(j=aa.length;L<j;L++)ga=l.vertexNormalsWorld[L],ga.copy(aa[L]),T.multiplyVector3(ga);L=0;for(j=ka.length;L<j;L++)if(da=ka[L][z]){aa=0;for(ga=da.length;aa<ga;aa++)l.uvs[L][aa]=da[aa]}l.material=ca;l.faceMaterial=H.materialIndex!==null?Q[H.materialIndex]:null;l.z=l.centroidScreen.z;w.elements.push(l)}}else if(N instanceof
-THREE.Line){M.multiply(I,W);z=N.geometry.vertices;L=c();L.positionScreen.copy(z[0].position);M.multiplyVector4(L.positionScreen);y=1;for(H=z.length;y<H;y++)if(L=c(),L.positionScreen.copy(z[y].position),M.multiplyVector4(L.positionScreen),j=k[i-2],F.copy(L.positionScreen),P.copy(j.positionScreen),d(F,P))F.multiplyScalar(1/F.w),P.multiplyScalar(1/P.w),N=u[s]=u[s]||new THREE.RenderableLine,s++,m=N,m.v1.positionScreen.copy(F),m.v2.positionScreen.copy(P),m.z=Math.max(F.z,P.z),m.material=ca,w.elements.push(m)}a=
-0;for(D=w.sprites.length;a<D;a++)if(N=w.sprites[a].object,W=N.matrixWorld,N instanceof THREE.Particle&&(x.set(W.n14,W.n24,W.n34,1),I.multiplyVector4(x),x.z/=x.w,x.z>0&&x.z<1))f=A[q]=A[q]||new THREE.RenderableParticle,q++,t=f,t.x=x.x/x.w,t.y=x.y/x.w,t.z=x.z,t.rotation=N.rotation.z,t.scale.x=N.scale.x*Math.abs(t.x-(x.x+e.projectionMatrix.n11)/(x.w+e.projectionMatrix.n14)),t.scale.y=N.scale.y*Math.abs(t.y-(x.y+e.projectionMatrix.n22)/(x.w+e.projectionMatrix.n24)),t.material=N.material,w.elements.push(t);
+THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=l[i]=l[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,l=[],
+k,o,p=[],n,r=[],m,s,t=[],v,q,A=[],w={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,x=new THREE.Vector4,J=new THREE.Matrix4,M=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,P=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);K[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[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=K[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;w.objects.length=0;w.sprites.length=0;w.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=K[h].x*d.n14+K[h].y*d.n24+K[h].z*d.n34+K[h].w,c<=e){c=!1;break a}c=!0}c?(J.multiplyVector3(D.copy(b.position)),g=a(),g.object=b,g.z=D.z,w.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(J.multiplyVector3(D.copy(b.position)),g=a(),g.object=b,g.z=D.z,w.sprites.push(g)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
+w.objects.sort(b);return w};this.projectScene=function(a,e,g){var f=e.near,D=e.far,K,G,z,y,L,j,ca,ga,N,X,T,ea,Q,C,Y,S;q=s=n=o=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(K=w.objects.length;a<K;a++)if(N=w.objects[a].object,X=N.matrixWorld,
+ea=N.material,i=0,N instanceof THREE.Mesh){T=N.geometry;Q=N.geometry.materials;y=T.vertices;C=T.faces;Y=T.faceVertexUvs;T=N.matrixRotationWorld.extractRotation(X);G=0;for(z=y.length;G<z;G++)h=c(),h.positionWorld.copy(y[G].position),X.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<D;y=0;for(G=C.length;y<G;y++){z=
+C[y];if(z instanceof THREE.Face3)if(L=l[z.a],j=l[z.b],ca=l[z.c],L.visible&&j.visible&&ca.visible&&(N.doubleSided||N.flipSided!=(ca.positionScreen.x-L.positionScreen.x)*(j.positionScreen.y-L.positionScreen.y)-(ca.positionScreen.y-L.positionScreen.y)*(j.positionScreen.x-L.positionScreen.x)<0))ga=p[o]=p[o]||new THREE.RenderableFace3,o++,k=ga,k.v1.copy(L),k.v2.copy(j),k.v3.copy(ca);else continue;else if(z instanceof THREE.Face4)if(L=l[z.a],j=l[z.b],ca=l[z.c],ga=l[z.d],L.visible&&j.visible&&ca.visible&&
+ga.visible&&(N.doubleSided||N.flipSided!=((ga.positionScreen.x-L.positionScreen.x)*(j.positionScreen.y-L.positionScreen.y)-(ga.positionScreen.y-L.positionScreen.y)*(j.positionScreen.x-L.positionScreen.x)<0||(j.positionScreen.x-ca.positionScreen.x)*(ga.positionScreen.y-ca.positionScreen.y)-(j.positionScreen.y-ca.positionScreen.y)*(ga.positionScreen.x-ca.positionScreen.x)<0)))S=r[n]=r[n]||new THREE.RenderableFace4,n++,k=S,k.v1.copy(L),k.v2.copy(j),k.v3.copy(ca),k.v4.copy(ga);else continue;k.normalWorld.copy(z.normal);
+T.multiplyVector3(k.normalWorld);k.centroidWorld.copy(z.centroid);X.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);J.multiplyVector3(k.centroidScreen);ca=z.vertexNormals;L=0;for(j=ca.length;L<j;L++)ga=k.vertexNormalsWorld[L],ga.copy(ca[L]),T.multiplyVector3(ga);L=0;for(j=Y.length;L<j;L++)if(S=Y[L][y]){ca=0;for(ga=S.length;ca<ga;ca++)k.uvs[L][ca]=S[ca]}k.material=ea;k.faceMaterial=z.materialIndex!==null?Q[z.materialIndex]:null;k.z=k.centroidScreen.z;w.elements.push(k)}}else if(N instanceof
+THREE.Line){M.multiply(J,X);y=N.geometry.vertices;L=c();L.positionScreen.copy(y[0].position);M.multiplyVector4(L.positionScreen);G=1;for(z=y.length;G<z;G++)if(L=c(),L.positionScreen.copy(y[G].position),M.multiplyVector4(L.positionScreen),j=l[i-2],E.copy(L.positionScreen),P.copy(j.positionScreen),d(E,P))E.multiplyScalar(1/E.w),P.multiplyScalar(1/P.w),N=t[s]=t[s]||new THREE.RenderableLine,s++,m=N,m.v1.positionScreen.copy(E),m.v2.positionScreen.copy(P),m.z=Math.max(E.z,P.z),m.material=ea,w.elements.push(m)}a=
+0;for(K=w.sprites.length;a<K;a++)if(N=w.sprites[a].object,X=N.matrixWorld,N instanceof THREE.Particle&&(x.set(X.n14,X.n24,X.n34,1),J.multiplyVector4(x),x.z/=x.w,x.z>0&&x.z<1))f=A[q]=A[q]||new THREE.RenderableParticle,q++,v=f,v.x=x.x/x.w,v.y=x.y/x.w,v.z=x.z,v.rotation=N.rotation.z,v.scale.x=N.scale.x*Math.abs(v.x-(x.x+e.projectionMatrix.n11)/(x.w+e.projectionMatrix.n14)),v.scale.y=N.scale.y*Math.abs(v.y-(x.y+e.projectionMatrix.n22)/(x.w+e.projectionMatrix.n24)),v.material=N.material,w.elements.push(v);
 g&&w.elements.sort(b);return w}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
 g&&w.elements.sort(b);return w}};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,o=i*g+e*d-f*b,b=-e*
-b-f*d-h*g;c.x=k*i+b*-e+l*-h-o*-f;c.y=l*i+b*-f+o*-e-k*-h;c.z=o*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.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};
+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,l=i*b+f*g-h*d,k=i*d+h*b-e*g,o=i*g+e*d-f*b,b=-e*
+b-f*d-h*g;c.x=l*i+b*-e+k*-h-o*-f;c.y=k*i+b*-f+o*-e-l*-h;c.z=o*i+b*-h+l*-f-k*-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.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,15 +83,15 @@ 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];o=f[g];p=f[j];n=i.x-h.x;r=k.x-h.x;m=i.y-h.y;s=k.y-h.y;u=i.z-h.z;t=k.z-h.z;q=o.u-l.u;A=p.u-l.u;w=o.v-l.v;E=p.v-l.v;x=1/(q*E-A*w);F.set((E*n-w*r)*x,(E*m-w*s)*x,(E*u-w*t)*x);P.set((q*r-A*n)*x,(q*s-A*m)*x,(q*t-A*u)*x);M[b].addSelf(F);M[c].addSelf(F);M[d].addSelf(F);D[b].addSelf(P);
-D[c].addSelf(P);D[d].addSelf(P)}var c,b,d,g,e,f,h,i,k,l,o,p,n,r,m,s,u,t,q,A,w,E,x,I,M=[],D=[],F=new THREE.Vector3,P=new THREE.Vector3,K=new THREE.Vector3,$=new THREE.Vector3,S=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)M[c]=new THREE.Vector3,D[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 R=["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++)S.copy(e.vertexNormals[d]),g=e[R[d]],I=M[g],K.copy(I),K.subSelf(S.multiplyScalar(S.dot(I))).normalize(),$.cross(e.vertexNormals[d],I),g=$.dot(D[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.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,
+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;l=a.vertices[d].position;k=f[e];o=f[g];p=f[j];n=i.x-h.x;r=l.x-h.x;m=i.y-h.y;s=l.y-h.y;t=i.z-h.z;v=l.z-h.z;q=o.u-k.u;A=p.u-k.u;w=o.v-k.v;D=p.v-k.v;x=1/(q*D-A*w);E.set((D*n-w*r)*x,(D*m-w*s)*x,(D*t-w*v)*x);P.set((q*r-A*n)*x,(q*s-A*m)*x,(q*v-A*t)*x);M[b].addSelf(E);M[c].addSelf(E);M[d].addSelf(E);K[b].addSelf(P);
+K[c].addSelf(P);K[d].addSelf(P)}var c,b,d,g,e,f,h,i,l,k,o,p,n,r,m,s,t,v,q,A,w,D,x,J,M=[],K=[],E=new THREE.Vector3,P=new THREE.Vector3,I=new THREE.Vector3,V=new THREE.Vector3,Z=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)M[c]=new THREE.Vector3,K[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 R=["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++)Z.copy(e.vertexNormals[d]),g=e[R[d]],J=M[g],I.copy(J),I.subSelf(Z.multiplyScalar(Z.dot(J))).normalize(),V.cross(e.vertexNormals[d],J),g=V.dot(K[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(I.x,I.y,I.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]),
 b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
 b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function c(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,e,f,h,i,k,l,o,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;e=Math.floor(g);f=g-e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>this.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;k=this.points[b[0]];l=this.points[b[1]];
-o=this.points[b[2]];p=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,o.x,p.x,f,h,i);d.y=c(k.y,l.y,o.y,p.y,f,h,i);d.z=c(k.z,l.z,o.z,p.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
-g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,l=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];f=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
+THREE.Spline=function(a){function c(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,e,f,h,i,l,k,o,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;e=Math.floor(g);f=g-e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>this.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;l=this.points[b[0]];k=this.points[b[1]];
+o=this.points[b[2]];p=this.points[b[3]];h=f*f;i=f*h;d.x=c(l.x,k.x,o.x,p.x,f,h,i);d.y=c(l.y,k.y,o.y,p.y,f,h,i);d.z=c(l.z,k.z,o.z,p.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
+g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
 h}};THREE.Edge=function(a,c,b,d){this.vertices=[a,c];this.vertexIndices=[b,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 h}};THREE.Edge=function(a,c,b,d){this.vertices=[a,c];this.vertexIndices=[b,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,d,g,e){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=d;this.near=g!==void 0?g:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,d,g,e){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=d;this.near=g!==void 0?g:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,c,b,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=c!==void 0?c:1;this.near=b!==void 0?b:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,c,b,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=c!==void 0?c:1;this.near=b!==void 0?b:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
@@ -148,46 +148,46 @@ 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,o,p,n,r,m;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(p=a[i],p instanceof THREE.RenderableParticle){r=p.x*g+g;m=p.y*e+e;l=0;for(o=p.material.length;l<o;l++)if(n=p.material[l],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=r+"px",n.style.top=m+"px"}}};
-THREE.CanvasRenderer=function(a){function c(a){if(t!=a)m.globalAlpha=t=a}function b(a){if(q!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=a}}function d(a){if(A!=a)m.strokeStyle=A=a}function g(a){if(w!=a)m.fillStyle=w=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-o,p,n,r,m=l.getContext("2d"),s=new THREE.Color(0),u=0,t=1,q=0,A=null,w=null,E=null,x=null,I=null,M,D,F,P,K=new THREE.RenderableVertex,$=new THREE.RenderableVertex,S,R,V,ja,y,H,z,L,j,aa,ga,N,W=new THREE.Color,T=new THREE.Color,ca=new THREE.Color,Q=new THREE.Color,C=new THREE.Color,ka=[],da,X,oa,la,ra,ta,pa,qa,wa,U,v=new THREE.Rectangle,J=new THREE.Rectangle,Y=new THREE.Rectangle,ea=!1,ba=new THREE.Color,ua=new THREE.Color,Z=new THREE.Color,fa=new THREE.Vector3,ia,xa,O,ma,sa,ha,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);O=xa.getImageData(0,0,2,2);ma=O.data;sa=document.createElement("canvas");sa.width=sa.height=a;ha=sa.getContext("2d");ha.translate(-a/2,-a/2);ha.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){o=a;p=b;n=Math.floor(o/2);r=Math.floor(p/2);l.width=o;l.height=p;v.set(-n,-r,n,r);J.set(-n,-r,n,r);t=1;q=0;I=x=
-E=w=A=null};this.setClearColor=function(a,b){s.copy(a);u=b;J.set(-n,-r,n,r)};this.setClearColorHex=function(a,b){s.setHex(a);u=b;J.set(-n,-r,n,r)};this.clear=function(){m.setTransform(1,0,0,-1,n,r);J.isEmpty()||(J.minSelf(v),J.inflate(2),u<1&&m.clearRect(Math.floor(J.getX()),Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.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+")"),m.fillRect(Math.floor(J.getX()),
-Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.getHeight()))),J.empty())};this.render=function(a,l){function p(a){var b,c,d,e;ba.setRGB(0,0,0);ua.setRGB(0,0,0);Z.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ba.r+=e.r,ba.g+=e.g,ba.b+=e.b):d instanceof THREE.DirectionalLight?(ua.r+=e.r,ua.g+=e.g,ua.b+=e.b):d instanceof THREE.PointLight&&(Z.r+=e.r,Z.g+=e.g,Z.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(fa.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 s(a,e,f){c(f.opacity);b(f.blending);var j,h,i,l,k,ha;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)l=f.map.image,k=l.width>>1,ha=
-l.height>>1,f=e.scale.x*n,i=e.scale.y*r,j=f*k,h=i*ha,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),v.intersects(Y)&&(m.save(),m.translate(a.x,a.y),m.rotate(-e.rotation),m.scale(f,-i),m.translate(-k,-ha),m.drawImage(l,0,0),m.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*r,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),v.intersects(Y)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-e.rotation),m.scale(j,h),f.program(m),m.restore()))}function q(a,
-e,g,f){c(f.opacity);b(f.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(E!=a)m.lineWidth=E=a;a=f.linecap;if(x!=a)m.lineCap=x=a;a=f.linejoin;if(I!=a)m.lineJoin=I=a;d(f.color.getContextStyle());m.stroke();Y.inflate(f.linewidth*2)}}function u(a,d,g,f,j,h,n,k){e.info.render.vertices+=3;e.info.render.faces++;c(k.opacity);b(k.blending);S=a.positionScreen.x;R=a.positionScreen.y;
-V=d.positionScreen.x;ja=d.positionScreen.y;y=g.positionScreen.x;H=g.positionScreen.y;A(S,R,V,ja,y,H);if(k instanceof THREE.MeshBasicMaterial)if(k.map)k.map.mapping instanceof THREE.UVMapping&&(la=n.uvs[0],Ga(S,R,V,ja,y,H,la[f].u,la[f].v,la[j].u,la[j].v,la[h].u,la[h].v,k.map));else if(k.envMap){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,fa.copy(n.vertexNormalsWorld[f]),ra=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,ta=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+
-0.5,fa.copy(n.vertexNormalsWorld[j]),pa=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,qa=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,fa.copy(n.vertexNormalsWorld[h]),wa=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,U=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,Ga(S,R,V,ja,y,H,ra,ta,pa,qa,wa,U,k.envMap)}else k.wireframe?ya(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):w(k.color);else if(k instanceof THREE.MeshLambertMaterial)k.map&&!k.wireframe&&(k.map.mapping instanceof THREE.UVMapping&&
-(la=n.uvs[0],Ga(S,R,V,ja,y,H,la[f].u,la[f].v,la[j].u,la[j].v,la[h].u,la[h].v,k.map)),b(THREE.SubtractiveBlending)),ea?!k.wireframe&&k.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==3?(T.r=ca.r=Q.r=ba.r,T.g=ca.g=Q.g=ba.g,T.b=ca.b=Q.b=ba.b,o(i,n.v1.positionWorld,n.vertexNormalsWorld[0],T),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],ca),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],Q),T.r=Math.max(0,Math.min(k.color.r*T.r,1)),T.g=Math.max(0,Math.min(k.color.g*T.g,1)),T.b=Math.max(0,Math.min(k.color.b*
-T.b,1)),ca.r=Math.max(0,Math.min(k.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(k.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(k.color.b*ca.b,1)),Q.r=Math.max(0,Math.min(k.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(k.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(k.color.b*Q.b,1)),C.r=(ca.r+Q.r)*0.5,C.g=(ca.g+Q.g)*0.5,C.b=(ca.b+Q.b)*0.5,oa=Da(T,ca,Q,C),Ba(S,R,V,ja,y,H,0,0,1,0,0,1,oa)):(W.r=ba.r,W.g=ba.g,W.b=ba.b,o(i,n.centroidWorld,n.normalWorld,W),W.r=Math.max(0,Math.min(k.color.r*W.r,1)),W.g=Math.max(0,Math.min(k.color.g*
-W.g,1)),W.b=Math.max(0,Math.min(k.color.b*W.b,1)),k.wireframe?ya(W,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):w(W)):k.wireframe?ya(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):w(k.color);else if(k instanceof THREE.MeshDepthMaterial)da=l.near,X=l.far,T.r=T.g=T.b=1-Aa(a.positionScreen.z,da,X),ca.r=ca.g=ca.b=1-Aa(d.positionScreen.z,da,X),Q.r=Q.g=Q.b=1-Aa(g.positionScreen.z,da,X),C.r=(ca.r+Q.r)*0.5,C.g=(ca.g+Q.g)*0.5,C.b=(ca.b+Q.b)*0.5,oa=Da(T,ca,Q,C),Ba(S,R,
-V,ja,y,H,0,0,1,0,0,1,oa);else if(k instanceof THREE.MeshNormalMaterial)W.r=Ca(n.normalWorld.x),W.g=Ca(n.normalWorld.y),W.b=Ca(n.normalWorld.z),k.wireframe?ya(W,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):w(W)}function t(a,d,g,f,h,k,n,m,ha){e.info.render.vertices+=4;e.info.render.faces++;c(m.opacity);b(m.blending);if(m.map||m.envMap)u(a,d,f,0,1,3,n,m,ha),u(h,g,k,1,2,3,n,m,ha);else if(S=a.positionScreen.x,R=a.positionScreen.y,V=d.positionScreen.x,ja=d.positionScreen.y,y=g.positionScreen.x,
-H=g.positionScreen.y,z=f.positionScreen.x,L=f.positionScreen.y,j=h.positionScreen.x,aa=h.positionScreen.y,ga=k.positionScreen.x,N=k.positionScreen.y,m instanceof THREE.MeshBasicMaterial)Ea(S,R,V,ja,y,H,z,L),m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(m.color);else if(m instanceof THREE.MeshLambertMaterial)ea?!m.wireframe&&m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(T.r=ca.r=Q.r=C.r=ba.r,T.g=ca.g=Q.g=C.g=ba.g,T.b=ca.b=Q.b=C.b=ba.b,o(i,n.v1.positionWorld,
-n.vertexNormalsWorld[0],T),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],ca),o(i,n.v4.positionWorld,n.vertexNormalsWorld[3],Q),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],C),T.r=Math.max(0,Math.min(m.color.r*T.r,1)),T.g=Math.max(0,Math.min(m.color.g*T.g,1)),T.b=Math.max(0,Math.min(m.color.b*T.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),Q.r=Math.max(0,Math.min(m.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(m.color.g*
-Q.g,1)),Q.b=Math.max(0,Math.min(m.color.b*Q.b,1)),C.r=Math.max(0,Math.min(m.color.r*C.r,1)),C.g=Math.max(0,Math.min(m.color.g*C.g,1)),C.b=Math.max(0,Math.min(m.color.b*C.b,1)),oa=Da(T,ca,Q,C),A(S,R,V,ja,z,L),Ba(S,R,V,ja,z,L,0,0,1,0,0,1,oa),A(j,aa,y,H,ga,N),Ba(j,aa,y,H,ga,N,1,0,1,1,0,1,oa)):(W.r=ba.r,W.g=ba.g,W.b=ba.b,o(i,n.centroidWorld,n.normalWorld,W),W.r=Math.max(0,Math.min(m.color.r*W.r,1)),W.g=Math.max(0,Math.min(m.color.g*W.g,1)),W.b=Math.max(0,Math.min(m.color.b*W.b,1)),Ea(S,R,V,ja,y,H,z,L),
-m.wireframe?ya(W,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(W)):(Ea(S,R,V,ja,y,H,z,L),m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(m.color));else if(m instanceof THREE.MeshNormalMaterial)W.r=Ca(n.normalWorld.x),W.g=Ca(n.normalWorld.y),W.b=Ca(n.normalWorld.z),Ea(S,R,V,ja,y,H,z,L),m.wireframe?ya(W,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(W);else if(m instanceof THREE.MeshDepthMaterial)da=l.near,X=l.far,T.r=T.g=T.b=1-
-Aa(a.positionScreen.z,da,X),ca.r=ca.g=ca.b=1-Aa(d.positionScreen.z,da,X),Q.r=Q.g=Q.b=1-Aa(f.positionScreen.z,da,X),C.r=C.g=C.b=1-Aa(g.positionScreen.z,da,X),oa=Da(T,ca,Q,C),A(S,R,V,ja,z,L),Ba(S,R,V,ja,z,L,0,0,1,0,0,1,oa),A(j,aa,y,H,ga,N),Ba(j,aa,y,H,ga,N,1,0,1,1,0,1,oa)}function A(a,b,c,d,e,g){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,g);m.lineTo(a,b);m.closePath()}function Ea(a,b,c,d,e,g,f,j){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,g);m.lineTo(f,j);m.lineTo(a,b);m.closePath()}
-function ya(a,b,c,e){if(E!=b)m.lineWidth=E=b;if(x!=c)m.lineCap=x=c;if(I!=e)m.lineJoin=I=e;d(a.getContextStyle());m.stroke();Y.inflate(b*2)}function w(a){g(a.getContextStyle());m.fill()}function Ga(a,b,c,d,e,f,j,h,i,n,k,l,ha){if(ha.image.width!=0){if(ha.needsUpdate==!0||ka[ha.id]==void 0){var o=ha.wrapS==THREE.RepeatWrapping,p=ha.wrapT==THREE.RepeatWrapping;ka[ha.id]=m.createPattern(ha.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");ha.needsUpdate=!1}g(ka[ha.id]);var o=ha.offset.x/
-ha.repeat.x,p=ha.offset.y/ha.repeat.y,U=(ha.image.width-1)*ha.repeat.x,ha=(ha.image.height-1)*ha.repeat.y,j=(j+o)*U,h=(h+p)*ha,i=(i+o)*U,n=(n+p)*ha,k=(k+o)*U,l=(l+p)*ha;c-=a;d-=b;e-=a;f-=b;i-=j;n-=h;k-=j;l-=h;o=1/(i*l-k*n);ha=(l*c-n*e)*o;n=(l*d-n*f)*o;c=(i*e-k*c)*o;d=(i*f-k*d)*o;a=a-ha*j-c*h;b=b-n*j-d*h;m.save();m.transform(ha,n,c,d,a,b);m.fill();m.restore()}}function Ba(a,b,c,d,e,g,f,j,h,i,n,k,l){var ha,o;ha=l.width-1;o=l.height-1;f*=ha;j*=o;h*=ha;i*=o;n*=ha;k*=o;c-=a;d-=b;e-=a;g-=b;h-=f;i-=j;n-=
-f;k-=j;o=1/(h*k-n*i);ha=(k*c-i*e)*o;i=(k*d-i*g)*o;c=(h*e-n*c)*o;d=(h*g-n*d)*o;a=a-ha*f-c*j;b=b-i*f-d*j;m.save();m.transform(ha,i,c,d,a,b);m.clip();m.drawImage(l,0,0);m.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),n=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);ma[0]=e<0?0:e>255?255:e;ma[1]=f<0?0:f>255?255:f;ma[2]=a<0?0:a>255?255:a;ma[4]=g<0?0:g>255?255:g;ma[5]=j<0?0:j>255?255:j;ma[6]=b<0?
-0:b>255?255:b;ma[8]=h<0?0:h>255?255:h;ma[9]=i<0?0:i>255?255:i;ma[10]=c<0?0:c>255?255:c;ma[12]=n<0?0:n>255?255:n;ma[13]=k<0?0:k>255?255:k;ma[14]=d<0?0:d>255?255:d;xa.putImageData(O,0,0);ha.drawImage(ia,0,0);return sa}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,na,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,n,r);
-e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ea=i.length>0)&&p(i);Fa=0;for(Ha=h.length;Fa<Ha;Fa++)if(na=h[Fa],va=na.material,va=va instanceof THREE.MeshFaceMaterial?na.faceMaterial:va,!(va==null||va.opacity==0)){Y.empty();if(na instanceof THREE.RenderableParticle)M=na,M.x*=n,M.y*=r,s(M,na,va,a);else if(na instanceof THREE.RenderableLine)M=na.v1,D=na.v2,M.positionScreen.x*=n,M.positionScreen.y*=r,D.positionScreen.x*=n,D.positionScreen.y*=
-r,Y.addPoint(M.positionScreen.x,M.positionScreen.y),Y.addPoint(D.positionScreen.x,D.positionScreen.y),v.intersects(Y)&&q(M,D,na,va,a);else if(na instanceof THREE.RenderableFace3)M=na.v1,D=na.v2,F=na.v3,M.positionScreen.x*=n,M.positionScreen.y*=r,D.positionScreen.x*=n,D.positionScreen.y*=r,F.positionScreen.x*=n,F.positionScreen.y*=r,va.overdraw&&(za(M.positionScreen,D.positionScreen),za(D.positionScreen,F.positionScreen),za(F.positionScreen,M.positionScreen)),Y.add3Points(M.positionScreen.x,M.positionScreen.y,
-D.positionScreen.x,D.positionScreen.y,F.positionScreen.x,F.positionScreen.y),v.intersects(Y)&&u(M,D,F,0,1,2,na,va,a);else if(na instanceof THREE.RenderableFace4)M=na.v1,D=na.v2,F=na.v3,P=na.v4,M.positionScreen.x*=n,M.positionScreen.y*=r,D.positionScreen.x*=n,D.positionScreen.y*=r,F.positionScreen.x*=n,F.positionScreen.y*=r,P.positionScreen.x*=n,P.positionScreen.y*=r,K.positionScreen.copy(D.positionScreen),$.positionScreen.copy(P.positionScreen),va.overdraw&&(za(M.positionScreen,D.positionScreen),
-za(D.positionScreen,P.positionScreen),za(P.positionScreen,M.positionScreen),za(F.positionScreen,K.positionScreen),za(F.positionScreen,$.positionScreen)),Y.addPoint(M.positionScreen.x,M.positionScreen.y),Y.addPoint(D.positionScreen.x,D.positionScreen.y),Y.addPoint(F.positionScreen.x,F.positionScreen.y),Y.addPoint(P.positionScreen.x,P.positionScreen.y),v.intersects(Y)&&t(M,D,F,P,K,$,na,va,a);J.addRectangle(Y)}m.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(M.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){D[a]==null&&(D[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),S==0&&D[a].setAttribute("shape-rendering","crispEdges"));return D[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,o,p,n,r,m,s,u=new THREE.Rectangle,t=new THREE.Rectangle,q=!1,A=new THREE.Color,w=new THREE.Color,E=new THREE.Color,x=new THREE.Color,I,M=new THREE.Vector3,D=[],F=[],P,K,$,S=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":S=1;break;case "low":S=0}};this.setSize=function(a,b){k=a;l=b;o=k/2;p=l/2;i.setAttribute("viewBox",-o+" "+-p+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);u.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var M,y,H,z;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;$=K=0;if(q=f.length>0){w.setRGB(0,0,0);E.setRGB(0,0,0);x.setRGB(0,0,0);M=0;for(y=f.length;M<y;M++)z=f[M],H=z.color,z instanceof THREE.AmbientLight?(w.r+=H.r,w.g+=H.g,w.b+=H.b):z instanceof THREE.DirectionalLight?(E.r+=H.r,E.g+=H.g,E.b+=H.b):z instanceof THREE.PointLight&&(x.r+=H.r,x.g+=H.g,x.b+=H.b)}M=0;for(y=e.length;M<y;M++)if(H=e[M],z=H.material,z=z instanceof THREE.MeshFaceMaterial?H.faceMaterial:z,!(z==null||z.opacity==0))if(t.empty(),H instanceof THREE.RenderableParticle)n=H,n.x*=
-o,n.y*=-p;else if(H instanceof THREE.RenderableLine){if(n=H.v1,r=H.v2,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),u.intersects(t)){H=n;var L=r,j=$++;F[j]==null&&(F[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),S==0&&F[j].setAttribute("shape-rendering","crispEdges"));P=F[j];P.setAttribute("x1",H.positionScreen.x);P.setAttribute("y1",H.positionScreen.y);
-P.setAttribute("x2",L.positionScreen.x);P.setAttribute("y2",L.positionScreen.y);z instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+z.color.getContextStyle()+"; stroke-width: "+z.linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.linecap+"; stroke-linejoin: "+z.linejoin),i.appendChild(P))}}else if(H instanceof THREE.RenderableFace3){if(n=H.v1,r=H.v2,m=H.v3,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,m.positionScreen.x*=
-o,m.positionScreen.y*=-p,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),u.intersects(t)){var L=n,j=r,D=m;d.info.render.vertices+=3;d.info.render.faces++;P=c(K++);P.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?A.copy(z.color):z instanceof THREE.MeshLambertMaterial?
-q?(A.r=w.r,A.g=w.g,A.b=w.b,a(f,H.centroidWorld,H.normalWorld,A),A.r=Math.max(0,Math.min(z.color.r*A.r,1)),A.g=Math.max(0,Math.min(z.color.g*A.g,1)),A.b=Math.max(0,Math.min(z.color.b*A.b,1))):A.copy(z.color):z instanceof THREE.MeshDepthMaterial?(I=1-z.__2near/(z.__farPlusNear-H.z*z.__farMinusNear),A.setRGB(I,I,I)):z instanceof THREE.MeshNormalMaterial&&A.setRGB(b(H.normalWorld.x),b(H.normalWorld.y),b(H.normalWorld.z));z.wireframe?P.setAttribute("style","fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+
-z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):P.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(P)}}else if(H instanceof THREE.RenderableFace4&&(n=H.v1,r=H.v2,m=H.v3,s=H.v4,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,m.positionScreen.x*=o,m.positionScreen.y*=-p,s.positionScreen.x*=o,s.positionScreen.y*=-p,t.addPoint(n.positionScreen.x,
-n.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),u.intersects(t))){var L=n,j=r,D=m,ga=s;d.info.render.vertices+=4;d.info.render.faces++;P=c(K++);P.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?
-A.copy(z.color):z instanceof THREE.MeshLambertMaterial?q?(A.r=w.r,A.g=w.g,A.b=w.b,a(f,H.centroidWorld,H.normalWorld,A),A.r=Math.max(0,Math.min(z.color.r*A.r,1)),A.g=Math.max(0,Math.min(z.color.g*A.g,1)),A.b=Math.max(0,Math.min(z.color.b*A.b,1))):A.copy(z.color):z instanceof THREE.MeshDepthMaterial?(I=1-z.__2near/(z.__farPlusNear-H.z*z.__farMinusNear),A.setRGB(I,I,I)):z instanceof THREE.MeshNormalMaterial&&A.setRGB(b(H.normalWorld.x),b(H.normalWorld.y),b(H.normalWorld.z));z.wireframe?P.setAttribute("style",
-"fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):P.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(P)}}};
+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,l,k,o,p,n,r,m;a=c.projectScene(b,d);i=0;for(l=a.length;i<l;i++)if(p=a[i],p instanceof THREE.RenderableParticle){r=p.x*g+g;m=p.y*e+e;k=0;for(o=p.material.length;k<o;k++)if(n=p.material[k],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=r+"px",n.style.top=m+"px"}}};
+THREE.CanvasRenderer=function(a){function c(a){if(v!=a)m.globalAlpha=v=a}function b(a){if(q!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=a}}function d(a){if(A!=a)m.strokeStyle=A=a}function g(a){if(w!=a)m.fillStyle=w=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+o,p,n,r,m=k.getContext("2d"),s=new THREE.Color(0),t=0,v=1,q=0,A=null,w=null,D=null,x=null,J=null,M,K,E,P,I=new THREE.RenderableVertex,V=new THREE.RenderableVertex,Z,R,W,ka,G,z,y,L,j,ca,ga,N,X=new THREE.Color,T=new THREE.Color,ea=new THREE.Color,Q=new THREE.Color,C=new THREE.Color,Y=[],S,$,oa,la,ra,ta,pa,qa,wa,U,u=new THREE.Rectangle,H=new THREE.Rectangle,aa=new THREE.Rectangle,ja=!1,da=new THREE.Color,ua=new THREE.Color,ba=new THREE.Color,fa=new THREE.Vector3,ia,xa,O,ma,sa,ha,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);O=xa.getImageData(0,0,2,2);ma=O.data;sa=document.createElement("canvas");sa.width=sa.height=a;ha=sa.getContext("2d");ha.translate(-a/2,-a/2);ha.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;n=Math.floor(o/2);r=Math.floor(p/2);k.width=o;k.height=p;u.set(-n,-r,n,r);H.set(-n,-r,n,r);v=1;q=0;J=x=
+D=w=A=null};this.setClearColor=function(a,b){s.copy(a);t=b;H.set(-n,-r,n,r)};this.setClearColorHex=function(a,b){s.setHex(a);t=b;H.set(-n,-r,n,r)};this.clear=function(){m.setTransform(1,0,0,-1,n,r);H.isEmpty()||(H.minSelf(u),H.inflate(2),t<1&&m.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),t>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+t+")"),m.fillRect(Math.floor(H.getX()),
+Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(a,k){function p(a){var b,c,d,e;da.setRGB(0,0,0);ua.setRGB(0,0,0);ba.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(da.r+=e.r,da.g+=e.g,da.b+=e.b):d instanceof THREE.DirectionalLight?(ua.r+=e.r,ua.g+=e.g,ua.b+=e.b):d instanceof THREE.PointLight&&(ba.r+=e.r,ba.g+=e.g,ba.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(fa.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 s(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,ha;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,ha=
+k.height>>1,f=e.scale.x*n,i=e.scale.y*r,j=f*l,h=i*ha,aa.set(a.x-j,a.y-h,a.x+j,a.y+h),u.intersects(aa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-e.rotation),m.scale(f,-i),m.translate(-l,-ha),m.drawImage(k,0,0),m.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*r,aa.set(a.x-j,a.y-h,a.x+j,a.y+h),u.intersects(aa)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-e.rotation),m.scale(j,h),f.program(m),m.restore()))}function q(a,
+e,g,f){c(f.opacity);b(f.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(D!=a)m.lineWidth=D=a;a=f.linecap;if(x!=a)m.lineCap=x=a;a=f.linejoin;if(J!=a)m.lineJoin=J=a;d(f.color.getContextStyle());m.stroke();aa.inflate(f.linewidth*2)}}function t(a,d,f,g,j,h,n,l){e.info.render.vertices+=3;e.info.render.faces++;c(l.opacity);b(l.blending);Z=a.positionScreen.x;R=a.positionScreen.y;
+W=d.positionScreen.x;ka=d.positionScreen.y;G=f.positionScreen.x;z=f.positionScreen.y;A(Z,R,W,ka,G,z);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(la=n.uvs[0],Ga(Z,R,W,ka,G,z,la[g].u,la[g].v,la[j].u,la[j].v,la[h].u,la[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,fa.copy(n.vertexNormalsWorld[g]),ra=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,ta=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+
+0.5,fa.copy(n.vertexNormalsWorld[j]),pa=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,qa=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,fa.copy(n.vertexNormalsWorld[h]),wa=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,U=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,Ga(Z,R,W,ka,G,z,ra,ta,pa,qa,wa,U,l.envMap)}else l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):w(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&
+(la=n.uvs[0],Ga(Z,R,W,ka,G,z,la[g].u,la[g].v,la[j].u,la[j].v,la[h].u,la[h].v,l.map)),b(THREE.SubtractiveBlending)),ja?!l.wireframe&&l.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==3?(T.r=ea.r=Q.r=da.r,T.g=ea.g=Q.g=da.g,T.b=ea.b=Q.b=da.b,o(i,n.v1.positionWorld,n.vertexNormalsWorld[0],T),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],ea),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],Q),T.r=Math.max(0,Math.min(l.color.r*T.r,1)),T.g=Math.max(0,Math.min(l.color.g*T.g,1)),T.b=Math.max(0,Math.min(l.color.b*
+T.b,1)),ea.r=Math.max(0,Math.min(l.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(l.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(l.color.b*ea.b,1)),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(l.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),C.r=(ea.r+Q.r)*0.5,C.g=(ea.g+Q.g)*0.5,C.b=(ea.b+Q.b)*0.5,oa=Da(T,ea,Q,C),Ba(Z,R,W,ka,G,z,0,0,1,0,0,1,oa)):(X.r=da.r,X.g=da.g,X.b=da.b,o(i,n.centroidWorld,n.normalWorld,X),X.r=Math.max(0,Math.min(l.color.r*X.r,1)),X.g=Math.max(0,Math.min(l.color.g*
+X.g,1)),X.b=Math.max(0,Math.min(l.color.b*X.b,1)),l.wireframe?ya(X,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):w(X)):l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):w(l.color);else if(l instanceof THREE.MeshDepthMaterial)S=k.near,$=k.far,T.r=T.g=T.b=1-Aa(a.positionScreen.z,S,$),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,S,$),Q.r=Q.g=Q.b=1-Aa(f.positionScreen.z,S,$),C.r=(ea.r+Q.r)*0.5,C.g=(ea.g+Q.g)*0.5,C.b=(ea.b+Q.b)*0.5,oa=Da(T,ea,Q,C),Ba(Z,R,W,ka,
+G,z,0,0,1,0,0,1,oa);else if(l instanceof THREE.MeshNormalMaterial)X.r=Ca(n.normalWorld.x),X.g=Ca(n.normalWorld.y),X.b=Ca(n.normalWorld.z),l.wireframe?ya(X,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):w(X)}function v(a,d,f,g,h,l,n,m,ha){e.info.render.vertices+=4;e.info.render.faces++;c(m.opacity);b(m.blending);if(m.map||m.envMap)t(a,d,g,0,1,3,n,m,ha),t(h,f,l,1,2,3,n,m,ha);else if(Z=a.positionScreen.x,R=a.positionScreen.y,W=d.positionScreen.x,ka=d.positionScreen.y,G=f.positionScreen.x,
+z=f.positionScreen.y,y=g.positionScreen.x,L=g.positionScreen.y,j=h.positionScreen.x,ca=h.positionScreen.y,ga=l.positionScreen.x,N=l.positionScreen.y,m instanceof THREE.MeshBasicMaterial)Ea(Z,R,W,ka,G,z,y,L),m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(m.color);else if(m instanceof THREE.MeshLambertMaterial)ja?!m.wireframe&&m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(T.r=ea.r=Q.r=C.r=da.r,T.g=ea.g=Q.g=C.g=da.g,T.b=ea.b=Q.b=C.b=da.b,o(i,n.v1.positionWorld,
+n.vertexNormalsWorld[0],T),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],ea),o(i,n.v4.positionWorld,n.vertexNormalsWorld[3],Q),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],C),T.r=Math.max(0,Math.min(m.color.r*T.r,1)),T.g=Math.max(0,Math.min(m.color.g*T.g,1)),T.b=Math.max(0,Math.min(m.color.b*T.b,1)),ea.r=Math.max(0,Math.min(m.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(m.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(m.color.b*ea.b,1)),Q.r=Math.max(0,Math.min(m.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(m.color.g*
+Q.g,1)),Q.b=Math.max(0,Math.min(m.color.b*Q.b,1)),C.r=Math.max(0,Math.min(m.color.r*C.r,1)),C.g=Math.max(0,Math.min(m.color.g*C.g,1)),C.b=Math.max(0,Math.min(m.color.b*C.b,1)),oa=Da(T,ea,Q,C),A(Z,R,W,ka,y,L),Ba(Z,R,W,ka,y,L,0,0,1,0,0,1,oa),A(j,ca,G,z,ga,N),Ba(j,ca,G,z,ga,N,1,0,1,1,0,1,oa)):(X.r=da.r,X.g=da.g,X.b=da.b,o(i,n.centroidWorld,n.normalWorld,X),X.r=Math.max(0,Math.min(m.color.r*X.r,1)),X.g=Math.max(0,Math.min(m.color.g*X.g,1)),X.b=Math.max(0,Math.min(m.color.b*X.b,1)),Ea(Z,R,W,ka,G,z,y,L),
+m.wireframe?ya(X,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(X)):(Ea(Z,R,W,ka,G,z,y,L),m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(m.color));else if(m instanceof THREE.MeshNormalMaterial)X.r=Ca(n.normalWorld.x),X.g=Ca(n.normalWorld.y),X.b=Ca(n.normalWorld.z),Ea(Z,R,W,ka,G,z,y,L),m.wireframe?ya(X,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(X);else if(m instanceof THREE.MeshDepthMaterial)S=k.near,$=k.far,T.r=T.g=T.b=1-Aa(a.positionScreen.z,
+S,$),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,S,$),Q.r=Q.g=Q.b=1-Aa(g.positionScreen.z,S,$),C.r=C.g=C.b=1-Aa(f.positionScreen.z,S,$),oa=Da(T,ea,Q,C),A(Z,R,W,ka,y,L),Ba(Z,R,W,ka,y,L,0,0,1,0,0,1,oa),A(j,ca,G,z,ga,N),Ba(j,ca,G,z,ga,N,1,0,1,1,0,1,oa)}function A(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function Ea(a,b,c,d,e,f,g,j){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,j);m.lineTo(a,b);m.closePath()}function ya(a,b,c,e){if(D!=
+b)m.lineWidth=D=b;if(x!=c)m.lineCap=x=c;if(J!=e)m.lineJoin=J=e;d(a.getContextStyle());m.stroke();aa.inflate(b*2)}function w(a){g(a.getContextStyle());m.fill()}function Ga(a,b,c,d,e,f,j,h,i,k,n,l,ha){if(ha.image.width!=0){if(ha.needsUpdate==!0||Y[ha.id]==void 0){var o=ha.wrapS==THREE.RepeatWrapping,p=ha.wrapT==THREE.RepeatWrapping;Y[ha.id]=m.createPattern(ha.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");ha.needsUpdate=!1}g(Y[ha.id]);var o=ha.offset.x/ha.repeat.x,p=ha.offset.y/
+ha.repeat.y,U=(ha.image.width-1)*ha.repeat.x,ha=(ha.image.height-1)*ha.repeat.y,j=(j+o)*U,h=(h+p)*ha,i=(i+o)*U,k=(k+p)*ha,n=(n+o)*U,l=(l+p)*ha;c-=a;d-=b;e-=a;f-=b;i-=j;k-=h;n-=j;l-=h;o=1/(i*l-n*k);ha=(l*c-k*e)*o;k=(l*d-k*f)*o;c=(i*e-n*c)*o;d=(i*f-n*d)*o;a=a-ha*j-c*h;b=b-k*j-d*h;m.save();m.transform(ha,k,c,d,a,b);m.fill();m.restore()}}function Ba(a,b,c,d,e,f,g,j,h,i,k,n,l){var ha,o;ha=l.width-1;o=l.height-1;g*=ha;j*=o;h*=ha;i*=o;k*=ha;n*=o;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;k-=g;n-=j;o=1/(h*n-k*i);ha=(n*
+c-i*e)*o;i=(n*d-i*f)*o;c=(h*e-k*c)*o;d=(h*f-k*d)*o;a=a-ha*g-c*j;b=b-i*g-d*j;m.save();m.transform(ha,i,c,d,a,b);m.clip();m.drawImage(l,0,0);m.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),k=~~(d.r*255),n=~~(d.g*255),d=~~(d.b*255);ma[0]=e<0?0:e>255?255:e;ma[1]=f<0?0:f>255?255:f;ma[2]=a<0?0:a>255?255:a;ma[4]=g<0?0:g>255?255:g;ma[5]=j<0?0:j>255?255:j;ma[6]=b<0?0:b>255?255:b;ma[8]=h<0?0:h>
+255?255:h;ma[9]=i<0?0:i>255?255:i;ma[10]=c<0?0:c>255?255:c;ma[12]=k<0?0:k>255?255:k;ma[13]=n<0?0:n>255?255:n;ma[14]=d<0?0:d>255?255:d;xa.putImageData(O,0,0);ha.drawImage(ia,0,0);return sa}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,na,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,n,r);e.info.render.vertices=0;e.info.render.faces=
+0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(ja=i.length>0)&&p(i);Fa=0;for(Ha=h.length;Fa<Ha;Fa++)if(na=h[Fa],va=na.material,va=va instanceof THREE.MeshFaceMaterial?na.faceMaterial:va,!(va==null||va.opacity==0)){aa.empty();if(na instanceof THREE.RenderableParticle)M=na,M.x*=n,M.y*=r,s(M,na,va,a);else if(na instanceof THREE.RenderableLine)M=na.v1,K=na.v2,M.positionScreen.x*=n,M.positionScreen.y*=r,K.positionScreen.x*=n,K.positionScreen.y*=r,aa.addPoint(M.positionScreen.x,M.positionScreen.y),
+aa.addPoint(K.positionScreen.x,K.positionScreen.y),u.intersects(aa)&&q(M,K,na,va,a);else if(na instanceof THREE.RenderableFace3)M=na.v1,K=na.v2,E=na.v3,M.positionScreen.x*=n,M.positionScreen.y*=r,K.positionScreen.x*=n,K.positionScreen.y*=r,E.positionScreen.x*=n,E.positionScreen.y*=r,va.overdraw&&(za(M.positionScreen,K.positionScreen),za(K.positionScreen,E.positionScreen),za(E.positionScreen,M.positionScreen)),aa.add3Points(M.positionScreen.x,M.positionScreen.y,K.positionScreen.x,K.positionScreen.y,
+E.positionScreen.x,E.positionScreen.y),u.intersects(aa)&&t(M,K,E,0,1,2,na,va,a);else if(na instanceof THREE.RenderableFace4)M=na.v1,K=na.v2,E=na.v3,P=na.v4,M.positionScreen.x*=n,M.positionScreen.y*=r,K.positionScreen.x*=n,K.positionScreen.y*=r,E.positionScreen.x*=n,E.positionScreen.y*=r,P.positionScreen.x*=n,P.positionScreen.y*=r,I.positionScreen.copy(K.positionScreen),V.positionScreen.copy(P.positionScreen),va.overdraw&&(za(M.positionScreen,K.positionScreen),za(K.positionScreen,P.positionScreen),
+za(P.positionScreen,M.positionScreen),za(E.positionScreen,I.positionScreen),za(E.positionScreen,V.positionScreen)),aa.addPoint(M.positionScreen.x,M.positionScreen.y),aa.addPoint(K.positionScreen.x,K.positionScreen.y),aa.addPoint(E.positionScreen.x,E.positionScreen.y),aa.addPoint(P.positionScreen.x,P.positionScreen.y),u.intersects(aa)&&v(M,K,E,P,I,V,na,va,a);H.addRectangle(aa)}m.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(M.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){K[a]==null&&(K[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),Z==0&&K[a].setAttribute("shape-rendering","crispEdges"));return K[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"),l,k,o,p,n,r,m,s,t=new THREE.Rectangle,v=new THREE.Rectangle,q=!1,A=new THREE.Color,w=new THREE.Color,D=new THREE.Color,x=new THREE.Color,J,M=new THREE.Vector3,K=[],E=[],P,I,V,Z=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":Z=1;break;case "low":Z=0}};this.setSize=function(a,b){l=a;k=b;o=l/2;p=k/2;i.setAttribute("viewBox",-o+" "+-p+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);t.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var M,G,z,y;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;V=I=0;if(q=f.length>0){w.setRGB(0,0,0);D.setRGB(0,0,0);x.setRGB(0,0,0);M=0;for(G=f.length;M<G;M++)y=f[M],z=y.color,y instanceof THREE.AmbientLight?(w.r+=z.r,w.g+=z.g,w.b+=z.b):y instanceof THREE.DirectionalLight?(D.r+=z.r,D.g+=z.g,D.b+=z.b):y instanceof THREE.PointLight&&(x.r+=z.r,x.g+=z.g,x.b+=z.b)}M=0;for(G=e.length;M<G;M++)if(z=e[M],y=z.material,y=y instanceof THREE.MeshFaceMaterial?z.faceMaterial:y,!(y==null||y.opacity==0))if(v.empty(),z instanceof THREE.RenderableParticle)n=z,n.x*=
+o,n.y*=-p;else if(z instanceof THREE.RenderableLine){if(n=z.v1,r=z.v2,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,v.addPoint(n.positionScreen.x,n.positionScreen.y),v.addPoint(r.positionScreen.x,r.positionScreen.y),t.intersects(v)){z=n;var L=r,j=V++;E[j]==null&&(E[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&E[j].setAttribute("shape-rendering","crispEdges"));P=E[j];P.setAttribute("x1",z.positionScreen.x);P.setAttribute("y1",z.positionScreen.y);
+P.setAttribute("x2",L.positionScreen.x);P.setAttribute("y2",L.positionScreen.y);y instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+y.color.getContextStyle()+"; stroke-width: "+y.linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.linecap+"; stroke-linejoin: "+y.linejoin),i.appendChild(P))}}else if(z instanceof THREE.RenderableFace3){if(n=z.v1,r=z.v2,m=z.v3,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,m.positionScreen.x*=
+o,m.positionScreen.y*=-p,v.addPoint(n.positionScreen.x,n.positionScreen.y),v.addPoint(r.positionScreen.x,r.positionScreen.y),v.addPoint(m.positionScreen.x,m.positionScreen.y),t.intersects(v)){var L=n,j=r,K=m;d.info.render.vertices+=3;d.info.render.faces++;P=c(I++);P.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?A.copy(y.color):y instanceof THREE.MeshLambertMaterial?
+q?(A.r=w.r,A.g=w.g,A.b=w.b,a(f,z.centroidWorld,z.normalWorld,A),A.r=Math.max(0,Math.min(y.color.r*A.r,1)),A.g=Math.max(0,Math.min(y.color.g*A.g,1)),A.b=Math.max(0,Math.min(y.color.b*A.b,1))):A.copy(y.color):y instanceof THREE.MeshDepthMaterial?(J=1-y.__2near/(y.__farPlusNear-z.z*y.__farMinusNear),A.setRGB(J,J,J)):y instanceof THREE.MeshNormalMaterial&&A.setRGB(b(z.normalWorld.x),b(z.normalWorld.y),b(z.normalWorld.z));y.wireframe?P.setAttribute("style","fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+
+y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):P.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+y.opacity);i.appendChild(P)}}else if(z instanceof THREE.RenderableFace4&&(n=z.v1,r=z.v2,m=z.v3,s=z.v4,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,m.positionScreen.x*=o,m.positionScreen.y*=-p,s.positionScreen.x*=o,s.positionScreen.y*=-p,v.addPoint(n.positionScreen.x,
+n.positionScreen.y),v.addPoint(r.positionScreen.x,r.positionScreen.y),v.addPoint(m.positionScreen.x,m.positionScreen.y),v.addPoint(s.positionScreen.x,s.positionScreen.y),t.intersects(v))){var L=n,j=r,K=m,ga=s;d.info.render.vertices+=4;d.info.render.faces++;P=c(I++);P.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?
+A.copy(y.color):y instanceof THREE.MeshLambertMaterial?q?(A.r=w.r,A.g=w.g,A.b=w.b,a(f,z.centroidWorld,z.normalWorld,A),A.r=Math.max(0,Math.min(y.color.r*A.r,1)),A.g=Math.max(0,Math.min(y.color.g*A.g,1)),A.b=Math.max(0,Math.min(y.color.b*A.b,1))):A.copy(y.color):y instanceof THREE.MeshDepthMaterial?(J=1-y.__2near/(y.__farPlusNear-z.z*y.__farMinusNear),A.setRGB(J,J,J)):y instanceof THREE.MeshNormalMaterial&&A.setRGB(b(z.normalWorld.x),b(z.normalWorld.y),b(z.normalWorld.z));y.wireframe?P.setAttribute("style",
+"fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):P.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+y.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",
@@ -221,124 +221,125 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 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 c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;g.type==="v2"?f=2:g.type==="v3"?f=3:g.type==="v4"?f=4:g.type==="c"&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=j.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
-function b(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 d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,n=i.length,k=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,U=a.__webglCustomAttributesList;if(c.sortParticles){J.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ba.copy(e),J.multiplyVector3(ba),m[d]=[ba.z,d];m.sort(function(a,
-b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[m[d][1]].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;for(d=0;d<n;d++)g=d*3,e=i[m[d][1]],l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(U){i=0;for(n=U.length;i<n;i++)if(h=U[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=m[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],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=m[d][1],f=h.value[f],
-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=m[d][1],f=h.value[f],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=m[d][1],f=h.value[f],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}}else{if(o)for(d=0;d<f;d++)e=h[d].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;if(p)for(d=0;d<n;d++)e=i[d],g=d*3,l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(U){i=0;for(n=U.length;i<n;i++)if(h=U[i],h.needsUpdate&&(h.boundTo===void 0||
-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(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(U){i=0;for(n=U.length;i<n;i++)if(h=U[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,n,k,l,m,o=a.count*3;for(m=0;m<o;m+=9)c=a.normalArray,d=c[m],e=c[m+1],g=c[m+2],f=c[m+3],i=c[m+4],k=c[m+5],h=c[m+6],n=c[m+7],l=c[m+8],d=(d+f+h)/3,e=(e+i+n)/3,g=
-(g+k+l)/3,c[m]=d,c[m+1]=e,c[m+2]=g,c[m+3]=d,c[m+4]=e,c[m+5]=g,c[m+6]=d,c[m+7]=e,c[m+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!==T&&(T=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&&
-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=[],n=-1,k=0;h=g.morphTargetInfluences;var l,m=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<m;l++)!i[l]&&h[l]>n&&(k=l,n=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
-n;i[k]=1;n=-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,
+THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
+function b(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 d(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,k=i.length,n=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,U=a.__webglCustomAttributesList;if(c.sortParticles){H.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,da.copy(e),H.multiplyVector3(da),m[d]=[da.z,d];m.sort(function(a,
+b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[m[d][1]].position,f=d*3,n[f]=e.x,n[f+1]=e.y,n[f+2]=e.z;for(d=0;d<k;d++)f=d*3,e=i[m[d][1]],l[f]=e.r,l[f+1]=e.g,l[f+2]=e.b;if(U){i=0;for(k=U.length;i<k;i++)if(h=U[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=m[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=m[d][1],g=h.value[g],
+h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=d*3,n[f]=e.x,n[f+1]=e.y,n[f+2]=e.z;if(p)for(d=0;d<k;d++)e=i[d],f=d*3,l[f]=e.r,l[f+1]=e.g,l[f+2]=e.b;if(U){i=0;for(k=U.length;i<k;i++)if(h=U[i],h.needsUpdate&&(h.boundTo===void 0||
+h.boundTo==="vertices"))if(e=h.value.length,f=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++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,
+f+=4}}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,n,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(U){i=0;for(k=U.length;i<k;i++)if(h=U[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,f,g,h,i,k,n,l,m,o=a.count*3;for(m=0;m<o;m+=9)c=a.normalArray,d=c[m],e=c[m+1],f=c[m+2],g=c[m+3],i=c[m+4],n=c[m+5],h=c[m+6],k=c[m+7],l=c[m+8],d=(d+g+h)/3,e=(e+i+k)/3,f=
+(f+n+l)/3,c[m]=d,c[m+1]=e,c[m+2]=f,c[m+3]=d,c[m+4]=e,c[m+5]=f,c[m+6]=d,c[m+7]=e,c[m+8]=f}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,f){if(d.opacity!==0){var g,h,c=s(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==T&&(T=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(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.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(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&
+g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,n=0;h=f.morphTargetInfluences;var l,m=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(l=0;l<m;l++)!i[l]&&h[l]>k&&(n=l,k=h[n]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=
+k;i[n]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],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,
 3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
 3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
 j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
 j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
-4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ta&&(j.lineWidth(d),ta=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=
-e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ta&&(j.lineWidth(d),ta=d),j.drawArrays(g,0,e.__webglLineCount),L.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}}function f(a){v[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
-a.n13,a.n44-a.n14);v[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);v[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);v[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);v[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);v[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=v[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),d=0;d<6;d++)if(a=v[d].x*b.n14+v[d].y*b.n24+v[d].z*b.n34+v[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,n,k,l,m,o=0,p=a.lights;Z||(Z=new THREE.PerspectiveCamera(L.shadowCameraFov,L.shadowMapWidth/L.shadowMapHeight,L.shadowCameraNear,L.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(m=p[b],m.castShadow&&m instanceof THREE.SpotLight){W=-1;L.shadowMap[o]||(L.shadowMap[o]=new THREE.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),fa[o]=new THREE.Matrix4);d=L.shadowMap[o];i=fa[o];Z.position.copy(m.position);Z.lookAt(m.target.position);Z.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(Z));this.autoUpdateScene&&a.updateMatrixWorld();Z.matrixWorldInverse.getInverse(Z.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(Z.projectionMatrix);i.multiplySelf(Z.matrixWorldInverse);Z.matrixWorldInverse.flattenToArray(ea);Z.projectionMatrix.flattenToArray(Y);
-J.multiply(Z.projectionMatrix,Z.matrixWorldInverse);f(J);F(d);j.clearColor(1,1,1,1);L.clear();j.clearColor(y.r,y.g,y.b,H);i=a.__webglObjects.length;for(d=0;d<i;d++)if(k=a.__webglObjects[d],m=k.object,k.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),u(m,Z,!1),k.render=!0;q(!0);E(THREE.NormalBlending);for(d=0;d<i;d++)if(k=a.__webglObjects[d],k.render)m=k.object,k=k.buffer,t(m),l=m.customDepthMaterial?m.customDepthMaterial:
-m.geometry.morphTargets.length?xa:ia,e(Z,p,null,l,k,m);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)k=a.__webglObjectsImmediate[d],m=k.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),T=-1,u(m,Z,!1),t(m),n=s(Z,p,null,ia,m),m.immediateRenderCallback?m.immediateRenderCallback(n,j,v):m.render(function(a){g(a,n,ia.shading)}));o++}}function l(a,b,c,d,g,f,h,j){var i,k,m,n;b?(k=a.length-1,n=b=-1):(k=0,b=a.length,n=1);for(var l=k;l!==b;l+=n)if(i=
-a[l],i.render){k=i.object;m=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&E(i.blending);q(i.depthTest);A(i.depthWrite);w(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}t(k);e(d,g,f,i,m,k)}}function o(a,b,c,d,e,f,h){for(var i,k,m,n,l=0,o=a.length;l<o;l++)if(i=a[l],k=i.object,k.visible){T=-1;if(h)m=h;else{m=i[b];if(!m)continue;f&&E(m.blending);q(m.depthTest);A(m.depthWrite);w(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}t(k);n=s(c,d,e,m,k);k.immediateRenderCallback?k.immediateRenderCallback(n,
-j,v):k.render(function(a){g(a,n,m.shading)})}}function p(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(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 m(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||L.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets);
-for(var g=0,f=L.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==ga&&(j.useProgram(g),ga=g,h=!0);if(d.id!==W)W=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,Y);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,n=0,l=0,o=0,p,U,r,J=ua,s=J.directional.colors,v=J.directional.positions,q=J.point.colors,u=J.point.positions,t=J.point.distances,A=0,C=0,c=k=r=0,h=b.length;c<h;c++)if(k=b[c],m=k.color,p=k.position,U=k.intensity,r=k.distance,k instanceof THREE.AmbientLight)L.gammaInput?(n+=m.r*m.r,l+=m.g*m.g,o+=m.b*m.b):(n+=m.r,l+=m.g,o+=m.b);else if(k instanceof THREE.DirectionalLight)r=A*3,L.gammaInput?(s[r]=m.r*m.r*U*U,s[r+1]=m.g*m.g*U*U,s[r+2]=m.b*m.b*U*U):(s[r]=m.r*U,s[r+1]=m.g*U,s[r+2]=m.b*U),v[r]=p.x,v[r+
-1]=p.y,v[r+2]=p.z,A+=1;else if(k instanceof THREE.SpotLight)r=A*3,L.gammaInput?(s[r]=m.r*m.r*U*U,s[r+1]=m.g*m.g*U*U,s[r+2]=m.b*m.b*U*U):(s[r]=m.r*U,s[r+1]=m.g*U,s[r+2]=m.b*U),m=1/p.length(),v[r]=p.x*m,v[r+1]=p.y*m,v[r+2]=p.z*m,A+=1;else if(k instanceof THREE.PointLight)k=C*3,L.gammaInput?(q[k]=m.r*m.r*U*U,q[k+1]=m.g*m.g*U*U,q[k+2]=m.b*m.b*U*U):(q[k]=m.r*U,q[k+1]=m.g*U,q[k+2]=m.b*U),u[k]=p.x,u[k+1]=p.y,u[k+2]=p.z,t[C]=r,C+=1;c=A*3;for(h=s.length;c<h;c++)s[c]=0;c=C*3;for(h=q.length;c<h;c++)q[c]=0;J.point.length=
-C;J.directional.length=A;J.ambient[0]=n;J.ambient[1]=l;J.ambient[2]=o;b=ua;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,L.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,L.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)L.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<fa.length;b++)i.shadowMatrix.value[b]=fa[b],i.shadowMap.texture[b]=L.shadowMap[b];i.shadowDarkness.value=L.shadowMapDarkness;i.shadowBias.value=L.shadowMapBias}b=d.uniformsList;i=0;for(c=
-b.length;i<c;i++)if(l=g.uniforms[b[i][1]])if(n=b[i][0],o=n.type,h=n.value,o==="i")j.uniform1i(l,h);else if(o==="f")j.uniform1f(l,h);else if(o==="v2")j.uniform2f(l,h.x,h.y);else if(o==="v3")j.uniform3f(l,h.x,h.y,h.z);else if(o==="v4")j.uniform4f(l,h.x,h.y,h.z,h.w);else if(o==="c")j.uniform3f(l,h.r,h.g,h.b);else if(o==="fv1")j.uniform1fv(l,h);else if(o==="fv")j.uniform3fv(l,h);else if(o==="v3v"){if(!n._array)n._array=new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)J=o*3,n._array[J]=h[o].x,n._array[J+
-1]=h[o].y,n._array[J+2]=h[o].z;j.uniform3fv(l,n._array)}else if(o==="m4"){if(!n._array)n._array=new Float32Array(16);h.flattenToArray(n._array);j.uniformMatrix4fv(l,!1,n._array)}else if(o==="m4v"){if(!n._array)n._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(n._array,o*16);j.uniformMatrix4fv(l,!1,n._array)}else if(o==="t"){if(j.uniform1i(l,h),l=n.texture)if(l.image instanceof Array&&l.image.length===6){if(n=l,n.image.length===6)if(n.needsUpdate){if(!n.image.__webglTextureCube)n.image.__webglTextureCube=
-j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,n.image[h]);I(j.TEXTURE_CUBE_MAP,n,n.image[0]);n.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(n=l,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,n.__webglTexture)):M(l,h)}else if(o===
-"tv"){if(!n._array){n._array=[];o=0;for(p=n.texture.length;o<p;o++)n._array[o]=h+o}j.uniform1iv(l,n._array);o=0;for(p=n.texture.length;o<p;o++)(l=n.texture[o])&&M(l,n._array[o])}(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,ea);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,ea),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 t(a){if(Q!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Q=a.doubleSided;if(C!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),C=a.flipSided}function q(a){da!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),da=a)}function A(a){X!==a&&(j.depthMask(a),X=a)}function w(a,b,c){oa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):
-j.disable(j.POLYGON_OFFSET_FILL),oa=a);if(a&&(la!==b||ra!==c))j.polygonOffset(b,c),la=b,ra=c}function E(a){if(a!==ka){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)}ka=a}}function x(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 I(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,K(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,K(b.wrapT)),
-j.texParameteri(a,j.TEXTURE_MAG_FILTER,K(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(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 M(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),L.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,K(a.format),a.image.width,a.image.height,0,K(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);I(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)}function D(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
-j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function F(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=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);I(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,
-a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);D(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),I(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,
-c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),D(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=wa,a=U,d=pa,e=qa);b!==N&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),N=b)}function P(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
-default:return j.LINEAR}}function K(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
-var a=a||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),S=a.precision!==void 0?a.precision:"highp",R=a.antialias!==void 0?a.antialias:!1,V=a.stencil!==void 0?a.stencil:!0,ja=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,y=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),H=a.clearAlpha!==void 0?a.clearAlpha:0,z=a.maxLights!==void 0?a.maxLights:4;this.domElement=$;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 L=
-this,j,aa=[],ga=null,N=null,W=-1,T=null,ca=0,Q=null,C=null,ka=null,da=null,X=null,oa=null,la=null,ra=null,ta=null,pa=0,qa=0,wa=0,U=0,v=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,Y=new Float32Array(16),ea=new Float32Array(16),ba=new THREE.Vector4,ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Z,fa=[],ia,xa,O={},ma=!1;j=function(){var a;try{if(!(a=
-$.getContext("experimental-webgl",{antialias:R,stencil:V,preserveDrawingBuffer:ja})))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}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);
-j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(y.r,y.g,y.b,H);(function(){O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);var a=0;O.vertices[a++]=-1;O.vertices[a++]=-1;O.vertices[a++]=0;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=0;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=0;a=O.vertices[a++]=0;O.faces[a++]=0;O.faces[a++]=
-1;O.faces[a++]=2;O.faces[a++]=0;O.faces[a++]=2;O.faces[a++]=3;O.vertexBuffer=j.createBuffer();O.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,O.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,O.faces,j.STATIC_DRAW);O.program=j.createProgram();j.attachShader(O.program,x("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(O.program,x("vertex",THREE.ShaderLib.sprite.vertexShader));
-j.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.position=j.getAttribLocation(O.program,"position");O.attributes.uv=j.getAttribLocation(O.program,"uv");O.uniforms.uvOffset=j.getUniformLocation(O.program,"uvOffset");O.uniforms.uvScale=j.getUniformLocation(O.program,"uvScale");O.uniforms.rotation=j.getUniformLocation(O.program,"rotation");O.uniforms.scale=j.getUniformLocation(O.program,"scale");O.uniforms.alignment=j.getUniformLocation(O.program,"alignment");O.uniforms.color=j.getUniformLocation(O.program,
-"color");O.uniforms.map=j.getUniformLocation(O.program,"map");O.uniforms.opacity=j.getUniformLocation(O.program,"opacity");O.uniforms.useScreenCoordinates=j.getUniformLocation(O.program,"useScreenCoordinates");O.uniforms.affectedByDistance=j.getUniformLocation(O.program,"affectedByDistance");O.uniforms.screenPosition=j.getUniformLocation(O.program,"screenPosition");O.uniforms.modelViewMatrix=j.getUniformLocation(O.program,"modelViewMatrix");O.uniforms.projectionMatrix=j.getUniformLocation(O.program,
-"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ia=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});ia._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var sa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=
-function(){return sa};this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,d){pa=a;qa=b;wa=c;U=d;j.viewport(pa,qa,wa,U)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){y.setHex(a);H=b;j.clearColor(y.r,y.g,y.b,H)};this.setClearColor=function(a,b){y.copy(a);H=b;j.clearColor(y.r,y.g,y.b,H)};this.getClearColor=
-function(){return y};this.getClearAlpha=function(){return H};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){F(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);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]);L.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
-L.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),L.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var e,g,m,n,p=a.lights,r=a.fog;W=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);L.info.render.calls=0;L.info.render.vertices=0;L.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(ea);b.projectionMatrix.flattenToArray(Y);J.multiply(b.projectionMatrix,b.matrixWorldInverse);f(J);F(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[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,v=s.object,t=s.buffer,C=void 0,C=C=void 0,C=v.material;if(C instanceof THREE.MeshFaceMaterial){if(C=t.materialIndex,C>=0)C=v.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:(ba.copy(m.position),J.multiplyVector3(ba),g.z=ba.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;
-d=0;for(e=n.length;d<e;d++)if(g=n[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?(E(a.overrideMaterial.blending),q(a.overrideMaterial.depthTest),A(a.overrideMaterial.depthWrite),w(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,p,r,!0,a.overrideMaterial),
-o(a.__webglObjectsImmediate,"",b,p,r,!1,a.overrideMaterial)):(E(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,p,r,!1),o(a.__webglObjectsImmediate,"opaque",b,p,r,!1),l(a.__webglObjects,!1,"transparent",b,p,r,!0),o(a.__webglObjectsImmediate,"transparent",b,p,r,!0));if(a.__webglSprites.length){m=O.attributes;p=O.uniforms;r=U/wa;d=[];e=wa*0.5;n=U*0.5;g=!0;j.useProgram(O.program);ga=O.program;T=da=ka=-1;ma||(j.enableVertexAttribArray(O.attributes.position),j.enableVertexAttribArray(O.attributes.uv),
-ma=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,O.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,O.elementBuffer);j.uniformMatrix4fv(p.projectionMatrix,!1,Y);j.activeTexture(j.TEXTURE0);j.uniform1i(p.map,0);m=0;for(s=a.__webglSprites.length;m<s;m++)if(v=a.__webglSprites[m],v.visible&&v.opacity!==0)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
-v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(s=a.__webglSprites.length;m<s;m++)v=a.__webglSprites[m],v.visible&&v.opacity!==0&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(j.uniform1i(p.useScreenCoordinates,1),j.uniform3f(p.screenPosition,(v.position.x-e)/e,(n-v.position.y)/n,Math.max(0,Math.min(1,v.position.z)))):(j.uniform1i(p.useScreenCoordinates,0),j.uniform1i(p.affectedByDistance,v.affectedByDistance?1:0),j.uniformMatrix4fv(p.modelViewMatrix,
-!1,v._modelViewMatrixArray)),b=v.map.image.width/(v.scaleByViewport?U:1),d[0]=b*r*v.scale.x,d[1]=b*v.scale.y,j.uniform2f(p.uvScale,v.uvScale.x,v.uvScale.y),j.uniform2f(p.uvOffset,v.uvOffset.x,v.uvOffset.y),j.uniform2f(p.alignment,v.alignment.x,v.alignment.y),j.uniform1f(p.opacity,v.opacity),j.uniform3f(p.color,v.color.r,v.color.g,v.color.b),j.uniform1f(p.rotation,v.rotation),j.uniform2fv(p.scale,d),v.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!v.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),E(v.blending),
-M(v.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(X)}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=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,o=void 0,U=void 0,
-v=void 0,J=void 0,s=void 0,q={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)o=i.faces[k],U=o.materialIndex,J=U!==void 0?U:-1,q[J]===void 0&&(q[J]={hash:J,counter:0}),s=q[J].hash+"_"+q[J].counter,i.geometryGroups[s]===void 0&&(i.geometryGroups[s]={faces3:[],faces4:[],materialIndex:U,vertices:0,numMorphTargets:u}),v=o instanceof THREE.Face3?3:4,i.geometryGroups[s].vertices+v>65535&&(q[J].counter+=1,s=q[J].hash+"_"+q[J].counter,i.geometryGroups[s]===void 0&&(i.geometryGroups[s]=
-{faces3:[],faces4:[],materialIndex:U,vertices:0,numMorphTargets:u})),o instanceof THREE.Face3?i.geometryGroups[s].faces3.push(k):i.geometryGroups[s].faces4.push(k),i.geometryGroups[s].vertices+=v;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=ca++,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){o=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(o=k.numMorphTargets;l<o;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}L.info.memory.geometries++;
-U=e;v=U.geometry;l=i.faces3;J=i.faces4;k=l.length*3+J.length*4;o=l.length*1+J.length*2;J=l.length*3+J.length*4;l=b(U,i);s=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;q=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(q)i.__normalArray=new Float32Array(k*3);if(v.hasTangents)i.__tangentArray=
-new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(s){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(U.geometry.skinWeights.length&&U.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(o*3);
-i.__lineArray=new Uint16Array(J*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];U=0;for(v=i.numMorphTargets;U<v;U++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=q===THREE.SmoothShading;i.__uvType=s;i.__vertexColorType=u;i.__normalType=q;i.__webglFaceCount=o*3;i.__webglLineCount=J*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];o=void 0;for(o in l.attributes){var U=l.attributes[o],v={},t;for(t in U)v[t]=U[t];if(!v.__webglInitialized||
-v.createUniqueBuffers)v.__webglInitialized=!0,J=1,v.type==="v2"?J=2:v.type==="v3"?J=3:v.type==="v4"?J=4:v.type==="c"&&(J=3),v.size=J,v.array=new Float32Array(k*J),v.buffer=j.createBuffer(),v.buffer.belongsToAttribute=o,U.needsUpdate=!0,v.__original=U;i.__webglCustomAttributesList.push(v)}}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,
+4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ta&&(j.lineWidth(d),ta=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=
+e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ta&&(j.lineWidth(d),ta=d),j.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}}function f(a){u[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
+a.n13,a.n44-a.n14);u[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);u[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);u[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);u[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);u[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=u[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),d=0;d<6;d++)if(a=u[d].x*b.n14+u[d].y*b.n24+u[d].z*b.n34+u[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function l(a){var b,c,d,i,k,n,l,m,o=0,p=a.lights;ba||(ba=new THREE.PerspectiveCamera(L.shadowCameraFov,L.shadowMapWidth/L.shadowMapHeight,L.shadowCameraNear,L.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(m=p[b],m.castShadow&&m instanceof THREE.SpotLight){X=-1;L.shadowMap[o]||(L.shadowMap[o]=new THREE.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,{minFilter:THREE.LinearFilter,
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),fa[o]=new THREE.Matrix4);d=L.shadowMap[o];i=fa[o];ba.position.copy(m.position);ba.lookAt(m.target.position);ba.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ba));this.autoUpdateScene&&a.updateMatrixWorld();ba.matrixWorldInverse.getInverse(ba.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(ba.projectionMatrix);i.multiplySelf(ba.matrixWorldInverse);ba.matrixWorldInverse.flattenToArray(ja);
+ba.projectionMatrix.flattenToArray(aa);H.multiply(ba.projectionMatrix,ba.matrixWorldInverse);f(H);E(d);j.clearColor(1,1,1,1);L.clear();j.clearColor(G.r,G.g,G.b,z);i=a.__webglObjects.length;for(d=0;d<i;d++)if(n=a.__webglObjects[d],m=n.object,n.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),t(m,ba,!1),n.render=!0;q(!0);D(THREE.NormalBlending);for(d=0;d<i;d++)if(n=a.__webglObjects[d],n.render)m=n.object,n=n.buffer,
+v(m),l=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?xa:ia,e(ba,p,null,l,n,m);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)n=a.__webglObjectsImmediate[d],m=n.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),T=-1,t(m,ba,!1),v(m),k=s(ba,p,null,ia,m),m.immediateRenderCallback?m.immediateRenderCallback(k,j,u):m.render(function(a){g(a,k,ia.shading)}));o++}}function k(a,b,c,d,f,g,h,j){var i,n,k,m;b?(n=a.length-1,m=
+b=-1):(n=0,b=a.length,m=1);for(var l=n;l!==b;l+=m)if(i=a[l],i.render){n=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&D(i.blending);q(i.depthTest);A(i.depthWrite);w(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}v(n);e(d,f,g,i,k,n)}}function o(a,b,c,d,e,f,h){for(var i,n,k,m,l=0,o=a.length;l<o;l++)if(i=a[l],n=i.object,n.visible){T=-1;if(h)k=h;else{k=i[b];if(!k)continue;f&&D(k.blending);q(k.depthTest);A(k.depthWrite);w(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}v(n);
+m=s(c,d,e,k,n);n.immediateRenderCallback?n.immediateRenderCallback(m,j,u):n.render(function(a){g(a,m,k.shading)})}}function p(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(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 m(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||L.initMaterial(d,b,c,e);if(d.morphTargets&&
+!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets);for(var f=0,g=L.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==ga&&(j.useProgram(f),ga=f,h=!0);if(d.id!==X)X=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,aa);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 n,k,m=0,l=0,o=0,p,U,r,H=ua,s=H.directional.colors,u=H.directional.positions,q=H.point.colors,t=H.point.positions,v=H.point.distances,A=0,C=0,c=n=r=0,h=b.length;c<h;c++)if(n=b[c],k=n.color,p=n.position,U=n.intensity,r=n.distance,n instanceof THREE.AmbientLight)L.gammaInput?(m+=k.r*k.r,l+=k.g*k.g,o+=k.b*k.b):(m+=k.r,l+=k.g,o+=k.b);else if(n instanceof THREE.DirectionalLight)r=A*3,L.gammaInput?(s[r]=k.r*
+k.r*U*U,s[r+1]=k.g*k.g*U*U,s[r+2]=k.b*k.b*U*U):(s[r]=k.r*U,s[r+1]=k.g*U,s[r+2]=k.b*U),u[r]=p.x,u[r+1]=p.y,u[r+2]=p.z,A+=1;else if(n instanceof THREE.SpotLight)r=A*3,L.gammaInput?(s[r]=k.r*k.r*U*U,s[r+1]=k.g*k.g*U*U,s[r+2]=k.b*k.b*U*U):(s[r]=k.r*U,s[r+1]=k.g*U,s[r+2]=k.b*U),k=1/p.length(),u[r]=p.x*k,u[r+1]=p.y*k,u[r+2]=p.z*k,A+=1;else if(n instanceof THREE.PointLight)n=C*3,L.gammaInput?(q[n]=k.r*k.r*U*U,q[n+1]=k.g*k.g*U*U,q[n+2]=k.b*k.b*U*U):(q[n]=k.r*U,q[n+1]=k.g*U,q[n+2]=k.b*U),t[n]=p.x,t[n+1]=p.y,
+t[n+2]=p.z,v[C]=r,C+=1;c=A*3;for(h=s.length;c<h;c++)s[c]=0;c=C*3;for(h=q.length;c<h;c++)q[c]=0;H.point.length=C;H.directional.length=A;H.ambient[0]=m;H.ambient[1]=l;H.ambient[2]=o;b=ua;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,L.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=V.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,L.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)L.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<fa.length;b++)i.shadowMatrix.value[b]=fa[b],i.shadowMap.texture[b]=L.shadowMap[b];
+i.shadowDarkness.value=L.shadowMapDarkness;i.shadowBias.value=L.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=f.uniforms[b[i][1]])if(m=b[i][0],o=m.type,h=m.value,o==="i")j.uniform1i(l,h);else if(o==="f")j.uniform1f(l,h);else if(o==="v2")j.uniform2f(l,h.x,h.y);else if(o==="v3")j.uniform3f(l,h.x,h.y,h.z);else if(o==="v4")j.uniform4f(l,h.x,h.y,h.z,h.w);else if(o==="c")j.uniform3f(l,h.r,h.g,h.b);else if(o==="fv1")j.uniform1fv(l,h);else if(o==="fv")j.uniform3fv(l,h);else if(o==="v3v"){if(!m._array)m._array=
+new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)H=o*3,m._array[H]=h[o].x,m._array[H+1]=h[o].y,m._array[H+2]=h[o].z;j.uniform3fv(l,m._array)}else if(o==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);j.uniformMatrix4fv(l,!1,m._array)}else if(o==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(m._array,o*16);j.uniformMatrix4fv(l,!1,m._array)}else if(o==="t"){if(j.uniform1i(l,h),l=m.texture)if(l.image instanceof
+Array&&l.image.length===6){if(m=l,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,m.image[h]);J(j.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else l instanceof
+THREE.WebGLRenderTargetCube?(m=l,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.__webglTexture)):M(l,h)}else if(o==="tv"){if(!m._array){m._array=[];o=0;for(p=m.texture.length;o<p;o++)m._array[o]=h+o}j.uniform1iv(l,m._array);o=0;for(p=m.texture.length;o<p;o++)(l=m.texture[o])&&M(l,m._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof
+THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&j.uniformMatrix4fv(g.viewMatrix,!1,ja);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,ja),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&
+g.objectMatrix!==null&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function t(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function v(a){if(Q!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Q=a.doubleSided;if(C!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),C=a.flipSided}function q(a){S!==
+a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),S=a)}function A(a){$!==a&&(j.depthMask(a),$=a)}function w(a,b,c){oa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),oa=a);if(a&&(la!==b||ra!==c))j.polygonOffset(b,c),la=b,ra=c}function D(a){if(a!==Y){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)}Y=a}}function x(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,I(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,I(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,I(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,I(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 M(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
+!0,a.__webglTexture=j.createTexture(),L.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,I(a.format),a.image.width,a.image.height,0,I(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)}
+function K(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function E(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=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);J(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,I(a.format),
+a.width,a.height,0,I(a.format),I(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);K(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),J(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,I(a.format),a.width,a.height,0,I(a.format),I(a.type),null),
+c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),K(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=wa,a=U,d=pa,
+e=qa);b!==N&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),N=b)}function P(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function I(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;
+case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;
+case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},V=a.canvas!==void 0?a.canvas:document.createElement("canvas"),Z=a.precision!==void 0?a.precision:"highp",R=a.antialias!==void 0?a.antialias:!1,W=a.stencil!==void 0?a.stencil:!0,ka=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,G=a.clearColor!==void 0?new THREE.Color(a.clearColor):
+new THREE.Color(0),z=a.clearAlpha!==void 0?a.clearAlpha:0,y=a.maxLights!==void 0?a.maxLights:4;this.domElement=V;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 L=this,j,ca=[],ga=null,N=null,X=-1,T=null,ea=0,Q=null,C=null,Y=null,S=null,$=null,oa=null,la=null,ra=null,ta=null,pa=0,qa=0,wa=0,U=0,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Matrix4,aa=new Float32Array(16),
+ja=new Float32Array(16),da=new THREE.Vector4,ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ba,fa=[],ia,xa,O={},ma=!1;j=function(){var a;try{if(!(a=V.getContext("experimental-webgl",{antialias:R,stencil:W,preserveDrawingBuffer:ka})))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}();
+j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(G.r,G.g,G.b,z);(function(){O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);var a=0;O.vertices[a++]=-1;O.vertices[a++]=-1;O.vertices[a++]=0;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=
+1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=0;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=0;a=O.vertices[a++]=0;O.faces[a++]=0;O.faces[a++]=1;O.faces[a++]=2;O.faces[a++]=0;O.faces[a++]=2;O.faces[a++]=3;O.vertexBuffer=j.createBuffer();O.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,O.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,O.faces,j.STATIC_DRAW);
+O.program=j.createProgram();j.attachShader(O.program,x("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(O.program,x("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.position=j.getAttribLocation(O.program,"position");O.attributes.uv=j.getAttribLocation(O.program,"uv");O.uniforms.uvOffset=j.getUniformLocation(O.program,"uvOffset");O.uniforms.uvScale=j.getUniformLocation(O.program,"uvScale");O.uniforms.rotation=j.getUniformLocation(O.program,
+"rotation");O.uniforms.scale=j.getUniformLocation(O.program,"scale");O.uniforms.alignment=j.getUniformLocation(O.program,"alignment");O.uniforms.color=j.getUniformLocation(O.program,"color");O.uniforms.map=j.getUniformLocation(O.program,"map");O.uniforms.opacity=j.getUniformLocation(O.program,"opacity");O.uniforms.useScreenCoordinates=j.getUniformLocation(O.program,"useScreenCoordinates");O.uniforms.affectedByDistance=j.getUniformLocation(O.program,"affectedByDistance");O.uniforms.screenPosition=
+j.getUniformLocation(O.program,"screenPosition");O.uniforms.modelViewMatrix=j.getUniformLocation(O.program,"modelViewMatrix");O.uniforms.projectionMatrix=j.getUniformLocation(O.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ia=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
+ia._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var sa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return sa};this.setSize=function(a,b){V.width=a;V.height=b;this.setViewport(0,0,V.width,V.height)};this.setViewport=function(a,b,c,d){pa=a;qa=b;wa=c;U=d;j.viewport(pa,qa,wa,U)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
+this.setClearColorHex=function(a,b){G.setHex(a);z=b;j.clearColor(G.r,G.g,G.b,z)};this.setClearColor=function(a,b){G.copy(a);z=b;j.clearColor(G.r,G.g,G.b,z)};this.getClearColor=function(){return G};this.getClearAlpha=function(){return z};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){E(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);
+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]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);L.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
+j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),L.info.memory.textures--};this.updateShadowMap=
+function(a,b){l(a,b)};this.render=function(a,b,c,d){var e,g,m,n,p=a.lights,r=a.fog;X=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&l(a,b);L.info.render.calls=0;L.info.render.vertices=0;L.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(aa);H.multiply(b.projectionMatrix,b.matrixWorldInverse);f(H);E(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);t(m,b,!0);var s=g,u=s.object,v=s.buffer,C=void 0,C=C=void 0,C=u.material;if(C instanceof THREE.MeshFaceMaterial){if(C=
+v.materialIndex,C>=0)C=u.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:(da.copy(m.position),H.multiplyVector3(da),g.z=da.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),
+t(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(D(a.overrideMaterial.blending),q(a.overrideMaterial.depthTest),A(a.overrideMaterial.depthWrite),w(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,p,r,!0,a.overrideMaterial),o(a.__webglObjectsImmediate,"",b,p,r,!1,a.overrideMaterial)):(D(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",
+b,p,r,!1),o(a.__webglObjectsImmediate,"opaque",b,p,r,!1),k(a.__webglObjects,!1,"transparent",b,p,r,!0),o(a.__webglObjectsImmediate,"transparent",b,p,r,!0));if(a.__webglSprites.length){m=O.attributes;p=O.uniforms;r=U/wa;d=[];e=wa*0.5;n=U*0.5;g=!0;j.useProgram(O.program);ga=O.program;T=S=Y=-1;ma||(j.enableVertexAttribArray(O.attributes.position),j.enableVertexAttribArray(O.attributes.uv),ma=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,O.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,O.elementBuffer);j.uniformMatrix4fv(p.projectionMatrix,!1,aa);j.activeTexture(j.TEXTURE0);j.uniform1i(p.map,0);m=0;for(s=a.__webglSprites.length;m<s;m++)if(u=a.__webglSprites[m],u.visible&&u.opacity!==0)u.useScreenCoordinates?u.z=-u.position.z:(u._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,u.matrixWorld,u._modelViewMatrixArray),u.z=-u._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(s=
+a.__webglSprites.length;m<s;m++)u=a.__webglSprites[m],u.visible&&u.opacity!==0&&u.map&&u.map.image&&u.map.image.width&&(u.useScreenCoordinates?(j.uniform1i(p.useScreenCoordinates,1),j.uniform3f(p.screenPosition,(u.position.x-e)/e,(n-u.position.y)/n,Math.max(0,Math.min(1,u.position.z)))):(j.uniform1i(p.useScreenCoordinates,0),j.uniform1i(p.affectedByDistance,u.affectedByDistance?1:0),j.uniformMatrix4fv(p.modelViewMatrix,!1,u._modelViewMatrixArray)),b=u.map.image.width/(u.scaleByViewport?U:1),d[0]=
+b*r*u.scale.x,d[1]=b*u.scale.y,j.uniform2f(p.uvScale,u.uvScale.x,u.uvScale.y),j.uniform2f(p.uvOffset,u.uvOffset.x,u.uvOffset.y),j.uniform2f(p.alignment,u.alignment.x,u.alignment.y),j.uniform1f(p.opacity,u.opacity),j.uniform3f(p.color,u.color.r,u.color.g,u.color.b),j.uniform1f(p.rotation,u.rotation),j.uniform2fv(p.scale,d),u.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!u.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),D(u.blending),M(u.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);
+j.enable(j.DEPTH_TEST);j.depthMask($)}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=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,o=void 0,U=void 0,u=void 0,H=void 0,s=void 0,q={},t=i.morphTargets.length;
+i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)o=i.faces[k],U=o.materialIndex,H=U!==void 0?U:-1,q[H]===void 0&&(q[H]={hash:H,counter:0}),s=q[H].hash+"_"+q[H].counter,i.geometryGroups[s]===void 0&&(i.geometryGroups[s]={faces3:[],faces4:[],materialIndex:U,vertices:0,numMorphTargets:t}),u=o instanceof THREE.Face3?3:4,i.geometryGroups[s].vertices+u>65535&&(q[H].counter+=1,s=q[H].hash+"_"+q[H].counter,i.geometryGroups[s]===void 0&&(i.geometryGroups[s]={faces3:[],faces4:[],materialIndex:U,vertices:0,
+numMorphTargets:t})),o instanceof THREE.Face3?i.geometryGroups[s].faces3.push(k):i.geometryGroups[s].faces4.push(k),i.geometryGroups[s].vertices+=u;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=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){o=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(o=k.numMorphTargets;l<o;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}L.info.memory.geometries++;
+U=e;u=U.geometry;l=i.faces3;H=i.faces4;k=l.length*3+H.length*4;o=l.length*1+H.length*2;H=l.length*3+H.length*4;l=b(U,i);s=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;q=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;t=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(q)i.__normalArray=new Float32Array(k*3);if(u.hasTangents)i.__tangentArray=
+new Float32Array(k*4);if(t)i.__colorArray=new Float32Array(k*3);if(s){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(U.geometry.skinWeights.length&&U.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(o*3);
+i.__lineArray=new Uint16Array(H*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];U=0;for(u=i.numMorphTargets;U<u;U++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=q===THREE.SmoothShading;i.__uvType=s;i.__vertexColorType=t;i.__normalType=q;i.__webglFaceCount=o*3;i.__webglLineCount=H*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];o=void 0;for(o in l.attributes){var U=l.attributes[o],u={},v;for(v in U)u[v]=U[v];if(!u.__webglInitialized||
+u.createUniqueBuffers)u.__webglInitialized=!0,H=1,u.type==="v2"?H=2:u.type==="v3"?H=3:u.type==="v4"?H=4:u.type==="c"&&(H=3),u.size=H,u.array=new Float32Array(k*H),u.buffer=j.createBuffer(),u.buffer.belongsToAttribute=o,U.needsUpdate=!0,u.__original=U;i.__webglCustomAttributesList.push(u)}}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(),L.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(),L.info.memory.geometries++,i=h,k=e,l=i.vertices.length,
 !h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),L.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(),L.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(),L.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=
 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(),L.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],p(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,p(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,
 !0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],p(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,p(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)m(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)&&m(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(t=
-a.__webglObjects[e].object,f=t.geometry,h=o=l=void 0,t instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(t,l),o=h.attributes&&n(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||o)if(o=j.DYNAMIC_DRAW,U=!f.dynamic,l.__inittedArrays){var A=J=v=void 0,C=void 0,Y=void 0,F=void 0,w=void 0,ba=void 0,E=void 0,M=void 0,ka=void 0,H=A=F=void 0,x=void 0,z=void 0,y=void 0,I=C=
-void 0,K=void 0,ea=C=E=ka=void 0,O=void 0,da=y=z=x=w=void 0,D=C=y=z=x=da=y=z=x=da=y=z=x=void 0,Z=void 0,P=F=void 0,W=void 0,X=void 0,ua=void 0,R=void 0,N=H=X=Z=0,fa=0,T=D=A=0,Q=w=I=0,G=0,S=void 0,Q=l.__vertexArray,W=l.__uvArray,G=l.__uv2Array,P=l.__normalArray,Y=l.__tangentArray,K=l.__colorArray,ea=l.__skinVertexAArray,O=l.__skinVertexBArray,ba=l.__skinIndexArray,V=l.__skinWeightArray,da=l.__morphTargetsArrays,s=l.__webglCustomAttributesList,B=void 0,B=l.__faceArray,S=l.__lineArray,$=l.__needsSmoothNormals,
-ka=l.__vertexColorType,M=l.__uvType,F=l.__normalType,E=t.geometry,aa=E.__dirtyElements,oa=E.__dirtyUvs,ja=E.__dirtyNormals,ga=E.__dirtyTangents,xa=E.__dirtyColors,ua=E.__dirtyMorphTargets,R=E.vertices,q=l.faces3,u=l.faces4,ia=E.faces,la=E.faceVertexUvs[0],ta=E.faceVertexUvs[1],sa=E.skinVerticesA,ra=E.skinVerticesB,qa=E.skinIndices,ma=E.skinWeights,pa=E.morphTargets;if(E.__dirtyVertices){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=R[C.a].position,z=R[C.b].position,y=R[C.c].position,Q[X]=x.x,Q[X+1]=x.y,
-Q[X+2]=x.z,Q[X+3]=z.x,Q[X+4]=z.y,Q[X+5]=z.z,Q[X+6]=y.x,Q[X+7]=y.y,Q[X+8]=y.z,X+=9;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=R[C.a].position,z=R[C.b].position,y=R[C.c].position,C=R[C.d].position,Q[X]=x.x,Q[X+1]=x.y,Q[X+2]=x.z,Q[X+3]=z.x,Q[X+4]=z.y,Q[X+5]=z.z,Q[X+6]=y.x,Q[X+7]=y.y,Q[X+8]=y.z,Q[X+9]=C.x,Q[X+10]=C.y,Q[X+11]=C.z,X+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q,o)}if(ua){X=0;for(ua=pa.length;X<ua;X++){v=Q=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=pa[X].vertices[C.a].position,
-z=pa[X].vertices[C.b].position,y=pa[X].vertices[C.c].position,R=da[X],R[Q]=x.x,R[Q+1]=x.y,R[Q+2]=x.z,R[Q+3]=z.x,R[Q+4]=z.y,R[Q+5]=z.z,R[Q+6]=y.x,R[Q+7]=y.y,R[Q+8]=y.z,Q+=9;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=pa[X].vertices[C.a].position,z=pa[X].vertices[C.b].position,y=pa[X].vertices[C.c].position,C=pa[X].vertices[C.d].position,R=da[X],R[Q]=x.x,R[Q+1]=x.y,R[Q+2]=x.z,R[Q+3]=z.x,R[Q+4]=z.y,R[Q+5]=z.z,R[Q+6]=y.x,R[Q+7]=y.y,R[Q+8]=y.z,R[Q+9]=C.x,R[Q+10]=C.y,R[Q+11]=C.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,
-l.__webglMorphTargetsBuffers[X]);j.bufferData(j.ARRAY_BUFFER,da[X],o)}}if(ma.length){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=ma[C.a],z=ma[C.b],y=ma[C.c],V[w]=x.x,V[w+1]=x.y,V[w+2]=x.z,V[w+3]=x.w,V[w+4]=z.x,V[w+5]=z.y,V[w+6]=z.z,V[w+7]=z.w,V[w+8]=y.x,V[w+9]=y.y,V[w+10]=y.z,V[w+11]=y.w,x=qa[C.a],z=qa[C.b],y=qa[C.c],ba[w]=x.x,ba[w+1]=x.y,ba[w+2]=x.z,ba[w+3]=x.w,ba[w+4]=z.x,ba[w+5]=z.y,ba[w+6]=z.z,ba[w+7]=z.w,ba[w+8]=y.x,ba[w+9]=y.y,ba[w+10]=y.z,ba[w+11]=y.w,x=sa[C.a],z=sa[C.b],y=sa[C.c],ea[w]=x.x,ea[w+
-1]=x.y,ea[w+2]=x.z,ea[w+3]=1,ea[w+4]=z.x,ea[w+5]=z.y,ea[w+6]=z.z,ea[w+7]=1,ea[w+8]=y.x,ea[w+9]=y.y,ea[w+10]=y.z,ea[w+11]=1,x=ra[C.a],z=ra[C.b],y=ra[C.c],O[w]=x.x,O[w+1]=x.y,O[w+2]=x.z,O[w+3]=1,O[w+4]=z.x,O[w+5]=z.y,O[w+6]=z.z,O[w+7]=1,O[w+8]=y.x,O[w+9]=y.y,O[w+10]=y.z,O[w+11]=1,w+=12;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=ma[C.a],z=ma[C.b],y=ma[C.c],da=ma[C.d],V[w]=x.x,V[w+1]=x.y,V[w+2]=x.z,V[w+3]=x.w,V[w+4]=z.x,V[w+5]=z.y,V[w+6]=z.z,V[w+7]=z.w,V[w+8]=y.x,V[w+9]=y.y,V[w+10]=y.z,V[w+11]=y.w,V[w+12]=
-da.x,V[w+13]=da.y,V[w+14]=da.z,V[w+15]=da.w,x=qa[C.a],z=qa[C.b],y=qa[C.c],da=qa[C.d],ba[w]=x.x,ba[w+1]=x.y,ba[w+2]=x.z,ba[w+3]=x.w,ba[w+4]=z.x,ba[w+5]=z.y,ba[w+6]=z.z,ba[w+7]=z.w,ba[w+8]=y.x,ba[w+9]=y.y,ba[w+10]=y.z,ba[w+11]=y.w,ba[w+12]=da.x,ba[w+13]=da.y,ba[w+14]=da.z,ba[w+15]=da.w,x=sa[C.a],z=sa[C.b],y=sa[C.c],da=sa[C.d],ea[w]=x.x,ea[w+1]=x.y,ea[w+2]=x.z,ea[w+3]=1,ea[w+4]=z.x,ea[w+5]=z.y,ea[w+6]=z.z,ea[w+7]=1,ea[w+8]=y.x,ea[w+9]=y.y,ea[w+10]=y.z,ea[w+11]=1,ea[w+12]=da.x,ea[w+13]=da.y,ea[w+14]=
-da.z,ea[w+15]=1,x=ra[C.a],z=ra[C.b],y=ra[C.c],C=ra[C.d],O[w]=x.x,O[w+1]=x.y,O[w+2]=x.z,O[w+3]=1,O[w+4]=z.x,O[w+5]=z.y,O[w+6]=z.z,O[w+7]=1,O[w+8]=y.x,O[w+9]=y.y,O[w+10]=y.z,O[w+11]=1,O[w+12]=C.x,O[w+13]=C.y,O[w+14]=C.z,O[w+15]=1,w+=16;w>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ea,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,O,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,
-ba,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,V,o))}if(xa&&ka){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],w=C.vertexColors,ba=C.color,w.length===3&&ka===THREE.VertexColors?(C=w[0],ea=w[1],O=w[2]):O=ea=C=ba,K[I]=C.r,K[I+1]=C.g,K[I+2]=C.b,K[I+3]=ea.r,K[I+4]=ea.g,K[I+5]=ea.b,K[I+6]=O.r,K[I+7]=O.g,K[I+8]=O.b,I+=9;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],w=C.vertexColors,ba=C.color,w.length===4&&ka===THREE.VertexColors?(C=w[0],ea=w[1],O=w[2],w=w[3]):w=O=ea=C=ba,K[I]=
-C.r,K[I+1]=C.g,K[I+2]=C.b,K[I+3]=ea.r,K[I+4]=ea.g,K[I+5]=ea.b,K[I+6]=O.r,K[I+7]=O.g,K[I+8]=O.b,K[I+9]=w.r,K[I+10]=w.g,K[I+11]=w.b,I+=12;I>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,K,o))}if(ga&&E.hasTangents){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],E=C.vertexTangents,I=E[0],K=E[1],ka=E[2],Y[D]=I.x,Y[D+1]=I.y,Y[D+2]=I.z,Y[D+3]=I.w,Y[D+4]=K.x,Y[D+5]=K.y,Y[D+6]=K.z,Y[D+7]=K.w,Y[D+8]=ka.x,Y[D+9]=ka.y,Y[D+10]=ka.z,Y[D+11]=ka.w,D+=12;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],
-E=C.vertexTangents,I=E[0],K=E[1],ka=E[2],E=E[3],Y[D]=I.x,Y[D+1]=I.y,Y[D+2]=I.z,Y[D+3]=I.w,Y[D+4]=K.x,Y[D+5]=K.y,Y[D+6]=K.z,Y[D+7]=K.w,Y[D+8]=ka.x,Y[D+9]=ka.y,Y[D+10]=ka.z,Y[D+11]=ka.w,Y[D+12]=E.x,Y[D+13]=E.y,Y[D+14]=E.z,Y[D+15]=E.w,D+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Y,o)}if(ja&&F){v=0;for(J=q.length;v<J;v++)if(C=ia[q[v]],Y=C.vertexNormals,F=C.normal,Y.length===3&&$)for(D=0;D<3;D++)F=Y[D],P[A]=F.x,P[A+1]=F.y,P[A+2]=F.z,A+=3;else for(D=0;D<3;D++)P[A]=
-F.x,P[A+1]=F.y,P[A+2]=F.z,A+=3;v=0;for(J=u.length;v<J;v++)if(C=ia[u[v]],Y=C.vertexNormals,F=C.normal,Y.length===4&&$)for(D=0;D<4;D++)F=Y[D],P[A]=F.x,P[A+1]=F.y,P[A+2]=F.z,A+=3;else for(D=0;D<4;D++)P[A]=F.x,P[A+1]=F.y,P[A+2]=F.z,A+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,P,o)}if(oa&&la&&M){v=0;for(J=q.length;v<J;v++)if(A=q[v],A=la[A],A!==void 0)for(D=0;D<3;D++)P=A[D],W[H]=P.u,W[H+1]=P.v,H+=2;v=0;for(J=u.length;v<J;v++)if(A=u[v],A=la[A],A!==void 0)for(D=0;D<
-4;D++)P=A[D],W[H]=P.u,W[H+1]=P.v,H+=2;H>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,W,o))}if(oa&&ta&&M){v=0;for(J=q.length;v<J;v++)if(A=q[v],H=ta[A],H!==void 0)for(D=0;D<3;D++)W=H[D],G[N]=W.u,G[N+1]=W.v,N+=2;v=0;for(J=u.length;v<J;v++)if(A=u[v],H=ta[A],H!==void 0)for(D=0;D<4;D++)W=H[D],G[N]=W.u,G[N+1]=W.v,N+=2;N>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,G,o))}if(aa){v=0;for(J=q.length;v<J;v++)B[fa]=Z,B[fa+1]=Z+1,B[fa+2]=Z+2,
-fa+=3,S[T]=Z,S[T+1]=Z+1,S[T+2]=Z,S[T+3]=Z+2,S[T+4]=Z+1,S[T+5]=Z+2,T+=6,Z+=3;v=0;for(J=u.length;v<J;v++)B[fa]=Z,B[fa+1]=Z+1,B[fa+2]=Z+3,B[fa+3]=Z+1,B[fa+4]=Z+2,B[fa+5]=Z+3,fa+=6,S[T]=Z,S[T+1]=Z+1,S[T+2]=Z,S[T+3]=Z+3,S[T+4]=Z+1,S[T+5]=Z+2,S[T+6]=Z+2,S[T+7]=Z+3,T+=8,Z+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,B,o);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,S,o)}if(s){D=0;for(Z=s.length;D<Z;D++)if(B=
-s[D],B.__original.needsUpdate){G=0;if(B.size===1)if(B.boundTo===void 0||B.boundTo==="vertices"){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],B.array[G]=B.value[C.a],B.array[G+1]=B.value[C.b],B.array[G+2]=B.value[C.c],G+=3;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],B.array[G]=B.value[C.a],B.array[G+1]=B.value[C.b],B.array[G+2]=B.value[C.c],B.array[G+3]=B.value[C.d],G+=4}else{if(B.boundTo==="faces"){v=0;for(J=q.length;v<J;v++)S=B.value[q[v]],B.array[G]=S,B.array[G+1]=S,B.array[G+2]=S,G+=3;v=0;for(J=u.length;v<
-J;v++)S=B.value[u[v]],B.array[G]=S,B.array[G+1]=S,B.array[G+2]=S,B.array[G+3]=S,G+=4}}else if(B.size===2)if(B.boundTo===void 0||B.boundTo==="vertices"){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=z.x,B.array[G+3]=z.y,B.array[G+4]=y.x,B.array[G+5]=y.y,G+=6;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=z.x,B.array[G+3]=z.y,
-B.array[G+4]=y.x,B.array[G+5]=y.y,B.array[G+6]=C.x,B.array[G+7]=C.y,G+=8}else{if(B.boundTo==="faces"){v=0;for(J=q.length;v<J;v++)y=z=x=S=B.value[q[v]],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=z.x,B.array[G+3]=z.y,B.array[G+4]=y.x,B.array[G+5]=y.y,G+=6;v=0;for(J=u.length;v<J;v++)C=y=z=x=S=B.value[u[v]],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=z.x,B.array[G+3]=z.y,B.array[G+4]=y.x,B.array[G+5]=y.y,B.array[G+6]=C.x,B.array[G+7]=C.y,G+=8}}else if(B.size===3)if(N=B.type==="c"?["r","g","b"]:["x",
-"y","z"],B.boundTo===void 0||B.boundTo==="vertices"){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],B.array[G]=x[N[0]],B.array[G+1]=x[N[1]],B.array[G+2]=x[N[2]],B.array[G+3]=z[N[0]],B.array[G+4]=z[N[1]],B.array[G+5]=z[N[2]],B.array[G+6]=y[N[0]],B.array[G+7]=y[N[1]],B.array[G+8]=y[N[2]],G+=9;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[G]=x[N[0]],B.array[G+1]=x[N[1]],B.array[G+2]=x[N[2]],B.array[G+3]=z[N[0]],
-B.array[G+4]=z[N[1]],B.array[G+5]=z[N[2]],B.array[G+6]=y[N[0]],B.array[G+7]=y[N[1]],B.array[G+8]=y[N[2]],B.array[G+9]=C[N[0]],B.array[G+10]=C[N[1]],B.array[G+11]=C[N[2]],G+=12}else{if(B.boundTo==="faces"){v=0;for(J=q.length;v<J;v++)y=z=x=S=B.value[q[v]],B.array[G]=x[N[0]],B.array[G+1]=x[N[1]],B.array[G+2]=x[N[2]],B.array[G+3]=z[N[0]],B.array[G+4]=z[N[1]],B.array[G+5]=z[N[2]],B.array[G+6]=y[N[0]],B.array[G+7]=y[N[1]],B.array[G+8]=y[N[2]],G+=9;v=0;for(J=u.length;v<J;v++)C=y=z=x=S=B.value[u[v]],B.array[G]=
-x[N[0]],B.array[G+1]=x[N[1]],B.array[G+2]=x[N[2]],B.array[G+3]=z[N[0]],B.array[G+4]=z[N[1]],B.array[G+5]=z[N[2]],B.array[G+6]=y[N[0]],B.array[G+7]=y[N[1]],B.array[G+8]=y[N[2]],B.array[G+9]=C[N[0]],B.array[G+10]=C[N[1]],B.array[G+11]=C[N[2]],G+=12}}else if(B.size===4)if(B.boundTo===void 0||B.boundTo==="vertices"){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=x.z,B.array[G+3]=x.w,B.array[G+4]=z.x,B.array[G+5]=z.y,B.array[G+
-6]=z.z,B.array[G+7]=z.w,B.array[G+8]=y.x,B.array[G+9]=y.y,B.array[G+10]=y.z,B.array[G+11]=y.w,G+=12;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=x.z,B.array[G+3]=x.w,B.array[G+4]=z.x,B.array[G+5]=z.y,B.array[G+6]=z.z,B.array[G+7]=z.w,B.array[G+8]=y.x,B.array[G+9]=y.y,B.array[G+10]=y.z,B.array[G+11]=y.w,B.array[G+12]=C.x,B.array[G+13]=C.y,B.array[G+14]=C.z,B.array[G+15]=C.w,G+=16}else if(B.boundTo==="faces"){v=
-0;for(J=q.length;v<J;v++)y=z=x=S=B.value[q[v]],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=x.z,B.array[G+3]=x.w,B.array[G+4]=z.x,B.array[G+5]=z.y,B.array[G+6]=z.z,B.array[G+7]=z.w,B.array[G+8]=y.x,B.array[G+9]=y.y,B.array[G+10]=y.z,B.array[G+11]=y.w,G+=12;v=0;for(J=u.length;v<J;v++)C=y=z=x=S=B.value[u[v]],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=x.z,B.array[G+3]=x.w,B.array[G+4]=z.x,B.array[G+5]=z.y,B.array[G+6]=z.z,B.array[G+7]=z.w,B.array[G+8]=y.x,B.array[G+9]=y.y,B.array[G+10]=y.z,B.array[G+
-11]=y.w,B.array[G+12]=C.x,B.array[G+13]=C.y,B.array[G+14]=C.z,B.array[G+15]=C.w,G+=16}j.bindBuffer(j.ARRAY_BUFFER,B.buffer);j.bufferData(j.ARRAY_BUFFER,B.array,o)}}U&&(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(t instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;t=j.DYNAMIC_DRAW;v=i=v=U=U=void 0;J=h.vertices;k=h.colors;s=J.length;l=k.length;q=h.__vertexArray;o=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(U=0;U<s;U++)v=J[U].position,i=U*3,q[i]=v.x,q[i+1]=v.y,q[i+2]=v.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,q,
-t)}if(u){for(U=0;U<l;U++)v=k[U],i=U*3,o[i]=v.r,o[i+1]=v.g,o[i+2]=v.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,o,t)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(t instanceof THREE.Line){h=b(t,l);o=h.attributes&&n(h);if(f.__dirtyVertices||f.__dirtyColors||o){t=f;i=j.DYNAMIC_DRAW;s=k=Z=J=ia=void 0;J=t.vertices;l=t.colors;s=J.length;o=l.length;q=t.__vertexArray;U=t.__colorArray;u=t.__dirtyColors;v=t.__webglCustomAttributesList;H=T=fa=N=Z=ia=void 0;if(t.__dirtyVertices){for(ia=
-0;ia<s;ia++)Z=J[ia].position,k=ia*3,q[k]=Z.x,q[k+1]=Z.y,q[k+2]=Z.z;j.bindBuffer(j.ARRAY_BUFFER,t.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,q,i)}if(u){for(J=0;J<o;J++)s=l[J],k=J*3,U[k]=s.r,U[k+1]=s.g,U[k+2]=s.b;j.bindBuffer(j.ARRAY_BUFFER,t.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,U,i)}if(v){ia=0;for(Z=v.length;ia<Z;ia++)if(H=v[ia],H.needsUpdate&&(H.boundTo===void 0||H.boundTo==="vertices")){k=0;fa=H.value.length;if(H.size===1)for(N=0;N<fa;N++)H.array[N]=H.value[N];else if(H.size===2)for(N=
-0;N<fa;N++)T=H.value[N],H.array[k]=T.x,H.array[k+1]=T.y,k+=2;else if(H.size===3)if(H.type==="c")for(N=0;N<fa;N++)T=H.value[N],H.array[k]=T.r,H.array[k+1]=T.g,H.array[k+2]=T.b,k+=3;else for(N=0;N<fa;N++)T=H.value[N],H.array[k]=T.x,H.array[k+1]=T.y,H.array[k+2]=T.z,k+=3;else if(H.size===4)for(N=0;N<fa;N++)T=H.value[N],H.array[k]=T.x,H.array[k+1]=T.y,H.array[k+2]=T.z,H.array[k+3]=T.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=
-!1;h.attributes&&r(h)}else if(t instanceof THREE.ParticleSystem)h=b(t,l),o=h.attributes&&n(h),(f.__dirtyVertices||f.__dirtyColors||t.sortParticles||o)&&d(f,j.DYNAMIC_DRAW,t),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);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<=z?k=m:(k=Math.ceil(z*m/(i+m)),i=z-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 o;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,perPixel:a.perPixel},v,d=[];h?d.push(h):(d.push(k),d.push(l));for(v in c)d.push(v),d.push(c[v]);h=d.join();v=0;for(d=aa.length;v<d;v++)if(aa[v].code===h){o=aa[v].program;break a}v=j.createProgram();d=[sa?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":
+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)m(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)&&m(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(v=
+a.__webglObjects[e].object,f=v.geometry,h=o=l=void 0,v instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(v,l),o=h.attributes&&n(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||o)if(o=j.DYNAMIC_DRAW,U=!f.dynamic,l.__inittedArrays){var A=H=u=void 0,C=void 0,aa=void 0,E=void 0,w=void 0,da=void 0,D=void 0,M=void 0,J=void 0,Y=A=E=void 0,z=void 0,x=void 0,y=void 0,G=C=
+void 0,ja=void 0,O=C=D=J=void 0,I=void 0,K=y=x=z=w=void 0,S=C=y=x=z=K=y=x=z=K=y=x=z=void 0,ba=void 0,P=E=void 0,X=void 0,$=void 0,ua=void 0,R=void 0,N=Y=$=ba=0,fa=0,T=S=A=0,Q=w=G=0,F=0,W=void 0,Q=l.__vertexArray,X=l.__uvArray,F=l.__uv2Array,P=l.__normalArray,aa=l.__tangentArray,ja=l.__colorArray,O=l.__skinVertexAArray,I=l.__skinVertexBArray,da=l.__skinIndexArray,V=l.__skinWeightArray,K=l.__morphTargetsArrays,s=l.__webglCustomAttributesList,B=void 0,B=l.__faceArray,W=l.__lineArray,ca=l.__needsSmoothNormals,
+J=l.__vertexColorType,M=l.__uvType,E=l.__normalType,D=v.geometry,Z=D.__dirtyElements,oa=D.__dirtyUvs,ka=D.__dirtyNormals,ga=D.__dirtyTangents,xa=D.__dirtyColors,ua=D.__dirtyMorphTargets,R=D.vertices,q=l.faces3,t=l.faces4,ia=D.faces,la=D.faceVertexUvs[0],ta=D.faceVertexUvs[1],sa=D.skinVerticesA,ra=D.skinVerticesB,qa=D.skinIndices,ma=D.skinWeights,pa=D.morphTargets;if(D.__dirtyVertices){u=0;for(H=q.length;u<H;u++)C=ia[q[u]],z=R[C.a].position,x=R[C.b].position,y=R[C.c].position,Q[$]=z.x,Q[$+1]=z.y,Q[$+
+2]=z.z,Q[$+3]=x.x,Q[$+4]=x.y,Q[$+5]=x.z,Q[$+6]=y.x,Q[$+7]=y.y,Q[$+8]=y.z,$+=9;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],z=R[C.a].position,x=R[C.b].position,y=R[C.c].position,C=R[C.d].position,Q[$]=z.x,Q[$+1]=z.y,Q[$+2]=z.z,Q[$+3]=x.x,Q[$+4]=x.y,Q[$+5]=x.z,Q[$+6]=y.x,Q[$+7]=y.y,Q[$+8]=y.z,Q[$+9]=C.x,Q[$+10]=C.y,Q[$+11]=C.z,$+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q,o)}if(ua){$=0;for(ua=pa.length;$<ua;$++){u=Q=0;for(H=q.length;u<H;u++)C=ia[q[u]],z=pa[$].vertices[C.a].position,
+x=pa[$].vertices[C.b].position,y=pa[$].vertices[C.c].position,R=K[$],R[Q]=z.x,R[Q+1]=z.y,R[Q+2]=z.z,R[Q+3]=x.x,R[Q+4]=x.y,R[Q+5]=x.z,R[Q+6]=y.x,R[Q+7]=y.y,R[Q+8]=y.z,Q+=9;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],z=pa[$].vertices[C.a].position,x=pa[$].vertices[C.b].position,y=pa[$].vertices[C.c].position,C=pa[$].vertices[C.d].position,R=K[$],R[Q]=z.x,R[Q+1]=z.y,R[Q+2]=z.z,R[Q+3]=x.x,R[Q+4]=x.y,R[Q+5]=x.z,R[Q+6]=y.x,R[Q+7]=y.y,R[Q+8]=y.z,R[Q+9]=C.x,R[Q+10]=C.y,R[Q+11]=C.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,
+l.__webglMorphTargetsBuffers[$]);j.bufferData(j.ARRAY_BUFFER,K[$],o)}}if(ma.length){u=0;for(H=q.length;u<H;u++)C=ia[q[u]],z=ma[C.a],x=ma[C.b],y=ma[C.c],V[w]=z.x,V[w+1]=z.y,V[w+2]=z.z,V[w+3]=z.w,V[w+4]=x.x,V[w+5]=x.y,V[w+6]=x.z,V[w+7]=x.w,V[w+8]=y.x,V[w+9]=y.y,V[w+10]=y.z,V[w+11]=y.w,z=qa[C.a],x=qa[C.b],y=qa[C.c],da[w]=z.x,da[w+1]=z.y,da[w+2]=z.z,da[w+3]=z.w,da[w+4]=x.x,da[w+5]=x.y,da[w+6]=x.z,da[w+7]=x.w,da[w+8]=y.x,da[w+9]=y.y,da[w+10]=y.z,da[w+11]=y.w,z=sa[C.a],x=sa[C.b],y=sa[C.c],O[w]=z.x,O[w+
+1]=z.y,O[w+2]=z.z,O[w+3]=1,O[w+4]=x.x,O[w+5]=x.y,O[w+6]=x.z,O[w+7]=1,O[w+8]=y.x,O[w+9]=y.y,O[w+10]=y.z,O[w+11]=1,z=ra[C.a],x=ra[C.b],y=ra[C.c],I[w]=z.x,I[w+1]=z.y,I[w+2]=z.z,I[w+3]=1,I[w+4]=x.x,I[w+5]=x.y,I[w+6]=x.z,I[w+7]=1,I[w+8]=y.x,I[w+9]=y.y,I[w+10]=y.z,I[w+11]=1,w+=12;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],z=ma[C.a],x=ma[C.b],y=ma[C.c],K=ma[C.d],V[w]=z.x,V[w+1]=z.y,V[w+2]=z.z,V[w+3]=z.w,V[w+4]=x.x,V[w+5]=x.y,V[w+6]=x.z,V[w+7]=x.w,V[w+8]=y.x,V[w+9]=y.y,V[w+10]=y.z,V[w+11]=y.w,V[w+12]=K.x,V[w+
+13]=K.y,V[w+14]=K.z,V[w+15]=K.w,z=qa[C.a],x=qa[C.b],y=qa[C.c],K=qa[C.d],da[w]=z.x,da[w+1]=z.y,da[w+2]=z.z,da[w+3]=z.w,da[w+4]=x.x,da[w+5]=x.y,da[w+6]=x.z,da[w+7]=x.w,da[w+8]=y.x,da[w+9]=y.y,da[w+10]=y.z,da[w+11]=y.w,da[w+12]=K.x,da[w+13]=K.y,da[w+14]=K.z,da[w+15]=K.w,z=sa[C.a],x=sa[C.b],y=sa[C.c],K=sa[C.d],O[w]=z.x,O[w+1]=z.y,O[w+2]=z.z,O[w+3]=1,O[w+4]=x.x,O[w+5]=x.y,O[w+6]=x.z,O[w+7]=1,O[w+8]=y.x,O[w+9]=y.y,O[w+10]=y.z,O[w+11]=1,O[w+12]=K.x,O[w+13]=K.y,O[w+14]=K.z,O[w+15]=1,z=ra[C.a],x=ra[C.b],y=
+ra[C.c],C=ra[C.d],I[w]=z.x,I[w+1]=z.y,I[w+2]=z.z,I[w+3]=1,I[w+4]=x.x,I[w+5]=x.y,I[w+6]=x.z,I[w+7]=1,I[w+8]=y.x,I[w+9]=y.y,I[w+10]=y.z,I[w+11]=1,I[w+12]=C.x,I[w+13]=C.y,I[w+14]=C.z,I[w+15]=1,w+=16;w>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,O,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,I,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,da,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),
+j.bufferData(j.ARRAY_BUFFER,V,o))}if(xa&&J){u=0;for(H=q.length;u<H;u++)C=ia[q[u]],w=C.vertexColors,da=C.color,w.length===3&&J===THREE.VertexColors?(C=w[0],O=w[1],I=w[2]):I=O=C=da,ja[G]=C.r,ja[G+1]=C.g,ja[G+2]=C.b,ja[G+3]=O.r,ja[G+4]=O.g,ja[G+5]=O.b,ja[G+6]=I.r,ja[G+7]=I.g,ja[G+8]=I.b,G+=9;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],w=C.vertexColors,da=C.color,w.length===4&&J===THREE.VertexColors?(C=w[0],O=w[1],I=w[2],w=w[3]):w=I=O=C=da,ja[G]=C.r,ja[G+1]=C.g,ja[G+2]=C.b,ja[G+3]=O.r,ja[G+4]=O.g,ja[G+5]=O.b,
+ja[G+6]=I.r,ja[G+7]=I.g,ja[G+8]=I.b,ja[G+9]=w.r,ja[G+10]=w.g,ja[G+11]=w.b,G+=12;G>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,ja,o))}if(ga&&D.hasTangents){u=0;for(H=q.length;u<H;u++)C=ia[q[u]],D=C.vertexTangents,G=D[0],ja=D[1],J=D[2],aa[S]=G.x,aa[S+1]=G.y,aa[S+2]=G.z,aa[S+3]=G.w,aa[S+4]=ja.x,aa[S+5]=ja.y,aa[S+6]=ja.z,aa[S+7]=ja.w,aa[S+8]=J.x,aa[S+9]=J.y,aa[S+10]=J.z,aa[S+11]=J.w,S+=12;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],D=C.vertexTangents,G=D[0],ja=D[1],J=D[2],
+D=D[3],aa[S]=G.x,aa[S+1]=G.y,aa[S+2]=G.z,aa[S+3]=G.w,aa[S+4]=ja.x,aa[S+5]=ja.y,aa[S+6]=ja.z,aa[S+7]=ja.w,aa[S+8]=J.x,aa[S+9]=J.y,aa[S+10]=J.z,aa[S+11]=J.w,aa[S+12]=D.x,aa[S+13]=D.y,aa[S+14]=D.z,aa[S+15]=D.w,S+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,aa,o)}if(ka&&E){u=0;for(H=q.length;u<H;u++)if(C=ia[q[u]],aa=C.vertexNormals,E=C.normal,aa.length===3&&ca)for(S=0;S<3;S++)E=aa[S],P[A]=E.x,P[A+1]=E.y,P[A+2]=E.z,A+=3;else for(S=0;S<3;S++)P[A]=E.x,P[A+1]=E.y,P[A+
+2]=E.z,A+=3;u=0;for(H=t.length;u<H;u++)if(C=ia[t[u]],aa=C.vertexNormals,E=C.normal,aa.length===4&&ca)for(S=0;S<4;S++)E=aa[S],P[A]=E.x,P[A+1]=E.y,P[A+2]=E.z,A+=3;else for(S=0;S<4;S++)P[A]=E.x,P[A+1]=E.y,P[A+2]=E.z,A+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,P,o)}if(oa&&la&&M){u=0;for(H=q.length;u<H;u++)if(A=q[u],A=la[A],A!==void 0)for(S=0;S<3;S++)P=A[S],X[Y]=P.u,X[Y+1]=P.v,Y+=2;u=0;for(H=t.length;u<H;u++)if(A=t[u],A=la[A],A!==void 0)for(S=0;S<4;S++)P=A[S],X[Y]=
+P.u,X[Y+1]=P.v,Y+=2;Y>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,X,o))}if(oa&&ta&&M){u=0;for(H=q.length;u<H;u++)if(A=q[u],Y=ta[A],Y!==void 0)for(S=0;S<3;S++)X=Y[S],F[N]=X.u,F[N+1]=X.v,N+=2;u=0;for(H=t.length;u<H;u++)if(A=t[u],Y=ta[A],Y!==void 0)for(S=0;S<4;S++)X=Y[S],F[N]=X.u,F[N+1]=X.v,N+=2;N>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,F,o))}if(Z){u=0;for(H=q.length;u<H;u++)B[fa]=ba,B[fa+1]=ba+1,B[fa+2]=ba+2,fa+=3,W[T]=ba,W[T+
+1]=ba+1,W[T+2]=ba,W[T+3]=ba+2,W[T+4]=ba+1,W[T+5]=ba+2,T+=6,ba+=3;u=0;for(H=t.length;u<H;u++)B[fa]=ba,B[fa+1]=ba+1,B[fa+2]=ba+3,B[fa+3]=ba+1,B[fa+4]=ba+2,B[fa+5]=ba+3,fa+=6,W[T]=ba,W[T+1]=ba+1,W[T+2]=ba,W[T+3]=ba+3,W[T+4]=ba+1,W[T+5]=ba+2,W[T+6]=ba+2,W[T+7]=ba+3,T+=8,ba+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,B,o);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,W,o)}if(s){S=0;for(ba=s.length;S<ba;S++)if(B=
+s[S],B.__original.needsUpdate){F=0;if(B.size===1)if(B.boundTo===void 0||B.boundTo==="vertices"){u=0;for(H=q.length;u<H;u++)C=ia[q[u]],B.array[F]=B.value[C.a],B.array[F+1]=B.value[C.b],B.array[F+2]=B.value[C.c],F+=3;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],B.array[F]=B.value[C.a],B.array[F+1]=B.value[C.b],B.array[F+2]=B.value[C.c],B.array[F+3]=B.value[C.d],F+=4}else{if(B.boundTo==="faces"){u=0;for(H=q.length;u<H;u++)W=B.value[q[u]],B.array[F]=W,B.array[F+1]=W,B.array[F+2]=W,F+=3;u=0;for(H=t.length;u<
+H;u++)W=B.value[t[u]],B.array[F]=W,B.array[F+1]=W,B.array[F+2]=W,B.array[F+3]=W,F+=4}}else if(B.size===2)if(B.boundTo===void 0||B.boundTo==="vertices"){u=0;for(H=q.length;u<H;u++)C=ia[q[u]],z=B.value[C.a],x=B.value[C.b],y=B.value[C.c],B.array[F]=z.x,B.array[F+1]=z.y,B.array[F+2]=x.x,B.array[F+3]=x.y,B.array[F+4]=y.x,B.array[F+5]=y.y,F+=6;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],z=B.value[C.a],x=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[F]=z.x,B.array[F+1]=z.y,B.array[F+2]=x.x,B.array[F+3]=x.y,
+B.array[F+4]=y.x,B.array[F+5]=y.y,B.array[F+6]=C.x,B.array[F+7]=C.y,F+=8}else{if(B.boundTo==="faces"){u=0;for(H=q.length;u<H;u++)y=x=z=W=B.value[q[u]],B.array[F]=z.x,B.array[F+1]=z.y,B.array[F+2]=x.x,B.array[F+3]=x.y,B.array[F+4]=y.x,B.array[F+5]=y.y,F+=6;u=0;for(H=t.length;u<H;u++)C=y=x=z=W=B.value[t[u]],B.array[F]=z.x,B.array[F+1]=z.y,B.array[F+2]=x.x,B.array[F+3]=x.y,B.array[F+4]=y.x,B.array[F+5]=y.y,B.array[F+6]=C.x,B.array[F+7]=C.y,F+=8}}else if(B.size===3)if(N=B.type==="c"?["r","g","b"]:["x",
+"y","z"],B.boundTo===void 0||B.boundTo==="vertices"){u=0;for(H=q.length;u<H;u++)C=ia[q[u]],z=B.value[C.a],x=B.value[C.b],y=B.value[C.c],B.array[F]=z[N[0]],B.array[F+1]=z[N[1]],B.array[F+2]=z[N[2]],B.array[F+3]=x[N[0]],B.array[F+4]=x[N[1]],B.array[F+5]=x[N[2]],B.array[F+6]=y[N[0]],B.array[F+7]=y[N[1]],B.array[F+8]=y[N[2]],F+=9;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],z=B.value[C.a],x=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[F]=z[N[0]],B.array[F+1]=z[N[1]],B.array[F+2]=z[N[2]],B.array[F+3]=x[N[0]],
+B.array[F+4]=x[N[1]],B.array[F+5]=x[N[2]],B.array[F+6]=y[N[0]],B.array[F+7]=y[N[1]],B.array[F+8]=y[N[2]],B.array[F+9]=C[N[0]],B.array[F+10]=C[N[1]],B.array[F+11]=C[N[2]],F+=12}else{if(B.boundTo==="faces"){u=0;for(H=q.length;u<H;u++)y=x=z=W=B.value[q[u]],B.array[F]=z[N[0]],B.array[F+1]=z[N[1]],B.array[F+2]=z[N[2]],B.array[F+3]=x[N[0]],B.array[F+4]=x[N[1]],B.array[F+5]=x[N[2]],B.array[F+6]=y[N[0]],B.array[F+7]=y[N[1]],B.array[F+8]=y[N[2]],F+=9;u=0;for(H=t.length;u<H;u++)C=y=x=z=W=B.value[t[u]],B.array[F]=
+z[N[0]],B.array[F+1]=z[N[1]],B.array[F+2]=z[N[2]],B.array[F+3]=x[N[0]],B.array[F+4]=x[N[1]],B.array[F+5]=x[N[2]],B.array[F+6]=y[N[0]],B.array[F+7]=y[N[1]],B.array[F+8]=y[N[2]],B.array[F+9]=C[N[0]],B.array[F+10]=C[N[1]],B.array[F+11]=C[N[2]],F+=12}}else if(B.size===4)if(B.boundTo===void 0||B.boundTo==="vertices"){u=0;for(H=q.length;u<H;u++)C=ia[q[u]],z=B.value[C.a],x=B.value[C.b],y=B.value[C.c],B.array[F]=z.x,B.array[F+1]=z.y,B.array[F+2]=z.z,B.array[F+3]=z.w,B.array[F+4]=x.x,B.array[F+5]=x.y,B.array[F+
+6]=x.z,B.array[F+7]=x.w,B.array[F+8]=y.x,B.array[F+9]=y.y,B.array[F+10]=y.z,B.array[F+11]=y.w,F+=12;u=0;for(H=t.length;u<H;u++)C=ia[t[u]],z=B.value[C.a],x=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[F]=z.x,B.array[F+1]=z.y,B.array[F+2]=z.z,B.array[F+3]=z.w,B.array[F+4]=x.x,B.array[F+5]=x.y,B.array[F+6]=x.z,B.array[F+7]=x.w,B.array[F+8]=y.x,B.array[F+9]=y.y,B.array[F+10]=y.z,B.array[F+11]=y.w,B.array[F+12]=C.x,B.array[F+13]=C.y,B.array[F+14]=C.z,B.array[F+15]=C.w,F+=16}else if(B.boundTo==="faces"){u=
+0;for(H=q.length;u<H;u++)y=x=z=W=B.value[q[u]],B.array[F]=z.x,B.array[F+1]=z.y,B.array[F+2]=z.z,B.array[F+3]=z.w,B.array[F+4]=x.x,B.array[F+5]=x.y,B.array[F+6]=x.z,B.array[F+7]=x.w,B.array[F+8]=y.x,B.array[F+9]=y.y,B.array[F+10]=y.z,B.array[F+11]=y.w,F+=12;u=0;for(H=t.length;u<H;u++)C=y=x=z=W=B.value[t[u]],B.array[F]=z.x,B.array[F+1]=z.y,B.array[F+2]=z.z,B.array[F+3]=z.w,B.array[F+4]=x.x,B.array[F+5]=x.y,B.array[F+6]=x.z,B.array[F+7]=x.w,B.array[F+8]=y.x,B.array[F+9]=y.y,B.array[F+10]=y.z,B.array[F+
+11]=y.w,B.array[F+12]=C.x,B.array[F+13]=C.y,B.array[F+14]=C.z,B.array[F+15]=C.w,F+=16}j.bindBuffer(j.ARRAY_BUFFER,B.buffer);j.bufferData(j.ARRAY_BUFFER,B.array,o)}}U&&(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(v instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;v=j.DYNAMIC_DRAW;u=i=u=U=U=void 0;H=h.vertices;k=h.colors;s=H.length;l=k.length;q=h.__vertexArray;o=h.__colorArray;t=h.__dirtyColors;if(h.__dirtyVertices){for(U=0;U<s;U++)u=H[U].position,i=U*3,q[i]=u.x,q[i+1]=u.y,q[i+2]=u.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,q,
+v)}if(t){for(U=0;U<l;U++)u=k[U],i=U*3,o[i]=u.r,o[i+1]=u.g,o[i+2]=u.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,o,v)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(v instanceof THREE.Line){h=b(v,l);o=h.attributes&&n(h);if(f.__dirtyVertices||f.__dirtyColors||o){v=f;i=j.DYNAMIC_DRAW;s=k=ba=H=ia=void 0;H=v.vertices;l=v.colors;s=H.length;o=l.length;q=v.__vertexArray;U=v.__colorArray;t=v.__dirtyColors;u=v.__webglCustomAttributesList;Y=T=fa=N=ba=ia=void 0;if(v.__dirtyVertices){for(ia=
+0;ia<s;ia++)ba=H[ia].position,k=ia*3,q[k]=ba.x,q[k+1]=ba.y,q[k+2]=ba.z;j.bindBuffer(j.ARRAY_BUFFER,v.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,q,i)}if(t){for(H=0;H<o;H++)s=l[H],k=H*3,U[k]=s.r,U[k+1]=s.g,U[k+2]=s.b;j.bindBuffer(j.ARRAY_BUFFER,v.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,U,i)}if(u){ia=0;for(ba=u.length;ia<ba;ia++)if(Y=u[ia],Y.needsUpdate&&(Y.boundTo===void 0||Y.boundTo==="vertices")){k=0;fa=Y.value.length;if(Y.size===1)for(N=0;N<fa;N++)Y.array[N]=Y.value[N];else if(Y.size===
+2)for(N=0;N<fa;N++)T=Y.value[N],Y.array[k]=T.x,Y.array[k+1]=T.y,k+=2;else if(Y.size===3)if(Y.type==="c")for(N=0;N<fa;N++)T=Y.value[N],Y.array[k]=T.r,Y.array[k+1]=T.g,Y.array[k+2]=T.b,k+=3;else for(N=0;N<fa;N++)T=Y.value[N],Y.array[k]=T.x,Y.array[k+1]=T.y,Y.array[k+2]=T.z,k+=3;else if(Y.size===4)for(N=0;N<fa;N++)T=Y.value[N],Y.array[k]=T.x,Y.array[k+1]=T.y,Y.array[k+2]=T.z,Y.array[k+3]=T.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,Y.buffer);j.bufferData(j.ARRAY_BUFFER,Y.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=
+!1;h.attributes&&r(h)}else if(v instanceof THREE.ParticleSystem)h=b(v,l),o=h.attributes&&n(h),(f.__dirtyVertices||f.__dirtyColors||v.sortParticles||o)&&d(f,j.DYNAMIC_DRAW,v),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&r(h)};this.initMaterial=function(a,b,c,d){var e,f,g,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++)g=b[k],g instanceof THREE.SpotLight&&m++,g instanceof THREE.DirectionalLight&&m++,g instanceof THREE.PointLight&&i++;i+m<=y?k=m:(k=Math.ceil(y*m/(i+m)),i=y-k);g={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 o;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:g.directional,maxPointLights:g.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},u,d=[];h?d.push(h):(d.push(k),d.push(l));for(u in c)d.push(u),d.push(c[u]);h=d.join();u=0;for(d=ca.length;u<d;u++)if(ca[u].code===h){o=ca[u].program;break a}u=j.createProgram();d=[sa?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":
 "",L.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":
 "",L.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");
 "",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");
-f=["#ifdef GL_ES","precision "+S+" 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:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.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");j.attachShader(v,x("fragment",f+k));j.attachShader(v,
-x("vertex",d+l));j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");v.uniforms={};v.attributes={};var p,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(p in i)d.push(p);p=d;d=0;for(i=p.length;d<i;d++)k=p[d],v.uniforms[k]=j.getUniformLocation(v,
-k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(p=0;p<c.maxMorphTargets;p++)d.push("morphTarget"+p);for(o in b)d.push(o);o=d;p=0;for(b=o.length;p<b;p++)c=o[p],v.attributes[c]=j.getAttribLocation(v,c);v.id=aa.length;aa.push({program:v,code:h});L.info.memory.programs=aa.length;o=v}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
-o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)p="morphTarget"+g,o[p]>=0&&(j.enableVertexAttribArray(o[p]),
+g=["#ifdef GL_ES","precision "+Z+" 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:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.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");j.attachShader(u,x("fragment",g+k));j.attachShader(u,
+x("vertex",d+l));j.linkProgram(u);j.getProgramParameter(u,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(u,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");u.uniforms={};u.attributes={};var p,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(p in i)d.push(p);p=d;d=0;for(i=p.length;d<i;d++)k=p[d],u.uniforms[k]=j.getUniformLocation(u,
+k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(p=0;p<c.maxMorphTargets;p++)d.push("morphTarget"+p);for(o in b)d.push(o);o=d;p=0;for(b=o.length;p<b;p++)c=o[p],u.attributes[c]=j.getAttribLocation(u,c);u.id=ca.length;ca.push({program:u,code:h});L.info.memory.programs=ca.length;o=u}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
+o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&j.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)p="morphTarget"+f,o[p]>=0&&(j.enableVertexAttribArray(o[p]),
 a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
 a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
 THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
 THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
 THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
@@ -349,19 +350,19 @@ 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],o=e.faceVertexUvs[0],p={},n=0;n<a.materials.length;n++)p[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,r=h.length;n<r;n++){var m=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(m.position);f.push(m)}n=
-0;for(r=k.length;n<r;n++){var f=k[n],s,u,t=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(m=t.length;h<m;h++)u=t[h].clone(),d&&d.multiplyVector3(u),s.vertexNormals.push(u);s.color.copy(f.color);h=0;for(m=q.length;h<m;h++)u=q[h],s.vertexColors.push(u.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
-m=p[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);s.materialIndex=m}s.centroid.copy(f.centroid);b&&b.multiplyVector3(s.centroid);i.push(s)}n=0;for(r=o.length;n<r;n++){b=o[n];d=[];h=0;for(m=b.length;h<m;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,o=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=o.length;d<f;d++)k=o[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<
+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,l=e.faces,k=a.faceVertexUvs[0],o=e.faceVertexUvs[0],p={},n=0;n<a.materials.length;n++)p[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,r=h.length;n<r;n++){var m=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(m.position);f.push(m)}n=
+0;for(r=l.length;n<r;n++){var f=l[n],s,t,v=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(m=v.length;h<m;h++)t=v[h].clone(),d&&d.multiplyVector3(t),s.vertexNormals.push(t);s.color.copy(f.color);h=0;for(m=q.length;h<m;h++)t=q[h],s.vertexColors.push(t.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
+m=p[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);s.materialIndex=m}s.centroid.copy(f.centroid);b&&b.multiplyVector3(s.centroid);i.push(s)}n=0;for(r=o.length;n<r;n++){b=o[n];d=[];h=0;for(m=b.length;h<m;h++)d.push(new THREE.UV(b[h].u,b[h].v));k.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,l,k=h.vertexNormals,o=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=k.length;d<f;d++)l=k[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)l=o[d],i.vertexColors.push(l.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+
-f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,e,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,g,e=a.faces,f=a.vertices,h=e.length,i=0,k=[],l,o,p,n;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)l=f[d.a].position,o=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,o,p);else if(d instanceof
-THREE.Face4)l=f[d.a].position,o=f[d.b].position,p=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,p,n),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();
+f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,e,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,g,e=a.faces,f=a.vertices,h=e.length,i=0,l=[],k,o,p,n;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)k=f[d.a].position,o=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,p);else if(d instanceof
+THREE.Face4)k=f[d.a].position,o=f[d.b].position,p=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,p,n),d._area=d._area1+d._area2;i+=d._area;l[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 o=1;o<g;o++){var p=o-1<0?g-1:o-1,n=(o+1)%g,r=l-1<0?d-1:l-1,m=(l+1)%d,s=[],u=[0,0,h[(o*d+l)*4]/255*c];s.push([-1,0,h[(o*d+r)*4]/255*c]);s.push([-1,-1,h[(p*d+r)*4]/255*c]);s.push([0,-1,h[(p*d+l)*4]/255*c]);s.push([1,-1,h[(p*d+m)*4]/255*c]);
-s.push([1,0,h[(o*d+m)*4]/255*c]);s.push([1,1,h[(n*d+m)*4]/255*c]);s.push([0,1,h[(n*d+l)*4]/255*c]);s.push([-1,1,h[(n*d+r)*4]/255*c]);p=[];r=s.length;for(n=0;n<r;n++){var m=s[n],t=s[(n+1)%r],m=[m[0]-u[0],m[1]-u[1],m[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];p.push(b([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}s=[0,0,0];for(n=0;n<p.length;n++)s[0]+=p[n][0],s[1]+=p[n][1],s[2]+=p[n][2];s[0]/=p.length;s[1]/=p.length;s[2]/=p.length;u=(o*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),l=i.data,k=0;k<d;k++)for(var o=1;o<g;o++){var p=o-1<0?g-1:o-1,n=(o+1)%g,r=k-1<0?d-1:k-1,m=(k+1)%d,s=[],t=[0,0,h[(o*d+k)*4]/255*c];s.push([-1,0,h[(o*d+r)*4]/255*c]);s.push([-1,-1,h[(p*d+r)*4]/255*c]);s.push([0,-1,h[(p*d+k)*4]/255*c]);s.push([1,-1,h[(p*d+m)*4]/255*c]);
+s.push([1,0,h[(o*d+m)*4]/255*c]);s.push([1,1,h[(n*d+m)*4]/255*c]);s.push([0,1,h[(n*d+k)*4]/255*c]);s.push([-1,1,h[(n*d+r)*4]/255*c]);p=[];r=s.length;for(n=0;n<r;n++){var m=s[n],v=s[(n+1)%r],m=[m[0]-t[0],m[1]-t[1],m[2]-t[2]],v=[v[0]-t[0],v[1]-t[1],v[2]-t[2]];p.push(b([m[1]*v[2]-m[2]*v[1],m[2]*v[0]-m[0]*v[2],m[0]*v[1]-m[1]*v[0]]))}s=[0,0,0];for(n=0;n<p.length;n++)s[0]+=p[n][0],s[1]+=p[n][1],s[2]+=p[n][2];s[0]/=p.length;s[1]/=p.length;s[2]/=p.length;t=(o*d+k)*4;l[t]=(s[0]+1)/2*255|0;l[t+1]=(s[1]+0.5)*
+255|0;l[t+2]=s[2]*255|0;l[t+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,37 +401,37 @@ 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,o,p,n,r,m;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];o=e[0];p=e[1];b.length>0?(f=b[b.length-1],n=f.x,r=f.y):(f=this.actions[d-1].args,n=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,e=THREE.Shape.Utils.b2(m,n,o,h),m=THREE.Shape.Utils.b2(m,r,p,
-i),b.push(new THREE.Vector2(e,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];o=e[0];p=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],n=f.x,r=f.y):(f=this.actions[d-1].args,n=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,e=THREE.Shape.Utils.b3(m,n,o,k,h),m=THREE.Shape.Utils.b3(m,r,p,l,i),b.push(new THREE.Vector2(e,m));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];m=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
-for(f=1;f<=m;f++)b.push(e.getPointAt(f/m));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];o=e[3];m=e[4];p=!!e[5];l=f[f.length-2];n=f[f.length-1];f.length==0&&(l=n=0);r=m-o;var s=a*2;for(f=1;f<=s;f++)m=f/s,p||(m=1-m),m=o+m*r,e=l+h+k*Math.cos(m),m=n+i+k*Math.sin(m),b.push(new THREE.Vector2(e,m))}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,o;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,o=k.y,k.x=a*l+c*o+b,k.y=d*o+g*l+e;return f};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,l,k,o,p,n,r,m;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];o=e[0];p=e[1];b.length>0?(f=b[b.length-1],n=f.x,r=f.y):(f=this.actions[d-1].args,n=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,e=THREE.Shape.Utils.b2(m,n,o,h),m=THREE.Shape.Utils.b2(m,r,p,
+i),b.push(new THREE.Vector2(e,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];o=e[0];p=e[1];l=e[2];k=e[3];b.length>0?(f=b[b.length-1],n=f.x,r=f.y):(f=this.actions[d-1].args,n=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,e=THREE.Shape.Utils.b3(m,n,o,l,h),m=THREE.Shape.Utils.b3(m,r,p,k,i),b.push(new THREE.Vector2(e,m));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];m=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
+for(f=1;f<=m;f++)b.push(e.getPointAt(f/m));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];l=e[2];o=e[3];m=e[4];p=!!e[5];k=f[f.length-2];n=f[f.length-1];f.length==0&&(k=n=0);r=m-o;var s=a*2;for(f=1;f<=s;f++)m=f/s,p||(m=1-m),m=o+m*r,e=k+h+l*Math.cos(m),m=n+i+l*Math.sin(m),b.push(new THREE.Vector2(e,m))}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,l,k,o;h=0;for(i=f.length;h<i;h++)l=f[h],k=l.x,o=l.y,l.x=a*k+c*o+b,l.y=d*o+g*k+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()};
 THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],e=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&e.actions.length!=0&&(g.push(e),e=new THREE.Path),e[b].apply(e,d);e.actions.length!=0&&g.push(e);if(g.length==0)return[];var f,e=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&e.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],e=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&e.actions.length!=0&&(g.push(e),e=new THREE.Path),e[b].apply(e,d);e.actions.length!=0&&g.push(e);if(g.length==0)return[];var f,e=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&e.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 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,o,p,n,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++){p=k[g];n=[];for(o=0;o<b.length;o++)l=b[o],l=p.distanceToSquared(l),n.push(l),l<e&&(e=l,f=g,h=o)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var m=[k[f],b[h],b[g]];o=THREE.FontUtils.Triangulate.area(m);var s=[k[f],k[e],b[h]];p=THREE.FontUtils.Triangulate.area(s);n=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;m=[k[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);s=[k[f],k[e],b[h]];s=THREE.FontUtils.Triangulate.area(s);o+p>m+s&&(h=n,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);o=b.slice(0,h);p=b.slice(h);n=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=o.concat(n).concat(l).concat(p)}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,l,k,o,p,n,r=[];for(i=0;i<c.length;i++){l=c[i];Array.prototype.push.apply(d,l);e=Number.POSITIVE_INFINITY;for(g=0;g<l.length;g++){p=l[g];n=[];for(o=0;o<b.length;o++)k=b[o],k=p.distanceToSquared(k),n.push(k),k<e&&(e=k,f=g,h=o)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:l.length-1;var m=[l[f],b[h],b[g]];o=THREE.FontUtils.Triangulate.area(m);var s=[l[f],l[e],b[h]];p=THREE.FontUtils.Triangulate.area(s);n=h;k=f;h+=1;f+=-1;h<
+0&&(h+=b.length);h%=b.length;f<0&&(f+=l.length);f%=l.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:l.length-1;m=[l[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);s=[l[f],l[e],b[h]];s=THREE.FontUtils.Triangulate.area(s);o+p>m+s&&(h=n,f=k,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=l.length),f%=l.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:l.length-1);o=b.slice(0,h);p=b.slice(h);n=l.slice(f);k=l.slice(0,f);e=[l[f],l[e],b[h]];r.push([l[f],b[h],b[g]]);r.push(e);b=o.concat(n).concat(k).concat(p)}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,l={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,l[i]!==void 0&&console.log("Duplicate point",i),l[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=l[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=l[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};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
-0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var l=
-{};for(k in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){l[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var l=a.hierarchy[b].keys[d].morphTargets[i];h[l]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var k=
+{};for(l in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===l){k[l]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(k[l]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
 THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
 THREE.Bone?g.skinMatrix:g.matrix;var 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,o,p;this.currentTime+=a*this.timeScale;p=this.currentTime;o=this.currentTime%=this.data.length;k=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&l[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=l[n][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 m=0;m<3;m++){b=c[m];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<o;)f=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,e,f,h,i,l,k=this.data.JIT.hierarchy,o,p;this.currentTime+=a*this.timeScale;p=this.currentTime;o=this.currentTime%=this.data.length;l=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[n][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=k[n][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){b=c[m];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<o;)f=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
 o)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-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 "+n),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]=
 o)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-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 "+n),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",n,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",n,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",n,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",n,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===
-"rot")THREE.Quaternion.slerp(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,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}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)l[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,e,f,h,i,k;g=(a.length-1)*c;e=Math.floor(g);g-=e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>a.length-2?e:e+1;b[3]=e>a.length-3?e:e+2;e=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;f=g*b;d[0]=this.interpolate(e[0],h[0],i[0],k[0],g,b,f);d[1]=this.interpolate(e[1],h[1],i[1],k[1],g,b,f);d[2]=this.interpolate(e[2],h[2],i[2],k[2],g,b,f);return d};
+"rot")THREE.Quaternion.slerp(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,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}}if(this.JITCompile&&k[0][l]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)k[n][l]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,e,f,h,i,l;g=(a.length-1)*c;e=Math.floor(g);g-=e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>a.length-2?e:e+1;b[3]=e>a.length-3?e:e+2;e=a[b[0]];h=a[b[1]];i=a[b[2]];l=a[b[3]];b=g*g;f=g*b;d[0]=this.interpolate(e[0],h[0],i[0],l[0],g,b,f);d[1]=this.interpolate(e[1],h[1],i[1],l[1],g,b,f);d[2]=this.interpolate(e[2],h[2],i[2],l[2],g,b,f);return d};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,g,e,f){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*f+(-3*(c-b)-2*a-d)*e+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,g,e,f){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*f+(-3*(c-b)-2*a-d)*e+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -444,24 +445,24 @@ 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.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=
+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=
 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=
-!1;break;case 70:this.moveDown=!1}};this.update=function(a){if(!this.freeze){if(this.heightSpeed){var b=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*b*this.heightCoef}else this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&this.object.translateX(b);
-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);
-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]=
+!1;break;case 70:this.moveDown=!1}};this.update=function(a){var b=0;if(!this.freeze){if(this.heightSpeed){var c=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*c*this.heightCoef}else this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&
+this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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)};
+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,t=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++)t=d*h.chunks[f]/h.total,b.keys[f]={time:t,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.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=
+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=
 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}),n=0;n<b.points.length;n++)c=new THREE.Mesh(f,h),c.position.copy(b.points[n]),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}),n=0;n<b.points.length;n++)c=new THREE.Mesh(f,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.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,
+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,
 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,76 +471,77 @@ 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,o=0,p=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*o);this.rotateVertically(c*p)}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,
+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,l=0,k=0,o=0,p=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*o);this.rotateVertically(c*p)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*l);this.object.translateY(c*k);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){o=(a.clientX-n)/window.innerWidth;p=(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){o=(a.clientX-n)/window.innerWidth;p=(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){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:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:k=0;break;case 70:k=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,o=new THREE.Vector2,p=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,l=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,p=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)/
 b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(b.object.position).subSelf(b.target);e=b.object.up.clone().setLength(d.y);e.addSelf(b.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(f);
 b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(b.object.position).subSelf(b.target);e=b.object.up.clone().setLength(d.y);e.addSelf(b.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(f);
-d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-l.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?l=k:l.y+=(k.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
 b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
 b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-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),o=p=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&&(p=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||(o=p=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+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),l=k=b.getMouseOnScreen(a.clientX,a.clientY),o=p=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?k=b.getMouseOnScreen(a.clientX,
+a.clientY):e===d.PAN&&!b.noPan&&(p=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?l=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=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 t=p+1,H=r+1;h/=p;var z=i/r;for(o=0;o<H;o++)for(i=0;i<t;i++){var L=new THREE.Vector3;L[a]=(i*h-s)*c;L[b]=(o*z-q)*f;L[n]=l;k.vertices.push(new THREE.Vertex(L))}for(o=0;o<r;o++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
-t*o+u,i+t*(o+1)+u,i+1+t*(o+1)+u,i+1+t*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,o=c/2,p=b/2,n,r,m,s,u,t;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(f)}n=0;s=1;r=2;u=3;m=4;t=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,n);this.sides.nx&&i("z","y",1,-1,b,c,-l,s);this.sides.py&&i("x","z",1,1,a,b,o,r);this.sides.ny&&i("x","z",1,-1,a,b,-o,u);this.sides.pz&&i("x","y",1,-1,a,c,p,m);this.sides.nz&&i("x","y",-1,-1,a,c,-p,t);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 o=[],p=[],n=i/g,r=n*(c-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(r*Math.sin(m*Math.PI*2),-n*b+f,r*Math.cos(m*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(m,n))}k.push(o);l.push(p)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],o=k[i+1][h],p=k[i+1][h+1],n=k[i][h+1],r=
-this.vertices[b].position.clone().setY(0).normalize(),m=this.vertices[o].position.clone().setY(0).normalize(),s=this.vertices[p].position.clone().setY(0).normalize(),u=this.vertices[n].position.clone().setY(0).normalize(),t=l[i][h].clone(),q=l[i+1][h].clone(),A=l[i+1][h+1].clone(),w=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,o,p,n,[r,m,s,u]));this.faceVertexUvs[0].push([t,q,A,w])}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],o=k[0][h+
-1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),t=l[0][h].clone(),q=l[0][h+1].clone(),A=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,o,p,[r,m,s])),this.faceVertexUvs[0].push([t,q,A])}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],o=k[i][h],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),t=l[i][h+1].clone(),q=l[i][h].clone(),
-A=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,o,p,[r,m,s])),this.faceVertexUvs[0].push([t,q,A])}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,k,m){var n,o=d||1,p=g||1,r=h/2,s=i/2,q=l.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",p=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=e||1;var t=o+1,v=p+1,z=h/o,y=i/p,L=new THREE.Vector3;L[n]=k>0?1:-1;for(h=0;h<v;h++)for(i=0;i<t;i++){var j=new THREE.Vector3;j[a]=(i*z-r)*c;j[b]=(h*y-s)*f;j[n]=k;l.vertices.push(new THREE.Vertex(j))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+t*h+q,i+t*(h+1)+q,i+1+t*(h+1)+q,i+1+t*h+q),a.normal.copy(L),a.vertexNormals.push(L.clone(),L.clone(),L.clone(),L.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,k=a/2,o=c/2,p=b/2,n,r,m,s,t,v;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(f)}n=0;s=1;r=2;t=
+3;m=4;v=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,k,n);this.sides.nx&&i("z","y",1,-1,b,c,-k,s);this.sides.py&&i("x","z",1,1,a,b,o,r);this.sides.ny&&i("x","z",1,-1,a,b,-o,t);this.sides.pz&&i("x","y",1,-1,a,c,p,m);this.sides.nz&&i("x","y",-1,-1,a,c,-p,v);this.computeCentroids();this.mergeVertices()};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,l=[],k=[];for(i=0;i<=g;i++){var o=[],p=[],n=i/g,r=n*(c-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(r*Math.sin(m*Math.PI*2),-n*b+f,r*Math.cos(m*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(m,n))}l.push(o);k.push(p)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=l[i][h],o=l[i+1][h],p=l[i+1][h+1],n=l[i][h+1],r=
+this.vertices[b].position.clone().setY(0).normalize(),m=this.vertices[o].position.clone().setY(0).normalize(),s=this.vertices[p].position.clone().setY(0).normalize(),t=this.vertices[n].position.clone().setY(0).normalize(),v=k[i][h].clone(),q=k[i+1][h].clone(),A=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,o,p,n,[r,m,s,t]));this.faceVertexUvs[0].push([v,q,A,w])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=l[0][h],o=l[0][h+
+1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),v=k[0][h].clone(),q=k[0][h+1].clone(),A=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,o,p,[r,m,s])),this.faceVertexUvs[0].push([v,q,A])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=l[i][h+1],o=l[i][h],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),v=k[i][h+1].clone(),q=k[i][h].clone(),
+A=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,o,p,[r,m,s])),this.faceVertexUvs[0].push([v,q,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,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(F=a.length;--F>=0;){j=F;aa=F-1;aa<0&&(aa=a.length-1);for(var b=
-0,c=n+l*2,b=0;b<c;b++){var d=V*b,e=V*(b+1),f=ga+j+d,g=ga+j+e,k=f,d=ga+aa+d,e=ga+aa+e,m=g;k+=D;d+=D;e+=D;m+=D;M.faces.push(new THREE.Face4(k,d,e,m,null,null,A));A&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(M.vertices[f].position.z+i)/e,g=(M.vertices[g].position.z+i)/e,M.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){M.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=D;b+=D;c+=D;M.faces.push(new THREE.Face3(a,b,c,
-null,null,q));if(q){var d=w.maxY,e=w.maxX,f=M.vertices[b].position.x,b=M.vertices[b].position.y,g=M.vertices[c].position.x,c=M.vertices[c].position.y;M.faceVertexUvs[0].push([new THREE.UV(M.vertices[a].position.x/e,M.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,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
-p=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,r=c.bendPath,m=c.extrudePath,s,u=!1,t=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,A=c.extrudeMaterial,w=this.shapebb;if(m)s=m.getPoints(p),n=s.length,u=!0,o=!1;o||(k=i=l=0);var E,x,I,M=this,D=this.vertices.length;r&&a.addWrapPath(r);p=t?a.extractAllSpacedPoints(p):a.extractAllPoints(p);r=p.shape;p=p.holes;if(m=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();x=0;for(I=p.length;x<I;x++)E=p[x],THREE.Shape.Utils.isClockWise(E)&&
-(p[x]=E.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(r,p);t=r;x=0;for(I=p.length;x<I;x++)E=p[x],r=r.concat(E);var F,P,K,$,S,R,V=r.length,ja=m.length,y=[];F=0;P=t.length;j=P-1;for(aa=F+1;F<P;F++,j++,aa++)j===P&&(j=0),aa===P&&(aa=0),y[F]=d(t[F],t[j],t[aa]);var H=[],z,L=y.concat();x=0;for(I=p.length;x<I;x++){E=p[x];z=[];F=0;P=E.length;j=P-1;for(aa=F+1;F<P;F++,j++,aa++)j===P&&(j=0),aa===P&&(aa=0),z[F]=d(E[F],E[j],E[aa]);H.push(z);L=L.concat(z)}for(K=0;K<l;K++){$=K/l;S=i*(1-$);$=k*Math.sin($*Math.PI/
-2);F=0;for(P=t.length;F<P;F++)R=b(t[F],y[F],$),e(R.x,R.y,-S);x=0;for(I=p.length;x<I;x++){E=p[x];z=H[x];F=0;for(P=E.length;F<P;F++)R=b(E[F],z[F],$),e(R.x,R.y,-S)}}$=k;for(F=0;F<V;F++)R=o?b(r[F],L[F],$):r[F],u?e(R.x,R.y+s[0].y,s[0].x):e(R.x,R.y,0);for(K=1;K<=n;K++)for(F=0;F<V;F++)R=o?b(r[F],L[F],$):r[F],u?e(R.x,R.y+s[K-1].y,s[K-1].x):e(R.x,R.y,h/n*K);for(K=l-1;K>=0;K--){$=K/l;S=i*(1-$);$=k*Math.sin($*Math.PI/2);F=0;for(P=t.length;F<P;F++)R=b(t[F],y[F],$),e(R.x,R.y,h+S);x=0;for(I=p.length;x<I;x++){E=
-p[x];z=H[x];F=0;for(P=E.length;F<P;F++)R=b(E[F],z[F],$),u?e(R.x,R.y+s[n-1].y,s[n-1].x+S):e(R.x,R.y,h+S)}}if(o){o=V*0;for(F=0;F<ja;F++)k=m[F],f(k[2]+o,k[1]+o,k[0]+o);o=V*(n+l*2);for(F=0;F<ja;F++)k=m[F],f(k[0]+o,k[1]+o,k[2]+o)}else{for(F=0;F<ja;F++)k=m[F],f(k[2],k[1],k[0]);for(F=0;F<ja;F++)k=m[F],f(k[0]+V*n,k[1]+V*n,k[2]+V*n)}var j,aa,ga=0;g(t);ga+=t.length;x=0;for(I=p.length;x<I;x++)E=p[x],g(E),ga+=E.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+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(E=a.length;--E>=0;){j=E;ca=E-1;ca<0&&(ca=a.length-1);for(var b=
+0,c=n+k*2,b=0;b<c;b++){var d=W*b,e=W*(b+1),f=ga+j+d,g=ga+j+e,l=f,d=ga+ca+d,e=ga+ca+e,m=g;l+=K;d+=K;e+=K;m+=K;M.faces.push(new THREE.Face4(l,d,e,m,null,null,A));A&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(M.vertices[f].position.z+i)/e,g=(M.vertices[g].position.z+i)/e,M.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){M.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=K;b+=K;c+=K;M.faces.push(new THREE.Face3(a,b,c,
+null,null,q));if(q){var d=w.maxY,e=w.maxX,f=M.vertices[b].position.x,b=M.vertices[b].position.y,g=M.vertices[c].position.x,c=M.vertices[c].position.y;M.faceVertexUvs[0].push([new THREE.UV(M.vertices[a].position.x/e,M.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,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
+p=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,r=c.bendPath,m=c.extrudePath,s,t=!1,v=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,A=c.extrudeMaterial,w=this.shapebb;if(m)s=m.getPoints(p),n=s.length,t=!0,o=!1;o||(l=i=k=0);var D,x,J,M=this,K=this.vertices.length;r&&a.addWrapPath(r);p=v?a.extractAllSpacedPoints(p):a.extractAllPoints(p);r=p.shape;p=p.holes;if(m=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();x=0;for(J=p.length;x<J;x++)D=p[x],THREE.Shape.Utils.isClockWise(D)&&
+(p[x]=D.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(r,p);v=r;x=0;for(J=p.length;x<J;x++)D=p[x],r=r.concat(D);var E,P,I,V,Z,R,W=r.length,ka=m.length,G=[];E=0;P=v.length;j=P-1;for(ca=E+1;E<P;E++,j++,ca++)j===P&&(j=0),ca===P&&(ca=0),G[E]=d(v[E],v[j],v[ca]);var z=[],y,L=G.concat();x=0;for(J=p.length;x<J;x++){D=p[x];y=[];E=0;P=D.length;j=P-1;for(ca=E+1;E<P;E++,j++,ca++)j===P&&(j=0),ca===P&&(ca=0),y[E]=d(D[E],D[j],D[ca]);z.push(y);L=L.concat(y)}for(I=0;I<k;I++){V=I/k;Z=i*(1-V);V=l*Math.sin(V*Math.PI/
+2);E=0;for(P=v.length;E<P;E++)R=b(v[E],G[E],V),e(R.x,R.y,-Z);x=0;for(J=p.length;x<J;x++){D=p[x];y=z[x];E=0;for(P=D.length;E<P;E++)R=b(D[E],y[E],V),e(R.x,R.y,-Z)}}V=l;for(E=0;E<W;E++)R=o?b(r[E],L[E],V):r[E],t?e(R.x,R.y+s[0].y,s[0].x):e(R.x,R.y,0);for(I=1;I<=n;I++)for(E=0;E<W;E++)R=o?b(r[E],L[E],V):r[E],t?e(R.x,R.y+s[I-1].y,s[I-1].x):e(R.x,R.y,h/n*I);for(I=k-1;I>=0;I--){V=I/k;Z=i*(1-V);V=l*Math.sin(V*Math.PI/2);E=0;for(P=v.length;E<P;E++)R=b(v[E],G[E],V),e(R.x,R.y,h+Z);x=0;for(J=p.length;x<J;x++){D=
+p[x];y=z[x];E=0;for(P=D.length;E<P;E++)R=b(D[E],y[E],V),t?e(R.x,R.y+s[n-1].y,s[n-1].x+Z):e(R.x,R.y,h+Z)}}if(o){o=W*0;for(E=0;E<ka;E++)l=m[E],f(l[2]+o,l[1]+o,l[0]+o);o=W*(n+k*2);for(E=0;E<ka;E++)l=m[E],f(l[0]+o,l[1]+o,l[2]+o)}else{for(E=0;E<ka;E++)l=m[E],f(l[2],l[1],l[0]);for(E=0;E<ka;E++)l=m[E],f(l[0]+W*n,l[1]+W*n,l[2]+W*n)}var j,ca,ga=0;g(v);ga+=v.length;x=0;for(J=p.length;x<J;x++)D=p[x],g(D),ga+=D.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,
-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.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);
+-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),l=d(e.faces[h].b,e.faces[h].c),k=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,k,a);b(e.faces[h].b,l,
+i,a);b(e.faces[h].c,k,l,a);b(i,l,k,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);
 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===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 {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.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 o=2*d/e,p=i*Math.sin(o*g),o=i*Math.cos(o*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,h,p)))-1);k.push(l)}c.push(k)}for(var n,r,m,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];p=b/(g-1);n=(b-1)/(g-1);r=(d+1)/e;var o=d/e,l=new THREE.UV(1-r,p),p=new THREE.UV(1-o,p),o=new THREE.UV(1-o,n),s=new THREE.UV(1-r,n);b<c.length-1&&(n=this.vertices[f].position.clone(),r=this.vertices[h].position.clone(),m=this.vertices[i].position.clone(),n.normalize(),r.normalize(),m.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(r.x,r.y,r.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([l,p,o]));b>1&&(n=
-this.vertices[f].position.clone(),r=this.vertices[i].position.clone(),m=this.vertices[k].position.clone(),n.normalize(),r.normalize(),m.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(r.x,r.y,r.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([l,o,s]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var g=a/2,e=c/2,b=b||1,d=d||1,f=b+1,h=d+1,i=a/b,l=c/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<f;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*l-e),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+f*a,c+f*(a+1),c+1+f*(a+1),c+1+f*a),g.normal.copy(k),g.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
+b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};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),l=[],k=0;for(d=0;d<e;d++){var o=2*d/e,p=i*Math.sin(o*g),o=i*Math.cos(o*g);(b==0||b==f)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,h,p)))-1);l.push(k)}c.push(l)}for(var n,r,m,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){l=d==e-1;f=c[b][l?0:d+1];h=c[b][l?e-1:d];i=c[b-1][l?
+e-1:d];l=c[b-1][l?0:d+1];p=b/(g-1);n=(b-1)/(g-1);r=(d+1)/e;var o=d/e,k=new THREE.UV(1-r,p),p=new THREE.UV(1-o,p),o=new THREE.UV(1-o,n),s=new THREE.UV(1-r,n);b<c.length-1&&(n=this.vertices[f].position.clone(),r=this.vertices[h].position.clone(),m=this.vertices[i].position.clone(),n.normalize(),r.normalize(),m.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(r.x,r.y,r.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([k,p,o]));b>1&&(n=
+this.vertices[f].position.clone(),r=this.vertices[i].position.clone(),m=this.vertices[l].position.clone(),n.normalize(),r.normalize(),m.normalize(),this.faces.push(new THREE.Face3(f,i,l,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(r.x,r.y,r.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([k,o,s]))}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,o,p,n,r,m,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;n=c[a++]*b+d;r=c[a++]*b;g.quadraticCurveTo(n,r,i,l);if(f=e[e.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var t=f/h,q=THREE.Shape.Utils.b2(t,o,n,i),t=THREE.Shape.Utils.b2(t,p,r,l);e.push(new THREE.Vector2(q,t))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,n=c[a++]*b+d,r=c[a++]*-b,m=c[a++]*b+d,s=c[a++]*-b,g.bezierCurveTo(i,l,n,r,m,s),f=e[e.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)t=f/h,q=THREE.Shape.Utils.b3(t,o,n,
-m,i),t=THREE.Shape.Utils.b3(t,p,r,s,l),e.push(new THREE.Vector2(q,t))}}}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 o=2*g;for(k=g-1;g>2;){if(o--<=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 p;a:{p=a;var n=i,r=k,m=l,s=g,u=f,t=void 0,q=void 0,A=void 0,
-w=void 0,E=void 0,x=void 0,I=void 0,M=void 0,D=void 0,q=p[u[n]].x,A=p[u[n]].y,w=p[u[r]].x,E=p[u[r]].y,x=p[u[m]].x,I=p[u[m]].y;if(1.0E-10>(w-q)*(I-A)-(E-A)*(x-q))p=!1;else{for(t=0;t<s;t++)if(!(t==n||t==r||t==m)){var M=p[u[t]].x,D=p[u[t]].y,F=void 0,P=void 0,K=void 0,$=void 0,S=void 0,R=void 0,V=void 0,ja=void 0,y=void 0,H=void 0,z=void 0,L=void 0,F=K=S=void 0,F=x-w,P=I-E,K=q-x,$=A-I,S=w-q,R=E-A,V=M-q,ja=D-A,y=M-w,H=D-E,z=M-x,L=D-I,F=F*H-P*y,S=S*ja-R*V,K=K*L-$*z;if(F>=0&&K>=0&&S>=0){p=!1;break a}}p=
-!0}}if(p){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--;o=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,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,l,k,o,p,n,r,m,s,t=c.glyphs[a]||c.glyphs["?"];if(t){if(t.o){c=t._cachedOutline||(t._cachedOutline=t.o.split(" "));l=c.length;for(a=0;a<l;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;e.push(new THREE.Vector2(i,k));g.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;e.push(new THREE.Vector2(i,
+k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;n=c[a++]*b+d;r=c[a++]*b;g.quadraticCurveTo(n,r,i,k);if(f=e[e.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var v=f/h,q=THREE.Shape.Utils.b2(v,o,n,i),v=THREE.Shape.Utils.b2(v,p,r,k);e.push(new THREE.Vector2(q,v))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,n=c[a++]*b+d,r=c[a++]*-b,m=c[a++]*b+d,s=c[a++]*-b,g.bezierCurveTo(i,k,n,r,m,s),f=e[e.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)v=f/h,q=THREE.Shape.Utils.b3(v,o,n,
+m,i),v=THREE.Shape.Utils.b3(v,p,r,s,k),e.push(new THREE.Vector2(q,v))}}}return{offset:t.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,l,k;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var o=2*g;for(l=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);k=l+1;g<=k&&(k=0);var p;a:{p=a;var n=i,r=l,m=k,s=g,t=f,v=void 0,q=void 0,A=void 0,
+w=void 0,D=void 0,x=void 0,J=void 0,M=void 0,K=void 0,q=p[t[n]].x,A=p[t[n]].y,w=p[t[r]].x,D=p[t[r]].y,x=p[t[m]].x,J=p[t[m]].y;if(1.0E-10>(w-q)*(J-A)-(D-A)*(x-q))p=!1;else{for(v=0;v<s;v++)if(!(v==n||v==r||v==m)){var M=p[t[v]].x,K=p[t[v]].y,E=void 0,P=void 0,I=void 0,V=void 0,Z=void 0,R=void 0,W=void 0,ka=void 0,G=void 0,z=void 0,y=void 0,L=void 0,E=I=Z=void 0,E=x-w,P=J-D,I=q-x,V=A-J,Z=w-q,R=D-A,W=M-q,ka=K-A,G=M-w,z=K-D,y=M-x,L=K-J,E=E*z-P*G,Z=Z*ka-R*W,I=I*L-V*y;if(E>=0&&I>=0&&Z>=0){p=!1;break a}}p=
+!0}}if(p){e.push([a[f[i]],a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<g;i++,k++)f[i]=f[k];g--;o=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);
 this.faceVertexUvs[0].push([a[g].clone(),a[e].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 this.faceVertexUvs[0].push([a[g].clone(),a[e].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=e||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
 THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=e||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
-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),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=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,l,k])}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 o=0;o<m.length;o++)l=h.vertexColors[m[o]-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||p.length!=0)&&e.push([p[a],p[b],p[c],p[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 o=0;o<m.length;o++)l=h.vertexColors[m[o]-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||p.length!=0)&&e.push([p[a],p[b],p[c],p[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={},o={},p=[],n,r,m,s,u,t=a.faceVertexUvs[0];n=0;for(r=t.length;n<r;n++){m=0;for(s=t[n].length;m<s;m++)u=d[n]["abcd".charAt(m)],p[u]||(p[u]=t[n][m])}var q;n=0;for(r=d.length;n<r;n++)if(u=d[n],k.push(u.centroid),i.push(new THREE.Vertex(u.centroid)),f.supportUVs&&p.length!=0){q=new THREE.UV;if(u instanceof THREE.Face3)q.u=p[u.a].u+p[u.b].u+p[u.c].u,q.v=p[u.a].v+p[u.b].v+p[u.c].v,q.u/=3,q.v/=3;else if(u instanceof THREE.Face4)q.u=
-p[u.a].u+p[u.b].u+p[u.c].u+p[u.d].u,q.v=p[u.a].v+p[u.b].v+p[u.c].v+p[u.d].v,q.u/=4,q.v/=4;p.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 A=0,t=h.length,w,E,x={},I={},M=function(a,
-b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},D=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(n in r){q=r[n];w=n.split("_");E=w[0];w=w[1];M(E,[E,w]);M(w,[E,w]);m=0;for(s=q.length;m<s;m++)u=q[m],D(E,u,n),D(w,u,n);q.length<2&&(o[n]=!0)}for(n in r)if(q=r[n],u=q[0],q=q[1],w=n.split("_"),E=w[0],w=w[1],s=new THREE.Vector3,o[n]?(s.addSelf(h[E].position),s.addSelf(h[w].position),s.multiplyScalar(0.5)):(s.addSelf(k[u]),s.addSelf(k[q]),s.addSelf(h[E].position),s.addSelf(h[w].position),s.multiplyScalar(0.25)),
-l[n]=t+d.length+A,i.push(new THREE.Vertex(s)),A++,f.supportUVs&&p.length!=0)q=new THREE.UV,q.u=p[E].u+p[w].u,q.v=p[E].v+p[w].v,q.u/=2,q.v/=2,p.push(q);var F,P;w=["123","12","2","23"];s=["123","23","3","31"];var M=["123","31","1","12"],D=["1234","12","2","23"],K=["1234","23","3","34"],$=["1234","34","4","41"],S=["1234","41","1","12"];n=0;for(r=k.length;n<r;n++)u=d[n],q=t+n,u instanceof THREE.Face3?(A=b(u.a,u.b),E=b(u.b,u.c),F=b(u.c,u.a),c(q,l[A],u.b,l[E],u,w),c(q,l[E],u.c,l[F],u,s),c(q,l[F],u.a,l[A],
-u,M)):u instanceof THREE.Face4?(A=b(u.a,u.b),E=b(u.b,u.c),F=b(u.c,u.d),P=b(u.d,u.a),c(q,l[A],u.b,l[E],u,D),c(q,l[E],u.c,l[F],u,K),c(q,l[F],u.d,l[P],u,$),c(q,l[P],u.a,l[A],u,S)):console.log("face should be a face!",u);d=i;i=new THREE.Vector3;l=new THREE.Vector3;n=0;for(r=h.length;n<r;n++)if(x[n]!==void 0){i.set(0,0,0);l.set(0,0,0);u=new THREE.Vector3(0,0,0);q=0;for(m in I[n])i.addSelf(k[m]),q++;A=0;t=x[n].length;for(m=0;m<t;m++)o[b(x[n][m][0],x[n][m][1])]&&A++;if(A!=2){i.divideScalar(q);for(m=0;m<
-t;m++)q=x[n][m],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),l.addSelf(q);l.divideScalar(t);u.addSelf(h[n].position);u.multiplyScalar(t-3);u.addSelf(i);u.addSelf(l.multiplyScalar(2));u.divideScalar(t);d[n].position=u}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},o={},p=[],n,r,m,s,t,v=a.faceVertexUvs[0];n=0;for(r=v.length;n<r;n++){m=0;for(s=v[n].length;m<s;m++)t=d[n]["abcd".charAt(m)],p[t]||(p[t]=v[n][m])}var q;n=0;for(r=d.length;n<r;n++)if(t=d[n],l.push(t.centroid),i.push(new THREE.Vertex(t.centroid)),f.supportUVs&&p.length!=0){q=new THREE.UV;if(t instanceof THREE.Face3)q.u=p[t.a].u+p[t.b].u+p[t.c].u,q.v=p[t.a].v+p[t.b].v+p[t.c].v,q.u/=3,q.v/=3;else if(t instanceof THREE.Face4)q.u=
+p[t.a].u+p[t.b].u+p[t.c].u+p[t.d].u,q.v=p[t.a].v+p[t.b].v+p[t.c].v+p[t.d].v,q.u/=4,q.v/=4;p.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 A=0,v=h.length,w,D,x={},J={},M=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},K=function(a,b){J[a]===void 0&&(J[a]={});J[a][b]=null};for(n in r){q=r[n];w=n.split("_");D=w[0];w=w[1];M(D,[D,w]);M(w,[D,w]);m=0;for(s=q.length;m<s;m++)t=q[m],K(D,t,n),K(w,t,n);q.length<2&&(o[n]=!0)}for(n in r)if(q=r[n],t=q[0],q=q[1],w=n.split("_"),D=w[0],w=w[1],s=new THREE.Vector3,o[n]?(s.addSelf(h[D].position),s.addSelf(h[w].position),s.multiplyScalar(0.5)):(s.addSelf(l[t]),s.addSelf(l[q]),s.addSelf(h[D].position),s.addSelf(h[w].position),s.multiplyScalar(0.25)),
+k[n]=v+d.length+A,i.push(new THREE.Vertex(s)),A++,f.supportUVs&&p.length!=0)q=new THREE.UV,q.u=p[D].u+p[w].u,q.v=p[D].v+p[w].v,q.u/=2,q.v/=2,p.push(q);var E,P;w=["123","12","2","23"];s=["123","23","3","31"];var M=["123","31","1","12"],K=["1234","12","2","23"],I=["1234","23","3","34"],V=["1234","34","4","41"],Z=["1234","41","1","12"];n=0;for(r=l.length;n<r;n++)t=d[n],q=v+n,t instanceof THREE.Face3?(A=b(t.a,t.b),D=b(t.b,t.c),E=b(t.c,t.a),c(q,k[A],t.b,k[D],t,w),c(q,k[D],t.c,k[E],t,s),c(q,k[E],t.a,k[A],
+t,M)):t instanceof THREE.Face4?(A=b(t.a,t.b),D=b(t.b,t.c),E=b(t.c,t.d),P=b(t.d,t.a),c(q,k[A],t.b,k[D],t,K),c(q,k[D],t.c,k[E],t,I),c(q,k[E],t.d,k[P],t,V),c(q,k[P],t.a,k[A],t,Z)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(r=h.length;n<r;n++)if(x[n]!==void 0){i.set(0,0,0);k.set(0,0,0);t=new THREE.Vector3(0,0,0);q=0;for(m in J[n])i.addSelf(l[m]),q++;A=0;v=x[n].length;for(m=0;m<v;m++)o[b(x[n][m][0],x[n][m][1])]&&A++;if(A!=2){i.divideScalar(q);for(m=0;m<
+v;m++)q=x[n][m],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),k.addSelf(q);k.divideScalar(v);t.addSelf(h[n].position);t.multiplyScalar(v-3);t.addSelf(i);t.addSelf(k.multiplyScalar(2));t.divideScalar(v);d[n].position=t}}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/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
@@ -547,125 +549,125 @@ a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this
 if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
 if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=e(a.colorDiffuse);
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=e(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=e(a.colorSpecular);if(a.colorAmbient)f.ambient=e(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=e(a.colorSpecular);if(a.colorAmbient)f.ambient=e(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(k.uniforms),o=f.color;h=f.specular;i=f.ambient;var p=f.shininess;l.tNormal.texture=f.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(f.map)l.tDiffuse.texture=f.map,l.enableDiffuse.value=!0;if(f.specularMap)l.tSpecular.texture=f.specularMap,l.enableSpecular.value=!0;if(f.lightMap)l.tAO.texture=
-f.lightMap,l.enableAO.value=!0;l.uDiffuseColor.value.setHex(o);l.uSpecularColor.value.setHex(h);l.uAmbientColor.value.setHex(i);l.uShininess.value=p;if(f.opacity)l.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:l,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(l.uniforms),o=f.color;h=f.specular;i=f.ambient;var p=f.shininess;k.tNormal.texture=f.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(f.map)k.tDiffuse.texture=f.map,k.enableDiffuse.value=!0;if(f.specularMap)k.tSpecular.texture=f.specularMap,k.enableSpecular.value=!0;if(f.lightMap)k.tAO.texture=
+f.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(o);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=p;if(f.opacity)k.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:k,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,e){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,e)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,e){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,e)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
 f.status+"]")};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.status+"]")};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var e=new XMLHttpRequest,f=b+"/"+a.buffers,h=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,c,d,a.materials):console.error("Couldn't load ["+f+"] ["+e.status+"]"):e.readyState==3?g&&(h==0&&(h=e.getResponseHeader("Content-Length")),g({total:h,loaded:e.responseText.length})):e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var e=new XMLHttpRequest,f=b+"/"+a.buffers,h=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,c,d,a.materials):console.error("Couldn't load ["+f+"] ["+e.status+"]"):e.readyState==3?g&&(h==0&&(h=e.getResponseHeader("Content-Length")),g({total:h,loaded:e.responseText.length})):e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",
 f,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
 f,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.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 o(b){var c,
-d,e;c=g(a,b);d=g(a,b+E);e=g(a,b+x);b=i(a,b+I);u.faces.push(new THREE.Face3(c,d,e,null,null,b))}function p(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+E);e=g(a,b+x);f=i(a,b+I);j=g(a,b+M);k=g(a,b+D);l=g(a,b+F);var b=A[k*3],m=A[k*3+1];k=A[k*3+2];var n=A[l*3],o=A[l*3+1];l=A[l*3+2];u.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(A[j*3],A[j*3+1],A[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+K);f=g(a,b+$);b=i(a,b+S);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+K);f=g(a,b+$);j=i(a,b+S);k=g(a,b+R);l=g(a,b+V);m=g(a,b+ja);n=g(a,b+y);var b=A[l*3],o=A[l*3+1];l=A[l*3+2];var p=A[m*3],v=A[m*3+1];m=A[m*3+2];var J=A[n*3],r=A[n*3+1];n=A[n*3+2];u.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(A[k*3],A[k*3+1],A[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(p,v,m),new THREE.Vector3(J,r,n)],null,j))}function m(b){var c,d,e,f;c=g(a,b);d=g(a,b+H);e=g(a,b+z);b=w[c*2];f=w[c*2+1];
-c=w[d*2];var i=u.faceVertexUvs[0];d=w[d*2+1];var j=w[e*2];e=w[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+L);e=g(a,b+j);f=g(a,b+aa);b=w[c*2];i=w[c*2+1];c=w[d*2];k=w[d*2+1];d=w[e*2];var l=u.faceVertexUvs[0];e=w[e*2+1];var m=w[f*2];f=w[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,t=0,q,A=[],w=[],E,x,
-I,M,D,F,P,K,$,S,R,V,ja,y,H,z,L,j,aa,ga,N,W,T,ca,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(u,d,b);q={signature:a.substr(t,8),header_bytes:l(a,t+8),vertex_coordinate_bytes:l(a,t+9),normal_coordinate_bytes:l(a,t+10),uv_coordinate_bytes:l(a,t+11),vertex_index_bytes:l(a,t+12),normal_index_bytes:l(a,t+13),uv_index_bytes:l(a,t+14),material_index_bytes:l(a,t+15),nvertices:g(a,t+16),nnormals:g(a,t+16+4),nuvs:g(a,t+16+8),ntri_flat:g(a,t+16+12),ntri_smooth:g(a,t+16+16),ntri_flat_uv:g(a,
-t+16+20),ntri_smooth_uv:g(a,t+16+24),nquad_flat:g(a,t+16+28),nquad_smooth:g(a,t+16+32),nquad_flat_uv:g(a,t+16+36),nquad_smooth_uv:g(a,t+16+40)};t+=q.header_bytes;E=q.vertex_index_bytes;x=q.vertex_index_bytes*2;I=q.vertex_index_bytes*3;M=q.vertex_index_bytes*3+q.material_index_bytes;D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;F=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;P=q.vertex_index_bytes;K=q.vertex_index_bytes*2;$=q.vertex_index_bytes*3;S=q.vertex_index_bytes*
-4;R=q.vertex_index_bytes*4+q.material_index_bytes;V=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;y=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;H=q.uv_index_bytes;z=q.uv_index_bytes*2;L=q.uv_index_bytes;j=q.uv_index_bytes*2;aa=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;Q=q.vertex_index_bytes*4+q.material_index_bytes;ga=q.ntri_flat*b;N=q.ntri_smooth*(b+q.normal_index_bytes*
-3);W=q.ntri_flat_uv*(b+q.uv_index_bytes*3);T=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ca=q.nquad_flat*Q;b=q.nquad_smooth*(Q+q.normal_index_bytes*4);Q=q.nquad_flat_uv*(Q+q.uv_index_bytes*4);t+=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}(t);t+=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),A.push(c/127,d/127,e/127);return q.nnormals*f}(t);t+=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),w.push(d,e);return q.nuvs*g}(t);ga=t+ga;N=ga+N;W=N+W;T=W+T;ca=T+ca;b=ca+b;Q=b+Q;(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)o(b),m(b+c);return e-
-a})(N);(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)p(b),m(b+c);return e-a})(W);(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)n(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})(Q);(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)o(b);return d-a})(t);(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)p(b);return d-a})(ga);(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)n(b);return d-a})(T);(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})(ca);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){N=a;d=d||ca;g!==void 0&&(a=g.split("/"),a.pop(),ta=a.length<1?"":a.join("/")+"/");C=c("//dae:library_images/dae:image",f,"image");oa=c("//dae:library_materials/dae:material",I,"material");la=c("//dae:library_effects/dae:effect",K,"effect");X=c("//dae:library_geometries/dae:geometry",s,"geometry");da=c("//dae:library_controllers/dae:controller",h,"controller");ka=c("//dae:library_animations/dae:animation",S,"animation");ra=c(".//dae:library_visual_scenes/dae:visual_scene",
-l,"visual_scene");pa=[];qa=[];(a=N.evaluate(".//dae:scene/dae:instance_visual_scene",N,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ra[a]):T=null;W=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)W.add(e(T.nodes[a]));b();for(var i in ka);i={scene:W,morphs:pa,skins:qa,dae:{images:C,materials:oa,effects:la,geometries:X,controllers:da,animations:ka,visualScenes:ra,scene:T}};d&&d(i);return i}function c(a,b,c){for(var a=N.evaluate(a,N,y,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 ka)for(var e=ka[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=da[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=T.getChildById(c.skeleton[0],!0)||T.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=[],o=[];for(h=0;h<a.vertices.length;h++)o.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 p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var r=0;r<i.weights[p].length;r++){var q=i.weights[p][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=o[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:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=da[a.controllers[f].url];switch(i.type){case "skin":if(X[i.skin.source]){var j=
-new m;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(da[i.skin.source]&&(d=i=da[i.skin.source],i.morph&&X[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(X[i.morph.source])j=new m,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=X[i.url],k={},l=0,o;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++){o=j[h];var p=la[oa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||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=da[c.url],j.skinInstanceController=c,j.name="skin_"+qa.length,qa.push(j);else if(d!==void 0){h=i;k=d instanceof n?da[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(p=X[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),f=k(a,b+2),g=k(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=k(a,b),d=k(a,b+1),e=k(a,b+2);return(k(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function l(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,b){return a.charCodeAt(b)&255}function o(b){var c,
+d,e;c=g(a,b);d=g(a,b+D);e=g(a,b+x);b=i(a,b+J);t.faces.push(new THREE.Face3(c,d,e,null,null,b))}function p(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+D);e=g(a,b+x);f=i(a,b+J);j=g(a,b+M);k=g(a,b+K);l=g(a,b+E);var b=A[k*3],m=A[k*3+1];k=A[k*3+2];var n=A[l*3],o=A[l*3+1];l=A[l*3+2];t.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(A[j*3],A[j*3+1],A[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+I);f=g(a,b+V);b=i(a,b+Z);t.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+I);f=g(a,b+V);j=i(a,b+Z);k=g(a,b+R);l=g(a,b+W);m=g(a,b+ka);n=g(a,b+G);var b=A[l*3],o=A[l*3+1];l=A[l*3+2];var p=A[m*3],u=A[m*3+1];m=A[m*3+2];var H=A[n*3],q=A[n*3+1];n=A[n*3+2];t.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(A[k*3],A[k*3+1],A[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(p,u,m),new THREE.Vector3(H,q,n)],null,j))}function m(b){var c,d,e,f;c=g(a,b);d=g(a,b+z);e=g(a,b+y);b=w[c*2];f=w[c*2+1];
+c=w[d*2];var i=t.faceVertexUvs[0];d=w[d*2+1];var j=w[e*2];e=w[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+L);e=g(a,b+j);f=g(a,b+ca);b=w[c*2];i=w[c*2+1];c=w[d*2];k=w[d*2+1];d=w[e*2];var l=t.faceVertexUvs[0];e=w[e*2+1];var m=w[f*2];f=w[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 t=this,v=0,q,A=[],w=[],D,x,
+J,M,K,E,P,I,V,Z,R,W,ka,G,z,y,L,j,ca,ga,N,X,T,ea,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(t,d,b);q={signature:a.substr(v,8),header_bytes:k(a,v+8),vertex_coordinate_bytes:k(a,v+9),normal_coordinate_bytes:k(a,v+10),uv_coordinate_bytes:k(a,v+11),vertex_index_bytes:k(a,v+12),normal_index_bytes:k(a,v+13),uv_index_bytes:k(a,v+14),material_index_bytes:k(a,v+15),nvertices:g(a,v+16),nnormals:g(a,v+16+4),nuvs:g(a,v+16+8),ntri_flat:g(a,v+16+12),ntri_smooth:g(a,v+16+16),ntri_flat_uv:g(a,
+v+16+20),ntri_smooth_uv:g(a,v+16+24),nquad_flat:g(a,v+16+28),nquad_smooth:g(a,v+16+32),nquad_flat_uv:g(a,v+16+36),nquad_smooth_uv:g(a,v+16+40)};v+=q.header_bytes;D=q.vertex_index_bytes;x=q.vertex_index_bytes*2;J=q.vertex_index_bytes*3;M=q.vertex_index_bytes*3+q.material_index_bytes;K=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;E=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;P=q.vertex_index_bytes;I=q.vertex_index_bytes*2;V=q.vertex_index_bytes*3;Z=q.vertex_index_bytes*
+4;R=q.vertex_index_bytes*4+q.material_index_bytes;W=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ka=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;G=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;z=q.uv_index_bytes;y=q.uv_index_bytes*2;L=q.uv_index_bytes;j=q.uv_index_bytes*2;ca=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;Q=q.vertex_index_bytes*4+q.material_index_bytes;ga=q.ntri_flat*b;N=q.ntri_smooth*(b+q.normal_index_bytes*
+3);X=q.ntri_flat_uv*(b+q.uv_index_bytes*3);T=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ea=q.nquad_flat*Q;b=q.nquad_smooth*(Q+q.normal_index_bytes*4);Q=q.nquad_flat_uv*(Q+q.uv_index_bytes*4);v+=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),t.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return q.nvertices*h}(v);v+=function(b){for(var c,d,e,f=q.normal_coordinate_bytes*
+3,g=b+q.nnormals*f;b<g;b+=f)c=l(a,b),d=l(a,b+q.normal_coordinate_bytes),e=l(a,b+q.normal_coordinate_bytes*2),A.push(c/127,d/127,e/127);return q.nnormals*f}(v);v+=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),w.push(d,e);return q.nuvs*g}(v);ga=v+ga;N=ga+N;X=N+X;T=X+T;ea=T+ea;b=ea+b;Q=b+Q;(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)o(b),m(b+c);return e-
+a})(N);(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)p(b),m(b+c);return e-a})(X);(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)n(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})(Q);(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)o(b);return d-a})(v);(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)p(b);return d-a})(ga);(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)n(b);return d-a})(T);(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){N=a;d=d||ea;g!==void 0&&(a=g.split("/"),a.pop(),ta=a.length<1?"":a.join("/")+"/");C=c("//dae:library_images/dae:image",f,"image");oa=c("//dae:library_materials/dae:material",J,"material");la=c("//dae:library_effects/dae:effect",I,"effect");$=c("//dae:library_geometries/dae:geometry",s,"geometry");S=c("//dae:library_controllers/dae:controller",h,"controller");Y=c("//dae:library_animations/dae:animation",Z,"animation");ra=c(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");pa=[];qa=[];(a=N.evaluate(".//dae:scene/dae:instance_visual_scene",N,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ra[a]):T=null;X=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)X.add(e(T.nodes[a]));b();for(var i in Y);i={scene:X,morphs:pa,skins:qa,dae:{images:C,materials:oa,effects:la,geometries:$,controllers:S,animations:Y,visualScenes:ra,scene:T}};d&&d(i);return i}function c(a,b,c){for(var a=N.evaluate(a,N,G,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 Y)for(var e=Y[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=S[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=T.getChildById(c.skeleton[0],!0)||T.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=[],o=[];for(h=0;h<a.vertices.length;h++)o.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 p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}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=o[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:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=S[a.controllers[f].url];switch(i.type){case "skin":if($[i.skin.source]){var j=
+new m;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(S[i.skin.source]&&(d=i=S[i.skin.source],i.morph&&$[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if($[i.morph.source])j=new m,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=$[i.url],k={},l=0,o;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++){o=j[h];var p=la[oa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||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=S[c.url],j.skinInstanceController=c,j.name="skin_"+qa.length,qa.push(j);else if(d!==void 0){h=i;k=d instanceof n?S[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(p=$[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.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:p.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 o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){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 t(){}function q(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function E(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function M(){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 D(a,b){this.type=a;this.effect=b;this.material=null}function F(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 K(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function R(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function V(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(Q[b]!=void 0)return Q[b];Q[b]=(new x(b)).parse(a);return Q[b]}function y(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function H(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function z(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function L(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 aa(a,b){if(a===
-void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ga(a,b){var c="";c+=aa(a.x,b)+",";c+=aa(a.y,b)+",";c+=aa(a.z,b);return c}var N=null,W=null,T,ca=null,Q={},C={},ka={},da={},X={},oa={},la={},ra,ta,pa,qa,wa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
-c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
-0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new E).parse(d))}}return b};
-k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=H(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
-f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new E).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
-a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new E).parse(g));break;case "v":c=z(g.textContent);break;case "vcount":d=z(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.prototype.getChildById=function(a,b){for(var c=
-0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function s(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function v(){}function q(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function D(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function M(){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 K(a,b){this.type=a;this.effect=b;this.material=null}function E(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 I(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function V(){this.url=""}function Z(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function R(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function W(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ka(a){var b=a.getAttribute("id");
+if(Q[b]!=void 0)return Q[b];Q[b]=(new x(b)).parse(a);return Q[b]}function G(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function z(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function y(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function L(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 ca(a,b){if(a===
+void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ga(a,b){var c="";c+=ca(a.x,b)+",";c+=ca(a.y,b)+",";c+=ca(a.z,b);return c}var N=null,X=null,T,ea=null,Q={},C={},Y={},S={},$={},oa={},la={},ra,ta,pa,qa,wa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new D).parse(d))}}return b};
+l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=z(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
+f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new D).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
+a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new D).parse(g));break;case "v":c=y(g.textContent);break;case "vcount":d=y(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
 b);if(d)return d}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
 b);if(d)return d}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
 this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=
 this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=N.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",N,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ka)for(var e=ka[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
+b.getAttribute("url").replace(/^#/,"");(b=N.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",N,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Y)for(var e=Y[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
 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};o.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};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=H(a.textContent);this.updateMatrix();return this};p.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)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=z(a.textContent);this.updateMatrix();return this};p.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};n.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};n.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=N.evaluate(".//dae:instance_material",c,y,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};m.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=N.evaluate(".//dae:instance_material",c,y,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=
-(new u(this)).parse(c)}}return this};u.prototype.parse=function(a){function b(a,c){var d=ga(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 w).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 t).parse(d))}}var e=
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=N.evaluate(".//dae:instance_material",c,G,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};m.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=N.evaluate(".//dae:instance_material",c,G,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=
+(new t(this)).parse(c)}}return this};t.prototype.parse=function(a){function b(a,c){var d=ga(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":ka(d);break;case "vertices":this.vertices=(new w).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 v).parse(d))}}var e=
 {};this.geometry3js=new THREE.Geometry;d=Q[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=Q[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=[],q={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=Q[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ga(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":s.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]],s.length?s: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]],s.length?s:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);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}};t.prototype=new q;t.prototype.constructor=t;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 E).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-z(c.textContent);break;case "p":this.p=z(c.textContent)}}return this};A.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};w.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 E).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};E.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};x.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=L(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=H(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=L(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 A).parse(c.childNodes[d]);break}}}return this};
-x.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};I.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};M.prototype.isColor=function(){return this.texture==null};M.prototype.isTexture=function(){return this.texture!=null};M.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=H(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};D.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 M).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=N.evaluate(".//dae:float",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof M)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=C[this.effect.surface.init_from]))a.map=
-THREE.ImageUtils.loadTexture(ta+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=wa;return this.material=new THREE.MeshLambertMaterial(a)};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+return this};t.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=[],q=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=Q[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ga(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.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],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
+e[1],e[2]]);d+=h.length*n}};v.prototype=new q;v.prototype.constructor=v;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 D).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+y(c.textContent);break;case "p":this.p=y(c.textContent)}}return this};A.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};w.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 D).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};D.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};x.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=L(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=z(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=y(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=L(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 A).parse(c.childNodes[d]);break}}}return this};
+x.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 V).parse(a.childNodes[b]);break}return this};M.prototype.isColor=function(){return this.texture==null};M.prototype.isTexture=function(){return this.texture!=null};M.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=z(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};K.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 M).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=N.evaluate(".//dae:float",c,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof M)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=C[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(ta+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=wa;return this.material=new THREE.MeshLambertMaterial(a)};E.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 "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};P.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 "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
 if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};P.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 "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};K.prototype.create=function(){if(this.shader==null)return null};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-K.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new F(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new P(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};K.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};K.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new D(c.nodeName,this)).parse(c)}}};$.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new V(this)).parse(c));break;case "channel":this.channel.push((new R(this)).parse(c))}}return this};R.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};V.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new E).parse(c))}}return this};
-V.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};I.prototype.create=function(){if(this.shader==null)return null};I.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+I.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new E(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new P(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};I.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};I.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};V.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Z.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new W(this)).parse(c));break;case "channel":this.channel.push((new R(this)).parse(c))}}return this};R.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};W.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new D).parse(c))}}return this};
+W.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 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))ca=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:X}};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:$}};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){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var e=new XMLHttpRequest,f=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+e.status+"]");else e.readyState==3?g&&(f==0&&(f=e.getResponseHeader("Content-Length")),g({total:f,loaded:e.responseText.length})):
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var e=new XMLHttpRequest,f=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+e.status+"]");else e.readyState==3?g&&(f==0&&(f=e.getResponseHeader("Content-Length")),g({total:f,loaded:e.responseText.length})):
 e.readyState==2&&(f=e.getResponseHeader("Content-Length"))};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
 e.readyState==2&&(f=e.getResponseHeader("Content-Length"))};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-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.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,l,o,p,n,r,m,s,u,t,q,A=a.faces;o=a.vertices;var w=a.normals,E=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=o.length;k<
-l;)p=new THREE.Vertex,p.position.x=o[k++]*b,p.position.y=o[k++]*b,p.position.z=o[k++]*b,d.vertices.push(p);k=0;for(l=A.length;k<l;){b=A[k++];o=b&1;i=b&2;c=b&4;g=b&8;n=b&16;p=b&32;m=b&64;b&=128;o?(s=new THREE.Face4,s.a=A[k++],s.b=A[k++],s.c=A[k++],s.d=A[k++],o=4):(s=new THREE.Face3,s.a=A[k++],s.b=A[k++],s.c=A[k++],o=3);if(i)i=A[k++],s.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)u=a.uvs[c],r=A[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<x;c++){u=a.uvs[c];t=[];
-for(g=0;g<o;g++)r=A[k++],q=u[r*2],r=u[r*2+1],t[g]=new THREE.UV(q,r);d.faceVertexUvs[c][i]=t}if(n)n=A[k++]*3,g=new THREE.Vector3,g.x=w[n++],g.y=w[n++],g.z=w[n],s.normal=g;if(p)for(c=0;c<o;c++)n=A[k++]*3,g=new THREE.Vector3,g.x=w[n++],g.y=w[n++],g.z=w[n],s.vertexNormals.push(g);if(m)p=A[k++],p=new THREE.Color(E[p]),s.color=p;if(b)for(c=0;c<o;c++)p=A[k++],p=new THREE.Color(E[p]),s.vertexColors.push(p);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,o,p,n,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=[];n=d.morphTargets[c].vertices;
-r=a.morphTargets[c].vertices;i=0;for(k=r.length;i<k;i+=3)l=r[i]*b,o=r[i+1]*b,p=r[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(l,o,p)))}}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)o=new THREE.Color(16755200),o.setRGB(l[b],l[b+1],l[b+2]),k.push(o)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(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.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,l,k,o,p,n,r,m,s,t,v,q,A=a.faces;o=a.vertices;var w=a.normals,D=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=o.length;l<
+k;)p=new THREE.Vertex,p.position.x=o[l++]*b,p.position.y=o[l++]*b,p.position.z=o[l++]*b,d.vertices.push(p);l=0;for(k=A.length;l<k;){b=A[l++];o=b&1;i=b&2;c=b&4;g=b&8;n=b&16;p=b&32;m=b&64;b&=128;o?(s=new THREE.Face4,s.a=A[l++],s.b=A[l++],s.c=A[l++],s.d=A[l++],o=4):(s=new THREE.Face3,s.a=A[l++],s.b=A[l++],s.c=A[l++],o=3);if(i)i=A[l++],s.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)t=a.uvs[c],r=A[l++],q=t[r*2],r=t[r*2+1],d.faceUvs[c][i]=new THREE.UV(q,r);if(g)for(c=0;c<x;c++){t=a.uvs[c];v=[];
+for(g=0;g<o;g++)r=A[l++],q=t[r*2],r=t[r*2+1],v[g]=new THREE.UV(q,r);d.faceVertexUvs[c][i]=v}if(n)n=A[l++]*3,g=new THREE.Vector3,g.x=w[n++],g.y=w[n++],g.z=w[n],s.normal=g;if(p)for(c=0;c<o;c++)n=A[l++]*3,g=new THREE.Vector3,g.x=w[n++],g.y=w[n++],g.z=w[n],s.vertexNormals.push(g);if(m)p=A[l++],p=new THREE.Color(D[p]),s.color=p;if(b)for(c=0;c<o;c++)p=A[l++],p=new THREE.Color(D[p]),s.vertexColors.push(p);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,l,k,o,p,n,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=[];n=d.morphTargets[c].vertices;
+r=a.morphTargets[c].vertices;i=0;for(l=r.length;i<l;i+=3)k=r[i]*b,o=r[i+1]*b,p=r[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,o,p)))}}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=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(k[b],k[b+1],k[b+2]),l.push(o)}}})(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.prototype.constructor=THREE.SceneLoader;
 d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(e){console.error(e),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(e){console.error(e),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(p in K.objects)if(!y.objects[p])if(u=K.objects[p],u.geometry!==void 0){if(M=y.geometries[u.geometry]){a=!1;for(z=0;z<u.materials.length;z++)P=y.materials[u.materials[z]],a=P instanceof THREE.ShaderMaterial;a&&M.computeTangents();A=u.position;w=u.rotation;E=u.quaternion;x=u.scale;E=0;P.length==0&&(P=new THREE.MeshFaceMaterial);P.length>1&&(P=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(M,P);a.name=p;a.position.set(A[0],A[1],A[2]);E?(a.quaternion.set(E[0],E[1],E[2],E[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]);a.scale.set(x[0],x[1],x[2]);a.visible=u.visible;y.scene.add(a);y.objects[p]=a;if(u.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(u.castsShadow)b=new THREE.ShadowVolume(M),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;u.trigger&&u.trigger.toLowerCase()!="none"&&(b=
-{type:u.trigger,object:u},y.triggers[a.name]=b)}}else A=u.position,w=u.rotation,E=u.quaternion,x=u.scale,E=0,a=new THREE.Object3D,a.name=p,a.position.set(A[0],A[1],A[2]),E?(a.quaternion.set(E[0],E[1],E[2],E[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(x[0],x[1],x[2]),a.visible=u.visible!==void 0?u.visible:!1,y.scene.add(a),y.objects[p]=a,y.empties[p]=a,u.trigger&&u.trigger.toLowerCase()!="none"&&(b={type:u.trigger,object:u},y.triggers[a.name]=b)}function e(a){return function(b){y.geometries[a]=
-b;g();S-=1;i.onLoadComplete();h()}}function f(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:V,totalTextures:ja,loadedModels:V-S,loadedTextures:ja-R},y);i.onLoadProgress();S==0&&R==0&&c(y)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),l,o,p,n,r,m,s,u,t,q,A,w,E,x,I,M,D,F,P,K,$,S,R,V,ja,y;K=a;b=new THREE.BinaryLoader;$=new THREE.JSONLoader;R=S=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(p in K.objects)if(u=K.objects[p],u.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(K.transform){a=K.transform.position;t=K.transform.rotation;var H=K.transform.scale;a&&y.scene.position.set(a[0],a[1],a[2]);t&&y.scene.rotation.set(t[0],t[1],t[2]);H&&y.scene.scale.set(H[0],H[1],H[2]);(a||t||H)&&y.scene.updateMatrix()}a=function(){R-=1;h();i.onLoadComplete()};for(r in K.cameras)t=K.cameras[r],t.type=="perspective"?D=new THREE.PerspectiveCamera(t.fov,
-t.aspect,t.near,t.far):t.type=="ortho"&&(D=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far)),A=t.position,t=t.target,D.position.set(A[0],A[1],A[2]),D.target=new THREE.Vector3(t[0],t[1],t[2]),y.cameras[r]=D;for(n in K.lights)t=K.lights[n],r=t.color!==void 0?t.color:16777215,D=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(A=t.direction,q=new THREE.DirectionalLight(r,D),q.position.set(A[0],A[1],A[2]),q.position.normalize()):t.type=="point"?(A=t.position,q=t.distance,
-q=new THREE.PointLight(r,D,q),q.position.set(A[0],A[1],A[2])):t.type=="ambient"&&(q=new THREE.AmbientLight(r)),y.scene.add(q),y.lights[n]=q;for(m in K.fogs)n=K.fogs[m],n.type=="linear"?F=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(F=new THREE.FogExp2(0,n.density)),t=n.color,F.color.setRGB(t[0],t[1],t[2]),y.fogs[m]=F;if(y.cameras&&K.defaults.camera)y.currentCamera=y.cameras[K.defaults.camera];if(y.fogs&&K.defaults.fog)y.scene.fog=y.fogs[K.defaults.fog];t=K.defaults.bgcolor;y.bgColor=new THREE.Color;
-y.bgColor.setRGB(t[0],t[1],t[2]);y.bgColorAlpha=K.defaults.bgalpha;for(l in K.geometries)if(m=K.geometries[l],m.type=="bin_mesh"||m.type=="ascii_mesh")S+=1,i.onLoadStart();V=S;for(l in K.geometries)m=K.geometries[l],m.type=="cube"?(M=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),y.geometries[l]=M):m.type=="plane"?(M=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[l]=M):m.type=="sphere"?
-(M=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[l]=M):m.type=="cylinder"?(M=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[l]=M):m.type=="torus"?(M=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[l]=M):m.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[l]=M):m.type=="bin_mesh"?b.load(d(m.url,K.urlBaseType),e(l)):m.type=="ascii_mesh"?$.load(d(m.url,K.urlBaseType),
-e(l)):m.type=="embedded_mesh"&&(m=K.embeds[m.id])&&$.createModel(m,f(l),"");for(s in K.textures)if(l=K.textures[s],l.url instanceof Array){R+=l.url.length;for(m=0;m<l.url.length;m++)i.onLoadStart()}else R+=1,i.onLoadStart();ja=R;for(s in K.textures){l=K.textures[s];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=[];for(var z=0;z<l.url.length;z++)m[z]=d(l.url[z],K.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,l.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(l.url,
-K.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)m.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!=void 0)m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[l.wrap[0]]!==void 0)m.wrapS=F[l.wrap[0]];if(F[l.wrap[1]]!==void 0)m.wrapT=
-F[l.wrap[1]]}}y.textures[s]=m}for(o in K.materials){s=K.materials[o];for(I in s.parameters)if(I=="envMap"||I=="map"||I=="lightMap")s.parameters[I]=y.textures[s.parameters[I]];else if(I=="shading")s.parameters[I]=s.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")s.parameters[I]=THREE[s.parameters[I]]?THREE[s.parameters[I]]:THREE.NormalBlending;else if(I=="combine")s.parameters[I]=s.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I==
-"vertexColors")if(s.parameters[I]=="face")s.parameters[I]=THREE.FaceColors;else if(s.parameters[I])s.parameters[I]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=!0;if(s.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);m=s.parameters.color;F=s.parameters.specular;b=s.parameters.ambient;$=s.parameters.shininess;a.tNormal.texture=y.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=
-s.parameters.normalMapFactor;if(s.parameters.map)a.tDiffuse.texture=s.parameters.map,a.enableDiffuse.value=!0;if(s.parameters.lightMap)a.tAO.texture=s.parameters.lightMap,a.enableAO.value=!0;if(s.parameters.specularMap)a.tSpecular.texture=y.textures[s.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(b);a.uShininess.value=$;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;s=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,
-vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else s=new THREE[s.type](s.parameters);y.materials[o]=s}g();i.callbackSync(y);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function g(){var a;for(p in I.objects)if(!G.objects[p])if(t=I.objects[p],t.geometry!==void 0){if(M=G.geometries[t.geometry]){a=!1;for(y=0;y<t.materials.length;y++)P=G.materials[t.materials[y]],a=P instanceof THREE.ShaderMaterial;a&&M.computeTangents();A=t.position;w=t.rotation;D=t.quaternion;x=t.scale;D=0;P.length==0&&(P=new THREE.MeshFaceMaterial);P.length>1&&(P=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(M,P);a.name=p;a.position.set(A[0],A[1],A[2]);D?(a.quaternion.set(D[0],D[1],D[2],D[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]);a.scale.set(x[0],x[1],x[2]);a.visible=t.visible;G.scene.add(a);G.objects[p]=a;if(t.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);G.scene.collisions.colliders.push(b)}if(t.castsShadow)b=new THREE.ShadowVolume(M),G.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;t.trigger&&t.trigger.toLowerCase()!="none"&&(b=
+{type:t.trigger,object:t},G.triggers[a.name]=b)}}else A=t.position,w=t.rotation,D=t.quaternion,x=t.scale,D=0,a=new THREE.Object3D,a.name=p,a.position.set(A[0],A[1],A[2]),D?(a.quaternion.set(D[0],D[1],D[2],D[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(x[0],x[1],x[2]),a.visible=t.visible!==void 0?t.visible:!1,G.scene.add(a),G.objects[p]=a,G.empties[p]=a,t.trigger&&t.trigger.toLowerCase()!="none"&&(b={type:t.trigger,object:t},G.triggers[a.name]=b)}function e(a){return function(b){G.geometries[a]=
+b;g();Z-=1;i.onLoadComplete();h()}}function f(a){return function(b){G.geometries[a]=b}}function h(){i.callbackProgress({totalModels:W,totalTextures:ka,loadedModels:W-Z,loadedTextures:ka-R},G);i.onLoadProgress();Z==0&&R==0&&c(G)}var i=this,l=THREE.Loader.prototype.extractUrlbase(b),k,o,p,n,r,m,s,t,v,q,A,w,D,x,J,M,K,E,P,I,V,Z,R,W,ka,G;I=a;b=new THREE.BinaryLoader;V=new THREE.JSONLoader;R=Z=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(p in I.objects)if(t=I.objects[p],t.meshCollider){a=!0;break}if(a)G.scene.collisions=new THREE.CollisionSystem;if(I.transform){a=I.transform.position;v=I.transform.rotation;var z=I.transform.scale;a&&G.scene.position.set(a[0],a[1],a[2]);v&&G.scene.rotation.set(v[0],v[1],v[2]);z&&G.scene.scale.set(z[0],z[1],z[2]);(a||v||z)&&G.scene.updateMatrix()}a=function(){R-=1;h();i.onLoadComplete()};for(r in I.cameras)v=I.cameras[r],v.type=="perspective"?K=new THREE.PerspectiveCamera(v.fov,
+v.aspect,v.near,v.far):v.type=="ortho"&&(K=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far)),A=v.position,v=v.target,K.position.set(A[0],A[1],A[2]),K.target=new THREE.Vector3(v[0],v[1],v[2]),G.cameras[r]=K;for(n in I.lights)v=I.lights[n],r=v.color!==void 0?v.color:16777215,K=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(A=v.direction,q=new THREE.DirectionalLight(r,K),q.position.set(A[0],A[1],A[2]),q.position.normalize()):v.type=="point"?(A=v.position,q=v.distance,
+q=new THREE.PointLight(r,K,q),q.position.set(A[0],A[1],A[2])):v.type=="ambient"&&(q=new THREE.AmbientLight(r)),G.scene.add(q),G.lights[n]=q;for(m in I.fogs)n=I.fogs[m],n.type=="linear"?E=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(E=new THREE.FogExp2(0,n.density)),v=n.color,E.color.setRGB(v[0],v[1],v[2]),G.fogs[m]=E;if(G.cameras&&I.defaults.camera)G.currentCamera=G.cameras[I.defaults.camera];if(G.fogs&&I.defaults.fog)G.scene.fog=G.fogs[I.defaults.fog];v=I.defaults.bgcolor;G.bgColor=new THREE.Color;
+G.bgColor.setRGB(v[0],v[1],v[2]);G.bgColorAlpha=I.defaults.bgalpha;for(k in I.geometries)if(m=I.geometries[k],m.type=="bin_mesh"||m.type=="ascii_mesh")Z+=1,i.onLoadStart();W=Z;for(k in I.geometries)m=I.geometries[k],m.type=="cube"?(M=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),G.geometries[k]=M):m.type=="plane"?(M=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),G.geometries[k]=M):m.type=="sphere"?
+(M=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),G.geometries[k]=M):m.type=="cylinder"?(M=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),G.geometries[k]=M):m.type=="torus"?(M=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),G.geometries[k]=M):m.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(m.subdivisions),G.geometries[k]=M):m.type=="bin_mesh"?b.load(d(m.url,I.urlBaseType),e(k)):m.type=="ascii_mesh"?V.load(d(m.url,I.urlBaseType),
+e(k)):m.type=="embedded_mesh"&&(m=I.embeds[m.id])&&V.createModel(m,f(k),"");for(s in I.textures)if(k=I.textures[s],k.url instanceof Array){R+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else R+=1,i.onLoadStart();ka=R;for(s in I.textures){k=I.textures[s];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(var y=0;y<k.url.length;y++)m[y]=d(k.url[y],I.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,
+I.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)m.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){E={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(E[k.wrap[0]]!==void 0)m.wrapS=E[k.wrap[0]];if(E[k.wrap[1]]!==void 0)m.wrapT=
+E[k.wrap[1]]}}G.textures[s]=m}for(o in I.materials){s=I.materials[o];for(J in s.parameters)if(J=="envMap"||J=="map"||J=="lightMap")s.parameters[J]=G.textures[s.parameters[J]];else if(J=="shading")s.parameters[J]=s.parameters[J]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(J=="blending")s.parameters[J]=THREE[s.parameters[J]]?THREE[s.parameters[J]]:THREE.NormalBlending;else if(J=="combine")s.parameters[J]=s.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(J==
+"vertexColors")if(s.parameters[J]=="face")s.parameters[J]=THREE.FaceColors;else if(s.parameters[J])s.parameters[J]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=!0;if(s.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);m=s.parameters.color;E=s.parameters.specular;b=s.parameters.ambient;V=s.parameters.shininess;a.tNormal.texture=G.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=
+s.parameters.normalMapFactor;if(s.parameters.map)a.tDiffuse.texture=s.parameters.map,a.enableDiffuse.value=!0;if(s.parameters.lightMap)a.tAO.texture=s.parameters.lightMap,a.enableAO.value=!0;if(s.parameters.specularMap)a.tSpecular.texture=G.textures[s.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(E);a.uAmbientColor.value.setHex(b);a.uShininess.value=V;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;s=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
+vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else s=new THREE[s.type](s.parameters);G.materials[o]=s}g();i.callbackSync(G);h()};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,t,q,A,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;A=e;i=f;t=d;var E=e,x=f,I=g.materials[0],M=k[E*3],D=k[E*3+1],E=k[E*3+2],F=k[x*3],P=k[x*3+1],x=k[x*3+2];t=new THREE.Vector3(k[t*3],k[t*3+1],k[t*3+2]);E=new THREE.Vector3(M,D,E);x=new THREE.Vector3(F,P,x);g.faces.push(new THREE.Face3(q,A,i,[t,E,x],null,I));g=l[d*2];d=l[d*2+
-1];i=l[e*2];t=l[e*2+1];q=l[f*2];A=l[f*2+1];f=c.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(q,A));f.push(t)}})(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),l=[],k=[];(function(a,f,i){for(var k,l,s,t=a.length;i<t;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,k.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,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,v,q,A,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;A=e;i=f;v=d;var D=e,x=f,J=g.materials[0],M=l[D*3],K=l[D*3+1],D=l[D*3+2],E=l[x*3],P=l[x*3+1],x=l[x*3+2];v=new THREE.Vector3(l[v*3],l[v*3+1],l[v*3+2]);D=new THREE.Vector3(M,K,D);x=new THREE.Vector3(E,P,x);g.faces.push(new THREE.Face3(q,A,i,[v,D,x],null,J));g=k[d*2];d=k[d*2+
+1];i=k[e*2];v=k[e*2+1];q=k[f*2];A=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=v;v=[];v.push(new THREE.UV(g,d));v.push(new THREE.UV(e,i));v.push(new THREE.UV(q,A));f.push(v)}})(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,o){f=(f-l)/(o-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,o){f=(f-l)/(o-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,o){f=(f-l)/(o-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,o=i+this.yd,p=i+this.zd,n=e+this.yd+this.zd,r=i+this.yd+this.zd,m=0,s=this.field[e],u=this.field[i],t=this.field[k],q=this.field[o],A=this.field[l],w=this.field[p],E=this.field[n],x=this.field[r];s<f&&(m|=1);u<f&&(m|=2);t<f&&(m|=8);q<f&&(m|=4);A<f&&(m|=16);w<f&&(m|=32);E<f&&(m|=128);x<f&&(m|=64);var I=THREE.edgeTable[m];if(I===0)return 0;
-var M=this.delta,D=a+M,F=c+M,M=g+M;I&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,s,u));I&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,D,c,g,u,q));I&4&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,F,g,t,q));I&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,s,t));I&16&&(this.compNorm(l),this.compNorm(p),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,M,A,w));
-I&32&&(this.compNorm(p),this.compNorm(r),this.VIntY(p*3,this.vlist,this.nlist,15,f,D,c,M,w,x));I&64&&(this.compNorm(n),this.compNorm(r),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,F,M,E,x));I&128&&(this.compNorm(l),this.compNorm(n),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,M,A,E));I&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,s,A));I&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,D,c,g,u,w));I&1024&&(this.compNorm(o),
-this.compNorm(r),this.VIntZ(o*3,this.vlist,this.nlist,30,f,D,F,g,q,x));I&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,F,g,t,E));m<<=4;for(f=e=0;THREE.triTable[m+f]!=-1;)a=m+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+
+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,l,k,o){f=(f-k)/(o-k);k=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=l;g[e]=this.lerp(k[a],k[a+3],f);g[e+1]=this.lerp(k[a+1],k[a+4],f);g[e+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,l,k,o){f=(f-k)/(o-k);k=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
+2]=l;c=a+this.yd*3;g[e]=this.lerp(k[a],k[c],f);g[e+1]=this.lerp(k[a+1],k[c+1],f);g[e+2]=this.lerp(k[a+2],k[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,l,k,o){f=(f-k)/(o-k);k=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=l+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(k[a],k[c],f);g[e+1]=this.lerp(k[a+1],k[c+1],f);g[e+2]=this.lerp(k[a+2],k[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,l=e+this.yd,k=e+this.zd,o=i+this.yd,p=i+this.zd,n=e+this.yd+this.zd,r=i+this.yd+this.zd,m=0,s=this.field[e],t=this.field[i],v=this.field[l],q=this.field[o],A=this.field[k],w=this.field[p],D=this.field[n],x=this.field[r];s<f&&(m|=1);t<f&&(m|=2);v<f&&(m|=8);q<f&&(m|=4);A<f&&(m|=16);w<f&&(m|=32);D<f&&(m|=128);x<f&&(m|=64);var J=THREE.edgeTable[m];if(J===0)return 0;
+var M=this.delta,K=a+M,E=c+M,M=g+M;J&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,s,t));J&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,K,c,g,t,q));J&4&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,E,g,v,q));J&8&&(this.compNorm(e),this.compNorm(l),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,s,v));J&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,c,M,A,w));
+J&32&&(this.compNorm(p),this.compNorm(r),this.VIntY(p*3,this.vlist,this.nlist,15,f,K,c,M,w,x));J&64&&(this.compNorm(n),this.compNorm(r),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,E,M,D,x));J&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,c,M,A,D));J&256&&(this.compNorm(e),this.compNorm(k),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,s,A));J&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,K,c,g,t,w));J&1024&&(this.compNorm(o),
+this.compNorm(r),this.VIntZ(o*3,this.vlist,this.nlist,30,f,K,E,g,q,x));J&2048&&(this.compNorm(l),this.compNorm(n),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,E,g,v,D));m<<=4;for(f=e=0;THREE.triTable[m+f]!=-1;)a=m+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,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(k-h);p<1&&(p=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(l-h);n<1&&(n=1);h=Math.floor(l+h);
-h>this.size-1&&(h=this.size-1);for(var r,m,s,u,t,q;o<i;o++){l=this.size2*o;m=o/this.size-g;t=m*m;for(m=p;m<k;m++){s=l+this.size*m;r=m/this.size-c;q=r*r;for(r=n;r<h;r++)u=r/this.size-a,u=e/(1.0E-6+u*u+q+t)-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,o=this.zd,p=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g<n;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++)p[o*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
-i,k,l=this.size,o=this.yd,p=this.zd,n=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*o;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)n[p*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,o=this.yd,p=this.zd,n=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=p*f;for(e=0;e<l;e++){k=i+e*o;for(g=0;g<l;g++)n[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,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<p;e++){l=o+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<p;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,o,p,n;for(f=0;f<e.count;f++)p=f*3,l=p+1,n=p+2,h=e.positionArray[p],
-i=e.positionArray[l],k=e.positionArray[n],o=new THREE.Vector3(h,i,k),h=e.normalArray[p],i=e.normalArray[l],k=e.normalArray[n],p=new THREE.Vector3(h,i,k),p.normalize(),l=new THREE.Vertex(o),c.vertices.push(l),g.push(p);o=e.count/3;for(f=0;f<o;f++)p=(a+f)*3,l=p+1,n=p+2,h=g[p],i=g[l],k=g[n],p=new THREE.Face3(p,l,n,[h,i,k]),c.faces.push(p);a+=o;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+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,l=c*this.size,k=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);
+h>this.size-1&&(h=this.size-1);for(var r,m,s,t,v,q;o<i;o++){k=this.size2*o;m=o/this.size-g;v=m*m;for(m=p;m<l;m++){s=k+this.size*m;r=m/this.size-c;q=r*r;for(r=n;r<h;r++)t=r/this.size-a,t=e/(1.0E-6+t*t+q+v)-f,t>0&&(this.field[s+r]+=t)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,l=this.size,k=this.yd,o=this.zd,p=this.field,n=l*Math.sqrt(a/c);n>l&&(n=l);for(g=0;g<n;g++)if(e=g/l,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<l;e++){i=g+e*k;for(f=0;f<l;f++)p[o*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
+i,l,k=this.size,o=this.yd,p=this.zd,n=this.field,r=k*Math.sqrt(a/c);r>k&&(r=k);for(e=0;e<r;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*o;for(g=0;g<k;g++){l=i+g;for(f=0;f<k;f++)n[p*f+l]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,l,k=this.size,o=this.yd,p=this.zd,n=this.field,r=k*Math.sqrt(a/c);r>k&&(r=k);for(f=0;f<r;f++)if(g=f/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=p*f;for(e=0;e<k;e++){l=i+e*o;for(g=0;g<k;g++)n[l+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,l,k,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(e=1;e<p;e++){k=o+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<p;g++)h=(g-this.halfsize)/this.halfsize,c=k+g,this.polygonize(h,i,l,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,l,k,o,p,n;for(f=0;f<e.count;f++)p=f*3,k=p+1,n=p+2,h=e.positionArray[p],
+i=e.positionArray[k],l=e.positionArray[n],o=new THREE.Vector3(h,i,l),h=e.normalArray[p],i=e.normalArray[k],l=e.normalArray[n],p=new THREE.Vector3(h,i,l),p.normalize(),k=new THREE.Vertex(o),c.vertices.push(k),g.push(p);o=e.count/3;for(f=0;f<o;f++)p=(a+f)*3,k=p+1,n=p+2,h=g[p],i=g[k],l=g[n],p=new THREE.Face3(p,k,n,[h,i,l]),c.faces.push(p);a+=o;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,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -694,20 +696,20 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,g,e=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],d=this.rayCast(a,g),d<Number.MAX_VALUE)g.distance=d,d>e?this.hits.push(g):this.hits.unshift(g),e=d;return this.hits};
 THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,g,e=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],d=this.rayCast(a,g),d<Number.MAX_VALUE)g.distance=d,d>e?this.hits.push(g):this.hits.unshift(g),e=d;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,e=0;e<c.numFaces;e++){var f=c.mesh.geometry.faces[e],h=c.mesh.geometry.vertices[f.a].position,i=c.mesh.geometry.vertices[f.b].position,k=c.mesh.geometry.vertices[f.c].position,l=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,h,i,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,i,k,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,e=0;e<c.numFaces;e++){var f=c.mesh.geometry.faces[e],h=c.mesh.geometry.vertices[f.a].position,i=c.mesh.geometry.vertices[f.b].position,l=c.mesh.geometry.vertices[f.c].position,k=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,h,i,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,i,l,k,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
 THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,g,e,f){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;e.set(0,0,0);h.sub(b,c);i.sub(d,b);e.cross(h,i);h=e.dot(a.direction);if(!(h<0))if(f.doubleSided||f.flipSided)e.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;f=e.dot(c)-e.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=h*g))return Number.MAX_VALUE;f/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(f);h.addSelf(a.origin);Math.abs(e.x)>
 THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,g,e,f){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;e.set(0,0,0);h.sub(b,c);i.sub(d,b);e.cross(h,i);h=e.dot(a.direction);if(!(h<0))if(f.doubleSided||f.flipSided)e.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;f=e.dot(c)-e.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=h*g))return Number.MAX_VALUE;f/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(f);h.addSelf(a.origin);Math.abs(e.x)>
 Math.abs(e.y)?Math.abs(e.x)>Math.abs(e.z)?(a=h.y-c.y,e=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(e.y)>Math.abs(e.z)?(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=e*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=e*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return f};
 Math.abs(e.y)?Math.abs(e.x)>Math.abs(e.z)?(a=h.y-c.y,e=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(e.y)>Math.abs(e.z)?(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=e*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=e*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return f};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,g=0,e=0,f=0,h=0,i=0,k=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,k=!1,f=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,k=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,k=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
-k=!1,h=1);b.origin.z<c.min.z?(e=c.min.z-b.origin.z,e/=b.direction.z,k=!1,i=-1):b.origin.z>c.max.z&&(e=c.max.z-b.origin.z,e/=b.direction.z,k=!1,i=1);if(k)return-1;k=0;g>d&&(k=1,d=g);e>d&&(k=2,d=e);switch(k){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,g=0,e=0,f=0,h=0,i=0,l=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,l=!1,f=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,l=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,l=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
+l=!1,h=1);b.origin.z<c.min.z?(e=c.min.z-b.origin.z,e/=b.direction.z,l=!1,i=-1):b.origin.z>c.max.z&&(e=c.max.z-b.origin.z,e/=b.direction.z,l=!1,i=1);if(l)return-1;l=0;g>d&&(l=1,d=g);e>d&&(l=2,d=e);switch(l){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
 d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
 d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var 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,o;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
+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,l,k,o;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),n=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:p},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
 1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(r);this.setSize=function(a,d){b.call(c,a,d);p.width=a;p.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||o!==b.fov){i=b.aspect;k=b.near;l=b.far;o=b.fov;var t=b.projectionMatrix.clone(),q=125/30*0.5,A=q*k/125,w=k*Math.tan(o*Math.PI/360),E;f.n14=q;h.n14=-q;q=-w*i+A;E=w*i+A;t.n11=2*k/(E-q);t.n13=(E+q)/(E-q);g.projectionMatrix.copy(t);q=-w*i-A;E=w*i-A;t.n11=
-2*k/(E-q);t.n13=(E+q)/(E-q);e.projectionMatrix.copy(t)}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,p,!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,n,!0);m.updateMatrixWorld();d.call(c,m,r)}};
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(r);this.setSize=function(a,d){b.call(c,a,d);p.width=a;p.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||l!==b.near||k!==b.far||o!==b.fov){i=b.aspect;l=b.near;k=b.far;o=b.fov;var v=b.projectionMatrix.clone(),q=125/30*0.5,A=q*l/125,w=l*Math.tan(o*Math.PI/360),D;f.n14=q;h.n14=-q;q=-w*i+A;D=w*i+A;v.n11=2*l/(D-q);v.n13=(D+q)/(D-q);g.projectionMatrix.copy(v);q=-w*i-A;D=w*i-A;v.n11=
+2*l/(D-q);v.n13=(D+q)/(D-q);e.projectionMatrix.copy(v)}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,p,!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,n,!0);m.updateMatrixWorld();d.call(c,m,r)}};
 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)}};

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
 c-g*d-h*f;b.x=m*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-m*-h;b.z=i*l+c*-h+m*-g-j*-e;return b}};
 c-g*d-h*f;b.x=m*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-m*-h;b.z=i*l+c*-h+m*-g-j*-e;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;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.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.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)}};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 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,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,m=k*c+g*e-h*d,j=k*d+h*c-f*e,i=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,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,m=k*c+g*e-h*d,j=k*d+h*c-f*e,i=k*e+f*d-g*c,c=-f*
 c-g*d-h*e;b.x=m*k+c*-f+j*-h-i*-g;b.y=j*k+c*-g+i*-f-m*-h;b.z=i*k+c*-h+m*-g-j*-f;return b}};
 c-g*d-h*e;b.x=m*k+c*-f+j*-h-i*-g;b.y=j*k+c*-g+i*-f-m*-h;b.z=i*k+c*-h+m*-g-j*-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.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.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.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)}};

+ 195 - 194
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,c,b,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,f=Math.max(Math.max(b,d),g),e=Math.min(Math.min(b,d),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(d-g)/h:d===f?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=e;c.v=f;return c}};
+THREE.ColorUtils={adjustHSV:function(a,c,b,d){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,h);h.h=THREE.Math.clamp(h.h+c,0,1);h.s=THREE.Math.clamp(h.s+b,0,1);h.v=THREE.Math.clamp(h.v+d,0,1);a.setHSV(h.h,h.s,h.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,h=a.b,f=Math.max(Math.max(b,d),h),e=Math.min(Math.min(b,d),h);if(e===f)e=b=0;else{var g=f-e,e=g/f,b=b===f?(d-h)/g:d===f?2+(h-b)/g:4+(b-d)/g;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=e;c.v=f;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,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},n=0;n<a.materials.length;n++)m[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=h.length;n<t;n++){var l=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(l.position);e.push(l)}n=
-0;for(t=k.length;n<t;n++){var e=k[n],s,q,r=e.vertexNormals,o=e.vertexColors;e instanceof THREE.Face3?s=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(s=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));s.normal.copy(e.normal);d&&d.multiplyVector3(s.normal);h=0;for(l=r.length;h<l;h++)q=r[h].clone(),d&&d.multiplyVector3(q),s.vertexNormals.push(q);s.color.copy(e.color);h=0;for(l=o.length;h<l;h++)q=o[h],s.vertexColors.push(q.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
-l=m[h.id];if(l===void 0)l=a.materials.length,a.materials.push(h);s.materialIndex=l}s.centroid.copy(e.centroid);b&&b.multiplyVector3(s.centroid);i.push(s)}n=0;for(t=p.length;n<t;n++){b=p[n];d=[];h=0;for(l=b.length;h<l;h++)d.push(new THREE.UV(b[h].u,b[h].v));j.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
-for(b=g.length;a<b;a++){var h=g[a],i,k,j=h.vertexNormals,p=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(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(e=p.length;d<e;d++)k=p[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
-e;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,f,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);f=1-d-g;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,g,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
-f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c));return THREE.GeometryUtils.random()*(b+
-e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,k=[],j,p,m,n;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)j=e[d.a].position,p=e[d.b].position,m=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,p,m);else if(d instanceof
-THREE.Face4)j=e[d.a].position,p=e[d.b].position,m=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,p,n),d._area2=THREE.GeometryUtils.triangleArea(p,m,n),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[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.GeometryUtils={merge:function(a,c){for(var b,d,h=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,g=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},n=0;n<a.materials.length;n++)m[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=g.length;n<t;n++){var l=new THREE.Vertex(g[n].position.clone());b&&b.multiplyVector3(l.position);e.push(l)}n=
+0;for(t=k.length;n<t;n++){var e=k[n],s,q,r=e.vertexNormals,o=e.vertexColors;e instanceof THREE.Face3?s=new THREE.Face3(e.a+h,e.b+h,e.c+h):e instanceof THREE.Face4&&(s=new THREE.Face4(e.a+h,e.b+h,e.c+h,e.d+h));s.normal.copy(e.normal);d&&d.multiplyVector3(s.normal);g=0;for(l=r.length;g<l;g++)q=r[g].clone(),d&&d.multiplyVector3(q),s.vertexNormals.push(q);s.color.copy(e.color);g=0;for(l=o.length;g<l;g++)q=o[g],s.vertexColors.push(q.clone());if(e.materialIndex!==void 0){g=f.materials[e.materialIndex];
+l=m[g.id];if(l===void 0)l=a.materials.length,a.materials.push(g);s.materialIndex=l}s.centroid.copy(e.centroid);b&&b.multiplyVector3(s.centroid);i.push(s)}n=0;for(t=p.length;n<t;n++){b=p[n];d=[];g=0;for(l=b.length;g<l;g++)d.push(new THREE.UV(b[g].u,b[g].v));j.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,h=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
+for(b=h.length;a<b;a++){var g=h[a],i,k,j=g.vertexNormals,p=g.vertexColors;g instanceof THREE.Face3?i=new THREE.Face3(g.a,g.b,g.c):g instanceof THREE.Face4&&(i=new THREE.Face4(g.a,g.b,g.c,g.d));i.normal.copy(g.normal);d=0;for(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(g.color);d=0;for(e=p.length;d<e;d++)k=p[d],i.vertexColors.push(k.clone());i.materialIndex=g.materialIndex;i.centroid.copy(g.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){h=f[a];i=[];d=0;for(e=h.length;d<
+e;d++)i.push(new THREE.UV(h[d].u,h[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,h,f,e=new THREE.Vector3,g=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();d+h>1&&(d=1-d,h=1-h);f=1-d-h;e.copy(a);e.multiplyScalar(d);g.copy(c);g.multiplyScalar(h);e.addSelf(g);g.copy(b);g.multiplyScalar(f);e.addSelf(g);return e},randomPointInFace:function(a,c,b){var d,h,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,h=c.vertices[a.b].position,
+f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,h,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;h=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,h,c),e=THREE.GeometryUtils.triangleArea(h,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,h,c),e=THREE.GeometryUtils.triangleArea(h,f,c));return THREE.GeometryUtils.random()*(b+
+e)<b?THREE.GeometryUtils.randomPointInTriangle(d,h,c):THREE.GeometryUtils.randomPointInTriangle(h,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,h,f=a.faces,e=a.vertices,g=f.length,i=0,k=[],j,p,m,n;for(h=0;h<g;h++){d=f[h];if(d instanceof THREE.Face3)j=e[d.a].position,p=e[d.b].position,m=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,p,m);else if(d instanceof
+THREE.Face4)j=e[d.a].position,p=e[d.b].position,m=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,p,n),d._area2=THREE.GeometryUtils.triangleArea(p,m,n),d._area=d._area1+d._area2;i+=d._area;k[h]=i}d=[];e={};for(h=0;h<c;h++)g=THREE.GeometryUtils.random()*i,g=b(g),d[h]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0),e[g]?e[g]+=1:e[g]=1;return d},triangleArea:function(a,c,b){var d,h=THREE.GeometryUtils.__v1;h.sub(a,c);d=h.length();h.sub(a,b);a=h.length();h.sub(c,b);b=h.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=[],f=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)f.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return f},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,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),k=i.data,j=0;j<d;j++)for(var p=1;p<g;p++){var m=p-1<0?g-1:p-1,n=(p+1)%g,t=j-1<0?d-1:j-1,l=(j+1)%d,s=[],q=[0,0,h[(p*d+j)*4]/255*c];s.push([-1,0,h[(p*d+t)*4]/255*c]);s.push([-1,-1,h[(m*d+t)*4]/255*c]);s.push([0,-1,h[(m*d+j)*4]/255*c]);s.push([1,-1,h[(m*d+l)*4]/255*c]);
-s.push([1,0,h[(p*d+l)*4]/255*c]);s.push([1,1,h[(n*d+l)*4]/255*c]);s.push([0,1,h[(n*d+j)*4]/255*c]);s.push([-1,1,h[(n*d+t)*4]/255*c]);m=[];t=s.length;for(n=0;n<t;n++){var l=s[n],r=s[(n+1)%t],l=[l[0]-q[0],l[1]-q[1],l[2]-q[2]],r=[r[0]-q[0],r[1]-q[1],r[2]-q[2]];m.push(b([l[1]*r[2]-l[2]*r[1],l[2]*r[0]-l[0]*r[2],l[0]*r[1]-l[1]*r[0]]))}s=[0,0,0];for(n=0;n<m.length;n++)s[0]+=m[n][0],s[1]+=m[n][1],s[2]+=m[n][2];s[0]/=m.length;s[1]/=m.length;s[2]/=m.length;q=(p*d+j)*4;k[q]=(s[0]+1)/2*255|0;k[q+1]=(s[1]+0.5)*
-255|0;k[q+2]=s[2]*255|0;k[q+3]=255}e.putImageData(i,0,0);return f}};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 f=new THREE.Mesh(a,c[b]);g.add(f)}return g}};
+THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,h=new THREE.Texture(d,c);d.onload=function(){h.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return h},loadTextureCube:function(a,c,b){var d,h=[],f=new THREE.Texture(h,c),c=h.loadCount=0;for(d=a.length;c<d;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount===6)f.needsUpdate=!0;b&&b(this)},h[c].crossOrigin="",h[c].src=a[c];return f},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,h=a.height,f=document.createElement("canvas");f.width=d;f.height=h;var e=f.getContext("2d");e.drawImage(a,0,0);for(var g=e.getImageData(0,0,d,h).data,i=e.createImageData(d,h),k=i.data,j=0;j<d;j++)for(var p=1;p<h;p++){var m=p-1<0?h-1:p-1,n=(p+1)%h,t=j-1<0?d-1:j-1,l=(j+1)%d,s=[],q=[0,0,g[(p*d+j)*4]/255*c];s.push([-1,0,g[(p*d+t)*4]/255*c]);s.push([-1,-1,g[(m*d+t)*4]/255*c]);s.push([0,-1,g[(m*d+j)*4]/255*c]);s.push([1,-1,g[(m*d+l)*4]/255*c]);
+s.push([1,0,g[(p*d+l)*4]/255*c]);s.push([1,1,g[(n*d+l)*4]/255*c]);s.push([0,1,g[(n*d+j)*4]/255*c]);s.push([-1,1,g[(n*d+t)*4]/255*c]);m=[];t=s.length;for(n=0;n<t;n++){var l=s[n],r=s[(n+1)%t],l=[l[0]-q[0],l[1]-q[1],l[2]-q[2]],r=[r[0]-q[0],r[1]-q[1],r[2]-q[2]];m.push(b([l[1]*r[2]-l[2]*r[1],l[2]*r[0]-l[0]*r[2],l[0]*r[1]-l[1]*r[0]]))}s=[0,0,0];for(n=0;n<m.length;n++)s[0]+=m[n][0],s[1]+=m[n][1],s[2]+=m[n][2];s[0]/=m.length;s[1]/=m.length;s[2]/=m.length;q=(p*d+j)*4;k[q]=(s[0]+1)/2*255|0;k[q+1]=(s[1]+0.5)*
+255|0;k[q+2]=s[2]*255|0;k[q+3]=255}e.putImageData(i,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,h=a.children.length;for(d=0;d<h;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,h=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);h.add(f)}return h}};
 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",
@@ -23,97 +23,97 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
-THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,d=this.getPoint(0),g,f=0;c.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),f+=b.distanceTo(d),c.push(f),d=b;return this.cacheArcLengths=c};
-THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),d=0,g=b.length,f;f=c?c:a*b[g-1];Date.now();for(var e=0,h=g-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=b[d]-f,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(b[d]==f)return d/(g-1);e=b[d];return b=(d+(f-e)/(b[d+1]-e))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,d=this.getPoint(0),h,f=0;c.push(0);for(h=1;h<=a;h++)b=this.getPoint(h/a),f+=b.distanceTo(d),c.push(f),d=b;return this.cacheArcLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),d=0,h=b.length,f;f=c?c:a*b[h-1];Date.now();for(var e=0,g=h-1,i;e<=g;)if(d=Math.floor(e+(g-e)/2),i=b[d]-f,i<0)e=d+1;else if(i>0)g=d-1;else{g=d;break}d=g;if(b[d]==f)return d/(h-1);e=b[d];return b=(d+(f-e)/(b[d+1]-e))/(h-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
 THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,d){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,d))};THREE.LineCurve.prototype=new THREE.Curve;
 THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,d){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,d))};THREE.LineCurve.prototype=new THREE.Curve;
 THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
 THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
 THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),c=new THREE.Vector2(d[2],d[3]),b=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
 THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),c=new THREE.Vector2(d[2],d[3]),b=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
 THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
 THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
-THREE.CubicBezierCurve=function(a,c,b,d){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),d=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve=function(a,c,b,d){if(!(c instanceof THREE.Vector2))var h=Array.prototype.slice.call(arguments),a=new THREE.Vector2(h[0],h[1]),c=new THREE.Vector2(h[2],h[3]),b=new THREE.Vector2(h[4],h[5]),d=new THREE.Vector2(h[6],h[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
 THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
 THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
 THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
 THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
-THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],d=this.points,g;g=(d.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,g);return c};THREE.ArcCurve=function(a,c,b,d,g,f){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=d;this.aEndAngle=g;this.aClockwise=f};
+THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],d=this.points,h;h=(d.length-1)*a;a=Math.floor(h);h-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,h);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,h);return c};THREE.ArcCurve=function(a,c,b,d,h,f){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=d;this.aEndAngle=h;this.aClockwise=f};
 THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
 THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,d){return 2*(1-a)*(b-c)+2*a*(d-b)},tangentCubicBezier:function(a,c,b,d,g){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,d,g){var a=(b-a)*0.5,d=(d-c)*0.5,f=g*g;return(2*c-2*b+a+d)*g*f+(-3*c+3*b-2*a-d)*f+a*g+c}};
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,d){return 2*(1-a)*(b-c)+2*a*(d-b)},tangentCubicBezier:function(a,c,b,d,h){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*h},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,d,h){var a=(b-a)*0.5,d=(d-c)*0.5,f=h*h;return(2*c-2*b+a+d)*h*f+(-3*c+3*b-2*a-d)*f+a*h+c}};
 THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(this.v2,this.v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
 THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(this.v2,this.v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
 THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
 THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
 THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,d){this.v0=a;this.v1=c;this.v2=b;this.v3=d},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
 THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,d){this.v0=a;this.v1=c;this.v2=b;this.v3=d},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],d=this.points,g;g=(d.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,g);c.z=THREE.Curve.Utils.interpolate(d[b[0]].z,d[b[1]].z,d[b[2]].z,d[b[3]].z,g);return c});
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],d=this.points,h;h=(d.length-1)*a;a=Math.floor(h);h-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,h);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,h);c.z=THREE.Curve.Utils.interpolate(d[b[0]].z,d[b[1]].z,d[b[2]].z,d[b[3]].z,h);return c});
 THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
 THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
 THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,d=this.curves.length;for(b=0;b<d;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,d=this.curves.length;for(b=0;b<d;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,d,g;c=b=Number.NEGATIVE_INFINITY;d=g=Number.POSITIVE_INFINITY;var f,e,h,i;i=new THREE.Vector2;e=0;for(h=a.length;e<h;e++){f=a[e];if(f.x>c)c=f.x;else if(f.x<d)d=f.x;if(f.y>b)b=f.y;else if(f.y<b)g=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:g,maxX:c,maxY:b,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,d,h;c=b=Number.NEGATIVE_INFINITY;d=h=Number.POSITIVE_INFINITY;var f,e,g,i;i=new THREE.Vector2;e=0;for(g=a.length;e<g;e++){f=a[e];if(f.x>c)c=f.x;else if(f.x<d)d=f.x;if(f.y>b)b=f.y;else if(f.y<b)h=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:h,maxX:c,maxY:b,centroid:i.divideScalar(g)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
-THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),d,g;if(!c)c=this.bends;d=0;for(g=c.length;d<g;d++)b=this.getWrapPoints(b,c[d]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),d,g;if(!c)c=this.bends;d=0;for(g=c.length;d<g;d++)b=this.getWrapPoints(b,c[d]);return b};
-THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),d,g,f,e,h,i;d=0;for(g=a.length;d<g;d++)f=a[d],e=f.x,h=f.y,i=e/b.maxX,i=c.getUtoTmapping(i,e),e=c.getPoint(i),h=c.getNormalVector(i).multiplyScalar(h),f.x=e.x+h.x,f.y=e.y+h.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
+THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),d,h;if(!c)c=this.bends;d=0;for(h=c.length;d<h;d++)b=this.getWrapPoints(b,c[d]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),d,h;if(!c)c=this.bends;d=0;for(h=c.length;d<h;d++)b=this.getWrapPoints(b,c[d]);return b};
+THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),d,h,f,e,g,i;d=0;for(h=a.length;d<h;d++)f=a[d],e=f.x,g=f.y,i=e/b.maxX,i=c.getUtoTmapping(i,e),e=c.getPoint(i),g=c.getNormalVector(i).multiplyScalar(g),f.x=e.x+g.x,f.y=e.y+g.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
 THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
 THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
 THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
 THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
-THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g})};
-THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,f){var e=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,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
+THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var h=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:h})};
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,h,f){var e=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(g[g.length-2],g[g.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(h,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 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,f){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,f));this.actions.push({action:THREE.PathActions.ARC,args:e})};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,f,e,h,i,k,j,p,m,n,t,l;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];m=f[1];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)l=e/a,f=THREE.Shape.Utils.b2(l,n,p,h),l=THREE.Shape.Utils.b2(l,t,m,
-i),b.push(new THREE.Vector2(f,l));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];m=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)l=e/a,f=THREE.Shape.Utils.b3(l,n,p,k,h),l=THREE.Shape.Utils.b3(l,t,m,j,i),b.push(new THREE.Vector2(f,l));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];l=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
-for(e=1;e<=l;e++)b.push(f.getPointAt(e/l));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];p=f[3];l=f[4];m=!!f[5];j=e[e.length-2];n=e[e.length-1];e.length==0&&(j=n=0);t=l-p;var s=a*2;for(e=1;e<=s;e++)l=e/s,m||(l=1-l),l=p+l*t,f=j+h+k*Math.cos(l),l=n+i+k*Math.sin(l),b.push(new THREE.Vector2(f,l))}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,f){var e=this.getPoints(),h,i,k,j,p;h=0;for(i=e.length;h<i;h++)k=e[h],j=k.x,p=k.y,k.x=a*j+c*p+b,k.y=d*p+g*j+f;return e};
-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()};
-THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],f=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(g.push(f),f=new THREE.Path),f[b].apply(f,d);f.actions.length!=0&&g.push(f);if(g.length==0)return[];var e,f=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e&&f.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
-d.curves):e.holes.push(d);f.push(e)}else{e=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,f.push(e),e=new THREE.Shape):e.holes.push(d)}return f};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.Path.prototype.arc=function(a,c,b,d,h,f){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,h,f));this.actions.push({action:THREE.PathActions.ARC,args:e})};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,h,f,e,g,i,k,j,p,m,n,t,l;d=0;for(h=this.actions.length;d<h;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:g=f[2];i=f[3];p=f[0];m=f[1];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)l=e/a,f=THREE.Shape.Utils.b2(l,n,p,g),l=THREE.Shape.Utils.b2(l,t,m,
+i),b.push(new THREE.Vector2(f,l));break;case THREE.PathActions.BEZIER_CURVE_TO:g=f[4];i=f[5];p=f[0];m=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)l=e/a,f=THREE.Shape.Utils.b3(l,n,p,k,g),l=THREE.Shape.Utils.b3(l,t,m,j,i),b.push(new THREE.Vector2(f,l));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];l=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
+for(e=1;e<=l;e++)b.push(f.getPointAt(e/l));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;g=f[0];i=f[1];k=f[2];p=f[3];l=f[4];m=!!f[5];j=e[e.length-2];n=e[e.length-1];e.length==0&&(j=n=0);t=l-p;var s=a*2;for(e=1;e<=s;e++)l=e/s,m||(l=1-l),l=p+l*t,f=j+g+k*Math.cos(l),l=n+i+k*Math.sin(l),b.push(new THREE.Vector2(f,l))}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,h,f){var e=this.getPoints(),g,i,k,j,p;g=0;for(i=e.length;g<i;g++)k=e[g],j=k.x,p=k.y,k.x=a*j+c*p+b,k.y=d*p+h*j+f;return e};
+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,h,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],h=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";d=
+this.getPoints();a=0;for(b=d.length;a<b;a++)h=d[a],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
+THREE.Path.prototype.toShapes=function(){var a,c,b,d,h=[],f=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(h.push(f),f=new THREE.Path),f[b].apply(f,d);f.actions.length!=0&&h.push(f);if(h.length==0)return[];var e,f=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){a=0;for(c=h.length;a<c;a++)d=h[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e&&f.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
+d.curves):e.holes.push(d);f.push(e)}else{e=new THREE.Shape;a=0;for(c=h.length;a<c;a++)d=h[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,f.push(e),e=new THREE.Shape):e.holes.push(d)}return f};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,f,e,h,i,k,j,p,m,n,t=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){m=k[g];n=[];for(p=0;p<b.length;p++)j=b[p],j=m.distanceToSquared(j),n.push(j),j<f&&(f=j,e=g,h=p)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var l=[k[e],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(l);var s=[k[e],k[f],b[h]];m=THREE.FontUtils.Triangulate.area(s);n=h;j=e;h+=1;e+=-1;h<
-0&&(h+=b.length);h%=b.length;e<0&&(e+=k.length);e%=k.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;l=[k[e],b[h],b[g]];l=THREE.FontUtils.Triangulate.area(l);s=[k[e],k[f],b[h]];s=THREE.FontUtils.Triangulate.area(s);p+m>l+s&&(h=n,e=j,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=k.length),e%=k.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:k.length-1);p=b.slice(0,h);m=b.slice(h);n=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[h]];t.push([k[e],b[h],b[g]]);t.push(f);b=p.concat(n).concat(j).concat(m)}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),f,e,h,i,k={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];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)+
-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",f=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=f};
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),h,f,e,g,i,k,j,p,m,n,t=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(h=0;h<k.length;h++){m=k[h];n=[];for(p=0;p<b.length;p++)j=b[p],j=m.distanceToSquared(j),n.push(j),j<f&&(f=j,e=h,g=p)}h=g-1>=0?g-1:b.length-1;f=e-1>=0?e-1:k.length-1;var l=[k[e],b[g],b[h]];p=THREE.FontUtils.Triangulate.area(l);var s=[k[e],k[f],b[g]];m=THREE.FontUtils.Triangulate.area(s);n=g;j=e;g+=1;e+=-1;g<
+0&&(g+=b.length);g%=b.length;e<0&&(e+=k.length);e%=k.length;h=g-1>=0?g-1:b.length-1;f=e-1>=0?e-1:k.length-1;l=[k[e],b[g],b[h]];l=THREE.FontUtils.Triangulate.area(l);s=[k[e],k[f],b[g]];s=THREE.FontUtils.Triangulate.area(s);p+m>l+s&&(g=n,e=j,g<0&&(g+=b.length),g%=b.length,e<0&&(e+=k.length),e%=k.length,h=g-1>=0?g-1:b.length-1,f=e-1>=0?e-1:k.length-1);p=b.slice(0,g);m=b.slice(g);n=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[g]];t.push([k[e],b[g],b[h]]);t.push(f);b=p.concat(n).concat(j).concat(m)}return{shape:b,
+isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,h=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,g,i,k={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=f;f=0;for(e=b.length;f<e;f++){g=b[f];for(d=0;d<3;d++)i=g[d].x+":"+g[d].y,i=k[i],i!==void 0&&(g[d]=i)}f=0;for(e=h.length;f<e;f++){g=h[f];for(d=0;d<3;d++)i=g[d].x+":"+g[d].y,i=k[i],i!==void 0&&(g[d]=i)}return b.concat(h)},
+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,h){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
+this.b3p3(a,h)}};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",h=c.weight!==void 0?c.weight:"normal",f=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=h;THREE.FontUtils.style=f};
 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};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var d=0;d<a.length;d++)a[d].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var d=0;d<a.length;d++)a[d].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
-0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var j=
-{};for(k in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var g=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){g={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];g[k]=-1}a.hierarchy[b].usedMorphTargets=g;for(d=0;d<a.hierarchy[b].keys.length;d++){var j=
+{};for(k in g){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
-THREE.Bone?g.skinMatrix:g.matrix;var f=g.animationCache.prevKey;g=g.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.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.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,h;for(b=0;b<d;b++){h=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)h.useQuaternion=!0;h.matrixAutoUpdate=!0;if(h.animationCache===void 0)h.animationCache={},h.animationCache.prevKey={pos:0,rot:0,scl:0},h.animationCache.nextKey={pos:0,rot:0,scl:0},h.animationCache.originalMatrix=h instanceof
+THREE.Bone?h.skinMatrix:h.matrix;var f=h.animationCache.prevKey;h=h.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];h.pos=this.getNextKeyWith("pos",b,1);h.rot=this.getNextKeyWith("rot",b,1);h.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,f,e,h,i,k,j=this.data.JIT.hierarchy,p,m;this.currentTime+=a*this.timeScale;m=this.currentTime;p=this.currentTime%=this.data.length;k=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&j[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[n][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 l=0;l<3;l++){b=c[l];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=m){if(p<m)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<p;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
-p)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-e.time)/(h.time-e.time);g=e[b];f=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=g,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,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===
-"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,k;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return d};
-THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,h,f,e,g,i,k,j=this.data.JIT.hierarchy,p,m;this.currentTime+=a*this.timeScale;m=this.currentTime;p=this.currentTime%=this.data.length;k=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&j[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=j[n][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 l=0;l<3;l++){b=c[l];e=i.prevKey[b];g=i.nextKey[b];if(g.time<=m){if(p<m)if(this.loop){e=this.data.hierarchy[n].keys[0];for(g=this.getNextKeyWith(b,n,1);g.time<p;)e=g,g=this.getNextKeyWith(b,n,g.index+1)}else{this.stop();return}else{do e=g,g=this.getNextKeyWith(b,n,g.index+1);while(g.time<
+p)}i.prevKey[b]=e;i.nextKey[b]=g}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-e.time)/(g.time-e.time);h=e[b];f=g[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=h[0]+(f[0]-h[0])*d,b.y=h[1]+(f[1]-h[1])*d,b.z=h[2]+(f[2]-h[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=h,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,g.index+1).pos,d=d*0.33+0.33,h=this.interpolateCatmullRom(this.points,d),b.x=h[0],b.y=h[1],b.z=h[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===
+"rot")THREE.Quaternion.slerp(h,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=h[0]+(f[0]-h[0])*d,b.y=h[1]+(f[1]-h[1])*d,b.z=h[2]+(f[2]-h[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],h,f,e,g,i,k;h=(a.length-1)*c;f=Math.floor(h);h-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];g=a[b[1]];i=a[b[2]];k=a[b[3]];b=h*h;e=h*b;d[0]=this.interpolate(f[0],g[0],i[0],k[0],h,b,e);d[1]=this.interpolate(f[1],g[1],i[1],k[1],h,b,e);d[2]=this.interpolate(f[2],g[2],i[2],k[2],h,b,e);return d};
+THREE.Animation.prototype.interpolate=function(a,c,b,d,h,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*h+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
 1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var d=this.renderTarget;d.activeCubeFace=0;a.render(b,this.cameraPX,d);d.activeCubeFace=1;a.render(b,this.cameraNX,d);d.activeCubeFace=2;a.render(b,this.cameraPY,d);d.activeCubeFace=3;a.render(b,
 1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var d=this.renderTarget;d.activeCubeFace=0;a.render(b,this.cameraPX,d);d.activeCubeFace=1;a.render(b,this.cameraNX,d);d.activeCubeFace=2;a.render(b,this.cameraPY,d);d.activeCubeFace=3;a.render(b,
 this.cameraNY,d);d.activeCubeFace=4;a.render(b,this.cameraPZ,d);d.activeCubeFace=5;a.render(b,this.cameraNZ,d)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
 this.cameraNY,d);d.activeCubeFace=4;a.render(b,this.cameraPZ,d);d.activeCubeFace=5;a.render(b,this.cameraNZ,d)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,d,g,f,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,f,e);this.cameraP=new THREE.PerspectiveCamera(b,a/c,d,g);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,d,h,f,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,f,e);this.cameraP=new THREE.PerspectiveCamera(b,a/c,d,h);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
 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.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=
+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=
 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=
-!1;break;case 70:this.moveDown=!1}};this.update=function(a){if(!this.freeze){if(this.heightSpeed){var b=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*b*this.heightCoef}else this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&this.object.translateX(b);
-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);
-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,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),s=g.length,q=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:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<s-1;f++)q=c*h.chunks[f]/h.total,b.keys[f]={time:q,pos:g[f]};e.hierarchy[0]=
+!1;break;case 70:this.moveDown=!1}};this.update=function(a){var b=0;if(!this.freeze){if(this.heightSpeed){var c=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*c*this.heightCoef}else this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&
+this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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)};
+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 h(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,h=b.getControlPointsArray(),g=b.getLength(),s=h.length,q=0;f=s-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:c,pos:h[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<s-1;f++)q=c*g.chunks[f]/g.total,b.keys[f]={time:q,pos:h[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(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 f(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.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;
+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=
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,g=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)*g;this.theta=this.lon*g;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=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,e=f(b,10),c=f(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),
+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=h(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=h(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=f(b,10),c=f(b,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,g),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),g=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,g),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.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,
+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,
 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=
@@ -122,121 +122,122 @@ 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,f=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,p=0,m=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*p);this.rotateVertically(c*m)}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*j);e&&(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;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
+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,h=new THREE.Vector3,f=new THREE.Matrix4,e=!1,g=1,i=0,k=0,j=0,p=0,m=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*p);this.rotateVertically(c*m)}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*j);e&&(this.roll+=this.rollSpeed*a*g);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);d.set(0,1,0);b.cross(d,
+h).normalize();d.cross(h,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=h.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=h.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=h.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);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){p=(a.clientX-n)/window.innerWidth;m=(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){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-n)/window.innerWidth;m=(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:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:j=1;break;case 70:j=-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:e=!1;break;case 69:e=!1;break;case 82:j=0;break;case 70:j=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:e=!0;g=1;break;case 69:e=!0;g=-1;break;case 82:j=1;break;case 70:j=-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:e=!1;break;case 69:e=!1;break;case 82:j=0;break;case 70:j=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,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,p=new THREE.Vector2,m=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-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)/
-b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),f=d.length();f>1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e);
-d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=m.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+new THREE.Vector3(0,0,0);var h=!1,f=d.NONE,e=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,p=new THREE.Vector2,m=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-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)/
+b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),f=d.length();f>1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(g.dot(i)/g.length()/i.length());if(a){var c=(new THREE.Vector3).cross(g,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e);
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?g=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=m.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
 b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=m:p.addSelf(a.sub(m,p).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
 b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=m:p.addSelf(a.sub(m,p).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,e);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=j=b.getMouseOnScreen(a.clientX,a.clientY),p=m=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=b.getMouseOnScreen(a.clientX,
-a.clientY):f===d.PAN&&!b.noPan&&(m=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=j=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=m=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
-f=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===d.NONE){if(a.keyCode===b.keys[d.ROTATE])f=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)f=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)f=d.PAN;f!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==d.NONE)f=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,j,n){var l,m,p=d||1,o=g||1,q=h/2,s=i/2,t=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")l="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")l="y",o=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")l="x",p=f||1;var r=p+1,K=o+1;h/=p;var H=i/o;for(m=0;m<K;m++)for(i=0;i<r;i++){var N=new THREE.Vector3;N[a]=(i*h-q)*c;N[b]=(m*H-s)*e;N[l]=j;k.vertices.push(new THREE.Vertex(N))}for(m=0;m<o;m++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
-r*m+t,i+r*(m+1)+t,i+1+r*(m+1)+t,i+1+r*m+t,null,null,n)),k.faceVertexUvs[0].push([new THREE.UV(i/p,m/o),new THREE.UV(i/p,(m+1)/o),new THREE.UV((i+1)/p,(m+1)/o),new THREE.UV((i+1)/p,m/o)])}THREE.Geometry.call(this);var k=this,j=a/2,p=c/2,m=b/2,n,t,l,s,q,r;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;s=1;t=2;q=3;l=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var o in h)this.sides[o]!=
-void 0&&(this.sides[o]=h[o]);this.sides.px&&i("z","y",-1,-1,b,c,j,n);this.sides.nx&&i("z","y",1,-1,b,c,-j,s);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,q);this.sides.pz&&i("x","y",1,-1,a,c,m,l);this.sides.nz&&i("x","y",-1,-1,a,c,-m,r);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,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,k=[],j=[];for(i=0;i<=g;i++){var p=[],m=[],n=i/g,t=n*(c-a)+a;for(h=0;h<=d;h++){var l=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(l*Math.PI*2),-n*b+e,t*Math.cos(l*Math.PI*2))));p.push(this.vertices.length-1);m.push(new THREE.UV(l,n))}k.push(p);j.push(m)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],p=k[i+1][h],m=k[i+1][h+1],n=k[i][h+1],t=
-this.vertices[b].position.clone().setY(0).normalize(),l=this.vertices[p].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),q=this.vertices[n].position.clone().setY(0).normalize(),r=j[i][h].clone(),o=j[i+1][h].clone(),u=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(b,p,m,n,[t,l,s,q]));this.faceVertexUvs[0].push([r,o,u,y])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=k[0][h],p=k[0][h+
-1],m=this.vertices.length-1,t=new THREE.Vector3(0,1,0),l=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),r=j[0][h].clone(),o=j[0][h+1].clone(),u=new THREE.UV(o.u,0),this.faces.push(new THREE.Face3(b,p,m,[t,l,s])),this.faceVertexUvs[0].push([r,o,u])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=k[i][h+1],p=k[i][h],m=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),l=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),r=j[i][h+1].clone(),o=j[i][h].clone(),
+b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(h&&(g=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=b.getMouseOnScreen(a.clientX,a.clientY),p=m=b.getMouseOnScreen(a.clientX,a.clientY),h=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=b.getMouseOnScreen(a.clientX,
+a.clientY):f===d.PAN&&!b.noPan&&(m=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?g=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=j=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=m=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+f=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===d.NONE){if(a.keyCode===b.keys[d.ROTATE])f=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)f=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)f=d.PAN;f!==d.NONE&&(h=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==d.NONE)f=d.NONE},!1)};
+THREE.CubeGeometry=function(a,c,b,d,h,f,e,g){function i(a,b,c,e,g,i,j,n){var l,m=d||1,p=h||1,o=g/2,q=i/2,s=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")l="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")l="y",p=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")l="x",m=f||1;var t=m+1,r=p+1,L=g/m,H=i/p,M=new THREE.Vector3;M[l]=j>0?1:-1;for(g=0;g<r;g++)for(i=0;i<t;i++){var J=new THREE.Vector3;J[a]=(i*L-o)*c;J[b]=(g*H-q)*e;J[l]=j;k.vertices.push(new THREE.Vertex(J))}for(g=0;g<p;g++)for(i=0;i<m;i++)a=
+new THREE.Face4(i+t*g+s,i+t*(g+1)+s,i+1+t*(g+1)+s,i+1+t*g+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=n,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/m,g/p),new THREE.UV(i/m,(g+1)/p),new THREE.UV((i+1)/m,(g+1)/p),new THREE.UV((i+1)/m,g/p)])}THREE.Geometry.call(this);var k=this,j=a/2,p=c/2,m=b/2,n,t,l,s,q,r;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;s=1;t=2;q=
+3;l=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(g!=void 0)for(var o in g)this.sides[o]!=void 0&&(this.sides[o]=g[o]);this.sides.px&&i("z","y",-1,-1,b,c,j,n);this.sides.nx&&i("z","y",1,-1,b,c,-j,s);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,q);this.sides.pz&&i("x","y",1,-1,a,c,m,l);this.sides.nz&&i("x","y",-1,-1,a,c,-m,r);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,d,h,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,h=h||1,g,i,k=[],j=[];for(i=0;i<=h;i++){var p=[],m=[],n=i/h,t=n*(c-a)+a;for(g=0;g<=d;g++){var l=g/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(l*Math.PI*2),-n*b+e,t*Math.cos(l*Math.PI*2))));p.push(this.vertices.length-1);m.push(new THREE.UV(l,n))}k.push(p);j.push(m)}for(i=0;i<h;i++)for(g=0;g<d;g++){var b=k[i][g],p=k[i+1][g],m=k[i+1][g+1],n=k[i][g+1],t=
+this.vertices[b].position.clone().setY(0).normalize(),l=this.vertices[p].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),q=this.vertices[n].position.clone().setY(0).normalize(),r=j[i][g].clone(),o=j[i+1][g].clone(),u=j[i+1][g+1].clone(),y=j[i][g+1].clone();this.faces.push(new THREE.Face4(b,p,m,n,[t,l,s,q]));this.faceVertexUvs[0].push([r,o,u,y])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(g=0;g<d;g++)b=k[0][g],p=k[0][g+
+1],m=this.vertices.length-1,t=new THREE.Vector3(0,1,0),l=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),r=j[0][g].clone(),o=j[0][g+1].clone(),u=new THREE.UV(o.u,0),this.faces.push(new THREE.Face3(b,p,m,[t,l,s])),this.faceVertexUvs[0].push([r,o,u])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(g=0;g<d;g++)b=k[i][g+1],p=k[i][g],m=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),l=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),r=j[i][g+1].clone(),o=j[i][g].clone(),
 u=new THREE.UV(o.u,1),this.faces.push(new THREE.Face3(b,p,m,[t,l,s])),this.faceVertexUvs[0].push([r,o,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 u=new THREE.UV(o.u,1),this.faces.push(new THREE.Face3(b,p,m,[t,l,s])),this.faceVertexUvs[0].push([r,o,u])}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,h;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)h=a[b],this.addShape(h,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(v=a.length;--v>=0;){L=v;M=v-1;M<0&&(M=a.length-1);for(var b=
-0,c=n+j*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),f=R+L+d,g=R+L+e,k=f,d=R+M+d,e=R+M+e,m=g;k+=F;d+=F;e+=F;m+=F;C.faces.push(new THREE.Face4(k,d,e,m,null,null,u));u&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,b,c,null,
-null,o));if(o){var d=y.maxY,e=y.maxX,f=C.vertices[b].position.x,b=C.vertices[b].position.y,g=C.vertices[c].position.x,c=C.vertices[c].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[a].position.x/e,C.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,j=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,m=c.curveSegments!==
+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 h(a){for(v=a.length;--v>=0;){J=v;N=v-1;N<0&&(N=a.length-1);for(var b=
+0,c=n+j*2,b=0;b<c;b++){var d=K*b,e=K*(b+1),f=R+J+d,h=R+J+e,k=f,d=R+N+d,e=R+N+e,m=h;k+=F;d+=F;e+=F;m+=F;C.faces.push(new THREE.Face4(k,d,e,m,null,null,u));u&&(k=b/c,d=(b+1)/c,e=g+i*2,f=(C.vertices[f].position.z+i)/e,h=(C.vertices[h].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(h,k),new THREE.UV(h,d),new THREE.UV(f,d)]))}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,b,c,null,
+null,o));if(o){var d=y.maxY,e=y.maxX,f=C.vertices[b].position.x,b=C.vertices[b].position.y,g=C.vertices[c].position.x,c=C.vertices[c].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[a].position.x/e,C.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var g=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,j=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,m=c.curveSegments!==
 void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,l=c.extrudePath,s,q=!1,r=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,o=c.material,u=c.extrudeMaterial,y=this.shapebb;if(l)s=l.getPoints(m),n=s.length,q=!0,p=!1;p||(k=i=j=0);var w,x,A,C=this,F=this.vertices.length;t&&a.addWrapPath(t);m=r?a.extractAllSpacedPoints(m):a.extractAllPoints(m);t=m.shape;m=m.holes;if(l=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();x=0;for(A=m.length;x<A;x++)w=m[x],THREE.Shape.Utils.isClockWise(w)&&
 void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,l=c.extrudePath,s,q=!1,r=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,o=c.material,u=c.extrudeMaterial,y=this.shapebb;if(l)s=l.getPoints(m),n=s.length,q=!0,p=!1;p||(k=i=j=0);var w,x,A,C=this,F=this.vertices.length;t&&a.addWrapPath(t);m=r?a.extractAllSpacedPoints(m):a.extractAllPoints(m);t=m.shape;m=m.holes;if(l=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();x=0;for(A=m.length;x<A;x++)w=m[x],THREE.Shape.Utils.isClockWise(w)&&
-(m[x]=w.reverse());l=!1}l=THREE.Shape.Utils.triangulateShape(t,m);r=t;x=0;for(A=m.length;x<A;x++)w=m[x],t=t.concat(w);var v,D,z,G,I,E,J=t.length,O=l.length,B=[];v=0;D=r.length;L=D-1;for(M=v+1;v<D;v++,L++,M++)L===D&&(L=0),M===D&&(M=0),B[v]=d(r[v],r[L],r[M]);var K=[],H,N=B.concat();x=0;for(A=m.length;x<A;x++){w=m[x];H=[];v=0;D=w.length;L=D-1;for(M=v+1;v<D;v++,L++,M++)L===D&&(L=0),M===D&&(M=0),H[v]=d(w[v],w[L],w[M]);K.push(H);N=N.concat(H)}for(z=0;z<j;z++){G=z/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=
-0;for(D=r.length;v<D;v++)E=b(r[v],B[v],G),f(E.x,E.y,-I);x=0;for(A=m.length;x<A;x++){w=m[x];H=K[x];v=0;for(D=w.length;v<D;v++)E=b(w[v],H[v],G),f(E.x,E.y,-I)}}G=k;for(v=0;v<J;v++)E=p?b(t[v],N[v],G):t[v],q?f(E.x,E.y+s[0].y,s[0].x):f(E.x,E.y,0);for(z=1;z<=n;z++)for(v=0;v<J;v++)E=p?b(t[v],N[v],G):t[v],q?f(E.x,E.y+s[z-1].y,s[z-1].x):f(E.x,E.y,h/n*z);for(z=j-1;z>=0;z--){G=z/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=0;for(D=r.length;v<D;v++)E=b(r[v],B[v],G),f(E.x,E.y,h+I);x=0;for(A=m.length;x<A;x++){w=m[x];
-H=K[x];v=0;for(D=w.length;v<D;v++)E=b(w[v],H[v],G),q?f(E.x,E.y+s[n-1].y,s[n-1].x+I):f(E.x,E.y,h+I)}}if(p){p=J*0;for(v=0;v<O;v++)k=l[v],e(k[2]+p,k[1]+p,k[0]+p);p=J*(n+j*2);for(v=0;v<O;v++)k=l[v],e(k[0]+p,k[1]+p,k[2]+p)}else{for(v=0;v<O;v++)k=l[v],e(k[2],k[1],k[0]);for(v=0;v<O;v++)k=l[v],e(k[0]+J*n,k[1]+J*n,k[2]+J*n)}var L,M,R=0;g(r);R+=r.length;x=0;for(A=m.length;x<A;x++)w=m[x],g(w),R+=w.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+(m[x]=w.reverse());l=!1}l=THREE.Shape.Utils.triangulateShape(t,m);r=t;x=0;for(A=m.length;x<A;x++)w=m[x],t=t.concat(w);var v,D,z,G,I,E,K=t.length,O=l.length,B=[];v=0;D=r.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),B[v]=d(r[v],r[J],r[N]);var L=[],H,M=B.concat();x=0;for(A=m.length;x<A;x++){w=m[x];H=[];v=0;D=w.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[v]=d(w[v],w[J],w[N]);L.push(H);M=M.concat(H)}for(z=0;z<j;z++){G=z/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=
+0;for(D=r.length;v<D;v++)E=b(r[v],B[v],G),f(E.x,E.y,-I);x=0;for(A=m.length;x<A;x++){w=m[x];H=L[x];v=0;for(D=w.length;v<D;v++)E=b(w[v],H[v],G),f(E.x,E.y,-I)}}G=k;for(v=0;v<K;v++)E=p?b(t[v],M[v],G):t[v],q?f(E.x,E.y+s[0].y,s[0].x):f(E.x,E.y,0);for(z=1;z<=n;z++)for(v=0;v<K;v++)E=p?b(t[v],M[v],G):t[v],q?f(E.x,E.y+s[z-1].y,s[z-1].x):f(E.x,E.y,g/n*z);for(z=j-1;z>=0;z--){G=z/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=0;for(D=r.length;v<D;v++)E=b(r[v],B[v],G),f(E.x,E.y,g+I);x=0;for(A=m.length;x<A;x++){w=m[x];
+H=L[x];v=0;for(D=w.length;v<D;v++)E=b(w[v],H[v],G),q?f(E.x,E.y+s[n-1].y,s[n-1].x+I):f(E.x,E.y,g+I)}}if(p){p=K*0;for(v=0;v<O;v++)k=l[v],e(k[2]+p,k[1]+p,k[0]+p);p=K*(n+j*2);for(v=0;v<O;v++)k=l[v],e(k[0]+p,k[1]+p,k[2]+p)}else{for(v=0;v<O;v++)k=l[v],e(k[2],k[1],k[0]);for(v=0;v<O;v++)k=l[v],e(k[0]+K*n,k[1]+K*n,k[2]+K*n)}var J,N,R=0;h(r);R+=r.length;x=0;for(A=m.length;x<A;x++)w=m[x],h(w),R+=w.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,f=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,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,j,a);b(f.faces[h].b,k,
-i,a);b(f.faces[h].c,j,k,a);b(i,k,j,a)}f.faces=a.faces}g.faces=f.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=[],f=[],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])),g[h]=this.vertices.length-1):g=f;i==0&&(f=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;
-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([f(a.uv,a.position,h),f(b.uv,b.position,h),f(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 f(a,b,c){c<0&&a.u===
-1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,e=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return h.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=h.vertices[a].position,e=h.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var h=this,f=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,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,g;for(g in f.faces){var i=d(f.faces[g].a,f.faces[g].b),k=d(f.faces[g].b,f.faces[g].c),j=d(f.faces[g].c,f.faces[g].a);b(f.faces[g].a,i,j,a);b(f.faces[g].b,k,
+i,a);b(f.faces[g].c,j,k,a);b(i,k,j,a)}f.faces=a.faces}h.faces=f.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=[],h=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),g=0;g<a.length;g++)this.vertices.push(new THREE.Vertex(a[g])),b[g]=a[g].clone(),d[g]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=c){for(g=0;g<b.length;g++)i<this.angle?(b[g]=e.multiplyVector3(b[g].clone()),this.vertices.push(new THREE.Vertex(b[g])),h[g]=this.vertices.length-1):h=f;i==0&&(f=d);
+for(g=0;g<d.length-1;g++)this.faces.push(new THREE.Face4(h[g],h[g+1],d[g+1],d[g])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,g/a.length),new THREE.UV(1-i/this.angle,(g+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(g+1)/a.length),new THREE.UV(1-(i-c)/this.angle,g/a.length)]);d=h;h=[]}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,g){g<1?(g=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),g.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),g.normal=g.centroid.clone().normalize(),
+e.faces.push(g),g=Math.atan2(g.centroid.z,-g.centroid.x),e.faceVertexUvs[0].push([f(a.uv,a.position,g),f(b.uv,b.position,g),f(c.uv,c.position,g)])):(g-=1,d(a,h(a,b),h(a,c),g),d(h(a,b),b,h(b,c),g),d(h(a,c),h(b,c),c,g),d(h(a,b),h(b,c),h(a,c),g))}function h(a,c){g[a.index]||(g[a.index]=[]);g[c.index]||(g[c.index]=[]);var d=g[a.index][c.index];d===void 0&&(g[a.index][c.index]=g[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function f(a,b,c){c<0&&a.u===
+1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,e=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var g=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 {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,f=a/2,e=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-f,-(g*k-e),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.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,f=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],j=0;for(d=0;d<f;d++){var p=2*d/f,m=i*Math.sin(p*g),p=i*Math.cos(p*g);(b==0||b==e)&&d>0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,h,m)))-1);k.push(j)}c.push(k)}for(var n,t,l,g=c.length,b=0;b<g;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){k=d==f-1;e=c[b][k?0:d+1];h=c[b][k?f-1:d];i=c[b-1][k?
-f-1:d];k=c[b-1][k?0:d+1];m=b/(g-1);n=(b-1)/(g-1);t=(d+1)/f;var p=d/f,j=new THREE.UV(1-t,m),m=new THREE.UV(1-p,m),p=new THREE.UV(1-p,n),s=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[e].position.clone(),t=this.vertices[h].position.clone(),l=this.vertices[i].position.clone(),n.normalize(),t.normalize(),l.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(l.x,l.y,l.z)])),this.faceVertexUvs[0].push([j,m,p]));b>1&&(n=
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var h=a/2,f=c/2,b=b||1,d=d||1,e=b+1,g=d+1,i=a/b,k=c/d,j=new THREE.Vector3(0,0,1),a=0;a<g;a++)for(c=0;c<e;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-h,-(a*k-f),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)h=new THREE.Face4(c+e*a,c+e*(a+1),c+1+e*(a+1),c+1+e*a),h.normal.copy(j),h.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(h),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
+b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};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,h=Math.PI,f=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var g=a*Math.cos(d*h),i=a*Math.sin(d*h),k=[],j=0;for(d=0;d<f;d++){var p=2*d/f,m=i*Math.sin(p*h),p=i*Math.cos(p*h);(b==0||b==e)&&d>0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,g,m)))-1);k.push(j)}c.push(k)}for(var n,t,l,h=c.length,b=0;b<h;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){k=d==f-1;e=c[b][k?0:d+1];g=c[b][k?f-1:d];i=c[b-1][k?
+f-1:d];k=c[b-1][k?0:d+1];m=b/(h-1);n=(b-1)/(h-1);t=(d+1)/f;var p=d/f,j=new THREE.UV(1-t,m),m=new THREE.UV(1-p,m),p=new THREE.UV(1-p,n),s=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[e].position.clone(),t=this.vertices[g].position.clone(),l=this.vertices[i].position.clone(),n.normalize(),t.normalize(),l.normalize(),this.faces.push(new THREE.Face3(e,g,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(l.x,l.y,l.z)])),this.faceVertexUvs[0].push([j,m,p]));b>1&&(n=
 this.vertices[e].position.clone(),t=this.vertices[i].position.clone(),l=this.vertices[k].position.clone(),n.normalize(),t.normalize(),l.normalize(),this.faces.push(new THREE.Face3(e,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(l.x,l.y,l.z)])),this.faceVertexUvs[0].push([j,p,s]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 this.vertices[e].position.clone(),t=this.vertices[i].position.clone(),l=this.vertices[k].position.clone(),n.normalize(),t.normalize(),l.normalize(),this.faces.push(new THREE.Face3(e,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(l.x,l.y,l.z)])),this.faceVertexUvs[0].push([j,p,s]))}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(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,k,j,p,m,n,t,l,s,q=c.glyphs[a]||c.glyphs["?"];if(q){if(q.o){c=q._cachedOutline||(q._cachedOutline=q.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,j));g.moveTo(i,j);break;case "l":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,
-j));g.lineTo(i,j);break;case "q":i=c[a++]*b+d;j=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(n,t,i,j);if(e=f[f.length-1]){p=e.x;m=e.y;e=1;for(h=this.divisions;e<=h;e++){var r=e/h,o=THREE.Shape.Utils.b2(r,p,n,i),r=THREE.Shape.Utils.b2(r,m,t,j);f.push(new THREE.Vector2(o,r))}}break;case "b":if(i=c[a++]*b+d,j=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,l=c[a++]*b+d,s=c[a++]*-b,g.bezierCurveTo(i,j,n,t,l,s),e=f[f.length-1]){p=e.x;m=e.y;e=1;for(h=this.divisions;e<=h;e++)r=e/h,o=THREE.Shape.Utils.b3(r,p,n,
-l,i),r=THREE.Shape.Utils.b3(r,m,t,s,j),f.push(new THREE.Vector2(o,r))}}}return{offset:q.ha*b,points:f,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,k,j;if(c(a)>0)for(k=0;k<g;k++)e[k]=k;else for(k=0;k<g;k++)e[k]=g-1-k;var p=2*g;for(k=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var m;a:{m=a;var n=i,t=k,l=j,s=g,q=e,r=void 0,o=void 0,u=void 0,
-y=void 0,w=void 0,x=void 0,A=void 0,C=void 0,F=void 0,o=m[q[n]].x,u=m[q[n]].y,y=m[q[t]].x,w=m[q[t]].y,x=m[q[l]].x,A=m[q[l]].y;if(1.0E-10>(y-o)*(A-u)-(w-u)*(x-o))m=!1;else{for(r=0;r<s;r++)if(!(r==n||r==t||r==l)){var C=m[q[r]].x,F=m[q[r]].y,v=void 0,D=void 0,z=void 0,G=void 0,I=void 0,E=void 0,J=void 0,O=void 0,B=void 0,K=void 0,H=void 0,N=void 0,v=z=I=void 0,v=x-y,D=A-w,z=o-x,G=u-A,I=y-o,E=w-u,J=C-o,O=F-u,B=C-y,K=F-w,H=C-x,N=F-A,v=v*K-D*B,I=I*O-E*J,z=z*N-G*H;if(v>=0&&z>=0&&I>=0){m=!1;break a}}m=!0}}if(m){f.push([a[e[i]],
-a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j<g;i++,j++)e[i]=e[j];g--;p=2*g}}if(d)return h;return f};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 f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(f);g.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);h.z=
-this.tube*Math.sin(e);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,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,f,e,h,[c[g],c[f],c[e],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
-this.faceVertexUvs[0].push([a[g].clone(),a[f].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,c,b,d,g,f,e){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
-g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=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),j=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,k,j])}this.computeCentroids();
+0,h=String(a).split(""),f=h.length,e=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(h[a],c,b,d,g);d+=g.offset;e.push(g.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,h){var f=[],e,g,i,k,j,p,m,n,t,l,s,q=c.glyphs[a]||c.glyphs["?"];if(q){if(q.o){c=q._cachedOutline||(q._cachedOutline=q.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,j));h.moveTo(i,j);break;case "l":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,
+j));h.lineTo(i,j);break;case "q":i=c[a++]*b+d;j=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;h.quadraticCurveTo(n,t,i,j);if(e=f[f.length-1]){p=e.x;m=e.y;e=1;for(g=this.divisions;e<=g;e++){var r=e/g,o=THREE.Shape.Utils.b2(r,p,n,i),r=THREE.Shape.Utils.b2(r,m,t,j);f.push(new THREE.Vector2(o,r))}}break;case "b":if(i=c[a++]*b+d,j=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,l=c[a++]*b+d,s=c[a++]*-b,h.bezierCurveTo(i,j,n,t,l,s),e=f[f.length-1]){p=e.x;m=e.y;e=1;for(g=this.divisions;e<=g;e++)r=e/g,o=THREE.Shape.Utils.b3(r,p,n,
+l,i),r=THREE.Shape.Utils.b3(r,m,t,s,j),f.push(new THREE.Vector2(o,r))}}}return{offset:q.ha*b,points:f,path:h}}}};
+(function(a){var c=function(a){for(var c=a.length,h=0,f=c-1,e=0;e<c;f=e++)h+=a[f].x*a[e].y-a[e].x*a[f].y;return h*0.5};a.Triangulate=function(a,d){var h=a.length;if(h<3)return null;var f=[],e=[],g=[],i,k,j;if(c(a)>0)for(k=0;k<h;k++)e[k]=k;else for(k=0;k<h;k++)e[k]=h-1-k;var p=2*h;for(k=h-1;h>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return g;return f}i=k;h<=i&&(i=0);k=i+1;h<=k&&(k=0);j=k+1;h<=j&&(j=0);var m;a:{m=a;var n=i,t=k,l=j,s=h,q=e,r=void 0,o=void 0,u=void 0,
+y=void 0,w=void 0,x=void 0,A=void 0,C=void 0,F=void 0,o=m[q[n]].x,u=m[q[n]].y,y=m[q[t]].x,w=m[q[t]].y,x=m[q[l]].x,A=m[q[l]].y;if(1.0E-10>(y-o)*(A-u)-(w-u)*(x-o))m=!1;else{for(r=0;r<s;r++)if(!(r==n||r==t||r==l)){var C=m[q[r]].x,F=m[q[r]].y,v=void 0,D=void 0,z=void 0,G=void 0,I=void 0,E=void 0,K=void 0,O=void 0,B=void 0,L=void 0,H=void 0,M=void 0,v=z=I=void 0,v=x-y,D=A-w,z=o-x,G=u-A,I=y-o,E=w-u,K=C-o,O=F-u,B=C-y,L=F-w,H=C-x,M=F-A,v=v*L-D*B,I=I*O-E*K,z=z*M-G*H;if(v>=0&&z>=0&&I>=0){m=!1;break a}}m=!0}}if(m){f.push([a[e[i]],
+a[e[k]],a[e[j]]]);g.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j<h;i++,j++)e[i]=e[j];h--;p=2*h}}if(d)return g;return f};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,h){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(f);h.y=this.radius*Math.sin(f);var g=new THREE.Vector3;g.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);g.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);g.z=
+this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(g));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(g.clone().subSelf(h).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var h=(this.segmentsT+1)*b+d-1,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,g=(this.segmentsT+1)*b+d,i=new THREE.Face4(h,f,e,g,[c[h],c[f],c[e],c[g]]);i.normal.addSelf(c[h]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[g]);i.normal.normalize();this.faces.push(i);
+this.faceVertexUvs[0].push([a[h].clone(),a[f].clone(),a[e].clone(),a[g].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
+THREE.TorusKnotGeometry=function(a,c,b,d,h,f,e){function g(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=h||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
+this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,h=g(i,e,this.q,this.p,this.radius,this.heightScale),i=g(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-h.x;b.y=i.y-h.y;b.z=i.z-h.z;d.x=i.x+h.x;d.y=i.y+h.y;d.z=i.z+h.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);h.x+=i*d.x+e*f.x;h.y+=i*d.y+e*f.y;h.z+=i*d.z+e*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
+h.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,h=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=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),j=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,b,d,f));this.faceVertexUvs[0].push([e,i,k,j])}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 j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,l,o=0;o<4;o++){l=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<l.length;q++)n=h.vertexColors[l[q]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[o]=k}}g.push(j);(!e.supportUVs||m.length!=0)&&f.push([m[a],m[b],m[c],m[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},p={},m=[],n,t,l,s,q,r=a.faceVertexUvs[0];n=0;for(t=r.length;n<t;n++){l=0;for(s=r[n].length;l<s;l++)q=d[n]["abcd".charAt(l)],m[q]||(m[q]=r[n][l])}var o;n=0;for(t=d.length;n<t;n++)if(q=d[n],k.push(q.centroid),i.push(new THREE.Vertex(q.centroid)),e.supportUVs&&m.length!=0){o=new THREE.UV;if(q instanceof THREE.Face3)o.u=m[q.a].u+m[q.b].u+m[q.c].u,o.v=m[q.a].v+m[q.b].v+m[q.c].v,o.u/=3,o.v/=3;else if(q instanceof THREE.Face4)o.u=
-m[q.a].u+m[q.b].u+m[q.c].u+m[q.d].u,o.v=m[q.a].v+m[q.b].v+m[q.c].v+m[q.d].v,o.u/=4,o.v/=4;m.push(o)}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 u=0,r=h.length,y,w,x={},A={},C=function(a,
-b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){A[a]===void 0&&(A[a]={});A[a][b]=null};for(n in t){o=t[n];y=n.split("_");w=y[0];y=y[1];C(w,[w,y]);C(y,[w,y]);l=0;for(s=o.length;l<s;l++)q=o[l],F(w,q,n),F(y,q,n);o.length<2&&(p[n]=!0)}for(n in t)if(o=t[n],q=o[0],o=o[1],y=n.split("_"),w=y[0],y=y[1],s=new THREE.Vector3,p[n]?(s.addSelf(h[w].position),s.addSelf(h[y].position),s.multiplyScalar(0.5)):(s.addSelf(k[q]),s.addSelf(k[o]),s.addSelf(h[w].position),s.addSelf(h[y].position),s.multiplyScalar(0.25)),
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,g,i){var j=new THREE.Face4(a,b,c,d,null,g.color,g.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,l,o=0;o<4;o++){l=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<l.length;q++)n=g.vertexColors[l[q]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[o]=k}}h.push(j);(!e.supportUVs||m.length!=0)&&f.push([m[a],m[b],m[c],m[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],h=[],f=[],e=this,g=a.vertices,d=a.faces,i=g.concat(),k=[],j={},p={},m=[],n,t,l,s,q,r=a.faceVertexUvs[0];n=0;for(t=r.length;n<t;n++){l=0;for(s=r[n].length;l<s;l++)q=d[n]["abcd".charAt(l)],m[q]||(m[q]=r[n][l])}var o;n=0;for(t=d.length;n<t;n++)if(q=d[n],k.push(q.centroid),i.push(new THREE.Vertex(q.centroid)),e.supportUVs&&m.length!=0){o=new THREE.UV;if(q instanceof THREE.Face3)o.u=m[q.a].u+m[q.b].u+m[q.c].u,o.v=m[q.a].v+m[q.b].v+m[q.c].v,o.u/=3,o.v/=3;else if(q instanceof THREE.Face4)o.u=
+m[q.a].u+m[q.b].u+m[q.c].u+m[q.d].u,o.v=m[q.a].v+m[q.b].v+m[q.c].v+m[q.d].v,o.u/=4,o.v/=4;m.push(o)}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 u=0,r=g.length,y,w,x={},A={},C=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){A[a]===void 0&&(A[a]={});A[a][b]=null};for(n in t){o=t[n];y=n.split("_");w=y[0];y=y[1];C(w,[w,y]);C(y,[w,y]);l=0;for(s=o.length;l<s;l++)q=o[l],F(w,q,n),F(y,q,n);o.length<2&&(p[n]=!0)}for(n in t)if(o=t[n],q=o[0],o=o[1],y=n.split("_"),w=y[0],y=y[1],s=new THREE.Vector3,p[n]?(s.addSelf(g[w].position),s.addSelf(g[y].position),s.multiplyScalar(0.5)):(s.addSelf(k[q]),s.addSelf(k[o]),s.addSelf(g[w].position),s.addSelf(g[y].position),s.multiplyScalar(0.25)),
 j[n]=r+d.length+u,i.push(new THREE.Vertex(s)),u++,e.supportUVs&&m.length!=0)o=new THREE.UV,o.u=m[w].u+m[y].u,o.v=m[w].v+m[y].v,o.u/=2,o.v/=2,m.push(o);var v,D;y=["123","12","2","23"];s=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],z=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];n=0;for(t=k.length;n<t;n++)q=d[n],o=r+n,q instanceof THREE.Face3?(u=b(q.a,q.b),w=b(q.b,q.c),v=b(q.c,q.a),c(o,j[u],q.b,j[w],q,y),c(o,j[w],q.c,j[v],q,s),c(o,j[v],q.a,j[u],
 j[n]=r+d.length+u,i.push(new THREE.Vertex(s)),u++,e.supportUVs&&m.length!=0)o=new THREE.UV,o.u=m[w].u+m[y].u,o.v=m[w].v+m[y].v,o.u/=2,o.v/=2,m.push(o);var v,D;y=["123","12","2","23"];s=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],z=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];n=0;for(t=k.length;n<t;n++)q=d[n],o=r+n,q instanceof THREE.Face3?(u=b(q.a,q.b),w=b(q.b,q.c),v=b(q.c,q.a),c(o,j[u],q.b,j[w],q,y),c(o,j[w],q.c,j[v],q,s),c(o,j[v],q.a,j[u],
-q,C)):q instanceof THREE.Face4?(u=b(q.a,q.b),w=b(q.b,q.c),v=b(q.c,q.d),D=b(q.d,q.a),c(o,j[u],q.b,j[w],q,F),c(o,j[w],q.c,j[v],q,z),c(o,j[v],q.d,j[D],q,G),c(o,j[D],q.a,j[u],q,I)):console.log("face should be a face!",q);d=i;i=new THREE.Vector3;j=new THREE.Vector3;n=0;for(t=h.length;n<t;n++)if(x[n]!==void 0){i.set(0,0,0);j.set(0,0,0);q=new THREE.Vector3(0,0,0);o=0;for(l in A[n])i.addSelf(k[l]),o++;u=0;r=x[n].length;for(l=0;l<r;l++)p[b(x[n][l][0],x[n][l][1])]&&u++;if(u!=2){i.divideScalar(o);for(l=0;l<
-r;l++)o=x[n][l],o=h[o[0]].position.clone().addSelf(h[o[1]].position).divideScalar(2),j.addSelf(o);j.divideScalar(r);q.addSelf(h[n].position);q.multiplyScalar(r-3);q.addSelf(i);q.addSelf(j.multiplyScalar(2));q.divideScalar(r);d[n].position=q}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+q,C)):q instanceof THREE.Face4?(u=b(q.a,q.b),w=b(q.b,q.c),v=b(q.c,q.d),D=b(q.d,q.a),c(o,j[u],q.b,j[w],q,F),c(o,j[w],q.c,j[v],q,z),c(o,j[v],q.d,j[D],q,G),c(o,j[D],q.a,j[u],q,I)):console.log("face should be a face!",q);d=i;i=new THREE.Vector3;j=new THREE.Vector3;n=0;for(t=g.length;n<t;n++)if(x[n]!==void 0){i.set(0,0,0);j.set(0,0,0);q=new THREE.Vector3(0,0,0);o=0;for(l in A[n])i.addSelf(k[l]),o++;u=0;r=x[n].length;for(l=0;l<r;l++)p[b(x[n][l][0],x[n][l][1])]&&u++;if(u!=2){i.divideScalar(o);for(l=0;l<
+r;l++)o=x[n][l],o=g[o[0]].position.clone().addSelf(g[o[1]].position).divideScalar(2),j.addSelf(o);j.divideScalar(r);q.addSelf(g[n].position);q.multiplyScalar(r-3);q.addSelf(i);q.addSelf(j.multiplyScalar(2));q.divideScalar(r);d[n].position=q}}a.vertices=d;a.faces=h;a.faceVertexUvs[0]=f;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/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function g(a,b,e,f,g,h){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(f){a[b].repeat.set(f[0],f[1]);if(f[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
-if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
+a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function h(a,b,e,f,g,h){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(f){a[b].repeat.set(f[0],f[1]);if(f[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
+if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,g,i;g="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?g="MeshPhongMaterial":a.shading=="Basic"&&(g="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=f(a.colorDiffuse);
 if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=f(a.colorDiffuse);
-else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=f(a.colorSpecular);if(a.colorAmbient)e.ambient=f(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),p=e.color;h=e.specular;i=e.ambient;var m=e.shininess;j.tNormal.texture=e.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(e.map)j.tDiffuse.texture=e.map,j.enableDiffuse.value=!0;if(e.specularMap)j.tSpecular.texture=e.specularMap,j.enableSpecular.value=!0;if(e.lightMap)j.tAO.texture=
-e.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(p);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=m;if(e.opacity)j.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
-THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
-THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,f){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
+else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=f(a.colorSpecular);if(a.colorAmbient)e.ambient=f(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&h(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&h(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&h(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
+a.mapSpecular&&c&&h(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),p=e.color;g=e.specular;i=e.ambient;var m=e.shininess;j.tNormal.texture=e.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(e.map)j.tDiffuse.texture=e.map,j.enableDiffuse.value=!0;if(e.specularMap)j.tSpecular.texture=e.specularMap,j.enableSpecular.value=!0;if(e.lightMap)j.tAO.texture=
+e.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(p);j.uSpecularColor.value.setHex(g);j.uAmbientColor.value.setHex(i);j.uShininess.value=m;if(e.opacity)j.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else e=new THREE[g](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,h)};
+THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,h,f){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var g=JSON.parse(e.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(g,b,h,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
 e.status+"]")};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
 e.status+"]")};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var f=new XMLHttpRequest,e=b+"/"+a.buffers,h=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,d,a.materials):console.error("Couldn't load ["+e+"] ["+f.status+"]"):f.readyState==3?g&&(h==0&&(h=f.getResponseHeader("Content-Length")),g({total:h,loaded:f.responseText.length})):f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,h){var f=new XMLHttpRequest,e=b+"/"+a.buffers,g=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,d,a.materials):console.error("Couldn't load ["+e+"] ["+f.status+"]"):f.readyState==3?h&&(g==0&&(g=f.getResponseHeader("Content-Length")),h({total:g,loaded:f.responseText.length})):f.readyState==2&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",
 e,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 e,!0);f.overrideMimeType("text/plain; charset=x-user-defined");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=j(a,b),e=j(a,b+1),f=j(a,b+2),g=j(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=j(a,b),d=j(a,b+1),e=j(a,b+2);return(j(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=j(a,b);return(j(a,b+1)<<8)+c}function k(a,b){var c=j(a,b);return c>127?c-256:c}function j(a,b){return a.charCodeAt(b)&255}function p(b){var c,
-d,e;c=g(a,b);d=g(a,b+w);e=g(a,b+x);b=i(a,b+A);q.faces.push(new THREE.Face3(c,d,e,null,null,b))}function m(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+w);e=g(a,b+x);f=i(a,b+A);j=g(a,b+C);k=g(a,b+F);l=g(a,b+v);var b=u[k*3],n=u[k*3+1];k=u[k*3+2];var m=u[l*3],o=u[l*3+1];l=u[l*3+2];q.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(u[j*3],u[j*3+1],u[j*3+2]),new THREE.Vector3(b,n,k),new THREE.Vector3(m,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+D);e=g(a,b+z);f=g(a,b+G);b=i(a,b+I);q.faces.push(new THREE.Face4(c,
-d,e,f,null,null,b))}function t(b){var c,d,e,f,j,k,l,n,m;c=g(a,b);d=g(a,b+D);e=g(a,b+z);f=g(a,b+G);j=i(a,b+I);k=g(a,b+E);l=g(a,b+J);n=g(a,b+O);m=g(a,b+B);var b=u[l*3],o=u[l*3+1];l=u[l*3+2];var fa=u[n*3],ga=u[n*3+1];n=u[n*3+2];var ha=u[m*3],p=u[m*3+1];m=u[m*3+2];q.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(u[k*3],u[k*3+1],u[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(fa,ga,n),new THREE.Vector3(ha,p,m)],null,j))}function l(b){var c,d,e,f;c=g(a,b);d=g(a,b+K);e=g(a,b+H);b=y[c*2];f=y[c*
-2+1];c=y[d*2];var i=q.faceVertexUvs[0];d=y[d*2+1];var j=y[e*2];e=y[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,j;c=g(a,b);d=g(a,b+N);e=g(a,b+L);f=g(a,b+M);b=y[c*2];i=y[c*2+1];c=y[d*2];j=y[d*2+1];d=y[e*2];var k=q.faceVertexUvs[0];e=y[e*2+1];var l=y[f*2];f=y[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,j));n.push(new THREE.UV(d,e));n.push(new THREE.UV(l,f));k.push(n)}var q=this,r=0,o,u=[],y=[],
-w,x,A,C,F,v,D,z,G,I,E,J,O,B,K,H,N,L,M,R,P,T,S,U,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(q,d,b);o={signature:a.substr(r,8),header_bytes:j(a,r+8),vertex_coordinate_bytes:j(a,r+9),normal_coordinate_bytes:j(a,r+10),uv_coordinate_bytes:j(a,r+11),vertex_index_bytes:j(a,r+12),normal_index_bytes:j(a,r+13),uv_index_bytes:j(a,r+14),material_index_bytes:j(a,r+15),nvertices:g(a,r+16),nnormals:g(a,r+16+4),nuvs:g(a,r+16+8),ntri_flat:g(a,r+16+12),ntri_smooth:g(a,r+16+16),ntri_flat_uv:g(a,
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var h=function(b){function c(a,b){var d=j(a,b),e=j(a,b+1),f=j(a,b+2),g=j(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=j(a,b),d=j(a,b+1),e=j(a,b+2);return(j(a,b+3)<<24)+(e<<16)+(d<<8)+c}function h(a,b){var c=j(a,b);return(j(a,b+1)<<8)+c}function k(a,b){var c=j(a,b);return c>127?c-256:c}function j(a,b){return a.charCodeAt(b)&255}function p(b){var c,
+d,e;c=g(a,b);d=g(a,b+w);e=g(a,b+x);b=h(a,b+A);q.faces.push(new THREE.Face3(c,d,e,null,null,b))}function m(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+w);e=g(a,b+x);f=h(a,b+A);j=g(a,b+C);k=g(a,b+F);l=g(a,b+v);var b=u[k*3],n=u[k*3+1];k=u[k*3+2];var m=u[l*3],o=u[l*3+1];l=u[l*3+2];q.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(u[j*3],u[j*3+1],u[j*3+2]),new THREE.Vector3(b,n,k),new THREE.Vector3(m,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+D);e=g(a,b+z);f=g(a,b+G);b=h(a,b+I);q.faces.push(new THREE.Face4(c,
+d,e,f,null,null,b))}function t(b){var c,d,e,f,j,k,l,n,m;c=g(a,b);d=g(a,b+D);e=g(a,b+z);f=g(a,b+G);j=h(a,b+I);k=g(a,b+E);l=g(a,b+K);n=g(a,b+O);m=g(a,b+B);var b=u[l*3],o=u[l*3+1];l=u[l*3+2];var fa=u[n*3],ga=u[n*3+1];n=u[n*3+2];var ha=u[m*3],p=u[m*3+1];m=u[m*3+2];q.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(u[k*3],u[k*3+1],u[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(fa,ga,n),new THREE.Vector3(ha,p,m)],null,j))}function l(b){var c,d,e,f;c=g(a,b);d=g(a,b+L);e=g(a,b+H);b=y[c*2];f=y[c*
+2+1];c=y[d*2];var h=q.faceVertexUvs[0];d=y[d*2+1];var i=y[e*2];e=y[e*2+1];var j=[];j.push(new THREE.UV(b,f));j.push(new THREE.UV(c,d));j.push(new THREE.UV(i,e));h.push(j)}function s(b){var c,d,e,f,h,i;c=g(a,b);d=g(a,b+M);e=g(a,b+J);f=g(a,b+N);b=y[c*2];h=y[c*2+1];c=y[d*2];i=y[d*2+1];d=y[e*2];var j=q.faceVertexUvs[0];e=y[e*2+1];var k=y[f*2];f=y[f*2+1];var l=[];l.push(new THREE.UV(b,h));l.push(new THREE.UV(c,i));l.push(new THREE.UV(d,e));l.push(new THREE.UV(k,f));j.push(l)}var q=this,r=0,o,u=[],y=[],
+w,x,A,C,F,v,D,z,G,I,E,K,O,B,L,H,M,J,N,R,P,T,S,U,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(q,d,b);o={signature:a.substr(r,8),header_bytes:j(a,r+8),vertex_coordinate_bytes:j(a,r+9),normal_coordinate_bytes:j(a,r+10),uv_coordinate_bytes:j(a,r+11),vertex_index_bytes:j(a,r+12),normal_index_bytes:j(a,r+13),uv_index_bytes:j(a,r+14),material_index_bytes:j(a,r+15),nvertices:g(a,r+16),nnormals:g(a,r+16+4),nuvs:g(a,r+16+8),ntri_flat:g(a,r+16+12),ntri_smooth:g(a,r+16+16),ntri_flat_uv:g(a,
 r+16+20),ntri_smooth_uv:g(a,r+16+24),nquad_flat:g(a,r+16+28),nquad_smooth:g(a,r+16+32),nquad_flat_uv:g(a,r+16+36),nquad_smooth_uv:g(a,r+16+40)};r+=o.header_bytes;w=o.vertex_index_bytes;x=o.vertex_index_bytes*2;A=o.vertex_index_bytes*3;C=o.vertex_index_bytes*3+o.material_index_bytes;F=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;v=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;D=o.vertex_index_bytes;z=o.vertex_index_bytes*2;G=o.vertex_index_bytes*3;I=o.vertex_index_bytes*
 r+16+20),ntri_smooth_uv:g(a,r+16+24),nquad_flat:g(a,r+16+28),nquad_smooth:g(a,r+16+32),nquad_flat_uv:g(a,r+16+36),nquad_smooth_uv:g(a,r+16+40)};r+=o.header_bytes;w=o.vertex_index_bytes;x=o.vertex_index_bytes*2;A=o.vertex_index_bytes*3;C=o.vertex_index_bytes*3+o.material_index_bytes;F=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;v=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;D=o.vertex_index_bytes;z=o.vertex_index_bytes*2;G=o.vertex_index_bytes*3;I=o.vertex_index_bytes*
-4;E=o.vertex_index_bytes*4+o.material_index_bytes;J=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;O=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;B=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;K=o.uv_index_bytes;H=o.uv_index_bytes*2;N=o.uv_index_bytes;L=o.uv_index_bytes*2;M=o.uv_index_bytes*3;b=o.vertex_index_bytes*3+o.material_index_bytes;Q=o.vertex_index_bytes*4+o.material_index_bytes;R=o.ntri_flat*b;P=o.ntri_smooth*(b+o.normal_index_bytes*
+4;E=o.vertex_index_bytes*4+o.material_index_bytes;K=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;O=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;B=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;L=o.uv_index_bytes;H=o.uv_index_bytes*2;M=o.uv_index_bytes;J=o.uv_index_bytes*2;N=o.uv_index_bytes*3;b=o.vertex_index_bytes*3+o.material_index_bytes;Q=o.vertex_index_bytes*4+o.material_index_bytes;R=o.ntri_flat*b;P=o.ntri_smooth*(b+o.normal_index_bytes*
 3);T=o.ntri_flat_uv*(b+o.uv_index_bytes*3);S=o.ntri_smooth_uv*(b+o.normal_index_bytes*3+o.uv_index_bytes*3);U=o.nquad_flat*Q;b=o.nquad_smooth*(Q+o.normal_index_bytes*4);Q=o.nquad_flat_uv*(Q+o.uv_index_bytes*4);r+=function(b){for(var d,f,g,h=o.vertex_coordinate_bytes*3,i=b+o.nvertices*h;b<i;b+=h)d=c(a,b),f=c(a,b+o.vertex_coordinate_bytes),g=c(a,b+o.vertex_coordinate_bytes*2),q.vertices.push(new THREE.Vertex(new THREE.Vector3(d,f,g)));return o.nvertices*h}(r);r+=function(b){for(var c,d,e,f=o.normal_coordinate_bytes*
 3);T=o.ntri_flat_uv*(b+o.uv_index_bytes*3);S=o.ntri_smooth_uv*(b+o.normal_index_bytes*3+o.uv_index_bytes*3);U=o.nquad_flat*Q;b=o.nquad_smooth*(Q+o.normal_index_bytes*4);Q=o.nquad_flat_uv*(Q+o.uv_index_bytes*4);r+=function(b){for(var d,f,g,h=o.vertex_coordinate_bytes*3,i=b+o.nvertices*h;b<i;b+=h)d=c(a,b),f=c(a,b+o.vertex_coordinate_bytes),g=c(a,b+o.vertex_coordinate_bytes*2),q.vertices.push(new THREE.Vertex(new THREE.Vector3(d,f,g)));return o.nvertices*h}(r);r+=function(b){for(var c,d,e,f=o.normal_coordinate_bytes*
 3,g=b+o.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+o.normal_coordinate_bytes),e=k(a,b+o.normal_coordinate_bytes*2),u.push(c/127,d/127,e/127);return o.nnormals*f}(r);r+=function(b){for(var d,f,g=o.uv_coordinate_bytes*2,h=b+o.nuvs*g;b<h;b+=g)d=c(a,b),f=c(a,b+o.uv_coordinate_bytes),y.push(d,f);return o.nuvs*g}(r);R=r+R;P=R+P;T=P+T;S=T+S;U=S+U;b=U+b;Q=b+Q;(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes,d=c+o.uv_index_bytes*3,e=a+o.ntri_flat_uv*d;for(b=a;b<e;b+=d)p(b),l(b+c);return e-a})(P);
 3,g=b+o.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+o.normal_coordinate_bytes),e=k(a,b+o.normal_coordinate_bytes*2),u.push(c/127,d/127,e/127);return o.nnormals*f}(r);r+=function(b){for(var d,f,g=o.uv_coordinate_bytes*2,h=b+o.nuvs*g;b<h;b+=g)d=c(a,b),f=c(a,b+o.uv_coordinate_bytes),y.push(d,f);return o.nuvs*g}(r);R=r+R;P=R+P;T=P+T;S=T+S;U=S+U;b=U+b;Q=b+Q;(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes,d=c+o.uv_index_bytes*3,e=a+o.ntri_flat_uv*d;for(b=a;b<e;b+=d)p(b),l(b+c);return e-a})(P);
 (function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,d=c+o.uv_index_bytes*3,e=a+o.ntri_smooth_uv*d;for(b=a;b<e;b+=d)m(b),l(b+c);return e-a})(T);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes,d=c+o.uv_index_bytes*4,e=a+o.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),s(b+c);return e-a})(b);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,d=c+o.uv_index_bytes*4,e=a+o.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),s(b+
 (function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,d=c+o.uv_index_bytes*3,e=a+o.ntri_smooth_uv*d;for(b=a;b<e;b+=d)m(b),l(b+c);return e-a})(T);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes,d=c+o.uv_index_bytes*4,e=a+o.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),s(b+c);return e-a})(b);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,d=c+o.uv_index_bytes*4,e=a+o.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),s(b+
 c);return e-a})(Q);(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes,d=a+o.ntri_flat*c;for(b=a;b<d;b+=c)p(b);return d-a})(r);(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,d=a+o.ntri_smooth*c;for(b=a;b<d;b+=c)m(b);return d-a})(R);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes,d=a+o.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(S);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*
 c);return e-a})(Q);(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes,d=a+o.ntri_flat*c;for(b=a;b<d;b+=c)p(b);return d-a})(r);(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,d=a+o.ntri_smooth*c;for(b=a;b<d;b+=c)m(b);return d-a})(R);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes,d=a+o.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(S);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*
-4,d=a+o.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(U);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){P=a;d=d||U;g!==void 0&&(a=g.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");$=c("//dae:library_images/dae:image",e,"image");aa=c("//dae:library_materials/dae:material",A,"material");ba=c("//dae:library_effects/dae:effect",z,"effect");W=c("//dae:library_geometries/dae:geometry",s,"geometry");V=c("//dae:library_controllers/dae:controller",h,"controller");X=c("//dae:library_animations/dae:animation",I,"animation");ca=c(".//dae:library_visual_scenes/dae:visual_scene",
+4,d=a+o.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(U);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(b))};
+THREE.ColladaLoader=function(){function a(a,d,h){P=a;d=d||U;h!==void 0&&(a=h.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");$=c("//dae:library_images/dae:image",e,"image");aa=c("//dae:library_materials/dae:material",A,"material");ba=c("//dae:library_effects/dae:effect",z,"effect");W=c("//dae:library_geometries/dae:geometry",s,"geometry");V=c("//dae:library_controllers/dae:controller",g,"controller");X=c("//dae:library_animations/dae:animation",I,"animation");ca=c(".//dae:library_visual_scenes/dae:visual_scene",
 j,"visual_scene");Y=[];Z=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ca[a]):S=null;T=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)T.add(f(S.nodes[a]));b();for(var i in X);i={scene:T,morphs:Y,skins:Z,dae:{images:$,materials:aa,effects:ba,geometries:W,controllers:V,animations:X,visualScenes:ca,scene:S}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 j,"visual_scene");Y=[];Z=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ca[a]):S=null;T=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)T.add(f(S.nodes[a]));b();for(var i in X);i={scene:T,morphs:Y,skins:Z,dae:{images:$,materials:aa,effects:ba,geometries:W,controllers:V,animations:X,visualScenes:ca,scene:S}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,B,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 X)for(var e=X[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 X)for(var e=X[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=V[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=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,n;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 h(a,c,e){var f=V[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=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,n;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
 for(e=0;e<g.frames;e++){var m=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,m,e);h=m;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],n=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){n=p;break}if(n>=0){p=i.invBindMatrices[n];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==n&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
 for(e=0;e<g.frames;e++){var m=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,m,e);h=m;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],n=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){n=p;break}if(n>=0){p=i.invBindMatrices[n];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==n&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<m.length;h++)if(m[h].type=="JOINT")for(i=0;i<m[h].weights.length;i++)j=m[h].weights[i],k=j.index,j=j.weight,n=a.vertices[k],k=o[k],l.x=n.position.x,l.y=n.position.y,l.z=n.position.z,m[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:o})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=V[a.controllers[e].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
+j.sid+"'.";}for(h=0;h<m.length;h++)if(m[h].type=="JOINT")for(i=0;i<m[h].weights.length;i++)j=m[h].weights[i],k=j.index,j=j.weight,n=a.vertices[k],k=o[k],l.x=n.position.x,l.y=n.position.y,l.z=n.position.z,m[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:o})}}}function f(a){var b=new THREE.Object3D,c,d,e,g;for(e=0;e<a.controllers.length;e++){var i=V[a.controllers[e].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
 new l;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(V[i.skin.source]&&(d=i=V[i.skin.source],i.morph&&W[i.morph.source]))j=new l,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(W[i.morph.source])j=new l,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
 new l;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(V[i.skin.source]&&(d=i=V[i.skin.source],i.morph&&W[i.morph.source]))j=new l,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(W[i.morph.source])j=new l,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
-0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=W[i.url],k={},m=0,o;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++){o=j[h];var p=ba[aa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;m++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)m=
-i.faces[h],m.materials=[k[m.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+Z.length,Z.push(j);else if(d!==void 0){h=i;k=d instanceof n?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(p=W[k.targets[m]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Y.length;Y.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(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
+0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=W[i.url],k={},m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(g=0;g<j.length;g++){p=j[g];var o=ba[aa[p.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;p=k[p.symbol]=o.material;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;for(g=0;g<i.faces.length;g++)m=
+i.faces[g],m.materials=[k[m.daeMaterial]]}if(c!==void 0)h(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+Z.length,Z.push(j);else if(d!==void 0){g=i;k=d instanceof n?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(o=W[k.targets[m]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
+g.vertices.length&&g.morphTargets.push({name:"target_1",vertices:o.vertices});g.morphTargets.push({name:"target_Z",vertices:g.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Y.length;Y.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(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function g(){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 j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){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 j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
 "";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function l(){this.url="";this.instance_material=[]}function s(){this.id="";this.mesh=null}function q(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function o(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function w(){this.semantic=
 "";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function l(){this.url="";this.instance_material=[]}function s(){this.id="";this.mesh=null}function q(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function o(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function w(){this.semantic=
 "";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function A(){this.name=this.id="";this.instance_effect=null}function C(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function v(a){this.effect=a;this.format=this.init_from=null}function D(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 x(a){this.id=a;this.type=null}function A(){this.name=this.id="";this.instance_effect=null}function C(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function v(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function z(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
-if(Q[b]!=void 0)return Q[b];Q[b]=(new x(b)).parse(a);return Q[b]}function B(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function K(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function L(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function M(a,
-b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function R(a,b){var c="";c+=M(a.x,b)+",";c+=M(a.y,b)+",";c+=M(a.z,b);return c}var P=null,T=null,S,U=null,Q={},$={},X={},V={},W={},aa={},ba={},ca,da,Y,Z,ea=THREE.SmoothShading;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
-c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
+this.source=null}function z(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
+if(Q[b]!=void 0)return Q[b];Q[b]=(new x(b)).parse(a);return Q[b]}function B(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function J(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function N(a,
+b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function R(a,b){var c="";c+=N(a.x,b)+",";c+=N(a.y,b)+",";c+=N(a.z,b);return c}var P=null,T=null,S,U=null,Q={},$={},X={},V={},W={},aa={},ba={},ca,da,Y,Z,ea=THREE.SmoothShading;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
+c.textContent}return this};g.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
 0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};
 0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};
-k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=K(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
+k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=L(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
 f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
 f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
 a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var n=e[l],m=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[n.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=
 a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var n=e[l],m=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[n.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=
 0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=
 0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=
@@ -246,20 +247,20 @@ this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];t
 b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
 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};p.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};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=K(a.textContent);this.updateMatrix();return this};m.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)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};m.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};n.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};n.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=P.evaluate(".//dae:instance_material",c,B,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};l.prototype.parse=function(a){this.url=
 if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,B,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};l.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=P.evaluate(".//dae:instance_material",c,B,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};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=
 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=P.evaluate(".//dae:instance_material",c,B,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};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=
 (new q(this)).parse(c)}}return this};q.prototype.parse=function(a){function b(a,c){var d=R(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":O(d);break;case "vertices":this.vertices=(new y).parse(d);break;case "triangles":this.primitives.push((new o).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).parse(d))}}var e=
 (new q(this)).parse(c)}}return this};q.prototype.parse=function(a){function b(a,c){var d=R(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":O(d);break;case "vertices":this.vertices=(new y).parse(d);break;case "triangles":this.primitives.push((new o).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).parse(d))}}var e=
 {};this.geometry3js=new THREE.Geometry;d=Q[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=Q[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};q.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=3,p=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":p.push(i.set)}for(;d<g.length;){var o=[],q=[],s={},r=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=Q[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=R(b.vertices[j].position);o.push(c[i].index);break;case "NORMAL":q.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":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(o[0],o[1],o[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):m==4&&(t=new THREE.Face4(o[0],o[1],o[2],o[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<p.length;f++)e=s[p[f]],b.faceVertexUvs[f].push([e[0],
-e[1],e[2]]);d+=h.length*m}};r.prototype=new o;r.prototype.constructor=r;o.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};o.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=L(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 w).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=L(a,"count",0);this.stride=L(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};y.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 w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=L(a,"set",-1);this.offset=L(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.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=N(c.textContent).split(/\s+/),
-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=K(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);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 u).parse(c.childNodes[d]);break}}}return this};
+return this};q.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=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=[],q=[],s={},t=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=Q[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=R(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.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":t.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var r;m==3?r=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],t.length?t:new THREE.Color):m==4&&(r=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],t.length?t:new THREE.Color));r.daeMaterial=a.material;b.faces.push(r);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],
+e[1],e[2]]);d+=h.length*m}};r.prototype=new o;r.prototype.constructor=r;o.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};o.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 w).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};u.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};y.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 w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.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};x.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=M(c.textContent).split(/\s+/),
+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=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent).split(/\s+/);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 u).parse(c.childNodes[d]);break}}}return this};
 x.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};A.prototype.parse=function(a){this.id=a.getAttribute("id");
 x.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};A.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 G).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.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=K(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 G).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.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=L(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};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,B,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};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=$[this.effect.surface.init_from]))a.map=
 null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=$[this.effect.surface.init_from]))a.map=
 THREE.ImageUtils.loadTexture(da+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ea;return this.material=new THREE.MeshLambertMaterial(a)};v.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 THREE.ImageUtils.loadTexture(da+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ea;return this.material=new THREE.MeshLambertMaterial(a)};v.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
@@ -267,57 +268,57 @@ if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textConten
 c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};z.prototype.create=function(){if(this.shader==null)return null};z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
 c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};z.prototype.create=function(){if(this.shader==null)return null};z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
 z.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new v(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
 z.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new v(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
 break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.prototype.parse=function(a){this.id=a.getAttribute("id");
 break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};
-J.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new K(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};
+K.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 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))U=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){ea=a},applySkin:g,geometries:W}};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))U=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){ea=a},applySkin:h,geometries:W}};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){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})):
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,h){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var g=JSON.parse(f.responseText);a.createModel(g,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?h&&(e==0&&(e=f.getResponseHeader("Content-Length")),h({total:e,loaded:f.responseText.length})):
 f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-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.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,j,p,m,n,t,l,s,q,r,o,u=a.faces;p=a.vertices;var y=a.normals,w=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=p.length;k<
-j;)m=new THREE.Vertex,m.position.x=p[k++]*b,m.position.y=p[k++]*b,m.position.z=p[k++]*b,d.vertices.push(m);k=0;for(j=u.length;k<j;){b=u[k++];p=b&1;i=b&2;c=b&4;g=b&8;n=b&16;m=b&32;l=b&64;b&=128;p?(s=new THREE.Face4,s.a=u[k++],s.b=u[k++],s.c=u[k++],s.d=u[k++],p=4):(s=new THREE.Face3,s.a=u[k++],s.b=u[k++],s.c=u[k++],p=3);if(i)i=u[k++],s.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)q=a.uvs[c],t=u[k++],o=q[t*2],t=q[t*2+1],d.faceUvs[c][i]=new THREE.UV(o,t);if(g)for(c=0;c<x;c++){q=a.uvs[c];r=[];
-for(g=0;g<p;g++)t=u[k++],o=q[t*2],t=q[t*2+1],r[g]=new THREE.UV(o,t);d.faceVertexUvs[c][i]=r}if(n)n=u[k++]*3,g=new THREE.Vector3,g.x=y[n++],g.y=y[n++],g.z=y[n],s.normal=g;if(m)for(c=0;c<p;c++)n=u[k++]*3,g=new THREE.Vector3,g.x=y[n++],g.y=y[n++],g.z=y[n],s.vertexNormals.push(g);if(l)m=u[k++],m=new THREE.Color(w[m]),s.color=m;if(b)for(c=0;c<p;c++)m=u[k++],m=new THREE.Color(w[m]),s.vertexColors.push(m);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,j,p,m,n,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=[];n=d.morphTargets[c].vertices;
-t=a.morphTargets[c].vertices;i=0;for(k=t.length;i<k;i+=3)j=t[i]*b,p=t[i+1]*b,m=t[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,p,m)))}}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;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(j[b],j[b+1],j[b+2]),k.push(p)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,h=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,h,k,j,p,m,n,t,l,s,q,r,o,u=a.faces;p=a.vertices;var y=a.normals,w=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=p.length;k<
+j;)m=new THREE.Vertex,m.position.x=p[k++]*b,m.position.y=p[k++]*b,m.position.z=p[k++]*b,d.vertices.push(m);k=0;for(j=u.length;k<j;){b=u[k++];p=b&1;h=b&2;c=b&4;g=b&8;n=b&16;m=b&32;l=b&64;b&=128;p?(s=new THREE.Face4,s.a=u[k++],s.b=u[k++],s.c=u[k++],s.d=u[k++],p=4):(s=new THREE.Face3,s.a=u[k++],s.b=u[k++],s.c=u[k++],p=3);if(h)h=u[k++],s.materialIndex=h;h=d.faces.length;if(c)for(c=0;c<x;c++)q=a.uvs[c],t=u[k++],o=q[t*2],t=q[t*2+1],d.faceUvs[c][h]=new THREE.UV(o,t);if(g)for(c=0;c<x;c++){q=a.uvs[c];r=[];
+for(g=0;g<p;g++)t=u[k++],o=q[t*2],t=q[t*2+1],r[g]=new THREE.UV(o,t);d.faceVertexUvs[c][h]=r}if(n)n=u[k++]*3,g=new THREE.Vector3,g.x=y[n++],g.y=y[n++],g.z=y[n],s.normal=g;if(m)for(c=0;c<p;c++)n=u[k++]*3,g=new THREE.Vector3,g.x=y[n++],g.y=y[n++],g.z=y[n],s.vertexNormals.push(g);if(l)m=u[k++],m=new THREE.Color(w[m]),s.color=m;if(b)for(c=0;c<p;c++)m=u[k++],m=new THREE.Color(w[m]),s.vertexColors.push(m);d.faces.push(s)}}})(h);(function(){var b,c,g,h;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)g=a.skinWeights[b],h=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,h,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],h=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,h,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,h,k,j,p,m,n,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=[];n=d.morphTargets[c].vertices;
+t=a.morphTargets[c].vertices;h=0;for(k=t.length;h<k;h+=3)j=t[h]*b,p=t[h+1]*b,m=t[h+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,p,m)))}}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;j=a.morphColors[c].colors;b=0;for(h=j.length;b<h;b+=3)p=new THREE.Color(16755200),p.setRGB(j[b],j[b+1],j[b+2]),k.push(p)}}})(h);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.prototype.constructor=THREE.SceneLoader;
 d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
-THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
+THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var h=JSON.parse(d.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(h,c,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(m in z.objects)if(!B.objects[m])if(q=z.objects[m],q.geometry!==void 0){if(C=B.geometries[q.geometry]){a=!1;for(H=0;H<q.materials.length;H++)D=B.materials[q.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&C.computeTangents();u=q.position;y=q.rotation;w=q.quaternion;x=q.scale;w=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function h(){var a;for(m in z.objects)if(!B.objects[m])if(q=z.objects[m],q.geometry!==void 0){if(C=B.geometries[q.geometry]){a=!1;for(H=0;H<q.materials.length;H++)D=B.materials[q.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&C.computeTangents();u=q.position;y=q.rotation;w=q.quaternion;x=q.scale;w=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
 a=new THREE.Mesh(C,D);a.name=m;a.position.set(u[0],u[1],u[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=q.visible;B.scene.add(a);B.objects[m]=a;if(q.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(q.castsShadow)b=new THREE.ShadowVolume(C),B.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;q.trigger&&q.trigger.toLowerCase()!="none"&&(b=
 a=new THREE.Mesh(C,D);a.name=m;a.position.set(u[0],u[1],u[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=q.visible;B.scene.add(a);B.objects[m]=a;if(q.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(q.castsShadow)b=new THREE.ShadowVolume(C),B.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;q.trigger&&q.trigger.toLowerCase()!="none"&&(b=
 {type:q.trigger,object:q},B.triggers[a.name]=b)}}else u=q.position,y=q.rotation,w=q.quaternion,x=q.scale,w=0,a=new THREE.Object3D,a.name=m,a.position.set(u[0],u[1],u[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=q.visible!==void 0?q.visible:!1,B.scene.add(a),B.objects[m]=a,B.empties[m]=a,q.trigger&&q.trigger.toLowerCase()!="none"&&(b={type:q.trigger,object:q},B.triggers[a.name]=b)}function f(a){return function(b){B.geometries[a]=
 {type:q.trigger,object:q},B.triggers[a.name]=b)}}else u=q.position,y=q.rotation,w=q.quaternion,x=q.scale,w=0,a=new THREE.Object3D,a.name=m,a.position.set(u[0],u[1],u[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=q.visible!==void 0?q.visible:!1,B.scene.add(a),B.objects[m]=a,B.empties[m]=a,q.trigger&&q.trigger.toLowerCase()!="none"&&(b={type:q.trigger,object:q},B.triggers[a.name]=b)}function f(a){return function(b){B.geometries[a]=
-b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){B.geometries[a]=b}}function h(){i.callbackProgress({totalModels:J,totalTextures:O,loadedModels:J-I,loadedTextures:O-E},B);i.onLoadProgress();I==0&&E==0&&c(B)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,p,m,n,t,l,s,q,r,o,u,y,w,x,A,C,F,v,D,z,G,I,E,J,O,B;z=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(m in z.objects)if(q=z.objects[m],q.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(z.transform){a=z.transform.position;r=z.transform.rotation;var K=z.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);r&&B.scene.rotation.set(r[0],r[1],r[2]);K&&B.scene.scale.set(K[0],K[1],K[2]);(a||r||K)&&B.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(t in z.cameras)r=z.cameras[t],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
+b;h();I-=1;i.onLoadComplete();g()}}function e(a){return function(b){B.geometries[a]=b}}function g(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},B);i.onLoadProgress();I==0&&E==0&&c(B)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,p,m,n,t,l,s,q,r,o,u,y,w,x,A,C,F,v,D,z,G,I,E,K,O,B;z=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(m in z.objects)if(q=z.objects[m],q.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(z.transform){a=z.transform.position;r=z.transform.rotation;var L=z.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);r&&B.scene.rotation.set(r[0],r[1],r[2]);L&&B.scene.scale.set(L[0],L[1],L[2]);(a||r||L)&&B.scene.updateMatrix()}a=function(){E-=1;g();i.onLoadComplete()};for(t in z.cameras)r=z.cameras[t],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
 r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),u=r.position,r=r.target,F.position.set(u[0],u[1],u[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),B.cameras[t]=F;for(n in z.lights)r=z.lights[n],t=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(u=r.direction,o=new THREE.DirectionalLight(t,F),o.position.set(u[0],u[1],u[2]),o.position.normalize()):r.type=="point"?(u=r.position,o=r.distance,
 r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),u=r.position,r=r.target,F.position.set(u[0],u[1],u[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),B.cameras[t]=F;for(n in z.lights)r=z.lights[n],t=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(u=r.direction,o=new THREE.DirectionalLight(t,F),o.position.set(u[0],u[1],u[2]),o.position.normalize()):r.type=="point"?(u=r.position,o=r.distance,
 o=new THREE.PointLight(t,F,o),o.position.set(u[0],u[1],u[2])):r.type=="ambient"&&(o=new THREE.AmbientLight(t)),B.scene.add(o),B.lights[n]=o;for(l in z.fogs)n=z.fogs[l],n.type=="linear"?v=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(v=new THREE.FogExp2(0,n.density)),r=n.color,v.color.setRGB(r[0],r[1],r[2]),B.fogs[l]=v;if(B.cameras&&z.defaults.camera)B.currentCamera=B.cameras[z.defaults.camera];if(B.fogs&&z.defaults.fog)B.scene.fog=B.fogs[z.defaults.fog];r=z.defaults.bgcolor;B.bgColor=new THREE.Color;
 o=new THREE.PointLight(t,F,o),o.position.set(u[0],u[1],u[2])):r.type=="ambient"&&(o=new THREE.AmbientLight(t)),B.scene.add(o),B.lights[n]=o;for(l in z.fogs)n=z.fogs[l],n.type=="linear"?v=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(v=new THREE.FogExp2(0,n.density)),r=n.color,v.color.setRGB(r[0],r[1],r[2]),B.fogs[l]=v;if(B.cameras&&z.defaults.camera)B.currentCamera=B.cameras[z.defaults.camera];if(B.fogs&&z.defaults.fog)B.scene.fog=B.fogs[z.defaults.fog];r=z.defaults.bgcolor;B.bgColor=new THREE.Color;
-B.bgColor.setRGB(r[0],r[1],r[2]);B.bgColorAlpha=z.defaults.bgalpha;for(j in z.geometries)if(l=z.geometries[j],l.type=="bin_mesh"||l.type=="ascii_mesh")I+=1,i.onLoadStart();J=I;for(j in z.geometries)l=z.geometries[j],l.type=="cube"?(C=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides),B.geometries[j]=C):l.type=="plane"?(C=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight),B.geometries[j]=C):l.type=="sphere"?
+B.bgColor.setRGB(r[0],r[1],r[2]);B.bgColorAlpha=z.defaults.bgalpha;for(j in z.geometries)if(l=z.geometries[j],l.type=="bin_mesh"||l.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in z.geometries)l=z.geometries[j],l.type=="cube"?(C=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides),B.geometries[j]=C):l.type=="plane"?(C=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight),B.geometries[j]=C):l.type=="sphere"?
 (C=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight),B.geometries[j]=C):l.type=="cylinder"?(C=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),B.geometries[j]=C):l.type=="torus"?(C=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),B.geometries[j]=C):l.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(l.subdivisions),B.geometries[j]=C):l.type=="bin_mesh"?b.load(d(l.url,z.urlBaseType),f(j)):l.type=="ascii_mesh"?G.load(d(l.url,z.urlBaseType),
 (C=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight),B.geometries[j]=C):l.type=="cylinder"?(C=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),B.geometries[j]=C):l.type=="torus"?(C=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),B.geometries[j]=C):l.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(l.subdivisions),B.geometries[j]=C):l.type=="bin_mesh"?b.load(d(l.url,z.urlBaseType),f(j)):l.type=="ascii_mesh"?G.load(d(l.url,z.urlBaseType),
 f(j)):l.type=="embedded_mesh"&&(l=z.embeds[l.id])&&G.createModel(l,e(j),"");for(s in z.textures)if(j=z.textures[s],j.url instanceof Array){E+=j.url.length;for(l=0;l<j.url.length;l++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(s in z.textures){j=z.textures[s];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){l=[];for(var H=0;H<j.url.length;H++)l[H]=d(j.url[H],z.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,j.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(j.url,
 f(j)):l.type=="embedded_mesh"&&(l=z.embeds[l.id])&&G.createModel(l,e(j),"");for(s in z.textures)if(j=z.textures[s],j.url instanceof Array){E+=j.url.length;for(l=0;l<j.url.length;l++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(s in z.textures){j=z.textures[s];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){l=[];for(var H=0;H<j.url.length;H++)l[H]=d(j.url[H],z.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,j.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(j.url,
 z.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)l.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)l.magFilter=THREE[j.magFilter];if(j.repeat){l.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)l.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)l.wrapT=THREE.RepeatWrapping}j.offset&&l.offset.set(j.offset[0],j.offset[1]);if(j.wrap){v={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(v[j.wrap[0]]!==void 0)l.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)l.wrapT=
 z.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)l.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)l.magFilter=THREE[j.magFilter];if(j.repeat){l.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)l.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)l.wrapT=THREE.RepeatWrapping}j.offset&&l.offset.set(j.offset[0],j.offset[1]);if(j.wrap){v={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(v[j.wrap[0]]!==void 0)l.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)l.wrapT=
 v[j.wrap[1]]}}B.textures[s]=l}for(p in z.materials){s=z.materials[p];for(A in s.parameters)if(A=="envMap"||A=="map"||A=="lightMap")s.parameters[A]=B.textures[s.parameters[A]];else if(A=="shading")s.parameters[A]=s.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")s.parameters[A]=THREE[s.parameters[A]]?THREE[s.parameters[A]]:THREE.NormalBlending;else if(A=="combine")s.parameters[A]=s.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A==
 v[j.wrap[1]]}}B.textures[s]=l}for(p in z.materials){s=z.materials[p];for(A in s.parameters)if(A=="envMap"||A=="map"||A=="lightMap")s.parameters[A]=B.textures[s.parameters[A]];else if(A=="shading")s.parameters[A]=s.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")s.parameters[A]=THREE[s.parameters[A]]?THREE[s.parameters[A]]:THREE.NormalBlending;else if(A=="combine")s.parameters[A]=s.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A==
 "vertexColors")if(s.parameters[A]=="face")s.parameters[A]=THREE.FaceColors;else if(s.parameters[A])s.parameters[A]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=!0;if(s.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);l=s.parameters.color;v=s.parameters.specular;b=s.parameters.ambient;G=s.parameters.shininess;a.tNormal.texture=B.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=
 "vertexColors")if(s.parameters[A]=="face")s.parameters[A]=THREE.FaceColors;else if(s.parameters[A])s.parameters[A]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=!0;if(s.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);l=s.parameters.color;v=s.parameters.specular;b=s.parameters.ambient;G=s.parameters.shininess;a.tNormal.texture=B.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=
 s.parameters.normalMapFactor;if(s.parameters.map)a.tDiffuse.texture=s.parameters.map,a.enableDiffuse.value=!0;if(s.parameters.lightMap)a.tAO.texture=s.parameters.lightMap,a.enableAO.value=!0;if(s.parameters.specularMap)a.tSpecular.texture=B.textures[s.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(v);a.uAmbientColor.value.setHex(b);a.uShininess.value=G;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;s=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
 s.parameters.normalMapFactor;if(s.parameters.map)a.tDiffuse.texture=s.parameters.map,a.enableDiffuse.value=!0;if(s.parameters.lightMap)a.tAO.texture=s.parameters.lightMap,a.enableAO.value=!0;if(s.parameters.specularMap)a.tSpecular.texture=B.textures[s.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(v);a.uAmbientColor.value.setHex(b);a.uShininess.value=G;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;s=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
-vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else s=new THREE[s.type](s.parameters);B.materials[p]=s}g();i.callbackSync(B);h()};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,f=b.offsetX!==void 0?b.offsetX:0,e=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,f,e,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 f=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);f+=h>>1^-(h&1);b[8*e+g]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(g=e=0;g<c;g++)h=a.charCodeAt(g+d),f[g]=e-h,h==0&&e++;return[b,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,e,i){for(var j,k,s,q=a.length;i<q;i+=e)j=a[i],k=a[i+1],s=a[i+2],j=j/16383*b,k=k/16383*b,s=s/16383*b,j+=d,k+=g,s+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,s)))})(e[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,j.push(d,1-e)})(e[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)})(e[0],8,5);(function(a){var b,d,e,f,g,i,r,o,u,y=a.length;for(b=0;b<y;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;o=d;u=e;i=f;r=d;var w=e,x=f,A=g.materials[0],C=k[w*3],F=k[w*3+1],w=k[w*3+2],v=k[x*3],D=k[x*3+1],x=k[x*3+2];r=new THREE.Vector3(k[r*3],k[r*3+1],k[r*3+2]);w=new THREE.Vector3(C,F,w);x=new THREE.Vector3(v,D,x);g.faces.push(new THREE.Face3(o,u,i,[r,w,x],null,A));g=j[d*2];d=j[d*2+
-1];i=j[e*2];r=j[e*2+1];o=j[f*2];u=j[f*2+1];f=c.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(g,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(o,u));f.push(r)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
+vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else s=new THREE[s.type](s.parameters);B.materials[p]=s}h();i.callbackSync(B);g()};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,h=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,g=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,h,f,e,g):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,h=0;h<8;h++){for(var f=0,e=0;e<c;++e){var g=a.charCodeAt(e+d);f+=g>>1^-(g&1);b[8*e+h]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(h=e=0;h<c;h++)g=a.charCodeAt(h+d),f[h]=e-g,g==0&&e++;return[b,f]};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,h,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,e,i){for(var j,k,s,q=a.length;i<q;i+=e)j=a[i],k=a[i+1],s=a[i+2],j=j/16383*b,k=k/16383*b,s=s/16383*b,j+=d,k+=h,s+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,s)))})(e[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,j.push(d,1-e)})(e[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)})(e[0],8,5);(function(a){var b,d,e,f,h,i,r,o,u,y=a.length;for(b=0;b<y;b+=3){d=a[b];e=a[b+1];f=a[b+2];h=c;o=d;u=e;i=f;r=d;var w=e,x=f,A=h.materials[0],C=k[w*3],F=k[w*3+1],w=k[w*3+2],v=k[x*3],D=k[x*3+1],x=k[x*3+2];r=new THREE.Vector3(k[r*3],k[r*3+1],k[r*3+2]);w=new THREE.Vector3(C,F,w);x=new THREE.Vector3(v,D,x);h.faces.push(new THREE.Face3(o,u,i,[r,w,x],null,A));h=j[d*2];d=j[d*2+
+1];i=j[e*2];r=j[e*2+1];o=j[f*2];u=j[f*2+1];f=c.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(h,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(o,u));f.push(r)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
 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,f,e,h,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=k;g[f]=this.lerp(j[a],j[a+3],e);g[f+1]=this.lerp(j[a+1],j[a+4],e);g[f+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+
-2]=k;c=a+this.yd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=k+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};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,f,e,h){var i=f+1,k=f+this.yd,j=f+this.zd,p=i+this.yd,m=i+this.zd,n=f+this.yd+this.zd,t=i+this.yd+this.zd,l=0,s=this.field[f],q=this.field[i],r=this.field[k],o=this.field[p],u=this.field[j],y=this.field[m],w=this.field[n],x=this.field[t];s<e&&(l|=1);q<e&&(l|=2);r<e&&(l|=8);o<e&&(l|=4);u<e&&(l|=16);y<e&&(l|=32);w<e&&(l|=128);x<e&&(l|=64);var A=THREE.edgeTable[l];if(A===0)return 0;
-var C=this.delta,F=a+C,v=c+C,C=g+C;A&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,s,q));A&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,g,q,o));A&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,6,e,a,v,g,r,o));A&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,s,r));A&16&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,12,e,a,c,C,u,y));
-A&32&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,15,e,F,c,C,y,x));A&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,v,C,w,x));A&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,21,e,a,c,C,u,w));A&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,s,u));A&512&&(this.compNorm(i),this.compNorm(m),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,g,q,y));A&1024&&(this.compNorm(p),
-this.compNorm(t),this.VIntZ(p*3,this.vlist,this.nlist,30,e,F,v,g,o,x));A&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,e,a,v,g,r,w));l<<=4;for(e=f=0;THREE.triTable[l+e]!=-1;)a=l+e,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),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,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[f];this.positionArray[i+4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+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[f];this.normalArray[i+4]=c[f+1];this.normalArray[i+5]=c[f+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+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,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,k=c*this.size,j=a*this.size,p=Math.floor(i-h);p<1&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h);
-h>this.size-1&&(h=this.size-1);for(var t,l,s,q,r,o;p<i;p++){j=this.size2*p;l=p/this.size-g;r=l*l;for(l=m;l<k;l++){s=j+this.size*l;t=l/this.size-c;o=t*t;for(t=n;t<h;t++)q=t/this.size-a,q=f/(1.0E-6+q*q+o+r)-e,q>0&&(this.field[s+t]+=q)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,k=this.size,j=this.yd,p=this.zd,m=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g<n;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<k;f++){i=g+f*j;for(e=0;e<k;e++)m[p*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,
-i,k,j=this.size,p=this.yd,m=this.zd,n=this.field,t=j*Math.sqrt(a/c);t>j&&(t=j);for(f=0;f<t;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*p;for(g=0;g<j;g++){k=i+g;for(e=0;e<j;e++)n[m*e+k]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,k,j=this.size,p=this.yd,m=this.zd,n=this.field,t=j*Math.sqrt(a/c);t>j&&(t=j);for(e=0;e<t;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=m*e;for(f=0;f<j;f++){k=i+f*p;for(g=0;g<j;g++)n[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,f,e,h,i,k,j,p,m=this.size-2;for(e=1;e<m;e++){p=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(f=1;f<m;f++){j=p+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<m;g++)h=(g-this.halfsize)/this.halfsize,c=j+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(f){var e,h,i,k,j,p,m,n;for(e=0;e<f.count;e++)m=e*3,j=m+1,n=m+2,h=f.positionArray[m],
-i=f.positionArray[j],k=f.positionArray[n],p=new THREE.Vector3(h,i,k),h=f.normalArray[m],i=f.normalArray[j],k=f.normalArray[n],m=new THREE.Vector3(h,i,k),m.normalize(),j=new THREE.Vertex(p),c.vertices.push(j),g.push(m);p=f.count/3;for(e=0;e<p;e++)m=(a+e)*3,j=m+1,n=m+2,h=g[m],i=g[j],k=g[n],m=new THREE.Face3(m,j,n,[h,i,k]),c.faces.push(m);a+=p;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,h){return a+(c-a)*h};this.VIntX=function(a,c,h,f,e,g,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=g+e*this.delta;c[f+1]=i;c[f+2]=k;h[f]=this.lerp(j[a],j[a+3],e);h[f+1]=this.lerp(j[a+1],j[a+4],e);h[f+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,c,h,f,e,g,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=g;c[f+1]=i+e*this.delta;c[f+
+2]=k;c=a+this.yd*3;h[f]=this.lerp(j[a],j[c],e);h[f+1]=this.lerp(j[a+1],j[c+1],e);h[f+2]=this.lerp(j[a+2],j[c+2],e)};this.VIntZ=function(a,c,h,f,e,g,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=g;c[f+1]=i;c[f+2]=k+e*this.delta;c=a+this.zd*3;h[f]=this.lerp(j[a],j[c],e);h[f+1]=this.lerp(j[a+1],j[c+1],e);h[f+2]=this.lerp(j[a+2],j[c+2],e)};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,h,f,e,g){var i=f+1,k=f+this.yd,j=f+this.zd,p=i+this.yd,m=i+this.zd,n=f+this.yd+this.zd,t=i+this.yd+this.zd,l=0,s=this.field[f],q=this.field[i],r=this.field[k],o=this.field[p],u=this.field[j],y=this.field[m],w=this.field[n],x=this.field[t];s<e&&(l|=1);q<e&&(l|=2);r<e&&(l|=8);o<e&&(l|=4);u<e&&(l|=16);y<e&&(l|=32);w<e&&(l|=128);x<e&&(l|=64);var A=THREE.edgeTable[l];if(A===0)return 0;
+var C=this.delta,F=a+C,v=c+C,C=h+C;A&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,h,s,q));A&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,h,q,o));A&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,6,e,a,v,h,r,o));A&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,h,s,r));A&16&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,12,e,a,c,C,u,y));
+A&32&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,15,e,F,c,C,y,x));A&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,v,C,w,x));A&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,21,e,a,c,C,u,w));A&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,h,s,u));A&512&&(this.compNorm(i),this.compNorm(m),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,h,q,y));A&1024&&(this.compNorm(p),
+this.compNorm(t),this.VIntZ(p*3,this.vlist,this.nlist,30,e,F,v,h,o,x));A&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,e,a,v,h,r,w));l<<=4;for(e=f=0;THREE.triTable[l+e]!=-1;)a=l+e,c=a+1,h=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[h],g),e+=3,f++;return f};this.posnormtriv=function(a,c,h,f,e,g){var i=this.count*3;this.positionArray[i]=a[h];this.positionArray[i+1]=a[h+1];this.positionArray[i+2]=a[h+2];this.positionArray[i+
+3]=a[f];this.positionArray[i+4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=c[h];this.normalArray[i+1]=c[h+1];this.normalArray[i+2]=c[h+2];this.normalArray[i+3]=c[f];this.normalArray[i+4]=c[f+1];this.normalArray[i+5]=c[f+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&g(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,h,f,e){var g=this.size*Math.sqrt(f/e),i=h*this.size,k=c*this.size,j=a*this.size,p=Math.floor(i-g);p<1&&(p=1);i=Math.floor(i+g);i>this.size-1&&(i=this.size-1);var m=Math.floor(k-g);m<1&&(m=1);k=Math.floor(k+g);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-g);n<1&&(n=1);g=Math.floor(j+g);
+g>this.size-1&&(g=this.size-1);for(var t,l,s,q,r,o;p<i;p++){j=this.size2*p;l=p/this.size-h;r=l*l;for(l=m;l<k;l++){s=j+this.size*l;t=l/this.size-c;o=t*t;for(t=n;t<g;t++)q=t/this.size-a,q=f/(1.0E-6+q*q+o+r)-e,q>0&&(this.field[s+t]+=q)}}};this.addPlaneX=function(a,c){var h,f,e,g,i,k=this.size,j=this.yd,p=this.zd,m=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(h=0;h<n;h++)if(f=h/k,f*=f,g=a/(1.0E-4+f)-c,g>0)for(f=0;f<k;f++){i=h+f*j;for(e=0;e<k;e++)m[p*e+i]+=g}};this.addPlaneY=function(a,c){var h,f,e,g,
+i,k,j=this.size,p=this.yd,m=this.zd,n=this.field,t=j*Math.sqrt(a/c);t>j&&(t=j);for(f=0;f<t;f++)if(h=f/j,h*=h,g=a/(1.0E-4+h)-c,g>0){i=f*p;for(h=0;h<j;h++){k=i+h;for(e=0;e<j;e++)n[m*e+k]+=g}}};this.addPlaneZ=function(a,c){var h,f,e,g,i,k,j=this.size,p=this.yd,m=this.zd,n=this.field,t=j*Math.sqrt(a/c);t>j&&(t=j);for(e=0;e<t;e++)if(h=e/j,h*=h,g=a/(1.0E-4+h)-c,g>0){i=m*e;for(f=0;f<j;f++){k=i+f*p;for(h=0;h<j;h++)n[k+h]+=g}}};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,h,f,e,g,i,k,j,p,m=this.size-2;for(e=1;e<m;e++){p=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(f=1;f<m;f++){j=p+this.size*f;i=(f-this.halfsize)/this.halfsize;for(h=1;h<m;h++)g=(h-this.halfsize)/this.halfsize,c=j+h,this.polygonize(g,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,h=[];this.render(function(f){var e,g,i,k,j,p,m,n;for(e=0;e<f.count;e++)m=e*3,j=m+1,n=m+2,g=f.positionArray[m],
+i=f.positionArray[j],k=f.positionArray[n],p=new THREE.Vector3(g,i,k),g=f.normalArray[m],i=f.normalArray[j],k=f.normalArray[n],m=new THREE.Vector3(g,i,k),m.normalize(),j=new THREE.Vertex(p),c.vertices.push(j),h.push(m);p=f.count/3;for(e=0;e<p;e++)m=(a+e)*3,j=m+1,n=m+2,g=h[m],i=h[j],k=h[n],m=new THREE.Face3(m,j,n,[g,i,k]),c.faces.push(m);a+=p;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -343,23 +344,23 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
 THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,g,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],d=this.rayCast(a,g),d<Number.MAX_VALUE)g.distance=d,d>f?this.hits.push(g):this.hits.unshift(g),f=d;return this.hits};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,h,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(h=this.colliders[c],d=this.rayCast(a,h),d<Number.MAX_VALUE)h.distance=d,d>f?this.hits.push(h):this.hits.unshift(h),f=d;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,f=0;f<c.numFaces;f++){var e=c.mesh.geometry.faces[f],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,k=c.mesh.geometry.vertices[e.c].position,j=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,k,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,g,f,e){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;f.set(0,0,0);h.sub(b,c);i.sub(d,b);f.cross(h,i);h=f.dot(a.direction);if(!(h<0))if(e.doubleSided||e.flipSided)f.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;e=f.dot(c)-f.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=h*g))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(f.x)>
-Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=h.y-c.y,f=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=f*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=f*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,h,f=0;f<c.numFaces;f++){var e=c.mesh.geometry.faces[f],g=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,k=c.mesh.geometry.vertices[e.c].position,j=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,g,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,h=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+e instanceof THREE.Face4&&(e=this.rayTriangle(b,g,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,h=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,k,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,h=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:h}};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,h,f,e){var g=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;f.set(0,0,0);g.sub(b,c);i.sub(d,b);f.cross(g,i);g=f.dot(a.direction);if(!(g<0))if(e.doubleSided||e.flipSided)f.multiplyScalar(-1),g*=-1;else return Number.MAX_VALUE;e=f.dot(c)-f.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=g*h))return Number.MAX_VALUE;e/=g;g=THREE.CollisionSystem.__v3;g.copy(a.direction);g.multiplyScalar(e);g.addSelf(a.origin);Math.abs(f.x)>
+Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=g.y-c.y,f=b.y-c.y,h=d.y-c.y,g=g.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=g.x-c.x,f=b.x-c.x,h=d.x-c.x,g=g.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=g.x-c.x,f=b.x-c.x,h=d.x-c.x,g=g.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=g.x-c.x,f=b.x-c.x,h=d.x-c.x,g=g.y-c.y,b=b.y-c.y,d=d.y-c.y);c=f*d-b*h;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-g*h)*c;if(!(d>=0))return Number.MAX_VALUE;c*=f*g-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,g=0,f=0,e=0,h=0,i=0,k=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,k=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,k=!1,e=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,k=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
-k=!1,h=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,k=!1,i=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,k=!1,i=1);if(k)return-1;k=0;g>d&&(k=1,d=g);f>d&&(k=2,d=f);switch(k){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
-d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,h=0,f=0,e=0,g=0,i=0,k=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,k=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,k=!1,e=1);b.origin.y<c.min.y?(h=c.min.y-b.origin.y,h/=b.direction.y,k=!1,g=-1):b.origin.y>c.max.y&&(h=c.max.y-b.origin.y,h/=b.direction.y,
+k=!1,g=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,k=!1,i=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,k=!1,i=1);if(k)return-1;k=0;h>d&&(k=1,d=h);f>d&&(k=2,d=f);switch(k){case 0:g=b.origin.y+b.direction.y*d;if(g<c.min.y||g>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,g,0);break;case 2:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;g=b.origin.y+b.direction.y*d;if(g<c.min.y||g>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var 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,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,p;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,h=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,g=new THREE.Matrix4,i,k,j,p;h.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),n=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:m},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
 1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:m},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-l=new THREE.Scene;l.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));l.add(t);this.setSize=function(a,d){b.call(c,a,d);m.width=a;m.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||p!==b.fov){i=b.aspect;k=b.near;j=b.far;p=b.fov;var r=b.projectionMatrix.clone(),o=125/30*0.5,u=o*k/125,y=k*Math.tan(p*Math.PI/360),w;e.n14=o;h.n14=-o;o=-y*i+u;w=y*i+u;r.n11=2*k/(w-o);r.n13=(w+o)/(w-o);g.projectionMatrix.copy(r);o=-y*i-u;w=y*i-u;r.n11=
-2*k/(w-o);r.n13=(w+o)/(w-o);f.projectionMatrix.copy(r)}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,m,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,n,!0);l.updateMatrixWorld();d.call(c,l,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,f,e=new THREE.PerspectiveCamera;e.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;f=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
-b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);d.call(c,a,e);this.setViewport(g,0,g,f);d.call(c,a,h,!1)}};
+l=new THREE.Scene;l.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));l.add(t);this.setSize=function(a,d){b.call(c,a,d);m.width=a;m.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||p!==b.fov){i=b.aspect;k=b.near;j=b.far;p=b.fov;var r=b.projectionMatrix.clone(),o=125/30*0.5,u=o*k/125,y=k*Math.tan(p*Math.PI/360),w;e.n14=o;g.n14=-o;o=-y*i+u;w=y*i+u;r.n11=2*k/(w-o);r.n13=(w+o)/(w-o);h.projectionMatrix.copy(r);o=-y*i-u;w=y*i-u;r.n11=
+2*k/(w-o);r.n13=(w+o)/(w-o);f.projectionMatrix.copy(r)}h.matrixWorld.copy(b.matrixWorld).multiplySelf(g);h.position.copy(b.position);h.near=b.near;h.far=b.far;d.call(c,a,h,m,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,n,!0);l.updateMatrixWorld();d.call(c,l,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,h,f,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var g=new THREE.PerspectiveCamera;g.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);h=a/2;f=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
+b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);g.projectionMatrix=e.projectionMatrix;g.position.copy(b.position);g.target.copy(b.target);g.translateX(-c.separation);g.lookAt(g.target);this.setViewport(0,0,h,f);d.call(c,a,e);this.setViewport(h,0,h,f);d.call(c,a,g,!1)}};

+ 1 - 1
build/custom/ThreeSVG.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,i=l*d+h*c-e*f,j=l*f+e*d-g*c,c=-e*
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,i=l*d+h*c-e*f,j=l*f+e*d-g*c,c=-e*
 c-g*d-h*f;b.x=m*l+c*-e+i*-h-j*-g;b.y=i*l+c*-g+j*-e-m*-h;b.z=j*l+c*-h+m*-g-i*-e;return b}};
 c-g*d-h*f;b.x=m*l+c*-e+i*-h-j*-g;b.y=i*l+c*-g+j*-e-m*-h;b.z=j*l+c*-h+m*-g-i*-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.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.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.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)}};

+ 58 - 58
build/custom/ThreeWebGL.js

@@ -72,7 +72,7 @@ this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRo
 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,i=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-e*i;this.y=c*a+f*i+e*g-b*h;this.z=e*a+f*h+b*i-c*g;this.w=f*a-b*g-c*i-e*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,i=this.y,h=this.z,r=this.w,p=r*c+i*f-h*e,j=r*e+h*c-g*f,n=r*f+g*e-i*c,c=-g*
 this.x,c=this.y,e=this.z,f=this.w,g=a.x,i=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-e*i;this.y=c*a+f*i+e*g-b*h;this.z=e*a+f*h+b*i-c*g;this.w=f*a-b*g-c*i-e*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,i=this.y,h=this.z,r=this.w,p=r*c+i*f-h*e,j=r*e+h*c-g*f,n=r*f+g*e-i*c,c=-g*
 c-i*e-h*f;b.x=p*r+c*-g+j*-h-n*-i;b.y=j*r+c*-i+n*-g-p*-h;b.z=n*r+c*-h+p*-i-j*-g;return b}};
 c-i*e-h*f;b.x=p*r+c*-g+j*-h-n*-i;b.y=j*r+c*-i+n*-g-p*-h;b.z=n*r+c*-h+p*-i-j*-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.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.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.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,i){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=i;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,i){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=i;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)}};
@@ -233,63 +233,63 @@ d.getUniformLocation(w.program,"screenPosition");w.uniforms.modelViewMatrix=d.ge
 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)};
 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){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=
 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);
 !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]);D.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
-d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,e){var f,g,q,l,C=a.lights,u=a.fog;na=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
-this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);D.info.render.calls=0;D.info.render.vertices=0;D.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);za.multiply(b.projectionMatrix,b.matrixWorldInverse);i(za);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||h(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);qa(q,b,!0);var k=g,m=k.object,y=k.buffer,x=void 0,x=x=void 0,x=m.material;if(x instanceof THREE.MeshFaceMaterial){if(x=y.materialIndex,x>=0)x=m.geometry.materials[x],x.transparent?(k.transparent=x,k.opaque=null):(k.opaque=x,k.transparent=null)}else if(x)x.transparent?
-(k.transparent=x,k.opaque=null):(k.opaque=x,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ca.copy(q.position),za.multiplyVector3(Ca),g.z=Ca.z)}this.sortObjects&&l.sort(r);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),qa(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),
-ia(a.overrideMaterial.depthTest),ka(a.overrideMaterial.depthWrite),F(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),j(a.__webglObjects,!1,"",b,C,u,!0,a.overrideMaterial),n(a.__webglObjectsImmediate,"",b,C,u,!1,a.overrideMaterial)):(M(THREE.NormalBlending),j(a.__webglObjects,!0,"opaque",b,C,u,!1),n(a.__webglObjectsImmediate,"opaque",b,C,u,!1),j(a.__webglObjects,!1,"transparent",b,C,u,!0),n(a.__webglObjectsImmediate,"transparent",b,C,u,
-!0));if(a.__webglSprites.length){q=w.attributes;C=w.uniforms;u=Da/Ha;e=[];f=Ha*0.5;l=Da*0.5;g=!0;d.useProgram(w.program);ra=w.program;sa=wa=ya=-1;Va||(d.enableVertexAttribArray(w.attributes.position),d.enableVertexAttribArray(w.attributes.uv),Va=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,w.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,w.elementBuffer);
-d.uniformMatrix4fv(C.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(C.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(r);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(C.useScreenCoordinates,1),d.uniform3f(C.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(C.useScreenCoordinates,0),d.uniform1i(C.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(C.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(C.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(C.uvOffset,m.uvOffset.x,m.uvOffset.y),
-d.uniform2f(C.alignment,m.alignment.x,m.alignment.y),d.uniform1f(C.opacity,m.opacity),d.uniform3f(C.color,m.color.r,m.color.g,m.color.b),d.uniform1f(C.rotation,m.rotation),d.uniform2fv(C.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(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,i=void 0,h=void 0,j=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 j=h,q=void 0,l=void 0,n=void 0,r=void 0,k=void 0,m=void 0,p=void 0,x={},w=j.morphTargets.length;j.geometryGroups={};q=0;for(l=j.faces.length;q<l;q++)n=j.faces[q],r=n.materialIndex,m=r!==void 0?r:-1,x[m]===void 0&&
-(x[m]={hash:m,counter:0}),p=x[m].hash+"_"+x[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w}),k=n instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+k>65535&&(x[m].counter+=1,p=x[m].hash+"_"+x[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w})),n instanceof THREE.Face3?j.geometryGroups[p].faces3.push(q):j.geometryGroups[p].faces4.push(q),
-j.geometryGroups[p].vertices+=k;j.geometryGroupsList=[];q=void 0;for(q in j.geometryGroups)j.geometryGroups[q].id=Ea++,j.geometryGroupsList.push(j.geometryGroups[q])}for(i in h.geometryGroups)if(j=h.geometryGroups[i],!j.__webglVertexBuffer){q=j;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){n=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(n=q.numMorphTargets;l<n;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}D.info.memory.geometries++;r=f;k=r.geometry;l=j.faces3;m=j.faces4;q=l.length*3+m.length*4;n=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(r,
-j);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;x=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;w=l.vertexColors?l.vertexColors:!1;j.__vertexArray=new Float32Array(q*3);if(x)j.__normalArray=new Float32Array(q*3);if(k.hasTangents)j.__tangentArray=new Float32Array(q*4);if(w)j.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>
-0)j.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(q*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(q*4),j.__skinVertexBArray=new Float32Array(q*4),j.__skinIndexArray=new Float32Array(q*4),j.__skinWeightArray=new Float32Array(q*4);j.__faceArray=new Uint16Array(n*3);j.__lineArray=new Uint16Array(m*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];r=0;for(k=j.numMorphTargets;r<k;r++)j.__morphTargetsArrays.push(new Float32Array(q*
-3))}j.__needsSmoothNormals=x===THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=w;j.__normalType=x;j.__webglFaceCount=n*3;j.__webglLineCount=m*2;if(l.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];n=void 0;for(n in l.attributes){var r=l.attributes[n],k={},F;for(F in r)k[F]=r[F];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=n,r.needsUpdate=!0,k.__original=r;j.__webglCustomAttributesList.push(k)}}j.__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)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,j=h,q=j.vertices.length,
-j.__vertexArray=new Float32Array(q*3),j.__colorArray=new Float32Array(q*3),j.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__webglLineCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof
-THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__sortArray=[],j.__webglParticleCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(i in h=f.geometry,h.geometryGroups)j=h.geometryGroups[i],y(g.__webglObjects,j,f);else f instanceof
-THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,y(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)I(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;i=f;for(h=g.length-1;h>=0;h--)g[h]===i&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&I(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(F=a.__webglObjects[f].object,i=F.geometry,h=n=l=void 0,F instanceof THREE.Mesh){j=0;for(q=i.geometryGroupsList.length;j<q;j++)if(l=i.geometryGroupsList[j],
-h=c(F,l),n=h.attributes&&u(h),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||n)if(n=d.DYNAMIC_DRAW,r=!i.dynamic,l.__inittedArrays){var E=m=k=void 0,s=void 0,G=void 0,L=void 0,v=void 0,Z=void 0,$=void 0,X=void 0,P=void 0,R=E=L=void 0,z=void 0,A=void 0,B=void 0,Y=s=void 0,aa=void 0,T=s=$=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=L=void 0,S=void 0,V=void 0,ca=void 0,da=void 0,H=R=V=
-W=0,Q=0,ba=J=E=0,O=v=Y=0,t=0,ea=void 0,O=l.__vertexArray,S=l.__uvArray,t=l.__uv2Array,N=l.__normalArray,G=l.__tangentArray,aa=l.__colorArray,T=l.__skinVertexAArray,U=l.__skinVertexBArray,Z=l.__skinIndexArray,ga=l.__skinWeightArray,M=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,o=void 0,o=l.__faceArray,ea=l.__lineArray,ha=l.__needsSmoothNormals,P=l.__vertexColorType,X=l.__uvType,L=l.__normalType,$=F.geometry,ia=$.__dirtyElements,ka=$.__dirtyUvs,pa=$.__dirtyNormals,qa=$.__dirtyTangents,ta=
-$.__dirtyColors,ca=$.__dirtyMorphTargets,da=$.vertices,x=l.faces3,w=l.faces4,fa=$.faces,oa=$.faceVertexUvs[0],ra=$.faceVertexUvs[1],ja=$.skinVerticesA,la=$.skinVerticesB,ma=$.skinIndices,na=$.skinWeights,sa=$.morphTargets;if($.__dirtyVertices){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=da[s.a].position,A=da[s.b].position,B=da[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=w.length;k<m;k++)s=fa[w[k]],z=da[s.a].position,A=da[s.b].position,
-B=da[s.c].position,s=da[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,n)}if(ca){V=0;for(ca=sa.length;V<ca;V++){k=O=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=sa[V].vertices[s.a].position,A=sa[V].vertices[s.b].position,B=sa[V].vertices[s.c].position,da=M[V],da[O]=z.x,da[O+1]=z.y,da[O+2]=z.z,da[O+3]=A.x,da[O+4]=A.y,da[O+
-5]=A.z,da[O+6]=B.x,da[O+7]=B.y,da[O+8]=B.z,O+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=sa[V].vertices[s.a].position,A=sa[V].vertices[s.b].position,B=sa[V].vertices[s.c].position,s=sa[V].vertices[s.d].position,da=M[V],da[O]=z.x,da[O+1]=z.y,da[O+2]=z.z,da[O+3]=A.x,da[O+4]=A.y,da[O+5]=A.z,da[O+6]=B.x,da[O+7]=B.y,da[O+8]=B.z,da[O+9]=s.x,da[O+10]=s.y,da[O+11]=s.z,O+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[V]);d.bufferData(d.ARRAY_BUFFER,M[V],n)}}if(na.length){k=0;for(m=x.length;k<
-m;k++)s=fa[x[k]],z=na[s.a],A=na[s.b],B=na[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=ma[s.a],A=ma[s.b],B=ma[s.c],Z[v]=z.x,Z[v+1]=z.y,Z[v+2]=z.z,Z[v+3]=z.w,Z[v+4]=A.x,Z[v+5]=A.y,Z[v+6]=A.z,Z[v+7]=A.w,Z[v+8]=B.x,Z[v+9]=B.y,Z[v+10]=B.z,Z[v+11]=B.w,z=ja[s.a],A=ja[s.b],B=ja[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=la[s.a],A=la[s.b],B=la[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=w.length;k<m;k++)s=fa[w[k]],z=na[s.a],A=na[s.b],B=na[s.c],M=na[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]=M.x,ga[v+13]=M.y,ga[v+14]=M.z,ga[v+15]=M.w,z=ma[s.a],A=ma[s.b],B=ma[s.c],M=ma[s.d],Z[v]=z.x,Z[v+1]=z.y,
-Z[v+2]=z.z,Z[v+3]=z.w,Z[v+4]=A.x,Z[v+5]=A.y,Z[v+6]=A.z,Z[v+7]=A.w,Z[v+8]=B.x,Z[v+9]=B.y,Z[v+10]=B.z,Z[v+11]=B.w,Z[v+12]=M.x,Z[v+13]=M.y,Z[v+14]=M.z,Z[v+15]=M.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],M=ja[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=la[s.a],A=la[s.b],B=la[s.c],s=la[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,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,U,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,Z,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,n))}if(ta&&P){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],
-v=s.vertexColors,Z=s.color,v.length===3&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2]):U=T=s=Z,aa[Y]=s.r,aa[Y+1]=s.g,aa[Y+2]=s.b,aa[Y+3]=T.r,aa[Y+4]=T.g,aa[Y+5]=T.b,aa[Y+6]=U.r,aa[Y+7]=U.g,aa[Y+8]=U.b,Y+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],v=s.vertexColors,Z=s.color,v.length===4&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2],v=v[3]):v=U=T=s=Z,aa[Y]=s.r,aa[Y+1]=s.g,aa[Y+2]=s.b,aa[Y+3]=T.r,aa[Y+4]=T.g,aa[Y+5]=T.b,aa[Y+6]=U.r,aa[Y+7]=U.g,aa[Y+8]=U.b,aa[Y+9]=v.r,aa[Y+10]=v.g,aa[Y+11]=v.b,Y+=12;Y>0&&
-(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,aa,n))}if(qa&&$.hasTangents){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],$=s.vertexTangents,Y=$[0],aa=$[1],P=$[2],G[J]=Y.x,G[J+1]=Y.y,G[J+2]=Y.z,G[J+3]=Y.w,G[J+4]=aa.x,G[J+5]=aa.y,G[J+6]=aa.z,G[J+7]=aa.w,G[J+8]=P.x,G[J+9]=P.y,G[J+10]=P.z,G[J+11]=P.w,J+=12;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],$=s.vertexTangents,Y=$[0],aa=$[1],P=$[2],$=$[3],G[J]=Y.x,G[J+1]=Y.y,G[J+2]=Y.z,G[J+3]=Y.w,G[J+4]=aa.x,G[J+5]=aa.y,G[J+6]=aa.z,G[J+7]=aa.w,
-G[J+8]=P.x,G[J+9]=P.y,G[J+10]=P.z,G[J+11]=P.w,G[J+12]=$.x,G[J+13]=$.y,G[J+14]=$.z,G[J+15]=$.w,J+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,G,n)}if(pa&&L){k=0;for(m=x.length;k<m;k++)if(s=fa[x[k]],G=s.vertexNormals,L=s.normal,G.length===3&&ha)for(J=0;J<3;J++)L=G[J],N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;else for(J=0;J<3;J++)N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;k=0;for(m=w.length;k<m;k++)if(s=fa[w[k]],G=s.vertexNormals,L=s.normal,G.length===4&&ha)for(J=0;J<4;J++)L=
-G[J],N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;else for(J=0;J<4;J++)N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,N,n)}if(ka&&oa&&X){k=0;for(m=x.length;k<m;k++)if(E=x[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=w.length;k<m;k++)if(E=w[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,n))}if(ka&&ra&&
-X){k=0;for(m=x.length;k<m;k++)if(E=x[k],R=ra[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=w.length;k<m;k++)if(E=w[k],R=ra[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,n))}if(ia){k=0;for(m=x.length;k<m;k++)o[Q]=W,o[Q+1]=W+1,o[Q+2]=W+2,Q+=3,ea[ba]=W,ea[ba+1]=W+1,ea[ba+2]=W,ea[ba+3]=W+2,ea[ba+4]=W+1,ea[ba+5]=W+2,ba+=6,W+=3;k=0;for(m=w.length;k<m;k++)o[Q]=W,o[Q+1]=W+1,o[Q+2]=
-W+3,o[Q+3]=W+1,o[Q+4]=W+2,o[Q+5]=W+3,Q+=6,ea[ba]=W,ea[ba+1]=W+1,ea[ba+2]=W,ea[ba+3]=W+3,ea[ba+4]=W+1,ea[ba+5]=W+2,ea[ba+6]=W+2,ea[ba+7]=W+3,ba+=8,W+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,o,n);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,n)}if(p){J=0;for(W=p.length;J<W;J++)if(o=p[J],o.__original.needsUpdate){t=0;if(o.size===1)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<
-m;k++)s=fa[x[k]],o.array[t]=o.value[s.a],o.array[t+1]=o.value[s.b],o.array[t+2]=o.value[s.c],t+=3;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],o.array[t]=o.value[s.a],o.array[t+1]=o.value[s.b],o.array[t+2]=o.value[s.c],o.array[t+3]=o.value[s.d],t+=4}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)ea=o.value[x[k]],o.array[t]=ea,o.array[t+1]=ea,o.array[t+2]=ea,t+=3;k=0;for(m=w.length;k<m;k++)ea=o.value[w[k]],o.array[t]=ea,o.array[t+1]=ea,o.array[t+2]=ea,o.array[t+3]=ea,t+=4}}else if(o.size===2)if(o.boundTo===
-void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,t+=6;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,o.array[t+6]=s.x,o.array[t+7]=s.y,t+=8}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<
-m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,t+=6;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,o.array[t+6]=s.x,o.array[t+7]=s.y,t+=8}}else if(o.size===3)if(H=o.type==="c"?["r","g","b"]:["x","y","z"],o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],
-B=o.value[s.c],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],t+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],o.array[t+
-9]=s[H[0]],o.array[t+10]=s[H[1]],o.array[t+11]=s[H[2]],t+=12}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],t+=9;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],
-o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],o.array[t+9]=s[H[0]],o.array[t+10]=s[H[1]],o.array[t+11]=s[H[2]],t+=12}}else if(o.size===4)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,t+=12;k=0;for(m=
-w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,o.array[t+12]=s.x,o.array[t+13]=s.y,o.array[t+14]=s.z,o.array[t+15]=s.w,t+=16}else if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+
-3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,t+=12;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,o.array[t+12]=s.x,o.array[t+13]=s.y,o.array[t+14]=s.z,o.array[t+15]=s.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,
-o.buffer);d.bufferData(d.ARRAY_BUFFER,o.array,n)}}r&&(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)}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=
-!1;h.attributes&&K(h)}else if(F instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){h=i;F=d.DYNAMIC_DRAW;k=j=k=r=r=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;x=h.__vertexArray;n=h.__colorArray;w=h.__dirtyColors;if(h.__dirtyVertices){for(r=0;r<p;r++)k=m[r].position,j=r*3,x[j]=k.x,x[j+1]=k.y,x[j+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,x,F)}if(w){for(r=0;r<l;r++)k=q[r],j=r*3,n[j]=k.r,n[j+1]=k.g,n[j+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,
-h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,n,F)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(F instanceof THREE.Line){h=c(F,l);n=h.attributes&&u(h);if(i.__dirtyVertices||i.__dirtyColors||n){F=i;j=d.DYNAMIC_DRAW;p=q=W=m=fa=void 0;m=F.vertices;l=F.colors;p=m.length;n=l.length;x=F.__vertexArray;r=F.__colorArray;w=F.__dirtyColors;k=F.__webglCustomAttributesList;R=ba=Q=H=W=fa=void 0;if(F.__dirtyVertices){for(fa=0;fa<p;fa++)W=m[fa].position,q=fa*3,x[q]=W.x,x[q+1]=W.y,x[q+2]=W.z;d.bindBuffer(d.ARRAY_BUFFER,
-F.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,x,j)}if(w){for(m=0;m<n;m++)p=l[m],q=m*3,r[q]=p.r,r[q+1]=p.g,r[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,F.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,r,j)}if(k){fa=0;for(W=k.length;fa<W;fa++)if(R=k[fa],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++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,q+=2;else if(R.size===3)if(R.type===
-"c")for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.r,R.array[q+1]=ba.g,R.array[q+2]=ba.b,q+=3;else for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,R.array[q+2]=ba.z,q+=3;else if(R.size===4)for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,R.array[q+2]=ba.z,R.array[q+3]=ba.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,R.buffer);d.bufferData(d.ARRAY_BUFFER,R.array,j)}}}i.__dirtyVertices=!1;i.__dirtyColors=!1;h.attributes&&K(h)}else if(F instanceof THREE.ParticleSystem)h=c(F,l),n=h.attributes&&
-u(h),(i.__dirtyVertices||i.__dirtyColors||F.sortParticles||n)&&e(i,d.DYNAMIC_DRAW,F),i.__dirtyVertices=!1,i.__dirtyColors=!1,h.attributes&&K(h)};this.initMaterial=function(a,b,c,e){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&
-(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var n,k,m;n=m=j=0;for(k=b.length;n<k;n++)h=b[n],h instanceof THREE.SpotLight&&m++,h instanceof THREE.DirectionalLight&&m++,h instanceof THREE.PointLight&&j++;j+m<=la?n=m:(n=Math.ceil(la*m/(j+m)),j=la-n);h={directional:n,point:j};j=m=0;for(n=b.length;j<n;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:{n=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:h.directional,maxPointLights:h.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=[];i?e.push(i):(e.push(n),e.push(k));for(u in c)e.push(u),e.push(c[u]);i=e.join();u=0;for(e=ca.length;u<e;u++)if(ca[u].code===i){p=ca[u].program;break a}u=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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");
+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]);if(c.__webglCustomAttributesList)for(e in e=void 0,c.__webglCustomAttributesList)d.deleteBuffer(c.__webglCustomAttributesList[e].buffer);D.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
+d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=
+function(a,b){p(a,b)};this.render=function(a,b,c,e){var f,g,q,l,C=a.lights,u=a.fog;na=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);D.info.render.calls=0;D.info.render.vertices=0;D.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);za.multiply(b.projectionMatrix,b.matrixWorldInverse);i(za);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||h(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);qa(q,b,!0);var k=g,m=k.object,y=k.buffer,x=void 0,x=x=void 0,x=m.material;if(x instanceof THREE.MeshFaceMaterial){if(x=
+y.materialIndex,x>=0)x=m.geometry.materials[x],x.transparent?(k.transparent=x,k.opaque=null):(k.opaque=x,k.transparent=null)}else if(x)x.transparent?(k.transparent=x,k.opaque=null):(k.opaque=x,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ca.copy(q.position),za.multiplyVector3(Ca),g.z=Ca.z)}this.sortObjects&&l.sort(r);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),
+qa(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),ia(a.overrideMaterial.depthTest),ka(a.overrideMaterial.depthWrite),F(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),j(a.__webglObjects,!1,"",b,C,u,!0,a.overrideMaterial),n(a.__webglObjectsImmediate,"",b,C,u,!1,a.overrideMaterial)):(M(THREE.NormalBlending),j(a.__webglObjects,!0,
+"opaque",b,C,u,!1),n(a.__webglObjectsImmediate,"opaque",b,C,u,!1),j(a.__webglObjects,!1,"transparent",b,C,u,!0),n(a.__webglObjectsImmediate,"transparent",b,C,u,!0));if(a.__webglSprites.length){q=w.attributes;C=w.uniforms;u=Da/Ha;e=[];f=Ha*0.5;l=Da*0.5;g=!0;d.useProgram(w.program);ra=w.program;sa=wa=ya=-1;Va||(d.enableVertexAttribArray(w.attributes.position),d.enableVertexAttribArray(w.attributes.uv),Va=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,w.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,w.elementBuffer);d.uniformMatrix4fv(C.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(C.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(r);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(C.useScreenCoordinates,1),d.uniform3f(C.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(C.useScreenCoordinates,0),d.uniform1i(C.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(C.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(C.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(C.uvOffset,m.uvOffset.x,m.uvOffset.y),d.uniform2f(C.alignment,m.alignment.x,m.alignment.y),d.uniform1f(C.opacity,m.opacity),d.uniform3f(C.color,m.color.r,m.color.g,m.color.b),d.uniform1f(C.rotation,m.rotation),d.uniform2fv(C.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(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,i=void 0,h=void 0,j=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 j=h,q=void 0,l=void 0,n=void 0,r=void 0,
+k=void 0,m=void 0,p=void 0,x={},w=j.morphTargets.length;j.geometryGroups={};q=0;for(l=j.faces.length;q<l;q++)n=j.faces[q],r=n.materialIndex,m=r!==void 0?r:-1,x[m]===void 0&&(x[m]={hash:m,counter:0}),p=x[m].hash+"_"+x[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w}),k=n instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+k>65535&&(x[m].counter+=1,p=x[m].hash+"_"+x[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]=
+{faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w})),n instanceof THREE.Face3?j.geometryGroups[p].faces3.push(q):j.geometryGroups[p].faces4.push(q),j.geometryGroups[p].vertices+=k;j.geometryGroupsList=[];q=void 0;for(q in j.geometryGroups)j.geometryGroups[q].id=Ea++,j.geometryGroupsList.push(j.geometryGroups[q])}for(i in h.geometryGroups)if(j=h.geometryGroups[i],!j.__webglVertexBuffer){q=j;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){n=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(n=q.numMorphTargets;l<n;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}D.info.memory.geometries++;
+r=f;k=r.geometry;l=j.faces3;m=j.faces4;q=l.length*3+m.length*4;n=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(r,j);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;x=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;w=l.vertexColors?l.vertexColors:!1;j.__vertexArray=new Float32Array(q*3);if(x)j.__normalArray=new Float32Array(q*3);if(k.hasTangents)j.__tangentArray=
+new Float32Array(q*4);if(w)j.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>0)j.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(q*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(q*4),j.__skinVertexBArray=new Float32Array(q*4),j.__skinIndexArray=new Float32Array(q*4),j.__skinWeightArray=new Float32Array(q*4);j.__faceArray=new Uint16Array(n*3);
+j.__lineArray=new Uint16Array(m*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];r=0;for(k=j.numMorphTargets;r<k;r++)j.__morphTargetsArrays.push(new Float32Array(q*3))}j.__needsSmoothNormals=x===THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=w;j.__normalType=x;j.__webglFaceCount=n*3;j.__webglLineCount=m*2;if(l.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];n=void 0;for(n in l.attributes){var r=l.attributes[n],k={},F;for(F in r)k[F]=r[F];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=n,r.needsUpdate=!0,k.__original=r;j.__webglCustomAttributesList.push(k)}}j.__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)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,j=h,q=j.vertices.length,j.__vertexArray=new Float32Array(q*3),j.__colorArray=new Float32Array(q*3),j.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,j=h,q=f,l=j.vertices.length,
+j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__webglLineCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__sortArray=[],j.__webglParticleCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=
+!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(i in h=f.geometry,h.geometryGroups)j=h.geometryGroups[i],y(g.__webglObjects,j,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,y(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)I(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;i=f;for(h=g.length-1;h>=0;h--)g[h]===i&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&I(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(F=
+a.__webglObjects[f].object,i=F.geometry,h=n=l=void 0,F instanceof THREE.Mesh){j=0;for(q=i.geometryGroupsList.length;j<q;j++)if(l=i.geometryGroupsList[j],h=c(F,l),n=h.attributes&&u(h),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||n)if(n=d.DYNAMIC_DRAW,r=!i.dynamic,l.__inittedArrays){var E=m=k=void 0,s=void 0,G=void 0,L=void 0,v=void 0,Z=void 0,$=void 0,X=void 0,P=void 0,R=E=L=void 0,z=void 0,A=void 0,B=void 0,Y=s=void 0,
+aa=void 0,T=s=$=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=L=void 0,S=void 0,V=void 0,ca=void 0,da=void 0,H=R=V=W=0,Q=0,ba=J=E=0,O=v=Y=0,t=0,ea=void 0,O=l.__vertexArray,S=l.__uvArray,t=l.__uv2Array,N=l.__normalArray,G=l.__tangentArray,aa=l.__colorArray,T=l.__skinVertexAArray,U=l.__skinVertexBArray,Z=l.__skinIndexArray,ga=l.__skinWeightArray,M=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,o=void 0,o=l.__faceArray,ea=l.__lineArray,ha=l.__needsSmoothNormals,
+P=l.__vertexColorType,X=l.__uvType,L=l.__normalType,$=F.geometry,ia=$.__dirtyElements,ka=$.__dirtyUvs,pa=$.__dirtyNormals,qa=$.__dirtyTangents,ta=$.__dirtyColors,ca=$.__dirtyMorphTargets,da=$.vertices,x=l.faces3,w=l.faces4,fa=$.faces,oa=$.faceVertexUvs[0],ra=$.faceVertexUvs[1],ja=$.skinVerticesA,la=$.skinVerticesB,ma=$.skinIndices,na=$.skinWeights,sa=$.morphTargets;if($.__dirtyVertices){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=da[s.a].position,A=da[s.b].position,B=da[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=w.length;k<m;k++)s=fa[w[k]],z=da[s.a].position,A=da[s.b].position,B=da[s.c].position,s=da[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,n)}if(ca){V=0;for(ca=sa.length;V<ca;V++){k=O=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=
+sa[V].vertices[s.a].position,A=sa[V].vertices[s.b].position,B=sa[V].vertices[s.c].position,da=M[V],da[O]=z.x,da[O+1]=z.y,da[O+2]=z.z,da[O+3]=A.x,da[O+4]=A.y,da[O+5]=A.z,da[O+6]=B.x,da[O+7]=B.y,da[O+8]=B.z,O+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=sa[V].vertices[s.a].position,A=sa[V].vertices[s.b].position,B=sa[V].vertices[s.c].position,s=sa[V].vertices[s.d].position,da=M[V],da[O]=z.x,da[O+1]=z.y,da[O+2]=z.z,da[O+3]=A.x,da[O+4]=A.y,da[O+5]=A.z,da[O+6]=B.x,da[O+7]=B.y,da[O+8]=B.z,da[O+9]=s.x,da[O+
+10]=s.y,da[O+11]=s.z,O+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[V]);d.bufferData(d.ARRAY_BUFFER,M[V],n)}}if(na.length){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=na[s.a],A=na[s.b],B=na[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=ma[s.a],A=ma[s.b],B=ma[s.c],Z[v]=z.x,Z[v+1]=z.y,Z[v+2]=z.z,Z[v+3]=z.w,Z[v+4]=A.x,Z[v+5]=A.y,Z[v+6]=A.z,Z[v+7]=A.w,Z[v+8]=B.x,Z[v+9]=B.y,Z[v+10]=B.z,
+Z[v+11]=B.w,z=ja[s.a],A=ja[s.b],B=ja[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=la[s.a],A=la[s.b],B=la[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=w.length;k<m;k++)s=fa[w[k]],z=na[s.a],A=na[s.b],B=na[s.c],M=na[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]=M.x,ga[v+13]=M.y,ga[v+14]=M.z,ga[v+15]=M.w,z=ma[s.a],A=ma[s.b],B=ma[s.c],M=ma[s.d],Z[v]=z.x,Z[v+1]=z.y,Z[v+2]=z.z,Z[v+3]=z.w,Z[v+4]=A.x,Z[v+5]=A.y,Z[v+6]=A.z,Z[v+7]=A.w,Z[v+8]=B.x,Z[v+9]=B.y,Z[v+10]=B.z,Z[v+11]=B.w,Z[v+12]=M.x,Z[v+13]=M.y,Z[v+14]=M.z,Z[v+15]=M.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],M=ja[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=la[s.a],A=la[s.b],B=la[s.c],s=la[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,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,U,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,
+Z,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,n))}if(ta&&P){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],v=s.vertexColors,Z=s.color,v.length===3&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2]):U=T=s=Z,aa[Y]=s.r,aa[Y+1]=s.g,aa[Y+2]=s.b,aa[Y+3]=T.r,aa[Y+4]=T.g,aa[Y+5]=T.b,aa[Y+6]=U.r,aa[Y+7]=U.g,aa[Y+8]=U.b,Y+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],v=s.vertexColors,Z=s.color,v.length===4&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2],v=v[3]):v=U=T=s=Z,aa[Y]=s.r,
+aa[Y+1]=s.g,aa[Y+2]=s.b,aa[Y+3]=T.r,aa[Y+4]=T.g,aa[Y+5]=T.b,aa[Y+6]=U.r,aa[Y+7]=U.g,aa[Y+8]=U.b,aa[Y+9]=v.r,aa[Y+10]=v.g,aa[Y+11]=v.b,Y+=12;Y>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,aa,n))}if(qa&&$.hasTangents){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],$=s.vertexTangents,Y=$[0],aa=$[1],P=$[2],G[J]=Y.x,G[J+1]=Y.y,G[J+2]=Y.z,G[J+3]=Y.w,G[J+4]=aa.x,G[J+5]=aa.y,G[J+6]=aa.z,G[J+7]=aa.w,G[J+8]=P.x,G[J+9]=P.y,G[J+10]=P.z,G[J+11]=P.w,J+=12;k=0;for(m=w.length;k<m;k++)s=
+fa[w[k]],$=s.vertexTangents,Y=$[0],aa=$[1],P=$[2],$=$[3],G[J]=Y.x,G[J+1]=Y.y,G[J+2]=Y.z,G[J+3]=Y.w,G[J+4]=aa.x,G[J+5]=aa.y,G[J+6]=aa.z,G[J+7]=aa.w,G[J+8]=P.x,G[J+9]=P.y,G[J+10]=P.z,G[J+11]=P.w,G[J+12]=$.x,G[J+13]=$.y,G[J+14]=$.z,G[J+15]=$.w,J+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,G,n)}if(pa&&L){k=0;for(m=x.length;k<m;k++)if(s=fa[x[k]],G=s.vertexNormals,L=s.normal,G.length===3&&ha)for(J=0;J<3;J++)L=G[J],N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;else for(J=0;J<
+3;J++)N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;k=0;for(m=w.length;k<m;k++)if(s=fa[w[k]],G=s.vertexNormals,L=s.normal,G.length===4&&ha)for(J=0;J<4;J++)L=G[J],N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;else for(J=0;J<4;J++)N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,N,n)}if(ka&&oa&&X){k=0;for(m=x.length;k<m;k++)if(E=x[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=w.length;k<m;k++)if(E=w[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,n))}if(ka&&ra&&X){k=0;for(m=x.length;k<m;k++)if(E=x[k],R=ra[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=w.length;k<m;k++)if(E=w[k],R=ra[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,n))}if(ia){k=0;for(m=x.length;k<m;k++)o[Q]=W,o[Q+1]=W+1,o[Q+2]=W+2,
+Q+=3,ea[ba]=W,ea[ba+1]=W+1,ea[ba+2]=W,ea[ba+3]=W+2,ea[ba+4]=W+1,ea[ba+5]=W+2,ba+=6,W+=3;k=0;for(m=w.length;k<m;k++)o[Q]=W,o[Q+1]=W+1,o[Q+2]=W+3,o[Q+3]=W+1,o[Q+4]=W+2,o[Q+5]=W+3,Q+=6,ea[ba]=W,ea[ba+1]=W+1,ea[ba+2]=W,ea[ba+3]=W+3,ea[ba+4]=W+1,ea[ba+5]=W+2,ea[ba+6]=W+2,ea[ba+7]=W+3,ba+=8,W+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,o,n);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,n)}if(p){J=0;for(W=
+p.length;J<W;J++)if(o=p[J],o.__original.needsUpdate){t=0;if(o.size===1)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],o.array[t]=o.value[s.a],o.array[t+1]=o.value[s.b],o.array[t+2]=o.value[s.c],t+=3;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],o.array[t]=o.value[s.a],o.array[t+1]=o.value[s.b],o.array[t+2]=o.value[s.c],o.array[t+3]=o.value[s.d],t+=4}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)ea=o.value[x[k]],o.array[t]=ea,o.array[t+1]=ea,o.array[t+2]=ea,
+t+=3;k=0;for(m=w.length;k<m;k++)ea=o.value[w[k]],o.array[t]=ea,o.array[t+1]=ea,o.array[t+2]=ea,o.array[t+3]=ea,t+=4}}else if(o.size===2)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,t+=6;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z.x,o.array[t+1]=z.y,
+o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,o.array[t+6]=s.x,o.array[t+7]=s.y,t+=8}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,t+=6;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,o.array[t+6]=s.x,o.array[t+7]=s.y,t+=8}}else if(o.size===3)if(H=
+o.type==="c"?["r","g","b"]:["x","y","z"],o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],t+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+
+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],o.array[t+9]=s[H[0]],o.array[t+10]=s[H[1]],o.array[t+11]=s[H[2]],t+=12}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],t+=9;k=0;for(m=w.length;k<m;k++)s=
+B=A=z=ea=o.value[w[k]],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],o.array[t+9]=s[H[0]],o.array[t+10]=s[H[1]],o.array[t+11]=s[H[2]],t+=12}}else if(o.size===4)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+
+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,t+=12;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,o.array[t+12]=s.x,o.array[t+13]=s.y,o.array[t+14]=s.z,o.array[t+15]=
+s.w,t+=16}else if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,t+=12;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,
+o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,o.array[t+12]=s.x,o.array[t+13]=s.y,o.array[t+14]=s.z,o.array[t+15]=s.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,o.buffer);d.bufferData(d.ARRAY_BUFFER,o.array,n)}}r&&(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)}i.__dirtyVertices=
+!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;h.attributes&&K(h)}else if(F instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){h=i;F=d.DYNAMIC_DRAW;k=j=k=r=r=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;x=h.__vertexArray;n=h.__colorArray;w=h.__dirtyColors;if(h.__dirtyVertices){for(r=0;r<p;r++)k=m[r].position,j=r*3,x[j]=k.x,x[j+1]=k.y,x[j+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
+x,F)}if(w){for(r=0;r<l;r++)k=q[r],j=r*3,n[j]=k.r,n[j+1]=k.g,n[j+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,n,F)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(F instanceof THREE.Line){h=c(F,l);n=h.attributes&&u(h);if(i.__dirtyVertices||i.__dirtyColors||n){F=i;j=d.DYNAMIC_DRAW;p=q=W=m=fa=void 0;m=F.vertices;l=F.colors;p=m.length;n=l.length;x=F.__vertexArray;r=F.__colorArray;w=F.__dirtyColors;k=F.__webglCustomAttributesList;R=ba=Q=H=W=fa=void 0;if(F.__dirtyVertices){for(fa=
+0;fa<p;fa++)W=m[fa].position,q=fa*3,x[q]=W.x,x[q+1]=W.y,x[q+2]=W.z;d.bindBuffer(d.ARRAY_BUFFER,F.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,x,j)}if(w){for(m=0;m<n;m++)p=l[m],q=m*3,r[q]=p.r,r[q+1]=p.g,r[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,F.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,r,j)}if(k){fa=0;for(W=k.length;fa<W;fa++)if(R=k[fa],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++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,q+=2;else if(R.size===3)if(R.type==="c")for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.r,R.array[q+1]=ba.g,R.array[q+2]=ba.b,q+=3;else for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,R.array[q+2]=ba.z,q+=3;else if(R.size===4)for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,R.array[q+2]=ba.z,R.array[q+3]=ba.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,R.buffer);d.bufferData(d.ARRAY_BUFFER,R.array,j)}}}i.__dirtyVertices=!1;
+i.__dirtyColors=!1;h.attributes&&K(h)}else if(F instanceof THREE.ParticleSystem)h=c(F,l),n=h.attributes&&u(h),(i.__dirtyVertices||i.__dirtyColors||F.sortParticles||n)&&e(i,d.DYNAMIC_DRAW,F),i.__dirtyVertices=!1,i.__dirtyColors=!1,h.attributes&&K(h)};this.initMaterial=function(a,b,c,e){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof
+THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var n,k,m;n=m=j=0;for(k=b.length;n<k;n++)h=b[n],h instanceof THREE.SpotLight&&m++,h instanceof THREE.DirectionalLight&&m++,h instanceof THREE.PointLight&&j++;j+m<=la?n=m:(n=Math.ceil(la*m/(j+m)),j=la-n);h={directional:n,
+point:j};j=m=0;for(n=b.length;j<n;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:{n=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:h.directional,maxPointLights:h.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=[];i?e.push(i):(e.push(n),e.push(k));for(u in c)e.push(u),e.push(c[u]);i=e.join();u=0;for(e=ca.length;u<e;u++)if(ca[u].code===i){p=ca[u].program;break a}u=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?
+"#define GAMMA_OUTPUT":"",D.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");
 h=["#ifdef GL_ES","precision "+va+" 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:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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":
 h=["#ifdef GL_ES","precision "+va+" 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:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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,L("fragment",h+n));d.attachShader(u,
 "",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,L("fragment",h+n));d.attachShader(u,
 L("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 w,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in j)e.push(w);w=e;e=0;for(j=w.length;e<j;e++)n=w[e],u.uniforms[n]=d.getUniformLocation(u,
 L("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 w,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in j)e.push(w);w=e;e=0;for(j=w.length;e<j;e++)n=w[e],u.uniforms[n]=d.getUniformLocation(u,

+ 20 - 15
src/extras/geometries/CubeGeometry.js

@@ -42,9 +42,9 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 
 	this.sides = { px: true, nx: true, py: true, ny: true, pz: true, nz: true };
 	this.sides = { px: true, nx: true, py: true, ny: true, pz: true, nz: true };
 
 
-	if( sides != undefined ) {
+	if ( sides != undefined ) {
 
 
-		for( var s in sides ) {
+		for ( var s in sides ) {
 
 
 			if ( this.sides[ s ] != undefined ) {
 			if ( this.sides[ s ] != undefined ) {
 
 
@@ -56,15 +56,13 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 
 	}
 	}
 
 
-	this.sides.px && buildPlane( 'z', 'y', - 1, - 1, depth, height, width_half, mpx ); 	 // px
+	this.sides.px && buildPlane( 'z', 'y', - 1, - 1, depth, height, width_half, mpx ); // px
 	this.sides.nx && buildPlane( 'z', 'y',   1, - 1, depth, height, - width_half, mnx ); // nx
 	this.sides.nx && buildPlane( 'z', 'y',   1, - 1, depth, height, - width_half, mnx ); // nx
-	this.sides.py && buildPlane( 'x', 'z',   1,   1, width, depth, height_half, mpy );   // py
+	this.sides.py && buildPlane( 'x', 'z',   1,   1, width, depth, height_half, mpy ); // py
 	this.sides.ny && buildPlane( 'x', 'z',   1, - 1, width, depth, - height_half, mny ); // ny
 	this.sides.ny && buildPlane( 'x', 'z',   1, - 1, width, depth, - height_half, mny ); // ny
-	this.sides.pz && buildPlane( 'x', 'y',   1, - 1, width, height, depth_half, mpz );   // pz
+	this.sides.pz && buildPlane( 'x', 'y',   1, - 1, width, height, depth_half, mpz ); // pz
 	this.sides.nz && buildPlane( 'x', 'y', - 1, - 1, width, height, - depth_half, mnz ); // nz
 	this.sides.nz && buildPlane( 'x', 'y', - 1, - 1, width, height, - depth_half, mnz ); // nz
 
 
-	this.mergeVertices();
-
 	function buildPlane( u, v, udir, vdir, width, height, depth, material ) {
 	function buildPlane( u, v, udir, vdir, width, height, depth, material ) {
 
 
 		var w, ix, iy,
 		var w, ix, iy,
@@ -93,11 +91,14 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 		var gridX1 = gridX + 1,
 		var gridX1 = gridX + 1,
 		gridY1 = gridY + 1,
 		gridY1 = gridY + 1,
 		segment_width = width / gridX,
 		segment_width = width / gridX,
-		segment_height = height / gridY;
+		segment_height = height / gridY,
+		normal = new THREE.Vector3();
+
+		normal[ w ] = depth > 0 ? 1 : - 1;
 
 
-		for( iy = 0; iy < gridY1; iy ++ ) {
+		for ( iy = 0; iy < gridY1; iy ++ ) {
 
 
-			for( ix = 0; ix < gridX1; ix ++ ) {
+			for ( ix = 0; ix < gridX1; ix ++ ) {
 
 
 				var vector = new THREE.Vector3();
 				var vector = new THREE.Vector3();
 				vector[ u ] = ( ix * segment_width - width_half ) * udir;
 				vector[ u ] = ( ix * segment_width - width_half ) * udir;
@@ -110,16 +111,21 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 
 		}
 		}
 
 
-		for( iy = 0; iy < gridY; iy++ ) {
+		for ( iy = 0; iy < gridY; iy++ ) {
 
 
-			for( ix = 0; ix < gridX; ix++ ) {
+			for ( ix = 0; ix < gridX; ix++ ) {
 
 
 				var a = ix + gridX1 * iy;
 				var a = ix + gridX1 * iy;
 				var b = ix + gridX1 * ( iy + 1 );
 				var b = ix + gridX1 * ( iy + 1 );
 				var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 				var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 				var d = ( ix + 1 ) + gridX1 * iy;
 				var d = ( ix + 1 ) + gridX1 * iy;
 
 
-				scope.faces.push( new THREE.Face4( a + offset, b + offset, c + offset, d + offset, null, null, material ) );
+				var face = new THREE.Face4( a + offset, b + offset, c + offset, d + offset );
+				face.normal.copy( normal );
+				face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone(), normal.clone() );
+				face.materialIndex = material;
+
+				scope.faces.push( face );
 				scope.faceVertexUvs[ 0 ].push( [
 				scope.faceVertexUvs[ 0 ].push( [
 							new THREE.UV( ix / gridX, iy / gridY ),
 							new THREE.UV( ix / gridX, iy / gridY ),
 							new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
 							new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
@@ -133,9 +139,8 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 
 	}
 	}
 
 
-
 	this.computeCentroids();
 	this.computeCentroids();
-	this.computeFaceNormals();
+	this.mergeVertices();
 
 
 };
 };
 
 

+ 11 - 8
src/extras/geometries/PlaneGeometry.js

@@ -15,12 +15,12 @@ THREE.PlaneGeometry = function ( width, height, segmentsWidth, segmentsHeight )
 	gridX1 = gridX + 1,
 	gridX1 = gridX + 1,
 	gridY1 = gridY + 1,
 	gridY1 = gridY + 1,
 	segment_width = width / gridX,
 	segment_width = width / gridX,
-	segment_height = height / gridY;
+	segment_height = height / gridY,
+	normal = new THREE.Vector3( 0, 0, 1 );
 
 
+	for ( iy = 0; iy < gridY1; iy++ ) {
 
 
-	for( iy = 0; iy < gridY1; iy++ ) {
-
-		for( ix = 0; ix < gridX1; ix++ ) {
+		for ( ix = 0; ix < gridX1; ix++ ) {
 
 
 			var x = ix * segment_width - width_half;
 			var x = ix * segment_width - width_half;
 			var y = iy * segment_height - height_half;
 			var y = iy * segment_height - height_half;
@@ -31,16 +31,20 @@ THREE.PlaneGeometry = function ( width, height, segmentsWidth, segmentsHeight )
 
 
 	}
 	}
 
 
-	for( iy = 0; iy < gridY; iy++ ) {
+	for ( iy = 0; iy < gridY; iy++ ) {
 
 
-		for( ix = 0; ix < gridX; ix++ ) {
+		for ( ix = 0; ix < gridX; ix++ ) {
 
 
 			var a = ix + gridX1 * iy;
 			var a = ix + gridX1 * iy;
 			var b = ix + gridX1 * ( iy + 1 );
 			var b = ix + gridX1 * ( iy + 1 );
 			var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 			var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 			var d = ( ix + 1 ) + gridX1 * iy;
 			var d = ( ix + 1 ) + gridX1 * iy;
 
 
-			this.faces.push( new THREE.Face4( a, b, c, d ) );
+			var face = new THREE.Face4( a, b, c, d );
+			face.normal.copy( normal );
+			face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone(), normal.clone() );
+
+			this.faces.push( face );
 			this.faceVertexUvs[ 0 ].push( [
 			this.faceVertexUvs[ 0 ].push( [
 						new THREE.UV( ix / gridX, iy / gridY ),
 						new THREE.UV( ix / gridX, iy / gridY ),
 						new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
 						new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
@@ -53,7 +57,6 @@ THREE.PlaneGeometry = function ( width, height, segmentsWidth, segmentsHeight )
 	}
 	}
 
 
 	this.computeCentroids();
 	this.computeCentroids();
-	this.computeFaceNormals();
 
 
 };
 };