瀏覽代碼

Moved UTF8Loader to /examples/js/loaders and start to setup the idea from #1613.

Mr.doob 13 年之前
父節點
當前提交
803f457728

+ 406 - 411
build/Three.js

@@ -14,47 +14,47 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.elements[0]/c,g=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,h=a.elements[9]/e,i=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-h/e,i/e);this.z=Math.atan2(-g/e,f/e)}else{this.x=0;this.z=Math.atan2(c,d)}return this},getScaleFromMatrix:function(a){var b=
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.elements[0]/c,g=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,h=a.elements[9]/e,j=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-h/e,j/e);this.z=Math.atan2(-g/e,f/e)}else{this.x=0;this.z=Math.atan2(c,d)}return this},getScaleFromMatrix:function(a){var b=
 this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
-THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],i=d[6],k=d[7],l=d[8],o=d[9],n=d[10],p=d[11],r=d[12],m=d[13],q=d[14],d=d[15];c[0].set(f-a,k-g,p-l,d-r);c[1].set(f+a,k+g,p+l,d+r);c[2].set(f+b,k+h,p+o,d+m);c[3].set(f-b,k-h,p-o,d-m);c[4].set(f-e,k-i,p-n,d-q);c[5].set(f+e,k+i,p+n,d+q);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
+THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],j=d[6],k=d[7],l=d[8],n=d[9],m=d[10],p=d[11],r=d[12],o=d[13],q=d[14],d=d[15];c[0].set(f-a,k-g,p-l,d-r);c[1].set(f+a,k+g,p+l,d+r);c[2].set(f+b,k+h,p+n,d+o);c[3].set(f-b,k-h,p-n,d-o);c[4].set(f-e,k-j,p-m,d-q);c[5].set(f+e,k+j,p+m,d+q);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);u=r.dot(b);t=m.add(a,q.copy(b).multiplyScalar(u));return w=c.distanceTo(t)}function d(a,b,c,d){r.sub(d,b);m.sub(c,b);q.sub(a,b);s=r.dot(r);x=r.dot(m);F=r.dot(q);E=m.dot(m);B=m.dot(q);v=1/(s*E-x*x);z=(E*F-x*B)*v;J=(s*B-x*F)*v;return z>=0&&J>=0&&z+J<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,
-k=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3;this.intersectObject=function(a){var b,m=[];if(a instanceof THREE.Particle){var r=c(this.origin,this.direction,a.matrixWorld.getPosition());if(r>a.scale.x)return[];b={distance:r,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){var r=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(r>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return m;var s,j,u=a.geometry,t=u.vertices,C;a.matrixRotationWorld.extractRotation(a.matrixWorld);r=0;for(q=u.faces.length;r<q;r++){b=u.faces[r];k.copy(this.origin);l.copy(this.direction);C=a.matrixWorld;o=C.multiplyVector3(o.copy(b.centroid)).subSelf(k);n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal));s=l.dot(n);if(!(Math.abs(s)<e)){j=n.dot(o)/s;if(!(j<0)&&(a.doubleSided||(a.flipSided?
-s>0:s<0))){p.add(k,l.multiplyScalar(j));if(b instanceof THREE.Face3){f=C.multiplyVector3(f.copy(t[b.a]));g=C.multiplyVector3(g.copy(t[b.b]));h=C.multiplyVector3(h.copy(t[b.c]));if(d(p,f,g,h)){b={distance:k.distanceTo(p),point:p.clone(),face:b,object:a};m.push(b)}}else if(b instanceof THREE.Face4){f=C.multiplyVector3(f.copy(t[b.a]));g=C.multiplyVector3(g.copy(t[b.b]));h=C.multiplyVector3(h.copy(t[b.c]));i=C.multiplyVector3(i.copy(t[b.d]));if(d(p,f,g,i)||d(p,g,h,i)){b={distance:k.distanceTo(p),point:p.clone(),
-face:b,object:a};m.push(b)}}}}}}return m};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,u,t,w,s,x,F,E,B,v,z,J};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,o){h=false;b=f;c=g;d=l;e=o;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
-e:g}a()};this.add3Points=function(f,g,l,o,n,p){if(h){h=false;b=f<l?f<n?f:n:l<n?l:n;c=g<o?g<p?g:p:o<p?o:p;d=f>l?f>n?f:n:l>n?l:n;e=g>o?g>p?g:p:o>p?o:p}else{b=f<l?f<n?f<b?f:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>l?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d;e=g>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
+THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);u=r.dot(b);t=o.add(a,q.copy(b).multiplyScalar(u));return x=c.distanceTo(t)}function d(a,b,c,d){r.sub(d,b);o.sub(c,b);q.sub(a,b);s=r.dot(r);w=r.dot(o);G=r.dot(q);E=o.dot(o);B=o.dot(q);v=1/(s*E-w*w);A=(E*G-w*B)*v;J=(s*B-w*G)*v;return A>=0&&J>=0&&A+J<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,
+k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var r=c(this.origin,this.direction,a.matrixWorld.getPosition());if(r>a.scale.x)return[];b={distance:r,point:a.position,face:null,object:a};o.push(b)}else if(a instanceof THREE.Mesh){var r=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
+a.matrixWorld.getColumnZ().length());if(r>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return o;var s,i,t=a.geometry,u=t.vertices,C;a.matrixRotationWorld.extractRotation(a.matrixWorld);r=0;for(q=t.faces.length;r<q;r++){b=t.faces[r];k.copy(this.origin);l.copy(this.direction);C=a.matrixWorld;n=C.multiplyVector3(n.copy(b.centroid)).subSelf(k);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));s=l.dot(m);if(!(Math.abs(s)<e)){i=m.dot(n)/s;if(!(i<0)&&(a.doubleSided||(a.flipSided?
+s>0:s<0))){p.add(k,l.multiplyScalar(i));if(b instanceof THREE.Face3){f=C.multiplyVector3(f.copy(u[b.a]));g=C.multiplyVector3(g.copy(u[b.b]));h=C.multiplyVector3(h.copy(u[b.c]));if(d(p,f,g,h)){b={distance:k.distanceTo(p),point:p.clone(),face:b,object:a};o.push(b)}}else if(b instanceof THREE.Face4){f=C.multiplyVector3(f.copy(u[b.a]));g=C.multiplyVector3(g.copy(u[b.b]));h=C.multiplyVector3(h.copy(u[b.c]));j=C.multiplyVector3(j.copy(u[b.d]));if(d(p,f,g,j)||d(p,g,h,j)){b={distance:k.distanceTo(p),point:p.clone(),
+face:b,object:a};o.push(b)}}}}}}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,u,t,x,s,w,G,E,B,v,A,J};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,n){h=false;b=f;c=g;d=l;e=n;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
+e:g}a()};this.add3Points=function(f,g,l,n,m,p){if(h){h=false;b=f<l?f<m?f:m:l<m?l:m;c=g<n?g<p?g:p:n<p?n:p;d=f>l?f>m?f:m:l>m?l:m;e=g>n?g>p?g:p:n>p?n:p}else{b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b;c=g<n?g<p?g<c?g:c:p<c?p:c:n<p?n<c?n:c:p<c?p:c;d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d;e=g>n?g>p?g>e?g:e:p>e?p:e:n>p?n>e?n:e:p>e?p:e}a()};this.addRectangle=function(f){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
 d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*k;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,l,o,n,p,r,m){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,k||0,l!==void 0?l:1,o||0,n||0,p||0,r||0,m!==void 0?m:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,l,o,n,p,r,m){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=k;q[10]=l;q[14]=o;q[3]=n;q[7]=p;q[11]=r;q[15]=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){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],l=c[5],o=c[9],n=c[13],p=c[2],r=c[6],m=c[10],q=c[14],u=c[3],t=c[7],w=c[11],c=c[15],s=d[0],x=d[4],
-F=d[8],E=d[12],B=d[1],v=d[5],z=d[9],J=d[13],K=d[2],X=d[6],Q=d[10],A=d[14],M=d[3],G=d[7],j=d[11],d=d[15];e[0]=f*s+g*B+h*K+i*M;e[4]=f*x+g*v+h*X+i*G;e[8]=f*F+g*z+h*Q+i*j;e[12]=f*E+g*J+h*A+i*d;e[1]=k*s+l*B+o*K+n*M;e[5]=k*x+l*v+o*X+n*G;e[9]=k*F+l*z+o*Q+n*j;e[13]=k*E+l*J+o*A+n*d;e[2]=p*s+r*B+m*K+q*M;e[6]=p*x+r*v+m*X+q*G;e[10]=p*F+r*z+m*Q+q*j;e[14]=p*E+r*J+m*A+q*d;e[3]=u*s+t*B+w*K+c*M;e[7]=u*x+t*v+w*X+c*G;e[11]=u*F+t*z+w*Q+c*j;e[15]=u*E+t*J+w*A+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],j=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*j;l[8]=b*k;return this},
+transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,j,k,l,n,m,p,r,o){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,j||0,k||0,l!==void 0?l:1,n||0,m||0,p||0,r||0,o!==void 0?o:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,j,k,l,n,m,p,r,o){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=j;q[6]=k;q[10]=l;q[14]=n;q[3]=m;q[7]=p;q[11]=r;q[15]=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],j=c[12],k=c[1],l=c[5],n=c[9],m=c[13],p=c[2],r=c[6],o=c[10],q=c[14],u=c[3],t=c[7],x=c[11],c=c[15],s=d[0],w=d[4],
+G=d[8],E=d[12],B=d[1],v=d[5],A=d[9],J=d[13],K=d[2],X=d[6],Q=d[10],z=d[14],M=d[3],F=d[7],i=d[11],d=d[15];e[0]=f*s+g*B+h*K+j*M;e[4]=f*w+g*v+h*X+j*F;e[8]=f*G+g*A+h*Q+j*i;e[12]=f*E+g*J+h*z+j*d;e[1]=k*s+l*B+n*K+m*M;e[5]=k*w+l*v+n*X+m*F;e[9]=k*G+l*A+n*Q+m*i;e[13]=k*E+l*J+n*z+m*d;e[2]=p*s+r*B+o*K+q*M;e[6]=p*w+r*v+o*X+q*F;e[10]=p*G+r*A+o*Q+q*i;e[14]=p*E+r*J+o*z+q*d;e[3]=u*s+t*B+x*K+c*M;e[7]=u*w+t*v+x*X+c*F;e[11]=u*G+t*A+x*Q+c*i;e[15]=u*E+t*J+x*z+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
-d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],l=a[6],o=a[10],n=a[14],p=a[3],r=a[7],
-m=a[11],a=a[15];return e*h*l*p-d*i*l*p-e*g*o*p+c*i*o*p+d*g*n*p-c*h*n*p-e*h*k*r+d*i*k*r+e*f*o*r-b*i*o*r-d*f*n*r+b*h*n*r+e*g*k*m-c*i*k*m-e*f*l*m+b*i*l*m+c*f*n*m-b*g*n*m-d*g*k*a+c*h*k*a+d*f*l*a-b*h*l*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
+d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],j=a[13],k=a[2],l=a[6],n=a[10],m=a[14],p=a[3],r=a[7],
+o=a[11],a=a[15];return e*h*l*p-d*j*l*p-e*g*n*p+c*j*n*p+d*g*m*p-c*h*m*p-e*h*k*r+d*j*k*r+e*f*n*r-b*j*n*r-d*f*m*r+b*h*m*r+e*g*k*o-c*j*k*o-e*f*l*o+b*j*l*o+c*f*m*o-b*g*m*o-d*g*k*a+c*h*k*a+d*f*l*a-b*h*l*a-c*f*n*a+b*g*n*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
 a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
-a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],i=c[5],k=c[9],l=c[13],o=c[2],n=c[6],p=c[10],r=
-c[14],m=c[3],q=c[7],u=c[11],c=c[15];b[0]=k*r*q-l*p*q+l*n*u-i*r*u-k*n*c+i*p*c;b[4]=g*p*q-f*r*q-g*n*u+e*r*u+f*n*c-e*p*c;b[8]=f*l*q-g*k*q+g*i*u-e*l*u-f*i*c+e*k*c;b[12]=g*k*n-f*l*n-g*i*p+e*l*p+f*i*r-e*k*r;b[1]=l*p*m-k*r*m-l*o*u+h*r*u+k*o*c-h*p*c;b[5]=f*r*m-g*p*m+g*o*u-d*r*u-f*o*c+d*p*c;b[9]=g*k*m-f*l*m-g*h*u+d*l*u+f*h*c-d*k*c;b[13]=f*l*o-g*k*o+g*h*p-d*l*p-f*h*r+d*k*r;b[2]=i*r*m-l*n*m+l*o*q-h*r*q-i*o*c+h*n*c;b[6]=g*n*m-e*r*m-g*o*q+d*r*q+e*o*c-d*n*c;b[10]=e*l*m-g*i*m+g*h*q-d*l*q-e*h*c+d*i*c;b[14]=g*i*o-
-e*l*o-g*h*n+d*l*n+e*h*r-d*i*r;b[3]=k*n*m-i*p*m-k*o*q+h*p*q+i*o*u-h*n*u;b[7]=e*p*m-f*n*m+f*o*q-d*p*q-e*o*u+d*n*u;b[11]=f*i*m-e*k*m-f*h*q+d*k*q+e*h*u-d*i*u;b[15]=e*k*o-f*i*o+f*h*n-d*k*n-e*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=h*i,l=h*f,o=e*i,n=e*f;c[0]=k+n*d;c[4]=o*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*
-i;c[9]=-d;c[2]=l*d-o;c[6]=n+k*d;c[10]=g*h;break;case "ZXY":k=h*i;l=h*f;o=e*i;n=e*f;c[0]=k-n*d;c[4]=-g*f;c[8]=o+l*d;c[1]=l+o*d;c[5]=g*i;c[9]=n-k*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":k=g*i;l=g*f;o=d*i;n=d*f;c[0]=h*i;c[4]=o*e-l;c[8]=k*e+n;c[1]=h*f;c[5]=n*e+k;c[9]=l*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":k=g*h;l=g*e;o=d*h;n=d*e;c[0]=h*i;c[4]=n-k*f;c[8]=o*f+l;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=l*f+o;c[10]=k-n*f;break;case "XZY":k=g*h;l=g*e;o=d*h;n=d*e;c[0]=h*i;c[4]=-f;c[8]=e*i;
-c[1]=k*f+n;c[5]=g*i;c[9]=l*f-o;c[2]=o*f-l;c[6]=d*i;c[10]=n*f+k;break;default:k=g*i;l=g*f;o=d*i;n=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+o*e;c[5]=k-n*e;c[9]=-d*h;c[2]=n-k*e;c[6]=o+l*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,k=c*h,c=c*i,l=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,
+a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],j=c[5],k=c[9],l=c[13],n=c[2],m=c[6],p=c[10],r=
+c[14],o=c[3],q=c[7],u=c[11],c=c[15];b[0]=k*r*q-l*p*q+l*m*u-j*r*u-k*m*c+j*p*c;b[4]=g*p*q-f*r*q-g*m*u+e*r*u+f*m*c-e*p*c;b[8]=f*l*q-g*k*q+g*j*u-e*l*u-f*j*c+e*k*c;b[12]=g*k*m-f*l*m-g*j*p+e*l*p+f*j*r-e*k*r;b[1]=l*p*o-k*r*o-l*n*u+h*r*u+k*n*c-h*p*c;b[5]=f*r*o-g*p*o+g*n*u-d*r*u-f*n*c+d*p*c;b[9]=g*k*o-f*l*o-g*h*u+d*l*u+f*h*c-d*k*c;b[13]=f*l*n-g*k*n+g*h*p-d*l*p-f*h*r+d*k*r;b[2]=j*r*o-l*m*o+l*n*q-h*r*q-j*n*c+h*m*c;b[6]=g*m*o-e*r*o-g*n*q+d*r*q+e*n*c-d*m*c;b[10]=e*l*o-g*j*o+g*h*q-d*l*q-e*h*c+d*j*c;b[14]=g*j*n-
+e*l*n-g*h*m+d*l*m+e*h*r-d*j*r;b[3]=k*m*o-j*p*o-k*n*q+h*p*q+j*n*u-h*m*u;b[7]=e*p*o-f*m*o+f*n*q-d*p*q-e*n*u+d*m*u;b[11]=f*j*o-e*k*o-f*h*q+d*k*q+e*h*u-d*j*u;b[15]=e*k*n-f*j*n+f*h*m-d*k*m-e*h*p+d*j*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=h*j,l=h*f,n=e*j,m=e*f;c[0]=k+m*d;c[4]=n*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*
+j;c[9]=-d;c[2]=l*d-n;c[6]=m+k*d;c[10]=g*h;break;case "ZXY":k=h*j;l=h*f;n=e*j;m=e*f;c[0]=k-m*d;c[4]=-g*f;c[8]=n+l*d;c[1]=l+n*d;c[5]=g*j;c[9]=m-k*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":k=g*j;l=g*f;n=d*j;m=d*f;c[0]=h*j;c[4]=n*e-l;c[8]=k*e+m;c[1]=h*f;c[5]=m*e+k;c[9]=l*e-n;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":k=g*h;l=g*e;n=d*h;m=d*e;c[0]=h*j;c[4]=m-k*f;c[8]=n*f+l;c[1]=f;c[5]=g*j;c[9]=-d*j;c[2]=-e*j;c[6]=l*f+n;c[10]=k-m*f;break;case "XZY":k=g*h;l=g*e;n=d*h;m=d*e;c[0]=h*j;c[4]=-f;c[8]=e*j;
+c[1]=k*f+m;c[5]=g*j;c[9]=l*f-n;c[2]=n*f-l;c[6]=d*j;c[10]=m*f+k;break;default:k=g*j;l=g*f;n=d*j;m=d*f;c[0]=h*j;c[4]=-h*f;c[8]=e;c[1]=l+n*e;c[5]=k-m*e;c[9]=-d*h;c[2]=m-k*e;c[6]=n+l*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,j=e+e,a=c*g,k=c*h,c=c*j,l=d*h,d=d*j,e=e*j,g=f*g,h=f*h,f=f*j;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,
 e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;
 c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
 b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
-d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=
-l*h+a*d;b[10]=l*i+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
-e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),l=Math.sin(b),o=1-k,n=d*e*o,p=d*f*o,o=e*f*o,d=d*l,r=e*l,l=f*l,f=g+(1-g)*k,g=n+l,e=p-r,n=n-l,h=h+(1-h)*k,l=o+d,p=p+r,o=o-d,i=i+(1-i)*k,k=c[0],d=c[1],r=c[2],m=c[3],q=c[4],u=c[5],t=c[6],w=c[7],s=c[8],x=c[9],F=c[10],E=c[11];c[0]=f*k+g*q+e*s;c[1]=f*d+g*u+e*x;c[2]=f*r+g*t+e*F;c[3]=f*m+g*w+e*E;c[4]=n*k+h*q+l*s;c[5]=n*d+h*u+l*x;c[6]=n*r+h*t+l*F;c[7]=n*m+h*w+l*E;c[8]=p*k+o*q+i*s;c[9]=p*d+o*u+i*x;c[10]=p*r+o*t+i*F;c[11]=
-p*m+o*w+i*E;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
-makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-
+d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],j=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*j;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*j-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],j=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*j;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=
+l*h+a*d;b[10]=l*j+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],j=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*j;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*j-a*e;b[7]=l*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
+e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,j=f*f,k=Math.cos(b),l=Math.sin(b),n=1-k,m=d*e*n,p=d*f*n,n=e*f*n,d=d*l,r=e*l,l=f*l,f=g+(1-g)*k,g=m+l,e=p-r,m=m-l,h=h+(1-h)*k,l=n+d,p=p+r,n=n-d,j=j+(1-j)*k,k=c[0],d=c[1],r=c[2],o=c[3],q=c[4],u=c[5],t=c[6],x=c[7],s=c[8],w=c[9],G=c[10],E=c[11];c[0]=f*k+g*q+e*s;c[1]=f*d+g*u+e*w;c[2]=f*r+g*t+e*G;c[3]=f*o+g*x+e*E;c[4]=m*k+h*q+l*s;c[5]=m*d+h*u+l*w;c[6]=m*r+h*t+l*G;c[7]=m*o+h*x+l*E;c[8]=p*k+n*q+j*s;c[9]=p*d+n*u+j*w;c[10]=p*r+n*t+j*G;c[11]=
+p*o+n*x+j*E;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
+makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,j=e*f,k=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,k*g+c,k*h-d*f,0,j*h-
 d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
-b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
+b,c,d,e,f){var g=this.elements,h=b-a,j=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/j;g[9]=0;g[13]=-((c+d)/j);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};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.id=THREE.Object3DCount++;this.name="";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=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
@@ -63,23 +63,23 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
 this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},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=false;a=true}for(var b=0,c=this.children.length;b<
 c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
-d);return true}var e,f,g=[],h,i,k=[],l,o,n=[],p,r=[],m,q,u=[],t,w,s=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,E=new THREE.Vector4,B=new THREE.Matrix4,v=new THREE.Matrix4,z=new THREE.Frustum,J=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||z.contains(b))){F.copy(b.matrixWorld.getPosition());
-B.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());B.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&x.objects.sort(c);return x};this.projectScene=function(a,e,f){var g=e.near,G=e.far,j=false,F,W,C,Y,H,ba,ga,la,P,S,ca,T,fa,Ma,xa;w=q=p=o=0;x.elements.length=0;
-if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);z.setFromMatrix(B);x=this.projectGraph(a,false);a=0;for(F=x.objects.length;a<F;a++){P=x.objects[a].object;S=P.matrixWorld;i=0;if(P instanceof THREE.Mesh){ca=P.geometry;T=P.geometry.materials;Y=ca.vertices;fa=ca.faces;Ma=ca.faceVertexUvs;ca=P.matrixRotationWorld.extractRotation(S);
-W=0;for(C=Y.length;W<C;W++){h=b();h.positionWorld.copy(Y[W]);S.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);B.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<G}Y=0;for(W=fa.length;Y<W;Y++){C=fa[Y];if(C instanceof THREE.Face3){H=k[C.a];ba=k[C.b];ga=k[C.c];if(H.visible&&ba.visible&&ga.visible){j=(ga.positionScreen.x-H.positionScreen.x)*
-(ba.positionScreen.y-H.positionScreen.y)-(ga.positionScreen.y-H.positionScreen.y)*(ba.positionScreen.x-H.positionScreen.x)<0;if(P.doubleSided||j!=P.flipSided){la=n[o]=n[o]||new THREE.RenderableFace3;o++;l=la;l.v1.copy(H);l.v2.copy(ba);l.v3.copy(ga)}else continue}else continue}else if(C instanceof THREE.Face4){H=k[C.a];ba=k[C.b];ga=k[C.c];la=k[C.d];if(H.visible&&ba.visible&&ga.visible&&la.visible){j=(la.positionScreen.x-H.positionScreen.x)*(ba.positionScreen.y-H.positionScreen.y)-(la.positionScreen.y-
-H.positionScreen.y)*(ba.positionScreen.x-H.positionScreen.x)<0||(ba.positionScreen.x-ga.positionScreen.x)*(la.positionScreen.y-ga.positionScreen.y)-(ba.positionScreen.y-ga.positionScreen.y)*(la.positionScreen.x-ga.positionScreen.x)<0;if(P.doubleSided||j!=P.flipSided){xa=r[p]=r[p]||new THREE.RenderableFace4;p++;l=xa;l.v1.copy(H);l.v2.copy(ba);l.v3.copy(ga);l.v4.copy(la)}else continue}else continue}l.normalWorld.copy(C.normal);!j&&(P.flipSided||P.doubleSided)&&l.normalWorld.negate();ca.multiplyVector3(l.normalWorld);
-l.centroidWorld.copy(C.centroid);S.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);B.multiplyVector3(l.centroidScreen);ga=C.vertexNormals;H=0;for(ba=ga.length;H<ba;H++){la=l.vertexNormalsWorld[H];la.copy(ga[H]);!j&&(P.flipSided||P.doubleSided)&&la.negate();ca.multiplyVector3(la)}H=0;for(ba=Ma.length;H<ba;H++)if(xa=Ma[H][Y]){ga=0;for(la=xa.length;ga<la;ga++)l.uvs[H][ga]=xa[ga]}l.material=P.material;l.faceMaterial=C.materialIndex!==null?T[C.materialIndex]:null;l.z=l.centroidScreen.z;
-x.elements.push(l)}}else if(P instanceof THREE.Line){v.multiply(B,S);Y=P.geometry.vertices;H=b();H.positionScreen.copy(Y[0]);v.multiplyVector4(H.positionScreen);S=P.type===THREE.LinePieces?2:1;W=1;for(C=Y.length;W<C;W++){H=b();H.positionScreen.copy(Y[W]);v.multiplyVector4(H.positionScreen);if(!((W+1)%S>0)){ba=k[i-2];J.copy(H.positionScreen);K.copy(ba.positionScreen);if(d(J,K)){J.multiplyScalar(1/J.w);K.multiplyScalar(1/K.w);T=u[q]=u[q]||new THREE.RenderableLine;q++;m=T;m.v1.positionScreen.copy(J);
-m.v2.positionScreen.copy(K);m.z=Math.max(J.z,K.z);m.material=P.material;x.elements.push(m)}}}}}a=0;for(F=x.sprites.length;a<F;a++){P=x.sprites[a].object;S=P.matrixWorld;if(P instanceof THREE.Particle){E.set(S.elements[12],S.elements[13],S.elements[14],1);B.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<1){g=s[w]=s[w]||new THREE.RenderableParticle;w++;t=g;t.x=E.x/E.w;t.y=E.y/E.w;t.z=E.z;t.rotation=P.rotation.z;t.scale.x=P.scale.x*Math.abs(t.x-(E.x+e.projectionMatrix.elements[0])/(E.w+e.projectionMatrix.elements[12]));
-t.scale.y=P.scale.y*Math.abs(t.y-(E.y+e.projectionMatrix.elements[5])/(E.w+e.projectionMatrix.elements[13]));t.material=P.material;x.elements.push(t)}}}f&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[j]=k[j]||new THREE.RenderableVertex;j++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
+d);return true}var e,f,g=[],h,j,k=[],l,n,m=[],p,r=[],o,q,u=[],t,x,s=[],w={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,E=new THREE.Vector4,B=new THREE.Matrix4,v=new THREE.Matrix4,A=new THREE.Frustum,J=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||A.contains(b))){G.copy(b.matrixWorld.getPosition());
+B.multiplyVector3(G);e=a();e.object=b;e.z=G.z;w.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){G.copy(b.matrixWorld.getPosition());B.multiplyVector3(G);e=a();e.object=b;e.z=G.z;w.sprites.push(e)}else b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,F=e.far,i=false,G,W,C,Y,H,ba,ga,la,P,S,ca,T,fa,Ma,xa;x=q=p=n=0;w.elements.length=0;
+if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);A.setFromMatrix(B);w=this.projectGraph(a,false);a=0;for(G=w.objects.length;a<G;a++){P=w.objects[a].object;S=P.matrixWorld;j=0;if(P instanceof THREE.Mesh){ca=P.geometry;T=P.geometry.materials;Y=ca.vertices;fa=ca.faces;Ma=ca.faceVertexUvs;ca=P.matrixRotationWorld.extractRotation(S);
+W=0;for(C=Y.length;W<C;W++){h=b();h.positionWorld.copy(Y[W]);S.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);B.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}Y=0;for(W=fa.length;Y<W;Y++){C=fa[Y];if(C instanceof THREE.Face3){H=k[C.a];ba=k[C.b];ga=k[C.c];if(H.visible&&ba.visible&&ga.visible){i=(ga.positionScreen.x-H.positionScreen.x)*
+(ba.positionScreen.y-H.positionScreen.y)-(ga.positionScreen.y-H.positionScreen.y)*(ba.positionScreen.x-H.positionScreen.x)<0;if(P.doubleSided||i!=P.flipSided){la=m[n]=m[n]||new THREE.RenderableFace3;n++;l=la;l.v1.copy(H);l.v2.copy(ba);l.v3.copy(ga)}else continue}else continue}else if(C instanceof THREE.Face4){H=k[C.a];ba=k[C.b];ga=k[C.c];la=k[C.d];if(H.visible&&ba.visible&&ga.visible&&la.visible){i=(la.positionScreen.x-H.positionScreen.x)*(ba.positionScreen.y-H.positionScreen.y)-(la.positionScreen.y-
+H.positionScreen.y)*(ba.positionScreen.x-H.positionScreen.x)<0||(ba.positionScreen.x-ga.positionScreen.x)*(la.positionScreen.y-ga.positionScreen.y)-(ba.positionScreen.y-ga.positionScreen.y)*(la.positionScreen.x-ga.positionScreen.x)<0;if(P.doubleSided||i!=P.flipSided){xa=r[p]=r[p]||new THREE.RenderableFace4;p++;l=xa;l.v1.copy(H);l.v2.copy(ba);l.v3.copy(ga);l.v4.copy(la)}else continue}else continue}l.normalWorld.copy(C.normal);!i&&(P.flipSided||P.doubleSided)&&l.normalWorld.negate();ca.multiplyVector3(l.normalWorld);
+l.centroidWorld.copy(C.centroid);S.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);B.multiplyVector3(l.centroidScreen);ga=C.vertexNormals;H=0;for(ba=ga.length;H<ba;H++){la=l.vertexNormalsWorld[H];la.copy(ga[H]);!i&&(P.flipSided||P.doubleSided)&&la.negate();ca.multiplyVector3(la)}H=0;for(ba=Ma.length;H<ba;H++)if(xa=Ma[H][Y]){ga=0;for(la=xa.length;ga<la;ga++)l.uvs[H][ga]=xa[ga]}l.material=P.material;l.faceMaterial=C.materialIndex!==null?T[C.materialIndex]:null;l.z=l.centroidScreen.z;
+w.elements.push(l)}}else if(P instanceof THREE.Line){v.multiply(B,S);Y=P.geometry.vertices;H=b();H.positionScreen.copy(Y[0]);v.multiplyVector4(H.positionScreen);S=P.type===THREE.LinePieces?2:1;W=1;for(C=Y.length;W<C;W++){H=b();H.positionScreen.copy(Y[W]);v.multiplyVector4(H.positionScreen);if(!((W+1)%S>0)){ba=k[j-2];J.copy(H.positionScreen);K.copy(ba.positionScreen);if(d(J,K)){J.multiplyScalar(1/J.w);K.multiplyScalar(1/K.w);T=u[q]=u[q]||new THREE.RenderableLine;q++;o=T;o.v1.positionScreen.copy(J);
+o.v2.positionScreen.copy(K);o.z=Math.max(J.z,K.z);o.material=P.material;w.elements.push(o)}}}}}a=0;for(G=w.sprites.length;a<G;a++){P=w.sprites[a].object;S=P.matrixWorld;if(P instanceof THREE.Particle){E.set(S.elements[12],S.elements[13],S.elements[14],1);B.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<1){g=s[x]=s[x]||new THREE.RenderableParticle;x++;t=g;t.x=E.x/E.w;t.y=E.y/E.w;t.z=E.z;t.rotation=P.rotation.z;t.scale.x=P.scale.x*Math.abs(t.x-(E.x+e.projectionMatrix.elements[0])/(E.w+e.projectionMatrix.elements[12]));
+t.scale.y=P.scale.y*Math.abs(t.y-(E.y+e.projectionMatrix.elements[5])/(E.w+e.projectionMatrix.elements[13]));t.material=P.material;w.elements.push(t)}}}f&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.elements[0]+a.elements[5]+a.elements[10]))/2;this.x=Math.sqrt(Math.max(0,b+a.elements[0]-a.elements[5]-a.elements[10]))/2;this.y=Math.sqrt(Math.max(0,b-a.elements[0]+a.elements[5]-a.elements[10]))/2;this.z=Math.sqrt(Math.max(0,b-a.elements[0]-a.elements[5]+a.elements[10]))/2;this.x=a.elements[6]-a.elements[9]<0?-Math.abs(this.x):
 Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<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=this.x*-1;this.y=this.y*-1;this.z=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);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a}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},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},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,i=this.w,k=i*c+g*e-h*d,l=i*d+h*c-f*e,o=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=k*i+c*-f+l*-h-o*-g;b.y=l*i+c*-g+o*-f-k*-h;b.z=o*i+c*-h+k*-g-l*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+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},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,j=this.w,k=j*c+g*e-h*d,l=j*d+h*c-f*e,n=j*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=k*j+c*-f+l*-h-n*-g;b.y=l*j+c*-g+n*-f-k*-h;b.z=n*j+c*-h+k*-g-l*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001){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);return 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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
@@ -93,17 +93,18 @@ b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices
 else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
 e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
-[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(i);h.push(k)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
-i=g.faceNormals[c];k=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,H){h=a.vertices[b];i=a.vertices[c];
-k=a.vertices[d];l=g[e];o=g[f];n=g[H];p=i.x-h.x;r=k.x-h.x;m=i.y-h.y;q=k.y-h.y;u=i.z-h.z;t=k.z-h.z;w=o.u-l.u;s=n.u-l.u;x=o.v-l.v;F=n.v-l.v;E=1/(w*F-s*x);J.set((F*p-x*r)*E,(F*m-x*q)*E,(F*u-x*t)*E);K.set((w*r-s*p)*E,(w*q-s*m)*E,(w*t-s*u)*E);v[b].addSelf(J);v[c].addSelf(J);v[d].addSelf(J);z[b].addSelf(K);z[c].addSelf(K);z[d].addSelf(K)}var b,c,d,e,f,g,h,i,k,l,o,n,p,r,m,q,u,t,w,s,x,F,E,B,v=[],z=[],J=new THREE.Vector3,K=new THREE.Vector3,X=new THREE.Vector3,Q=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=
-this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;z[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var M=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){A.copy(f.vertexNormals[d]);e=f[M[d]];B=v[e];X.copy(B);X.subSelf(A.multiplyScalar(A.dot(B))).normalize();
-Q.cross(f.vertexNormals[d],B);e=Q.dot(z[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(X.x,X.y,X.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
+[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,j,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);h.push(k)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
+j=g.faceNormals[c];k=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,H){h=a.vertices[b];j=a.vertices[c];
+k=a.vertices[d];l=g[e];n=g[f];m=g[H];p=j.x-h.x;r=k.x-h.x;o=j.y-h.y;q=k.y-h.y;u=j.z-h.z;t=k.z-h.z;x=n.u-l.u;s=m.u-l.u;w=n.v-l.v;G=m.v-l.v;E=1/(x*G-s*w);J.set((G*p-w*r)*E,(G*o-w*q)*E,(G*u-w*t)*E);K.set((x*r-s*p)*E,(x*q-s*o)*E,(x*t-s*u)*E);v[b].addSelf(J);v[c].addSelf(J);v[d].addSelf(J);A[b].addSelf(K);A[c].addSelf(K);A[d].addSelf(K)}var b,c,d,e,f,g,h,j,k,l,n,m,p,r,o,q,u,t,x,s,w,G,E,B,v=[],A=[],J=new THREE.Vector3,K=new THREE.Vector3,X=new THREE.Vector3,Q=new THREE.Vector3,z=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;A[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var M=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){z.copy(f.vertexNormals[d]);e=f[M[d]];B=v[e];X.copy(B);X.subSelf(z.multiplyScalar(z.dot(B))).normalize();
+Q.cross(f.vertexNormals[d],B);e=Q.dot(A[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(X.x,X.y,X.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
-e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d]}}this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,l,o,n;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){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
-f+2;k=this.points[c[0]];l=this.points[c[1]];o=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,l.x,o.x,n.x,g,h,i);d.y=b(k.y,l.y,o.y,n.y,g,h,i);d.z=b(k.z,l.z,o.z,n.z,g,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,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
-a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(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,f,g,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];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++){d=e+c*(1/g)*(f-e);d=this.getPoint(d);
-h.push(i.copy(d).clone())}h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
+e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];e=[a.a,a.b,a.c,a.d];for(d=3;d>0;d--)if(e.indexOf(a["abcd"[d]])!=d){e.splice(d,1);this.faces[f]=new THREE.Face3(e[0],e[1],e[2]);this.faceVertexUvs[0][f].splice(d,1)}}}this.vertices=
+b}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,j,k,l,n,m;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){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
+f+2;k=this.points[c[0]];l=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;j=g*h;d.x=b(k.x,l.x,n.x,m.x,g,h,j);d.y=b(k.y,l.y,n.y,m.y,g,h,j);d.z=b(k.z,l.z,n.z,m.z,g,h,j);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,f=new THREE.Vector3,g=new THREE.Vector3,h=[],j=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
+a/c;d=this.getPoint(b);g.copy(d);j=j+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=j;e=b}}h[h.length]=j;return{chunks:h,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],j=new THREE.Vector3,k=this.getLength();h.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++){d=e+c*(1/g)*(f-e);d=this.getPoint(d);
+h.push(j.copy(d).clone())}h.push(j.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
 THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
@@ -138,7 +139,7 @@ a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.ver
 THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
 true;this.needsUpdate=this.premultiplyAlpha=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
-THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,k){THREE.Texture.call(this,null,f,g,h,i,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,j,k){THREE.Texture.call(this,null,f,g,h,j,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=false;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}this.frustumCulled=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
@@ -169,51 +170,51 @@ THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function()
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
-THREE.DOMRenderer=function(){console.log("THREE.DOMRenderer",THREE.REVISION);var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if(typeof b.style[a[c]]==="string")return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var l,o,n,p,r,m;a=h.projectScene(c,d);b=a.elements;l=0;for(o=
-b.length;l<o;l++){n=b[l];if(n instanceof THREE.RenderableParticle&&n.material instanceof THREE.ParticleDOMMaterial){p=n.material.domElement;r=n.x*e+e-(p.offsetWidth>>1);m=n.y*f+f-(p.offsetHeight>>1);p.style.left=r+"px";p.style.top=m+"px";p.style.zIndex=Math.abs(Math.floor((1-n.z)*d.far/d.near));g&&(p.style[g]="scale("+n.scale.x*e+","+n.scale.y*f+")")}}}};
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(w!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}w=a}}function d(a){if(s!=a)m.strokeStyle=s=a}function e(a){if(x!=a)m.fillStyle=x=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,k=new THREE.Projector,l=a.canvas!==
-void 0?a.canvas:document.createElement("canvas"),o,n,p,r,m=l.getContext("2d"),q=new THREE.Color(0),u=0,t=1,w=0,s=null,x=null,F=null,E=null,B=null,v,z,J,K,X=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,A,M,G,j,U,W,C,Y,H,ba,ga,la,P=new THREE.Color,S=new THREE.Color,ca=new THREE.Color,T=new THREE.Color,fa=new THREE.Color,Ma=[],xa=[],ta,Na,Sa,sa,Wa,Ya,Ja,db,hb,mb,Oa=new THREE.Rectangle,ua=new THREE.Rectangle,va=new THREE.Rectangle,ab=false,ja=new THREE.Color,Ha=new THREE.Color,Xa=new THREE.Color,
-ma=new THREE.Vector3,Fb,da,R,O,pc,Cc,a=16;Fb=document.createElement("canvas");Fb.width=Fb.height=2;da=Fb.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);R=da.getImageData(0,0,2,2);O=R.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;n=b;p=Math.floor(o/2);r=Math.floor(n/
-2);l.width=o;l.height=n;Oa.set(-p,-r,p,r);ua.set(-p,-r,p,r);t=1;w=0;B=E=F=x=s=null};this.setClearColor=function(a,b){q.copy(a);u=b!==void 0?b:1;ua.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);u=b!==void 0?b:1;ua.set(-p,-r,p,r)};this.clear=function(){m.setTransform(1,0,0,-1,p,r);if(!ua.isEmpty()){ua.minSelf(Oa);ua.inflate(2);u<1&&m.clearRect(Math.floor(ua.getX()),Math.floor(ua.getY()),Math.floor(ua.getWidth()),Math.floor(ua.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+
-Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+u+")");m.fillRect(Math.floor(ua.getX()),Math.floor(ua.getY()),Math.floor(ua.getWidth()),Math.floor(ua.getHeight()))}ua.empty()}};this.render=function(a,l){function n(a){var b,c,d,e;ja.setRGB(0,0,0);Ha.setRGB(0,0,0);Xa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){ja.r=ja.r+e.r;ja.g=ja.g+e.g;ja.b=ja.b+e.b}else if(d instanceof THREE.DirectionalLight){Ha.r=Ha.r+e.r;Ha.g=Ha.g+e.g;Ha.b=
-Ha.b+e.b}else if(d instanceof THREE.PointLight){Xa.r=Xa.r+e.r;Xa.g=Xa.g+e.g;Xa.b=Xa.b+e.b}}}function o(a,b,c,d){var e,f,g,da,h,j;e=0;for(f=a.length;e<f;e++){g=a[e];da=g.color;if(g instanceof THREE.DirectionalLight){h=g.matrixWorld.getPosition();j=c.dot(h);if(!(j<=0)){j=j*g.intensity;d.r=d.r+da.r*j;d.g=d.g+da.g*j;d.b=d.b+da.b*j}}else if(g instanceof THREE.PointLight){h=g.matrixWorld.getPosition();j=c.dot(ma.sub(h,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,
-1));if(j!=0){j=j*g.intensity;d.r=d.r+da.r*j;d.g=d.g+da.g*j;d.b=d.b+da.b*j}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var da,j,h,O,R,i;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){O=g.map.image;R=O.width>>1;i=O.height>>1;g=f.scale.x*p;h=f.scale.y*r;da=g*R;j=h*i;va.set(a.x-da,a.y-j,a.x+da,a.y+j);if(Oa.intersects(va)){m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(g,-h);m.translate(-R,-i);m.drawImage(O,0,0);m.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){da=
-f.scale.x*p;j=f.scale.y*r;va.set(a.x-da,a.y-j,a.x+da,a.y+j);if(Oa.intersects(va)){d(g.color.getContextStyle());e(g.color.getContextStyle());m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(da,j);g.program(m);m.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)m.lineWidth=F=a;a=g.linecap;if(E!=
-a)m.lineCap=E=a;a=g.linejoin;if(B!=a)m.lineJoin=B=a;d(g.color.getContextStyle());m.stroke();va.inflate(g.linewidth*2)}}function t(a,d,e,g,da,h,O,R){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(R.opacity);c(R.blending);A=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;j=d.positionScreen.y;U=e.positionScreen.x;W=e.positionScreen.y;w(A,M,G,j,U,W);if(R instanceof THREE.MeshBasicMaterial)if(R.map){if(R.map.mapping instanceof THREE.UVMapping){sa=O.uvs[0];Tc(A,M,G,
-j,U,W,sa[g].u,sa[g].v,sa[da].u,sa[da].v,sa[h].u,sa[h].v,R.map)}}else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;ma.copy(O.vertexNormalsWorld[g]);Wa=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;Ya=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*0.5+0.5;ma.copy(O.vertexNormalsWorld[da]);Ja=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;db=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*
-0.5+0.5;ma.copy(O.vertexNormalsWorld[h]);hb=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;mb=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*0.5+0.5;Tc(A,M,G,j,U,W,Wa,Ya,Ja,db,hb,mb,R.envMap)}}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){if(R.map.mapping instanceof THREE.UVMapping){sa=O.uvs[0];Tc(A,M,G,j,U,W,sa[g].u,sa[g].v,sa[da].u,sa[da].v,
-sa[h].u,sa[h].v,R.map)}c(THREE.SubtractiveBlending)}if(ab)if(!R.wireframe&&R.shading==THREE.SmoothShading&&O.vertexNormalsWorld.length==3){S.r=ca.r=T.r=ja.r;S.g=ca.g=T.g=ja.g;S.b=ca.b=T.b=ja.b;o(i,O.v1.positionWorld,O.vertexNormalsWorld[0],S);o(i,O.v2.positionWorld,O.vertexNormalsWorld[1],ca);o(i,O.v3.positionWorld,O.vertexNormalsWorld[2],T);S.r=Math.max(0,Math.min(R.color.r*S.r,1));S.g=Math.max(0,Math.min(R.color.g*S.g,1));S.b=Math.max(0,Math.min(R.color.b*S.b,1));ca.r=Math.max(0,Math.min(R.color.r*
-ca.r,1));ca.g=Math.max(0,Math.min(R.color.g*ca.g,1));ca.b=Math.max(0,Math.min(R.color.b*ca.b,1));T.r=Math.max(0,Math.min(R.color.r*T.r,1));T.g=Math.max(0,Math.min(R.color.g*T.g,1));T.b=Math.max(0,Math.min(R.color.b*T.b,1));fa.r=(ca.r+T.r)*0.5;fa.g=(ca.g+T.g)*0.5;fa.b=(ca.b+T.b)*0.5;Sa=Dc(S,ca,T,fa);gc(A,M,G,j,U,W,0,0,1,0,0,1,Sa)}else{P.r=ja.r;P.g=ja.g;P.b=ja.b;o(i,O.centroidWorld,O.normalWorld,P);P.r=Math.max(0,Math.min(R.color.r*P.r,1));P.g=Math.max(0,Math.min(R.color.g*P.g,1));P.b=Math.max(0,Math.min(R.color.b*
-P.b,1));R.wireframe?Mb(P,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(P)}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color)}else if(R instanceof THREE.MeshDepthMaterial){ta=l.near;Na=l.far;S.r=S.g=S.b=1-ac(a.positionScreen.z,ta,Na);ca.r=ca.g=ca.b=1-ac(d.positionScreen.z,ta,Na);T.r=T.g=T.b=1-ac(e.positionScreen.z,ta,Na);fa.r=(ca.r+T.r)*0.5;fa.g=(ca.g+T.g)*0.5;fa.b=(ca.b+T.b)*0.5;Sa=Dc(S,ca,T,fa);gc(A,M,G,j,U,W,0,0,1,0,0,1,Sa)}else if(R instanceof
-THREE.MeshNormalMaterial){P.r=hc(O.normalWorld.x);P.g=hc(O.normalWorld.y);P.b=hc(O.normalWorld.z);R.wireframe?Mb(P,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(P)}}function u(a,d,e,g,da,h,R,O,k){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(O.opacity);c(O.blending);if(O.map||O.envMap){t(a,d,g,0,1,3,R,O,k);t(da,e,h,1,2,3,R,O,k)}else{A=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;j=d.positionScreen.y;U=e.positionScreen.x;W=e.positionScreen.y;
-C=g.positionScreen.x;Y=g.positionScreen.y;H=da.positionScreen.x;ba=da.positionScreen.y;ga=h.positionScreen.x;la=h.positionScreen.y;if(O instanceof THREE.MeshBasicMaterial){x(A,M,G,j,U,W,C,Y);O.wireframe?Mb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(O.color)}else if(O instanceof THREE.MeshLambertMaterial)if(ab)if(!O.wireframe&&O.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==4){S.r=ca.r=T.r=fa.r=ja.r;S.g=ca.g=T.g=fa.g=ja.g;S.b=ca.b=T.b=fa.b=ja.b;o(i,R.v1.positionWorld,
-R.vertexNormalsWorld[0],S);o(i,R.v2.positionWorld,R.vertexNormalsWorld[1],ca);o(i,R.v4.positionWorld,R.vertexNormalsWorld[3],T);o(i,R.v3.positionWorld,R.vertexNormalsWorld[2],fa);S.r=Math.max(0,Math.min(O.color.r*S.r,1));S.g=Math.max(0,Math.min(O.color.g*S.g,1));S.b=Math.max(0,Math.min(O.color.b*S.b,1));ca.r=Math.max(0,Math.min(O.color.r*ca.r,1));ca.g=Math.max(0,Math.min(O.color.g*ca.g,1));ca.b=Math.max(0,Math.min(O.color.b*ca.b,1));T.r=Math.max(0,Math.min(O.color.r*T.r,1));T.g=Math.max(0,Math.min(O.color.g*
-T.g,1));T.b=Math.max(0,Math.min(O.color.b*T.b,1));fa.r=Math.max(0,Math.min(O.color.r*fa.r,1));fa.g=Math.max(0,Math.min(O.color.g*fa.g,1));fa.b=Math.max(0,Math.min(O.color.b*fa.b,1));Sa=Dc(S,ca,T,fa);w(A,M,G,j,C,Y);gc(A,M,G,j,C,Y,0,0,1,0,0,1,Sa);w(H,ba,U,W,ga,la);gc(H,ba,U,W,ga,la,1,0,1,1,0,1,Sa)}else{P.r=ja.r;P.g=ja.g;P.b=ja.b;o(i,R.centroidWorld,R.normalWorld,P);P.r=Math.max(0,Math.min(O.color.r*P.r,1));P.g=Math.max(0,Math.min(O.color.g*P.g,1));P.b=Math.max(0,Math.min(O.color.b*P.b,1));x(A,M,G,j,
-U,W,C,Y);O.wireframe?Mb(P,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(P)}else{x(A,M,G,j,U,W,C,Y);O.wireframe?Mb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(O.color)}else if(O instanceof THREE.MeshNormalMaterial){P.r=hc(R.normalWorld.x);P.g=hc(R.normalWorld.y);P.b=hc(R.normalWorld.z);x(A,M,G,j,U,W,C,Y);O.wireframe?Mb(P,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(P)}else if(O instanceof THREE.MeshDepthMaterial){ta=l.near;Na=l.far;S.r=
-S.g=S.b=1-ac(a.positionScreen.z,ta,Na);ca.r=ca.g=ca.b=1-ac(d.positionScreen.z,ta,Na);T.r=T.g=T.b=1-ac(g.positionScreen.z,ta,Na);fa.r=fa.g=fa.b=1-ac(e.positionScreen.z,ta,Na);Sa=Dc(S,ca,T,fa);w(A,M,G,j,C,Y);gc(A,M,G,j,C,Y,0,0,1,0,0,1,Sa);w(H,ba,U,W,ga,la);gc(H,ba,U,W,ga,la,1,0,1,1,0,1,Sa)}}}function w(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 x(a,b,c,d,e,f,g,da){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,da);m.lineTo(a,
-b);m.closePath()}function Mb(a,b,c,e){if(F!=b)m.lineWidth=F=b;if(E!=c)m.lineCap=E=c;if(B!=e)m.lineJoin=B=e;d(a.getContextStyle());m.stroke();va.inflate(b*2)}function Gb(a){e(a.getContextStyle());m.fill()}function Tc(a,b,c,d,f,g,da,h,j,O,R,i,k){if(k.image.width!=0){if(k.needsUpdate==true||Ma[k.id]==void 0){var l=k.wrapS==THREE.RepeatWrapping,n=k.wrapT==THREE.RepeatWrapping;Ma[k.id]=m.createPattern(k.image,l&&n?"repeat":l&&!n?"repeat-x":!l&&n?"repeat-y":"no-repeat");k.needsUpdate=false}e(Ma[k.id]);
-var l=k.offset.x/k.repeat.x,n=k.offset.y/k.repeat.y,o=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,da=(da+l)*o,h=(h+n)*p,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+l)*o-da,O=(O+n)*p-h,R=(R+l)*o-da,i=(i+n)*p-h,l=j*i-R*O;if(l==0){if(xa[k.id]===void 0){b=document.createElement("canvas");b.width=k.image.width;b.height=k.image.height;b=b.getContext("2d");b.drawImage(k.image,0,0);xa[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data}b=xa[k.id];da=(Math.floor(da)+Math.floor(h)*k.image.width)*4;P.setRGB(b[da]/
-255,b[da+1]/255,b[da+2]/255);Gb(P)}else{l=1/l;k=(i*c-O*f)*l;O=(i*d-O*g)*l;c=(j*f-R*c)*l;d=(j*g-R*d)*l;a=a-k*da-c*h;da=b-O*da-d*h;m.save();m.transform(k,O,c,d,a,da);m.fill();m.restore()}}}function gc(a,b,c,d,e,f,g,da,h,O,j,R,i){var k,l;k=i.width-1;l=i.height-1;g=g*k;da=da*l;c=c-a;d=d-b;e=e-a;f=f-b;h=h*k-g;O=O*l-da;j=j*k-g;R=R*l-da;l=1/(h*R-j*O);k=(R*c-O*e)*l;O=(R*d-O*f)*l;c=(h*e-j*c)*l;d=(h*f-j*d)*l;a=a-k*g-c*da;b=b-O*g-d*da;m.save();m.transform(k,O,c,d,a,b);m.clip();m.drawImage(i,0,0);m.restore()}
-function Dc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);O[0]=e<0?0:e>255?255:e;O[1]=f<0?0:f>255?255:f;O[2]=a<0?0:a>255?255:a;O[4]=g<0?0:g>255?255:g;O[5]=h<0?0:h>255?255:h;O[6]=b<0?0:b>255?255:b;O[8]=j<0?0:j>255?255:j;O[9]=i<0?0:i>255?255:i;O[10]=c<0?0:c>255?255:c;O[12]=k<0?0:k>255?255:k;O[13]=l<0?0:l>255?255:l;O[14]=d<0?0:d>255?255:d;da.putImageData(R,0,0);Cc.drawImage(Fb,
-0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Ec,cd,Ta,kb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,l,this.sortElements);h=g.elements;i=g.lights;(ab=i.length>0)&&n(i);Ec=0;for(cd=h.length;Ec<cd;Ec++){Ta=h[Ec];kb=Ta.material;
-kb=kb instanceof THREE.MeshFaceMaterial?Ta.faceMaterial:kb;if(!(kb==null||kb.opacity==0)){va.empty();if(Ta instanceof THREE.RenderableParticle){v=Ta;v.x=v.x*p;v.y=v.y*r;q(v,Ta,kb,a)}else if(Ta instanceof THREE.RenderableLine){v=Ta.v1;z=Ta.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*r;va.addPoint(v.positionScreen.x,v.positionScreen.y);va.addPoint(z.positionScreen.x,z.positionScreen.y);
-Oa.intersects(va)&&s(v,z,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace3){v=Ta.v1;z=Ta.v2;J=Ta.v3;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*r;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*r;if(kb.overdraw){Nb(v.positionScreen,z.positionScreen);Nb(z.positionScreen,J.positionScreen);Nb(J.positionScreen,v.positionScreen)}va.add3Points(v.positionScreen.x,
-v.positionScreen.y,z.positionScreen.x,z.positionScreen.y,J.positionScreen.x,J.positionScreen.y);Oa.intersects(va)&&t(v,z,J,0,1,2,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace4){v=Ta.v1;z=Ta.v2;J=Ta.v3;K=Ta.v4;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*r;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*r;K.positionScreen.x=K.positionScreen.x*p;K.positionScreen.y=
-K.positionScreen.y*r;X.positionScreen.copy(z.positionScreen);Q.positionScreen.copy(K.positionScreen);if(kb.overdraw){Nb(v.positionScreen,z.positionScreen);Nb(z.positionScreen,K.positionScreen);Nb(K.positionScreen,v.positionScreen);Nb(J.positionScreen,X.positionScreen);Nb(J.positionScreen,Q.positionScreen)}va.addPoint(v.positionScreen.x,v.positionScreen.y);va.addPoint(z.positionScreen.x,z.positionScreen.y);va.addPoint(J.positionScreen.x,J.positionScreen.y);va.addPoint(K.positionScreen.x,K.positionScreen.y);
-Oa.intersects(va)&&u(v,z,J,K,X,Q,Ta,kb,a)}ua.addRectangle(va)}}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){i=g.matrixWorld.getPosition();k=c.dot(i);if(!(k<=0)){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}else if(g instanceof THREE.PointLight){i=g.matrixWorld.getPosition();k=c.dot(v.sub(i,b).normalize());if(!(k<=0)){k=k*(g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1));if(k!=0){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*
-k}}}}}function b(a){if(z[a]==null){z[a]=document.createElementNS("http://www.w3.org/2000/svg","path");A==0&&z[a].setAttribute("shape-rendering","crispEdges")}return z[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,o,n,p,r,m,q,u=new THREE.Rectangle,t=new THREE.Rectangle,w=false,s=new THREE.Color,x=new THREE.Color,F=new THREE.Color,E=new THREE.Color,
-B,v=new THREE.Vector3,z=[],J=[],K,X,Q,A=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":A=1;break;case "low":A=0}};this.setSize=function(a,b){k=a;l=b;o=k/2;n=l/2;i.setAttribute("viewBox",-o+" "+-n+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);u.set(-o,-n,o,n)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,
-l){var j,v,z,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);f=e.elements;g=e.lights;Q=X=0;if(w=g.length>0){x.setRGB(0,0,0);F.setRGB(0,0,0);E.setRGB(0,0,0);j=0;for(v=g.length;j<v;j++){C=g[j];z=C.color;if(C instanceof THREE.AmbientLight){x.r=x.r+z.r;x.g=x.g+z.g;x.b=x.b+z.b}else if(C instanceof THREE.DirectionalLight){F.r=F.r+z.r;F.g=F.g+z.g;F.b=F.b+z.b}else if(C instanceof THREE.PointLight){E.r=E.r+z.r;E.g=E.g+z.g;E.b=E.b+z.b}}}j=
-0;for(v=f.length;j<v;j++){z=f[j];C=z.material;C=C instanceof THREE.MeshFaceMaterial?z.faceMaterial:C;if(!(C==null||C.opacity==0)){t.empty();if(z instanceof THREE.RenderableParticle){p=z;p.x=p.x*o;p.y=p.y*-n}else if(z instanceof THREE.RenderableLine){p=z.v1;r=z.v2;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-n;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-n;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,
-r.positionScreen.y);if(u.intersects(t)){z=p;var Y=r,H=Q++;if(J[H]==null){J[H]=document.createElementNS("http://www.w3.org/2000/svg","line");A==0&&J[H].setAttribute("shape-rendering","crispEdges")}K=J[H];K.setAttribute("x1",z.positionScreen.x);K.setAttribute("y1",z.positionScreen.y);K.setAttribute("x2",Y.positionScreen.x);K.setAttribute("y2",Y.positionScreen.y);if(C instanceof THREE.LineBasicMaterial){K.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+
-"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin);i.appendChild(K)}}}else if(z instanceof THREE.RenderableFace3){p=z.v1;r=z.v2;m=z.v3;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-n;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-n;m.positionScreen.x=m.positionScreen.x*o;m.positionScreen.y=m.positionScreen.y*-n;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,
-r.positionScreen.y);t.addPoint(m.positionScreen.x,m.positionScreen.y);if(u.intersects(t)){var Y=p,H=r,ba=m;d.info.render.vertices=d.info.render.vertices+3;d.info.render.faces++;K=b(X++);K.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)s.copy(C.color);else if(C instanceof THREE.MeshLambertMaterial)if(w){s.r=x.r;s.g=x.g;s.b=x.b;a(g,z.centroidWorld,
-z.normalWorld,s);s.r=Math.max(0,Math.min(C.color.r*s.r,1));s.g=Math.max(0,Math.min(C.color.g*s.g,1));s.b=Math.max(0,Math.min(C.color.b*s.b,1))}else s.copy(C.color);else if(C instanceof THREE.MeshDepthMaterial){B=1-C.__2near/(C.__farPlusNear-z.z*C.__farMinusNear);s.setRGB(B,B,B)}else C instanceof THREE.MeshNormalMaterial&&s.setRGB(c(z.normalWorld.x),c(z.normalWorld.y),c(z.normalWorld.z));C.wireframe?K.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+
-"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):K.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(K)}}else if(z instanceof THREE.RenderableFace4){p=z.v1;r=z.v2;m=z.v3;q=z.v4;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-n;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-n;m.positionScreen.x=m.positionScreen.x*o;m.positionScreen.y=
-m.positionScreen.y*-n;q.positionScreen.x=q.positionScreen.x*o;q.positionScreen.y=q.positionScreen.y*-n;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);t.addPoint(m.positionScreen.x,m.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);if(u.intersects(t)){var Y=p,H=r,ba=m,ga=q;d.info.render.vertices=d.info.render.vertices+4;d.info.render.faces++;K=b(X++);K.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+H.positionScreen.x+
-" "+H.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)s.copy(C.color);else if(C instanceof THREE.MeshLambertMaterial)if(w){s.r=x.r;s.g=x.g;s.b=x.b;a(g,z.centroidWorld,z.normalWorld,s);s.r=Math.max(0,Math.min(C.color.r*s.r,1));s.g=Math.max(0,Math.min(C.color.g*s.g,1));s.b=Math.max(0,Math.min(C.color.b*s.b,1))}else s.copy(C.color);else if(C instanceof THREE.MeshDepthMaterial){B=1-C.__2near/
-(C.__farPlusNear-z.z*C.__farMinusNear);s.setRGB(B,B,B)}else C instanceof THREE.MeshNormalMaterial&&s.setRGB(c(z.normalWorld.x),c(z.normalWorld.y),c(z.normalWorld.z));C.wireframe?K.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):K.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(K)}}}}}};
+THREE.DOMRenderer=function(){console.log("THREE.DOMRenderer",THREE.REVISION);var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if(typeof b.style[a[c]]==="string")return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var l,n,m,p,r,o;a=h.projectScene(c,d);b=a.elements;l=0;for(n=
+b.length;l<n;l++){m=b[l];if(m instanceof THREE.RenderableParticle&&m.material instanceof THREE.ParticleDOMMaterial){p=m.material.domElement;r=m.x*e+e-(p.offsetWidth>>1);o=m.y*f+f-(p.offsetHeight>>1);p.style.left=r+"px";p.style.top=o+"px";p.style.zIndex=Math.abs(Math.floor((1-m.z)*d.far/d.near));g&&(p.style[g]="scale("+m.scale.x*e+","+m.scale.y*f+")")}}}};
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)o.globalAlpha=t=a}function c(a){if(x!=a){switch(a){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}x=a}}function d(a){if(s!=a)o.strokeStyle=s=a}function e(a){if(w!=a)o.fillStyle=w=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,j,k=new THREE.Projector,l=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),n,m,p,r,o=l.getContext("2d"),q=new THREE.Color(0),u=0,t=1,x=0,s=null,w=null,G=null,E=null,B=null,v,A,J,K,X=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,z,M,F,i,U,W,C,Y,H,ba,ga,la,P=new THREE.Color,S=new THREE.Color,ca=new THREE.Color,T=new THREE.Color,fa=new THREE.Color,Ma=[],xa=[],ta,Na,Sa,sa,Wa,Ya,Ja,db,hb,mb,Oa=new THREE.Rectangle,ua=new THREE.Rectangle,va=new THREE.Rectangle,ab=false,ja=new THREE.Color,Ha=new THREE.Color,Xa=new THREE.Color,
+ma=new THREE.Vector3,Fb,da,R,O,pc,Cc,a=16;Fb=document.createElement("canvas");Fb.width=Fb.height=2;da=Fb.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);R=da.getImageData(0,0,2,2);O=R.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;m=b;p=Math.floor(n/2);r=Math.floor(m/
+2);l.width=n;l.height=m;Oa.set(-p,-r,p,r);ua.set(-p,-r,p,r);t=1;x=0;B=E=G=w=s=null};this.setClearColor=function(a,b){q.copy(a);u=b!==void 0?b:1;ua.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);u=b!==void 0?b:1;ua.set(-p,-r,p,r)};this.clear=function(){o.setTransform(1,0,0,-1,p,r);if(!ua.isEmpty()){ua.minSelf(Oa);ua.inflate(2);u<1&&o.clearRect(Math.floor(ua.getX()),Math.floor(ua.getY()),Math.floor(ua.getWidth()),Math.floor(ua.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+
+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+u+")");o.fillRect(Math.floor(ua.getX()),Math.floor(ua.getY()),Math.floor(ua.getWidth()),Math.floor(ua.getHeight()))}ua.empty()}};this.render=function(a,l){function m(a){var b,c,d,e;ja.setRGB(0,0,0);Ha.setRGB(0,0,0);Xa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){ja.r=ja.r+e.r;ja.g=ja.g+e.g;ja.b=ja.b+e.b}else if(d instanceof THREE.DirectionalLight){Ha.r=Ha.r+e.r;Ha.g=Ha.g+e.g;Ha.b=
+Ha.b+e.b}else if(d instanceof THREE.PointLight){Xa.r=Xa.r+e.r;Xa.g=Xa.g+e.g;Xa.b=Xa.b+e.b}}}function n(a,b,c,d){var e,f,g,da,i,h;e=0;for(f=a.length;e<f;e++){g=a[e];da=g.color;if(g instanceof THREE.DirectionalLight){i=g.matrixWorld.getPosition();h=c.dot(i);if(!(h<=0)){h=h*g.intensity;d.r=d.r+da.r*h;d.g=d.g+da.g*h;d.b=d.b+da.b*h}}else if(g instanceof THREE.PointLight){i=g.matrixWorld.getPosition();h=c.dot(ma.sub(i,b).normalize());if(!(h<=0)){h=h*(g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,
+1));if(h!=0){h=h*g.intensity;d.r=d.r+da.r*h;d.g=d.g+da.g*h;d.b=d.b+da.b*h}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var da,h,i,O,R,j;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){O=g.map.image;R=O.width>>1;j=O.height>>1;g=f.scale.x*p;i=f.scale.y*r;da=g*R;h=i*j;va.set(a.x-da,a.y-h,a.x+da,a.y+h);if(Oa.intersects(va)){o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(g,-i);o.translate(-R,-j);o.drawImage(O,0,0);o.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){da=
+f.scale.x*p;h=f.scale.y*r;va.set(a.x-da,a.y-h,a.x+da,a.y+h);if(Oa.intersects(va)){d(g.color.getContextStyle());e(g.color.getContextStyle());o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(da,h);g.program(o);o.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);o.beginPath();o.moveTo(a.positionScreen.x,a.positionScreen.y);o.lineTo(e.positionScreen.x,e.positionScreen.y);o.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(G!=a)o.lineWidth=G=a;a=g.linecap;if(E!=
+a)o.lineCap=E=a;a=g.linejoin;if(B!=a)o.lineJoin=B=a;d(g.color.getContextStyle());o.stroke();va.inflate(g.linewidth*2)}}function u(a,d,e,g,da,h,O,R){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(R.opacity);c(R.blending);z=a.positionScreen.x;M=a.positionScreen.y;F=d.positionScreen.x;i=d.positionScreen.y;U=e.positionScreen.x;W=e.positionScreen.y;x(z,M,F,i,U,W);if(R instanceof THREE.MeshBasicMaterial)if(R.map){if(R.map.mapping instanceof THREE.UVMapping){sa=O.uvs[0];Tc(z,M,F,
+i,U,W,sa[g].u,sa[g].v,sa[da].u,sa[da].v,sa[h].u,sa[h].v,R.map)}}else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;ma.copy(O.vertexNormalsWorld[g]);Wa=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;Ya=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*0.5+0.5;ma.copy(O.vertexNormalsWorld[da]);Ja=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;db=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*
+0.5+0.5;ma.copy(O.vertexNormalsWorld[h]);hb=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;mb=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*0.5+0.5;Tc(z,M,F,i,U,W,Wa,Ya,Ja,db,hb,mb,R.envMap)}}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){if(R.map.mapping instanceof THREE.UVMapping){sa=O.uvs[0];Tc(z,M,F,i,U,W,sa[g].u,sa[g].v,sa[da].u,sa[da].v,
+sa[h].u,sa[h].v,R.map)}c(THREE.SubtractiveBlending)}if(ab)if(!R.wireframe&&R.shading==THREE.SmoothShading&&O.vertexNormalsWorld.length==3){S.r=ca.r=T.r=ja.r;S.g=ca.g=T.g=ja.g;S.b=ca.b=T.b=ja.b;n(j,O.v1.positionWorld,O.vertexNormalsWorld[0],S);n(j,O.v2.positionWorld,O.vertexNormalsWorld[1],ca);n(j,O.v3.positionWorld,O.vertexNormalsWorld[2],T);S.r=Math.max(0,Math.min(R.color.r*S.r,1));S.g=Math.max(0,Math.min(R.color.g*S.g,1));S.b=Math.max(0,Math.min(R.color.b*S.b,1));ca.r=Math.max(0,Math.min(R.color.r*
+ca.r,1));ca.g=Math.max(0,Math.min(R.color.g*ca.g,1));ca.b=Math.max(0,Math.min(R.color.b*ca.b,1));T.r=Math.max(0,Math.min(R.color.r*T.r,1));T.g=Math.max(0,Math.min(R.color.g*T.g,1));T.b=Math.max(0,Math.min(R.color.b*T.b,1));fa.r=(ca.r+T.r)*0.5;fa.g=(ca.g+T.g)*0.5;fa.b=(ca.b+T.b)*0.5;Sa=Dc(S,ca,T,fa);gc(z,M,F,i,U,W,0,0,1,0,0,1,Sa)}else{P.r=ja.r;P.g=ja.g;P.b=ja.b;n(j,O.centroidWorld,O.normalWorld,P);P.r=Math.max(0,Math.min(R.color.r*P.r,1));P.g=Math.max(0,Math.min(R.color.g*P.g,1));P.b=Math.max(0,Math.min(R.color.b*
+P.b,1));R.wireframe?Mb(P,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(P)}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color)}else if(R instanceof THREE.MeshDepthMaterial){ta=l.near;Na=l.far;S.r=S.g=S.b=1-ac(a.positionScreen.z,ta,Na);ca.r=ca.g=ca.b=1-ac(d.positionScreen.z,ta,Na);T.r=T.g=T.b=1-ac(e.positionScreen.z,ta,Na);fa.r=(ca.r+T.r)*0.5;fa.g=(ca.g+T.g)*0.5;fa.b=(ca.b+T.b)*0.5;Sa=Dc(S,ca,T,fa);gc(z,M,F,i,U,W,0,0,1,0,0,1,Sa)}else if(R instanceof
+THREE.MeshNormalMaterial){P.r=hc(O.normalWorld.x);P.g=hc(O.normalWorld.y);P.b=hc(O.normalWorld.z);R.wireframe?Mb(P,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(P)}}function t(a,d,e,g,da,h,R,O,k){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(O.opacity);c(O.blending);if(O.map||O.envMap){u(a,d,g,0,1,3,R,O,k);u(da,e,h,1,2,3,R,O,k)}else{z=a.positionScreen.x;M=a.positionScreen.y;F=d.positionScreen.x;i=d.positionScreen.y;U=e.positionScreen.x;W=e.positionScreen.y;
+C=g.positionScreen.x;Y=g.positionScreen.y;H=da.positionScreen.x;ba=da.positionScreen.y;ga=h.positionScreen.x;la=h.positionScreen.y;if(O instanceof THREE.MeshBasicMaterial){w(z,M,F,i,U,W,C,Y);O.wireframe?Mb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(O.color)}else if(O instanceof THREE.MeshLambertMaterial)if(ab)if(!O.wireframe&&O.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==4){S.r=ca.r=T.r=fa.r=ja.r;S.g=ca.g=T.g=fa.g=ja.g;S.b=ca.b=T.b=fa.b=ja.b;n(j,R.v1.positionWorld,
+R.vertexNormalsWorld[0],S);n(j,R.v2.positionWorld,R.vertexNormalsWorld[1],ca);n(j,R.v4.positionWorld,R.vertexNormalsWorld[3],T);n(j,R.v3.positionWorld,R.vertexNormalsWorld[2],fa);S.r=Math.max(0,Math.min(O.color.r*S.r,1));S.g=Math.max(0,Math.min(O.color.g*S.g,1));S.b=Math.max(0,Math.min(O.color.b*S.b,1));ca.r=Math.max(0,Math.min(O.color.r*ca.r,1));ca.g=Math.max(0,Math.min(O.color.g*ca.g,1));ca.b=Math.max(0,Math.min(O.color.b*ca.b,1));T.r=Math.max(0,Math.min(O.color.r*T.r,1));T.g=Math.max(0,Math.min(O.color.g*
+T.g,1));T.b=Math.max(0,Math.min(O.color.b*T.b,1));fa.r=Math.max(0,Math.min(O.color.r*fa.r,1));fa.g=Math.max(0,Math.min(O.color.g*fa.g,1));fa.b=Math.max(0,Math.min(O.color.b*fa.b,1));Sa=Dc(S,ca,T,fa);x(z,M,F,i,C,Y);gc(z,M,F,i,C,Y,0,0,1,0,0,1,Sa);x(H,ba,U,W,ga,la);gc(H,ba,U,W,ga,la,1,0,1,1,0,1,Sa)}else{P.r=ja.r;P.g=ja.g;P.b=ja.b;n(j,R.centroidWorld,R.normalWorld,P);P.r=Math.max(0,Math.min(O.color.r*P.r,1));P.g=Math.max(0,Math.min(O.color.g*P.g,1));P.b=Math.max(0,Math.min(O.color.b*P.b,1));w(z,M,F,i,
+U,W,C,Y);O.wireframe?Mb(P,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(P)}else{w(z,M,F,i,U,W,C,Y);O.wireframe?Mb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(O.color)}else if(O instanceof THREE.MeshNormalMaterial){P.r=hc(R.normalWorld.x);P.g=hc(R.normalWorld.y);P.b=hc(R.normalWorld.z);w(z,M,F,i,U,W,C,Y);O.wireframe?Mb(P,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(P)}else if(O instanceof THREE.MeshDepthMaterial){ta=l.near;Na=l.far;S.r=
+S.g=S.b=1-ac(a.positionScreen.z,ta,Na);ca.r=ca.g=ca.b=1-ac(d.positionScreen.z,ta,Na);T.r=T.g=T.b=1-ac(g.positionScreen.z,ta,Na);fa.r=fa.g=fa.b=1-ac(e.positionScreen.z,ta,Na);Sa=Dc(S,ca,T,fa);x(z,M,F,i,C,Y);gc(z,M,F,i,C,Y,0,0,1,0,0,1,Sa);x(H,ba,U,W,ga,la);gc(H,ba,U,W,ga,la,1,0,1,1,0,1,Sa)}}}function x(a,b,c,d,e,f){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(a,b);o.closePath()}function w(a,b,c,d,e,f,g,da){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(g,da);o.lineTo(a,
+b);o.closePath()}function Mb(a,b,c,e){if(G!=b)o.lineWidth=G=b;if(E!=c)o.lineCap=E=c;if(B!=e)o.lineJoin=B=e;d(a.getContextStyle());o.stroke();va.inflate(b*2)}function Gb(a){e(a.getContextStyle());o.fill()}function Tc(a,b,c,d,f,g,da,h,O,i,R,j,k){if(k.image.width!=0){if(k.needsUpdate==true||Ma[k.id]==void 0){var l=k.wrapS==THREE.RepeatWrapping,m=k.wrapT==THREE.RepeatWrapping;Ma[k.id]=o.createPattern(k.image,l&&m?"repeat":l&&!m?"repeat-x":!l&&m?"repeat-y":"no-repeat");k.needsUpdate=false}e(Ma[k.id]);
+var l=k.offset.x/k.repeat.x,m=k.offset.y/k.repeat.y,n=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,da=(da+l)*n,h=(h+m)*p,c=c-a,d=d-b,f=f-a,g=g-b,O=(O+l)*n-da,i=(i+m)*p-h,R=(R+l)*n-da,j=(j+m)*p-h,l=O*j-R*i;if(l==0){if(xa[k.id]===void 0){b=document.createElement("canvas");b.width=k.image.width;b.height=k.image.height;b=b.getContext("2d");b.drawImage(k.image,0,0);xa[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data}b=xa[k.id];da=(Math.floor(da)+Math.floor(h)*k.image.width)*4;P.setRGB(b[da]/
+255,b[da+1]/255,b[da+2]/255);Gb(P)}else{l=1/l;k=(j*c-i*f)*l;i=(j*d-i*g)*l;c=(O*f-R*c)*l;d=(O*g-R*d)*l;a=a-k*da-c*h;da=b-i*da-d*h;o.save();o.transform(k,i,c,d,a,da);o.fill();o.restore()}}}function gc(a,b,c,d,e,f,g,da,h,O,i,R,j){var k,l;k=j.width-1;l=j.height-1;g=g*k;da=da*l;c=c-a;d=d-b;e=e-a;f=f-b;h=h*k-g;O=O*l-da;i=i*k-g;R=R*l-da;l=1/(h*R-i*O);k=(R*c-O*e)*l;O=(R*d-O*f)*l;c=(h*e-i*c)*l;d=(h*f-i*d)*l;a=a-k*g-c*da;b=b-O*g-d*da;o.save();o.transform(k,O,c,d,a,b);o.clip();o.drawImage(j,0,0);o.restore()}
+function Dc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);O[0]=e<0?0:e>255?255:e;O[1]=f<0?0:f>255?255:f;O[2]=a<0?0:a>255?255:a;O[4]=g<0?0:g>255?255:g;O[5]=h<0?0:h>255?255:h;O[6]=b<0?0:b>255?255:b;O[8]=i<0?0:i>255?255:i;O[9]=j<0?0:j>255?255:j;O[10]=c<0?0:c>255?255:c;O[12]=k<0?0:k>255?255:k;O[13]=l<0?0:l>255?255:l;O[14]=d<0?0:d>255?255:d;da.putImageData(R,0,0);Cc.drawImage(Fb,
+0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Ec,cd,Ta,kb;this.autoClear?this.clear():o.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,l,this.sortElements);h=g.elements;j=g.lights;(ab=j.length>0)&&m(j);Ec=0;for(cd=h.length;Ec<cd;Ec++){Ta=h[Ec];kb=Ta.material;
+kb=kb instanceof THREE.MeshFaceMaterial?Ta.faceMaterial:kb;if(!(kb==null||kb.opacity==0)){va.empty();if(Ta instanceof THREE.RenderableParticle){v=Ta;v.x=v.x*p;v.y=v.y*r;q(v,Ta,kb,a)}else if(Ta instanceof THREE.RenderableLine){v=Ta.v1;A=Ta.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;A.positionScreen.x=A.positionScreen.x*p;A.positionScreen.y=A.positionScreen.y*r;va.addPoint(v.positionScreen.x,v.positionScreen.y);va.addPoint(A.positionScreen.x,A.positionScreen.y);
+Oa.intersects(va)&&s(v,A,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace3){v=Ta.v1;A=Ta.v2;J=Ta.v3;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;A.positionScreen.x=A.positionScreen.x*p;A.positionScreen.y=A.positionScreen.y*r;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*r;if(kb.overdraw){Nb(v.positionScreen,A.positionScreen);Nb(A.positionScreen,J.positionScreen);Nb(J.positionScreen,v.positionScreen)}va.add3Points(v.positionScreen.x,
+v.positionScreen.y,A.positionScreen.x,A.positionScreen.y,J.positionScreen.x,J.positionScreen.y);Oa.intersects(va)&&u(v,A,J,0,1,2,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace4){v=Ta.v1;A=Ta.v2;J=Ta.v3;K=Ta.v4;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;A.positionScreen.x=A.positionScreen.x*p;A.positionScreen.y=A.positionScreen.y*r;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*r;K.positionScreen.x=K.positionScreen.x*p;K.positionScreen.y=
+K.positionScreen.y*r;X.positionScreen.copy(A.positionScreen);Q.positionScreen.copy(K.positionScreen);if(kb.overdraw){Nb(v.positionScreen,A.positionScreen);Nb(A.positionScreen,K.positionScreen);Nb(K.positionScreen,v.positionScreen);Nb(J.positionScreen,X.positionScreen);Nb(J.positionScreen,Q.positionScreen)}va.addPoint(v.positionScreen.x,v.positionScreen.y);va.addPoint(A.positionScreen.x,A.positionScreen.y);va.addPoint(J.positionScreen.x,J.positionScreen.y);va.addPoint(K.positionScreen.x,K.positionScreen.y);
+Oa.intersects(va)&&t(v,A,J,K,X,Q,Ta,kb,a)}ua.addRectangle(va)}}o.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,k;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){j=g.matrixWorld.getPosition();k=c.dot(j);if(!(k<=0)){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}else if(g instanceof THREE.PointLight){j=g.matrixWorld.getPosition();k=c.dot(v.sub(j,b).normalize());if(!(k<=0)){k=k*(g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1));if(k!=0){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*
+k}}}}}function b(a){if(A[a]==null){A[a]=document.createElementNS("http://www.w3.org/2000/svg","path");z==0&&A[a].setAttribute("shape-rendering","crispEdges")}return A[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,n,m,p,r,o,q,u=new THREE.Rectangle,t=new THREE.Rectangle,x=false,s=new THREE.Color,w=new THREE.Color,G=new THREE.Color,E=new THREE.Color,
+B,v=new THREE.Vector3,A=[],J=[],K,X,Q,z=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;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){k=a;l=b;n=k/2;m=l/2;j.setAttribute("viewBox",-n+" "+-m+" "+k+" "+l);j.setAttribute("width",k);j.setAttribute("height",l);u.set(-n,-m,n,m)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(k,
+l){var i,v,A,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);f=e.elements;g=e.lights;Q=X=0;if(x=g.length>0){w.setRGB(0,0,0);G.setRGB(0,0,0);E.setRGB(0,0,0);i=0;for(v=g.length;i<v;i++){C=g[i];A=C.color;if(C instanceof THREE.AmbientLight){w.r=w.r+A.r;w.g=w.g+A.g;w.b=w.b+A.b}else if(C instanceof THREE.DirectionalLight){G.r=G.r+A.r;G.g=G.g+A.g;G.b=G.b+A.b}else if(C instanceof THREE.PointLight){E.r=E.r+A.r;E.g=E.g+A.g;E.b=E.b+A.b}}}i=
+0;for(v=f.length;i<v;i++){A=f[i];C=A.material;C=C instanceof THREE.MeshFaceMaterial?A.faceMaterial:C;if(!(C==null||C.opacity==0)){t.empty();if(A instanceof THREE.RenderableParticle){p=A;p.x=p.x*n;p.y=p.y*-m}else if(A instanceof THREE.RenderableLine){p=A.v1;r=A.v2;p.positionScreen.x=p.positionScreen.x*n;p.positionScreen.y=p.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*n;r.positionScreen.y=r.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,
+r.positionScreen.y);if(u.intersects(t)){A=p;var Y=r,H=Q++;if(J[H]==null){J[H]=document.createElementNS("http://www.w3.org/2000/svg","line");z==0&&J[H].setAttribute("shape-rendering","crispEdges")}K=J[H];K.setAttribute("x1",A.positionScreen.x);K.setAttribute("y1",A.positionScreen.y);K.setAttribute("x2",Y.positionScreen.x);K.setAttribute("y2",Y.positionScreen.y);if(C instanceof THREE.LineBasicMaterial){K.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+
+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin);j.appendChild(K)}}}else if(A instanceof THREE.RenderableFace3){p=A.v1;r=A.v2;o=A.v3;p.positionScreen.x=p.positionScreen.x*n;p.positionScreen.y=p.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*n;r.positionScreen.y=r.positionScreen.y*-m;o.positionScreen.x=o.positionScreen.x*n;o.positionScreen.y=o.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,
+r.positionScreen.y);t.addPoint(o.positionScreen.x,o.positionScreen.y);if(u.intersects(t)){var Y=p,H=r,ba=o;d.info.render.vertices=d.info.render.vertices+3;d.info.render.faces++;K=b(X++);K.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)s.copy(C.color);else if(C instanceof THREE.MeshLambertMaterial)if(x){s.r=w.r;s.g=w.g;s.b=w.b;a(g,A.centroidWorld,
+A.normalWorld,s);s.r=Math.max(0,Math.min(C.color.r*s.r,1));s.g=Math.max(0,Math.min(C.color.g*s.g,1));s.b=Math.max(0,Math.min(C.color.b*s.b,1))}else s.copy(C.color);else if(C instanceof THREE.MeshDepthMaterial){B=1-C.__2near/(C.__farPlusNear-A.z*C.__farMinusNear);s.setRGB(B,B,B)}else C instanceof THREE.MeshNormalMaterial&&s.setRGB(c(A.normalWorld.x),c(A.normalWorld.y),c(A.normalWorld.z));C.wireframe?K.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+
+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):K.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);j.appendChild(K)}}else if(A instanceof THREE.RenderableFace4){p=A.v1;r=A.v2;o=A.v3;q=A.v4;p.positionScreen.x=p.positionScreen.x*n;p.positionScreen.y=p.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*n;r.positionScreen.y=r.positionScreen.y*-m;o.positionScreen.x=o.positionScreen.x*n;o.positionScreen.y=
+o.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*n;q.positionScreen.y=q.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);if(u.intersects(t)){var Y=p,H=r,ba=o,ga=q;d.info.render.vertices=d.info.render.vertices+4;d.info.render.faces++;K=b(X++);K.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+H.positionScreen.x+
+" "+H.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)s.copy(C.color);else if(C instanceof THREE.MeshLambertMaterial)if(x){s.r=w.r;s.g=w.g;s.b=w.b;a(g,A.centroidWorld,A.normalWorld,s);s.r=Math.max(0,Math.min(C.color.r*s.r,1));s.g=Math.max(0,Math.min(C.color.g*s.g,1));s.b=Math.max(0,Math.min(C.color.b*s.b,1))}else s.copy(C.color);else if(C instanceof THREE.MeshDepthMaterial){B=1-C.__2near/
+(C.__farPlusNear-A.z*C.__farMinusNear);s.setRGB(B,B,B)}else C instanceof THREE.MeshNormalMaterial&&s.setRGB(c(A.normalWorld.x),c(A.normalWorld.y),c(A.normalWorld.z));C.wireframe?K.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):K.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);j.appendChild(K)}}}}}};
 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\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\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",
@@ -250,100 +251,100 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.Shader
 THREE.ShaderChunk.color_pars_vertex,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.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,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=true;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=true}a.__webglCustomAttributesList.push(f)}}}
+THREE.WebGLRenderer=function(a){function b(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=true;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=i.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
-var k=a.colors,i=k.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){va.copy(ua);va.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];ab.copy(e);va.multiplyVector3(ab);m[d]=[ab.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[m[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<i;d++){f=d*3;e=k[m[d][1]];n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){k=0;for(i=r.length;k<i;k++){h=r[k];
-if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(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=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=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=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=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<i;d++){e=k[d];f=d*3;n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){k=0;for(i=r.length;k<i;k++){h=r[k];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(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=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=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=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=f+4}}}}}if(o||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
-n,b)}if(r){k=0;for(i=r.length;k<i;k++){h=r[k];if(h.needsUpdate||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,h.buffer);j.bufferData(j.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){ba=W=null;Y=H=xa=Ma=S=-1;a[d].render(b,c,hb,mb);ba=W=null;Y=H=xa=Ma=S=-1}}function i(a,b,c,d,e,f,g,h){var j,k,i,l;if(b){k=a.length-1;l=b=-1}else{k=0;b=a.length;l=1}for(var m=k;m!==b;m=m+l){j=a[m];if(j.render){k=j.object;i=j.buffer;if(h)j=h;else{j=
-j[c];if(!j)continue;g&&G.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);G.setDepthTest(j.depthTest);G.setDepthWrite(j.depthWrite);u(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}G.setObjectFaces(k);i instanceof THREE.BufferGeometry?G.renderBufferDirect(d,e,f,j,i,k):G.renderBuffer(d,e,f,j,i,k)}}}function k(a,b,c,d,e,f,g){for(var h,j,k=0,i=a.length;k<i;k++){h=a[k];j=h.object;if(j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&G.setBlending(h.blending,h.blendEquation,h.blendSrc,
-h.blendDst);G.setDepthTest(h.depthTest);G.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,j)}}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function o(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,
-b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){if(!d.program||d.needsUpdate){G.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,g=G.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,k=d.uniforms;if(f!==W){j.useProgram(f);W=f;h=true}if(d.id!==Y){Y=d.id;h=true}if(h||a!==ba){j.uniformMatrix4fv(g.projectionMatrix,
-false,a._projectionMatrixArray);a!==ba&&(ba=a)}if(h){if(c&&d.fog){k.fogColor.value=c.color;if(c instanceof THREE.Fog){k.fogNear.value=c.near;k.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var i,l=0,m=0,n=0,o,p,r,q=Ha,s=q.directional.colors,t=q.directional.positions,u=q.point.colors,C=q.point.positions,v=q.point.distances,H=q.spot.colors,x=q.spot.positions,B=q.spot.distances,
-z=q.spot.directions,A=q.spot.angles,S=q.spot.exponents,J=0,P=0,K=0,T=r=0,c=T=0,h=b.length;c<h;c++){i=b[c];if(!i.onlyShadow){o=i.color;p=i.intensity;r=i.distance;if(i instanceof THREE.AmbientLight)if(G.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(i instanceof THREE.DirectionalLight){r=J*3;if(G.gammaInput){s[r]=o.r*o.r*p*p;s[r+1]=o.g*o.g*p*p;s[r+2]=o.b*o.b*p*p}else{s[r]=o.r*p;s[r+1]=o.g*p;s[r+2]=o.b*p}ja.copy(i.matrixWorld.getPosition());ja.subSelf(i.target.matrixWorld.getPosition());
-ja.normalize();t[r]=ja.x;t[r+1]=ja.y;t[r+2]=ja.z;J=J+1}else if(i instanceof THREE.PointLight){T=P*3;if(G.gammaInput){u[T]=o.r*o.r*p*p;u[T+1]=o.g*o.g*p*p;u[T+2]=o.b*o.b*p*p}else{u[T]=o.r*p;u[T+1]=o.g*p;u[T+2]=o.b*p}o=i.matrixWorld.getPosition();C[T]=o.x;C[T+1]=o.y;C[T+2]=o.z;v[P]=r;P=P+1}else if(i instanceof THREE.SpotLight){T=K*3;if(G.gammaInput){H[T]=o.r*o.r*p*p;H[T+1]=o.g*o.g*p*p;H[T+2]=o.b*o.b*p*p}else{H[T]=o.r*p;H[T+1]=o.g*p;H[T+2]=o.b*p}o=i.matrixWorld.getPosition();x[T]=o.x;x[T+1]=o.y;x[T+2]=
-o.z;B[K]=r;ja.copy(o);ja.subSelf(i.target.matrixWorld.getPosition());ja.normalize();z[T]=ja.x;z[T+1]=ja.y;z[T+2]=ja.z;A[K]=Math.cos(i.angle);S[K]=i.exponent;K=K+1}}}c=J*3;for(h=s.length;c<h;c++)s[c]=0;c=P*3;for(h=u.length;c<h;c++)u[c]=0;c=K*3;for(h=H.length;c<h;c++)H[c]=0;q.directional.length=J;q.point.length=P;q.spot.length=K;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=n;c=Ha;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;
+var k=a.colors,j=k.length,l=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,n=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){va.copy(ua);va.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];ab.copy(e);va.multiplyVector3(ab);o[d]=[ab.z,d]}o.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[o[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<j;d++){f=d*3;e=k[o[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){k=0;for(j=r.length;k<j;k++){h=r[k];
+if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=o[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=o[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=f+4}}}}}else{if(n)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<j;d++){e=k[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){k=0;for(j=r.length;k<j;k++){h=r[k];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(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=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=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=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=f+4}}}}}if(n||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
+m,b)}if(r){k=0;for(j=r.length;k<j;k++){h=r[k];if(h.needsUpdate||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,h.buffer);i.bufferData(i.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){ba=W=null;Y=H=xa=Ma=S=-1;a[d].render(b,c,hb,mb);ba=W=null;Y=H=xa=Ma=S=-1}}function j(a,b,c,d,e,f,g,h){var i,k,j,l;if(b){k=a.length-1;l=b=-1}else{k=0;b=a.length;l=1}for(var m=k;m!==b;m=m+l){i=a[m];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=
+i[c];if(!i)continue;g&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(k);j instanceof THREE.BufferGeometry?F.renderBufferDirect(d,e,f,i,j,k):F.renderBuffer(d,e,f,i,j,k)}}}function k(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,
+h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,e,h,i)}}}function l(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 true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,
+b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function o(a,b,c,d,e){if(!d.program||d.needsUpdate){F.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,g=F.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,k=d.uniforms;if(f!==W){i.useProgram(f);W=f;h=true}if(d.id!==Y){Y=d.id;h=true}if(h||a!==ba){i.uniformMatrix4fv(g.projectionMatrix,
+false,a._projectionMatrixArray);a!==ba&&(ba=a)}if(h){if(c&&d.fog){k.fogColor.value=c.color;if(c instanceof THREE.Fog){k.fogNear.value=c.near;k.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var j,l=0,m=0,o=0,n,p,r,q=Ha,s=q.directional.colors,u=q.directional.positions,t=q.point.colors,C=q.point.positions,H=q.point.distances,v=q.spot.colors,w=q.spot.positions,B=q.spot.distances,
+A=q.spot.directions,z=q.spot.angles,S=q.spot.exponents,P=0,J=0,K=0,T=r=0,c=T=0,h=b.length;c<h;c++){j=b[c];if(!j.onlyShadow){n=j.color;p=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(F.gammaInput){l=l+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{l=l+n.r;m=m+n.g;o=o+n.b}else if(j instanceof THREE.DirectionalLight){r=P*3;if(F.gammaInput){s[r]=n.r*n.r*p*p;s[r+1]=n.g*n.g*p*p;s[r+2]=n.b*n.b*p*p}else{s[r]=n.r*p;s[r+1]=n.g*p;s[r+2]=n.b*p}ja.copy(j.matrixWorld.getPosition());ja.subSelf(j.target.matrixWorld.getPosition());
+ja.normalize();u[r]=ja.x;u[r+1]=ja.y;u[r+2]=ja.z;P=P+1}else if(j instanceof THREE.PointLight){T=J*3;if(F.gammaInput){t[T]=n.r*n.r*p*p;t[T+1]=n.g*n.g*p*p;t[T+2]=n.b*n.b*p*p}else{t[T]=n.r*p;t[T+1]=n.g*p;t[T+2]=n.b*p}n=j.matrixWorld.getPosition();C[T]=n.x;C[T+1]=n.y;C[T+2]=n.z;H[J]=r;J=J+1}else if(j instanceof THREE.SpotLight){T=K*3;if(F.gammaInput){v[T]=n.r*n.r*p*p;v[T+1]=n.g*n.g*p*p;v[T+2]=n.b*n.b*p*p}else{v[T]=n.r*p;v[T+1]=n.g*p;v[T+2]=n.b*p}n=j.matrixWorld.getPosition();w[T]=n.x;w[T+1]=n.y;w[T+2]=
+n.z;B[K]=r;ja.copy(n);ja.subSelf(j.target.matrixWorld.getPosition());ja.normalize();A[T]=ja.x;A[T+1]=ja.y;A[T+2]=ja.z;z[K]=Math.cos(j.angle);S[K]=j.exponent;K=K+1}}}c=P*3;for(h=s.length;c<h;c++)s[c]=0;c=J*3;for(h=t.length;c<h;c++)t[c]=0;c=K*3;for(h=v.length;c<h;c++)v[c]=0;q.directional.length=P;q.point.length=J;q.spot.length=K;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=o;c=Ha;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;
 k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngle.value=c.spot.angles;k.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=
-d.opacity;G.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;(k.map.texture=d.map)&&k.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);k.lightMap.texture=d.lightMap;k.envMap.texture=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
-THREE.LineBasicMaterial){k.diffuse.value=d.color;k.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){k.psColor.value=d.color;k.opacity.value=d.opacity;k.size.value=d.size;k.scale.value=E.height/2;k.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){k.shininess.value=d.shininess;if(G.gammaInput){k.ambient.value.copyGammaToLinear(d.ambient);k.emissive.value.copyGammaToLinear(d.emissive);k.specular.value.copyGammaToLinear(d.specular)}else{k.ambient.value=d.ambient;
-k.emissive.value=d.emissive;k.specular.value=d.specular}d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(G.gammaInput){k.ambient.value.copyGammaToLinear(d.ambient);k.emissive.value.copyGammaToLinear(d.emissive)}else{k.ambient.value=d.ambient;k.emissive.value=d.emissive}d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){k.mNear.value=a.near;k.mFar.value=a.far;k.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)k.opacity.value=
-d.opacity;if(e.receiveShadow&&!d._shadowPass&&k.shadowMatrix){h=c=0;for(i=b.length;h<i;h++){l=b[h];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){k.shadowMap.texture[c]=l.shadowMap;k.shadowMapSize.value[c]=l.shadowMapSize;k.shadowMatrix.value[c]=l.shadowMatrix;k.shadowDarkness.value[c]=l.shadowDarkness;k.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;k=0;for(c=b.length;k<c;k++)if(l=f.uniforms[b[k][1]]){h=b[k][0];m=h.type;i=h.value;
-if(m==="i")j.uniform1i(l,i);else if(m==="f")j.uniform1f(l,i);else if(m==="v2")j.uniform2f(l,i.x,i.y);else if(m==="v3")j.uniform3f(l,i.x,i.y,i.z);else if(m==="v4")j.uniform4f(l,i.x,i.y,i.z,i.w);else if(m==="c")j.uniform3f(l,i.r,i.g,i.b);else if(m==="fv1")j.uniform1fv(l,i);else if(m==="fv")j.uniform3fv(l,i);else if(m==="v2v"){if(!h._array)h._array=new Float32Array(2*i.length);m=0;for(n=i.length;m<n;m++){q=m*2;h._array[q]=i[m].x;h._array[q+1]=i[m].y}j.uniform2fv(l,h._array)}else if(m==="v3v"){if(!h._array)h._array=
-new Float32Array(3*i.length);m=0;for(n=i.length;m<n;m++){q=m*3;h._array[q]=i[m].x;h._array[q+1]=i[m].y;h._array[q+2]=i[m].z}j.uniform3fv(l,h._array)}else if(m=="v4v"){if(!h._array)h._array=new Float32Array(4*i.length);m=0;for(n=i.length;m<n;m++){q=m*4;h._array[q]=i[m].x;h._array[q+1]=i[m].y;h._array[q+2]=i[m].z;h._array[q+3]=i[m].w}j.uniform4fv(l,h._array)}else if(m==="m4"){if(!h._array)h._array=new Float32Array(16);i.flattenToArray(h._array);j.uniformMatrix4fv(l,false,h._array)}else if(m==="m4v"){if(!h._array)h._array=
-new Float32Array(16*i.length);m=0;for(n=i.length;m<n;m++)i[m].flattenToArrayOffset(h._array,m*16);j.uniformMatrix4fv(l,false,h._array)}else if(m==="t"){j.uniform1i(l,i);if(l=h.texture)if(l.image instanceof Array&&l.image.length===6){h=l;if(h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+i);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);i=[];for(l=0;l<6;l++){m=i;n=l;if(G.autoScaleCubemaps){q=h.image[l];
-t=ma;if(!(q.width<=t&&q.height<=t)){u=Math.max(q.width,q.height);s=Math.floor(q.width*t/u);t=Math.floor(q.height*t/u);u=document.createElement("canvas");u.width=s;u.height=t;u.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,t);q=u}}else q=h.image[l];m[n]=q}l=i[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;n=F(h.format);q=F(h.type);w(j.TEXTURE_CUBE_MAP,h,m);for(l=0;l<6;l++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,q,i[l]);h.generateMipmaps&&m&&j.generateMipmap(j.TEXTURE_CUBE_MAP);
-h.needsUpdate=false;if(h.onUpdate)h.onUpdate()}else{j.activeTexture(j.TEXTURE0+i);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){h=l;j.activeTexture(j.TEXTURE0+i);j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)}else G.setTexture(l,i)}else if(m==="tv"){if(!h._array){h._array=[];m=0;for(n=h.texture.length;m<n;m++)h._array[m]=i+m}j.uniform1iv(l,h._array);m=0;for(n=h.texture.length;m<n;m++)(l=h.texture[m])&&G.setTexture(l,h._array[m])}}if((d instanceof
-THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null){b=a.matrixWorld.getPosition();j.uniform3f(g.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&j.uniformMatrix4fv(g.viewMatrix,false,a._viewMatrixArray);d.skinning&&j.uniformMatrix4fv(g.boneGlobalMatrices,false,e.boneMatrices)}j.uniformMatrix4fv(g.modelViewMatrix,false,e._modelViewMatrix.elements);
-g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,false,e._normalMatrix.elements);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&j.uniformMatrix4fv(g.objectMatrix,false,e.matrixWorld.elements);return f}function q(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(ta!==a){a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL);
-ta=a}if(a&&(Na!==b||Sa!==c)){j.polygonOffset(b,c);Na=b;Sa=c}}function t(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)){console.error(j.getShaderInfoLog(c));console.error(b);return null}return c}function w(a,b,c){if(c){j.texParameteri(a,j.TEXTURE_WRAP_S,F(b.wrapS));j.texParameteri(a,j.TEXTURE_WRAP_T,F(b.wrapT));j.texParameteri(a,j.TEXTURE_MAG_FILTER,
-F(b.magFilter));j.texParameteri(a,j.TEXTURE_MIN_FILTER,F(b.minFilter))}else{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,x(b.magFilter));j.texParameteri(a,j.TEXTURE_MIN_FILTER,x(b.minFilter))}}function s(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);if(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)}else if(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)}else j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function x(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function F(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.UnsignedIntType: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;case THREE.AddEquation:return j.FUNC_ADD;
-case THREE.SubtractEquation:return j.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return j.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return j.ZERO;case THREE.OneFactor:return j.ONE;case THREE.SrcColorFactor:return j.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return j.ONE_MINUS_SRC_COLOR;case THREE.SrcAlphaFactor:return j.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return j.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return j.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return j.ONE_MINUS_DST_ALPHA;
-case THREE.DstColorFactor:return j.DST_COLOR;case THREE.OneMinusDstColorFactor:return j.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return j.SRC_ALPHA_SATURATE}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},E=a.canvas!==void 0?a.canvas:document.createElement("canvas"),B=a.precision!==void 0?a.precision:"highp",v=a.alpha!==void 0?a.alpha:true,z=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,J=a.antialias!==void 0?a.antialias:false,K=a.stencil!==void 0?a.stencil:
-true,X=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,Q=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),A=a.clearAlpha!==void 0?a.clearAlpha:0,M=a.maxLights!==void 0?a.maxLights:4;this.domElement=E;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=
-this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var G=this,j,U=[],W=null,C=null,Y=-1,H=null,ba=null,ga=0,la=null,P=null,S=null,ca=null,T=null,fa=null,Ma=null,xa=null,ta=null,Na=null,Sa=null,sa=null,Wa=0,Ya=0,Ja=0,db=0,hb=0,mb=
-0,Oa=new THREE.Frustum,ua=new THREE.Matrix4,va=new THREE.Matrix4,ab=new THREE.Vector4,ja=new THREE.Vector3,Ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}};j=function(){var a;try{if(!(a=E.getContext("experimental-webgl",{alpha:v,premultipliedAlpha:z,antialias:J,stencil:K,preserveDrawingBuffer:X})))throw"Error creating WebGL context.";}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(Q.r,Q.g,Q.b,A);this.context=j;var Xa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var ma=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=
-function(){return Xa>0};this.setSize=function(a,b){E.width=a;E.height=b;this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){Wa=a;Ya=b;Ja=c;db=d;j.viewport(Wa,Ya,Ja,db)};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){Q.setHex(a);A=b;j.clearColor(Q.r,Q.g,Q.b,A)};this.setClearColor=function(a,b){Q.copy(a);A=b;j.clearColor(Q.r,Q.g,Q.b,A)};this.getClearColor=
-function(){return Q};this.getClearAlpha=function(){return A};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|j.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|j.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=
-false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(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);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}G.info.memory.geometries--}else if(a instanceof
-THREE.Ribbon){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);j.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);j.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);j.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
-false;j.deleteTexture(a.__webglTexture);G.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){j.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){j.deleteFramebuffer(a.__webglFramebuffer[b]);j.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{j.deleteFramebuffer(a.__webglFramebuffer);j.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.updateShadowMap=function(a,b){W=null;Y=H=xa=Ma=S=-1;this.shadowMapPlugin.update(a,
-b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();if(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,false,0,0)}if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,
-e,f,g,h,k,i,l,m,n,o=a.count*3;for(n=0;n<o;n=n+9){c=a.normalArray;d=c[n];e=c[n+1];f=c[n+2];g=c[n+3];k=c[n+4];l=c[n+5];h=c[n+6];i=c[n+7];m=c[n+8];d=(d+g+h)/3;e=(e+k+i)/3;f=(f+l+m)/3;c[n]=d;c[n+1]=e;c[n+2]=f;c[n+3]=d;c[n+4]=e;c[n+5]=f;c[n+6]=d;c[n+7]=e;c[n+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,false,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,
-b,c,d,e,f){if(d.opacity!==0){c=m(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==H){H=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer);j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer);j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,
-false,0,f[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer);j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,false,0,f[d].index*8);j.enableVertexAttribArray(a.uv)}else j.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer);j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,false,0,f[d].index*16)}j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}j.drawElements(j.TRIANGLES,
-f[d].count,j.UNSIGNED_SHORT,f[d].start*2);G.info.render.calls++;G.info.render.vertices=G.info.render.vertices+f[d].count;G.info.render.faces=G.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==H){H=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer);j.vertexAttribPointer(b.position,3,j.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=
-d.program.attributes;if(f.morphTargetBase!==-1){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);j.vertexAttribPointer(c.position,3,j.FLOAT,false,0,0)}else if(c.position>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer);j.vertexAttribPointer(c.position,3,j.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){g=0;var k=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<k.length;){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[g]]);
-j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,false,0,0);if(d.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[g]]);j.vertexAttribPointer(c["morphNormal"+g],3,j.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=h[k[g]];g++}}else{var k=[],i=-1,l=0;h=f.morphTargetInfluences;var n,o=h.length;g=0;for(f.morphTargetBase!==-1&&(k[f.morphTargetBase]=true);g<d.numSupportedMorphTargets;){for(n=0;n<o;n++)if(!k[n]&&h[n]>i){l=n;i=h[l]}j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);
-j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,false,0,0);if(d.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);j.vertexAttribPointer(c["morphNormal"+g],3,j.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=i;k[l]=1;i=-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];
-if(b[c.buffer.belongsToAttribute]>=0){j.bindBuffer(j.ARRAY_BUFFER,c.buffer);j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,false,0,0)}}}if(b.color>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer);j.vertexAttribPointer(b.color,3,j.FLOAT,false,0,0)}if(b.normal>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer);j.vertexAttribPointer(b.normal,3,j.FLOAT,false,0,0)}if(b.tangent>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer);j.vertexAttribPointer(b.tangent,4,j.FLOAT,
-false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer);j.vertexAttribPointer(b.uv,2,j.FLOAT,false,0,0);j.enableVertexAttribArray(b.uv)}else j.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer);j.vertexAttribPointer(b.uv2,2,j.FLOAT,false,0,0);j.enableVertexAttribArray(b.uv2)}else j.disableVertexAttribArray(b.uv2);if(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,false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==sa){j.lineWidth(d);
-sa=d}a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)}else{a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)}G.info.render.calls++;G.info.render.vertices=G.info.render.vertices+e.__webglFaceCount;G.info.render.faces=G.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;d=d.linewidth;
-if(d!==sa){j.lineWidth(d);sa=d}j.drawArrays(f,0,e.__webglLineCount);G.info.render.calls++}else if(f instanceof THREE.ParticleSystem){j.drawArrays(j.POINTS,0,e.__webglParticleCount);G.info.render.calls++;G.info.render.points=G.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount);G.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,l,m,n=a.__lights,o=a.fog;Y=-1;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");
+d.opacity;F.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;(k.map.texture=d.map)&&k.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);k.lightMap.texture=d.lightMap;k.envMap.texture=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
+THREE.LineBasicMaterial){k.diffuse.value=d.color;k.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){k.psColor.value=d.color;k.opacity.value=d.opacity;k.size.value=d.size;k.scale.value=E.height/2;k.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){k.shininess.value=d.shininess;if(F.gammaInput){k.ambient.value.copyGammaToLinear(d.ambient);k.emissive.value.copyGammaToLinear(d.emissive);k.specular.value.copyGammaToLinear(d.specular)}else{k.ambient.value=d.ambient;
+k.emissive.value=d.emissive;k.specular.value=d.specular}d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(F.gammaInput){k.ambient.value.copyGammaToLinear(d.ambient);k.emissive.value.copyGammaToLinear(d.emissive)}else{k.ambient.value=d.ambient;k.emissive.value=d.emissive}d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){k.mNear.value=a.near;k.mFar.value=a.far;k.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)k.opacity.value=
+d.opacity;if(e.receiveShadow&&!d._shadowPass&&k.shadowMatrix){h=c=0;for(j=b.length;h<j;h++){l=b[h];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){k.shadowMap.texture[c]=l.shadowMap;k.shadowMapSize.value[c]=l.shadowMapSize;k.shadowMatrix.value[c]=l.shadowMatrix;k.shadowDarkness.value[c]=l.shadowDarkness;k.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;k=0;for(c=b.length;k<c;k++)if(l=f.uniforms[b[k][1]]){h=b[k][0];m=h.type;j=h.value;
+if(m==="i")i.uniform1i(l,j);else if(m==="f")i.uniform1f(l,j);else if(m==="v2")i.uniform2f(l,j.x,j.y);else if(m==="v3")i.uniform3f(l,j.x,j.y,j.z);else if(m==="v4")i.uniform4f(l,j.x,j.y,j.z,j.w);else if(m==="c")i.uniform3f(l,j.r,j.g,j.b);else if(m==="fv1")i.uniform1fv(l,j);else if(m==="fv")i.uniform3fv(l,j);else if(m==="v2v"){if(!h._array)h._array=new Float32Array(2*j.length);m=0;for(o=j.length;m<o;m++){q=m*2;h._array[q]=j[m].x;h._array[q+1]=j[m].y}i.uniform2fv(l,h._array)}else if(m==="v3v"){if(!h._array)h._array=
+new Float32Array(3*j.length);m=0;for(o=j.length;m<o;m++){q=m*3;h._array[q]=j[m].x;h._array[q+1]=j[m].y;h._array[q+2]=j[m].z}i.uniform3fv(l,h._array)}else if(m=="v4v"){if(!h._array)h._array=new Float32Array(4*j.length);m=0;for(o=j.length;m<o;m++){q=m*4;h._array[q]=j[m].x;h._array[q+1]=j[m].y;h._array[q+2]=j[m].z;h._array[q+3]=j[m].w}i.uniform4fv(l,h._array)}else if(m==="m4"){if(!h._array)h._array=new Float32Array(16);j.flattenToArray(h._array);i.uniformMatrix4fv(l,false,h._array)}else if(m==="m4v"){if(!h._array)h._array=
+new Float32Array(16*j.length);m=0;for(o=j.length;m<o;m++)j[m].flattenToArrayOffset(h._array,m*16);i.uniformMatrix4fv(l,false,h._array)}else if(m==="t"){i.uniform1i(l,j);if(l=h.texture)if(l.image instanceof Array&&l.image.length===6){h=l;if(h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=i.createTexture();i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);j=[];for(l=0;l<6;l++){m=j;o=l;if(F.autoScaleCubemaps){q=h.image[l];
+u=ma;if(!(q.width<=u&&q.height<=u)){t=Math.max(q.width,q.height);s=Math.floor(q.width*u/t);u=Math.floor(q.height*u/t);t=document.createElement("canvas");t.width=s;t.height=u;t.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,u);q=t}}else q=h.image[l];m[o]=q}l=j[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;o=G(h.format);q=G(h.type);x(i.TEXTURE_CUBE_MAP,h,m);for(l=0;l<6;l++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o,o,q,j[l]);h.generateMipmaps&&m&&i.generateMipmap(i.TEXTURE_CUBE_MAP);
+h.needsUpdate=false;if(h.onUpdate)h.onUpdate()}else{i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){h=l;i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.__webglTexture)}else F.setTexture(l,j)}else if(m==="tv"){if(!h._array){h._array=[];m=0;for(o=h.texture.length;m<o;m++)h._array[m]=j+m}i.uniform1iv(l,h._array);m=0;for(o=h.texture.length;m<o;m++)(l=h.texture[m])&&F.setTexture(l,h._array[m])}}if((d instanceof
+THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null){b=a.matrixWorld.getPosition();i.uniform3f(g.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&i.uniformMatrix4fv(g.viewMatrix,false,a._viewMatrixArray);d.skinning&&i.uniformMatrix4fv(g.boneGlobalMatrices,false,e.boneMatrices)}i.uniformMatrix4fv(g.modelViewMatrix,false,e._modelViewMatrix.elements);
+g.normalMatrix&&i.uniformMatrix3fv(g.normalMatrix,false,e._normalMatrix.elements);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&i.uniformMatrix4fv(g.objectMatrix,false,e.matrixWorld.elements);return f}function q(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(ta!==a){a?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL);
+ta=a}if(a&&(Na!==b||Sa!==c)){i.polygonOffset(b,c);Na=b;Sa=c}}function t(a,b){var c;a==="fragment"?c=i.createShader(i.FRAGMENT_SHADER):a==="vertex"&&(c=i.createShader(i.VERTEX_SHADER));i.shaderSource(c,b);i.compileShader(c);if(!i.getShaderParameter(c,i.COMPILE_STATUS)){console.error(i.getShaderInfoLog(c));console.error(b);return null}return c}function x(a,b,c){if(c){i.texParameteri(a,i.TEXTURE_WRAP_S,G(b.wrapS));i.texParameteri(a,i.TEXTURE_WRAP_T,G(b.wrapT));i.texParameteri(a,i.TEXTURE_MAG_FILTER,
+G(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,G(b.minFilter))}else{i.texParameteri(a,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE);i.texParameteri(a,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);i.texParameteri(a,i.TEXTURE_MAG_FILTER,w(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,w(b.minFilter))}}function s(a,b){i.bindRenderbuffer(i.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,b.width,b.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,
+i.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,b.width,b.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,a)}else i.renderbufferStorage(i.RENDERBUFFER,i.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return i.NEAREST;default:return i.LINEAR}}function G(a){switch(a){case THREE.RepeatWrapping:return i.REPEAT;
+case THREE.ClampToEdgeWrapping:return i.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return i.MIRRORED_REPEAT;case THREE.NearestFilter:return i.NEAREST;case THREE.NearestMipMapNearestFilter:return i.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return i.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return i.LINEAR;case THREE.LinearMipMapNearestFilter:return i.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return i.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return i.BYTE;
+case THREE.UnsignedByteType:return i.UNSIGNED_BYTE;case THREE.ShortType:return i.SHORT;case THREE.UnsignedShortType:return i.UNSIGNED_SHORT;case THREE.IntType:return i.INT;case THREE.UnsignedIntType:return i.UNSIGNED_INT;case THREE.FloatType:return i.FLOAT;case THREE.AlphaFormat:return i.ALPHA;case THREE.RGBFormat:return i.RGB;case THREE.RGBAFormat:return i.RGBA;case THREE.LuminanceFormat:return i.LUMINANCE;case THREE.LuminanceAlphaFormat:return i.LUMINANCE_ALPHA;case THREE.AddEquation:return i.FUNC_ADD;
+case THREE.SubtractEquation:return i.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return i.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return i.ZERO;case THREE.OneFactor:return i.ONE;case THREE.SrcColorFactor:return i.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return i.ONE_MINUS_SRC_COLOR;case THREE.SrcAlphaFactor:return i.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return i.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return i.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return i.ONE_MINUS_DST_ALPHA;
+case THREE.DstColorFactor:return i.DST_COLOR;case THREE.OneMinusDstColorFactor:return i.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return i.SRC_ALPHA_SATURATE}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},E=a.canvas!==void 0?a.canvas:document.createElement("canvas"),B=a.precision!==void 0?a.precision:"highp",v=a.alpha!==void 0?a.alpha:true,A=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,J=a.antialias!==void 0?a.antialias:false,K=a.stencil!==void 0?a.stencil:
+true,X=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,Q=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),z=a.clearAlpha!==void 0?a.clearAlpha:0,M=a.maxLights!==void 0?a.maxLights:4;this.domElement=E;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=
+this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var F=this,i,U=[],W=null,C=null,Y=-1,H=null,ba=null,ga=0,la=null,P=null,S=null,ca=null,T=null,fa=null,Ma=null,xa=null,ta=null,Na=null,Sa=null,sa=null,Wa=0,Ya=0,Ja=0,db=0,hb=0,mb=
+0,Oa=new THREE.Frustum,ua=new THREE.Matrix4,va=new THREE.Matrix4,ab=new THREE.Vector4,ja=new THREE.Vector3,Ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}};i=function(){var a;try{if(!(a=E.getContext("experimental-webgl",{alpha:v,premultipliedAlpha:A,antialias:J,stencil:K,preserveDrawingBuffer:X})))throw"Error creating WebGL context.";}catch(b){console.error(b)}return a}();
+i.clearColor(0,0,0,1);i.clearDepth(1);i.clearStencil(0);i.enable(i.DEPTH_TEST);i.depthFunc(i.LEQUAL);i.frontFace(i.CCW);i.cullFace(i.BACK);i.enable(i.CULL_FACE);i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA);i.clearColor(Q.r,Q.g,Q.b,z);this.context=i;var Xa=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS);i.getParameter(i.MAX_TEXTURE_SIZE);var ma=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return i};this.supportsVertexTextures=
+function(){return Xa>0};this.setSize=function(a,b){E.width=a;E.height=b;this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){Wa=a;Ya=b;Ja=c;db=d;i.viewport(Wa,Ya,Ja,db)};this.setScissor=function(a,b,c,d){i.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?i.enable(i.SCISSOR_TEST):i.disable(i.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Q.setHex(a);z=b;i.clearColor(Q.r,Q.g,Q.b,z)};this.setClearColor=function(a,b){Q.copy(a);z=b;i.clearColor(Q.r,Q.g,Q.b,z)};this.getClearColor=
+function(){return Q};this.getClearAlpha=function(){return z};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|i.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|i.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|i.STENCIL_BUFFER_BIT;i.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=
+false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];i.deleteBuffer(c.__webglVertexBuffer);i.deleteBuffer(c.__webglNormalBuffer);i.deleteBuffer(c.__webglTangentBuffer);i.deleteBuffer(c.__webglColorBuffer);i.deleteBuffer(c.__webglUVBuffer);i.deleteBuffer(c.__webglUV2Buffer);i.deleteBuffer(c.__webglSkinVertexABuffer);
+i.deleteBuffer(c.__webglSkinVertexBBuffer);i.deleteBuffer(c.__webglSkinIndicesBuffer);i.deleteBuffer(c.__webglSkinWeightsBuffer);i.deleteBuffer(c.__webglFaceBuffer);i.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)i.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)i.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)i.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}F.info.memory.geometries--}else if(a instanceof
+THREE.Ribbon){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
+false;i.deleteTexture(a.__webglTexture);F.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){i.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){i.deleteFramebuffer(a.__webglFramebuffer[b]);i.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{i.deleteFramebuffer(a.__webglFramebuffer);i.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.updateShadowMap=function(a,b){W=null;Y=H=xa=Ma=S=-1;this.shadowMapPlugin.update(a,
+b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=i.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=i.createBuffer();if(a.hasPos){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,a.positionArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.position);i.vertexAttribPointer(b.attributes.position,3,i.FLOAT,false,0,0)}if(a.hasNormal){i.bindBuffer(i.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,
+e,f,g,h,k,j,l,m,n,o=a.count*3;for(n=0;n<o;n=n+9){c=a.normalArray;d=c[n];e=c[n+1];f=c[n+2];g=c[n+3];k=c[n+4];l=c[n+5];h=c[n+6];j=c[n+7];m=c[n+8];d=(d+g+h)/3;e=(e+k+j)/3;f=(f+l+m)/3;c[n]=d;c[n+1]=e;c[n+2]=f;c[n+3]=d;c[n+4]=e;c[n+5]=f;c[n+6]=d;c[n+7]=e;c[n+8]=f}}i.bufferData(i.ARRAY_BUFFER,a.normalArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.normal);i.vertexAttribPointer(b.attributes.normal,3,i.FLOAT,false,0,0)}i.drawArrays(i.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,
+b,c,d,e,f){if(d.opacity!==0){c=o(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==H){H=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){i.bindBuffer(i.ARRAY_BUFFER,e.vertexPositionBuffer);i.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,i.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexNormalBuffer);i.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,i.FLOAT,
+false,0,f[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexUvBuffer);i.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,i.FLOAT,false,0,f[d].index*8);i.enableVertexAttribArray(a.uv)}else i.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexColorBuffer);i.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,i.FLOAT,false,0,f[d].index*16)}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}i.drawElements(i.TRIANGLES,
+f[d].count,i.UNSIGNED_SHORT,f[d].start*2);F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+f[d].count;F.info.render.faces=F.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=o(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==H){H=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(b.position,3,i.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=
+d.program.attributes;if(f.morphTargetBase!==-1){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}else if(c.position>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){g=0;var k=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<k.length;){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[g]]);
+i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[g]]);i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=h[k[g]];g++}}else{var k=[],j=-1,l=0;h=f.morphTargetInfluences;var m,n=h.length;g=0;for(f.morphTargetBase!==-1&&(k[f.morphTargetBase]=true);g<d.numSupportedMorphTargets;){for(m=0;m<n;m++)if(!k[m]&&h[m]>j){l=m;j=h[l]}i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);
+i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=j;k[l]=1;j=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&i.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];
+if(b[c.buffer.belongsToAttribute]>=0){i.bindBuffer(i.ARRAY_BUFFER,c.buffer);i.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,i.FLOAT,false,0,0)}}}if(b.color>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglColorBuffer);i.vertexAttribPointer(b.color,3,i.FLOAT,false,0,0)}if(b.normal>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglNormalBuffer);i.vertexAttribPointer(b.normal,3,i.FLOAT,false,0,0)}if(b.tangent>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglTangentBuffer);i.vertexAttribPointer(b.tangent,4,i.FLOAT,
+false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.__webglUVBuffer);i.vertexAttribPointer(b.uv,2,i.FLOAT,false,0,0);i.enableVertexAttribArray(b.uv)}else i.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){i.bindBuffer(i.ARRAY_BUFFER,e.__webglUV2Buffer);i.vertexAttribPointer(b.uv2,2,i.FLOAT,false,0,0);i.enableVertexAttribArray(b.uv2)}else i.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){i.bindBuffer(i.ARRAY_BUFFER,
+e.__webglSkinVertexABuffer);i.vertexAttribPointer(b.skinVertexA,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);i.vertexAttribPointer(b.skinVertexB,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);i.vertexAttribPointer(b.skinIndex,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);i.vertexAttribPointer(b.skinWeight,4,i.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==sa){i.lineWidth(d);
+sa=d}a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);i.drawElements(i.LINES,e.__webglLineCount,i.UNSIGNED_SHORT,0)}else{a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);i.drawElements(i.TRIANGLES,e.__webglFaceCount,i.UNSIGNED_SHORT,0)}F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+e.__webglFaceCount;F.info.render.faces=F.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?i.LINE_STRIP:i.LINES;d=d.linewidth;
+if(d!==sa){i.lineWidth(d);sa=d}i.drawArrays(f,0,e.__webglLineCount);F.info.render.calls++}else if(f instanceof THREE.ParticleSystem){i.drawArrays(i.POINTS,0,e.__webglParticleCount);F.info.render.calls++;F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){i.drawArrays(i.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,l,m,n=a.__lights,o=a.fog;Y=-1;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");
 a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ua.multiply(b.projectionMatrix,b.matrixWorldInverse);Oa.setFromMatrix(ua);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,
-a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;f.render=false;if(l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||Oa.contains(l))){q(l,b);var p=f,r=p.object,s=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=
+a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;f.render=false;if(l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||Oa.contains(l))){q(l,b);var p=f,r=p.object,s=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=
 s.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}}}else if(t)if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}f.render=true;if(this.sortObjects)if(l.renderDepth)f.z=l.renderDepth;else{ab.copy(l.matrixWorld.getPosition());ua.multiplyVector3(ab);f.z=ab.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;if(l.visible){q(l,b);l=f.object.material;
-if(l.transparent){f.transparent=l;f.opaque=null}else{f.opaque=l;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);i(a.__webglObjects,false,"",b,n,o,true,d);k(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);i(a.__webglObjects,true,"opaque",b,n,o,false);k(a.__webglObjectsImmediate,
-"opaque",b,n,o,false);i(a.__webglObjects,false,"transparent",b,n,o,true);k(a.__webglObjectsImmediate,"transparent",b,n,o,true)}h(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(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)}else{j.bindTexture(j.TEXTURE_2D,c.__webglTexture);j.generateMipmap(j.TEXTURE_2D);
-j.bindTexture(j.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);H=-1;G.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Oa):e.render(function(a){G.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,
-k=void 0,i=void 0,m=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){i=g.geometry;if(i instanceof THREE.Geometry){if(i.geometryGroups===void 0){var q=i,s=void 0,t=void 0,u=void 0,C=void 0,H=void 0,v=void 0,w=void 0,x={},Y=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){u=q.faces[s];C=u.materialIndex;v=C!==void 0?C:-1;x[v]===void 0&&(x[v]={hash:v,counter:0});
-w=x[v].hash+"_"+x[v].counter;q.geometryGroups[w]===void 0&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:Y,numMorphNormals:B});H=u instanceof THREE.Face3?3:4;if(q.geometryGroups[w].vertices+H>65535){x[v].counter=x[v].counter+1;w=x[v].hash+"_"+x[v].counter;q.geometryGroups[w]===void 0&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:Y,numMorphNormals:B})}u instanceof THREE.Face3?q.geometryGroups[w].faces3.push(s):q.geometryGroups[w].faces4.push(s);
-q.geometryGroups[w].vertices=q.geometryGroups[w].vertices+H}q.geometryGroupsList=[];var z=void 0;for(z in q.geometryGroups){q.geometryGroups[z].id=ga++;q.geometryGroupsList.push(q.geometryGroups[z])}}for(k in i.geometryGroups){m=i.geometryGroups[k];if(!m.__webglVertexBuffer){var A=m;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();
-A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();var E=void 0,F=void 0;if(A.numMorphTargets){A.__webglMorphTargetsBuffers=[];E=0;for(F=A.numMorphTargets;E<F;E++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}if(A.numMorphNormals){A.__webglMorphNormalsBuffers=[];E=0;for(F=A.numMorphNormals;E<F;E++)A.__webglMorphNormalsBuffers.push(j.createBuffer())}G.info.memory.geometries++;
-var S=m,T=g,J=T.geometry,P=S.faces3,K=S.faces4,ba=P.length*3+K.length*4,M=P.length*1+K.length*2,ca=P.length*3+K.length*4,Q=c(T,S),la=e(Q),fa=d(Q),X=Q.vertexColors?Q.vertexColors:false;S.__vertexArray=new Float32Array(ba*3);if(fa)S.__normalArray=new Float32Array(ba*3);if(J.hasTangents)S.__tangentArray=new Float32Array(ba*4);if(X)S.__colorArray=new Float32Array(ba*3);if(la){if(J.faceUvs.length>0||J.faceVertexUvs.length>0)S.__uvArray=new Float32Array(ba*2);if(J.faceUvs.length>1||J.faceVertexUvs.length>
+if(l.transparent){f.transparent=l;f.opaque=null}else{f.opaque=l;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);k(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);k(a.__webglObjectsImmediate,
+"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",b,n,o,true);k(a.__webglObjectsImmediate,"transparent",b,n,o,true)}h(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){i.bindTexture(i.TEXTURE_CUBE_MAP,c.__webglTexture);i.generateMipmap(i.TEXTURE_CUBE_MAP);i.bindTexture(i.TEXTURE_CUBE_MAP,null)}else{i.bindTexture(i.TEXTURE_2D,c.__webglTexture);i.generateMipmap(i.TEXTURE_2D);
+i.bindTexture(i.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=o(a,b,c,d,e);H=-1;F.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,i,Oa):e.render(function(a){F.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,
+k=void 0,j=void 0,o=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,s=void 0,t=void 0,u=void 0,C=void 0,v=void 0,H=void 0,w=void 0,x={},Y=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){u=q.faces[s];C=u.materialIndex;H=C!==void 0?C:-1;x[H]===void 0&&(x[H]={hash:H,counter:0});
+w=x[H].hash+"_"+x[H].counter;q.geometryGroups[w]===void 0&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:Y,numMorphNormals:B});v=u instanceof THREE.Face3?3:4;if(q.geometryGroups[w].vertices+v>65535){x[H].counter=x[H].counter+1;w=x[H].hash+"_"+x[H].counter;q.geometryGroups[w]===void 0&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:Y,numMorphNormals:B})}u instanceof THREE.Face3?q.geometryGroups[w].faces3.push(s):q.geometryGroups[w].faces4.push(s);
+q.geometryGroups[w].vertices=q.geometryGroups[w].vertices+v}q.geometryGroupsList=[];var A=void 0;for(A in q.geometryGroups){q.geometryGroups[A].id=ga++;q.geometryGroupsList.push(q.geometryGroups[A])}}for(k in j.geometryGroups){o=j.geometryGroups[k];if(!o.__webglVertexBuffer){var z=o;z.__webglVertexBuffer=i.createBuffer();z.__webglNormalBuffer=i.createBuffer();z.__webglTangentBuffer=i.createBuffer();z.__webglColorBuffer=i.createBuffer();z.__webglUVBuffer=i.createBuffer();z.__webglUV2Buffer=i.createBuffer();
+z.__webglSkinVertexABuffer=i.createBuffer();z.__webglSkinVertexBBuffer=i.createBuffer();z.__webglSkinIndicesBuffer=i.createBuffer();z.__webglSkinWeightsBuffer=i.createBuffer();z.__webglFaceBuffer=i.createBuffer();z.__webglLineBuffer=i.createBuffer();var E=void 0,G=void 0;if(z.numMorphTargets){z.__webglMorphTargetsBuffers=[];E=0;for(G=z.numMorphTargets;E<G;E++)z.__webglMorphTargetsBuffers.push(i.createBuffer())}if(z.numMorphNormals){z.__webglMorphNormalsBuffers=[];E=0;for(G=z.numMorphNormals;E<G;E++)z.__webglMorphNormalsBuffers.push(i.createBuffer())}F.info.memory.geometries++;
+var S=o,T=g,J=T.geometry,P=S.faces3,K=S.faces4,ba=P.length*3+K.length*4,M=P.length*1+K.length*2,ca=P.length*3+K.length*4,Q=c(T,S),la=e(Q),fa=d(Q),X=Q.vertexColors?Q.vertexColors:false;S.__vertexArray=new Float32Array(ba*3);if(fa)S.__normalArray=new Float32Array(ba*3);if(J.hasTangents)S.__tangentArray=new Float32Array(ba*4);if(X)S.__colorArray=new Float32Array(ba*3);if(la){if(J.faceUvs.length>0||J.faceVertexUvs.length>0)S.__uvArray=new Float32Array(ba*2);if(J.faceUvs.length>1||J.faceVertexUvs.length>
 1)S.__uv2Array=new Float32Array(ba*2)}if(T.geometry.skinWeights.length&&T.geometry.skinIndices.length){S.__skinVertexAArray=new Float32Array(ba*4);S.__skinVertexBArray=new Float32Array(ba*4);S.__skinIndexArray=new Float32Array(ba*4);S.__skinWeightArray=new Float32Array(ba*4)}S.__faceArray=new Uint16Array(M*3);S.__lineArray=new Uint16Array(ca*2);var U=void 0,W=void 0;if(S.numMorphTargets){S.__morphTargetsArrays=[];U=0;for(W=S.numMorphTargets;U<W;U++)S.__morphTargetsArrays.push(new Float32Array(ba*
 3))}if(S.numMorphNormals){S.__morphNormalsArrays=[];U=0;for(W=S.numMorphNormals;U<W;U++)S.__morphNormalsArrays.push(new Float32Array(ba*3))}S.__webglFaceCount=M*3;S.__webglLineCount=ca*2;if(Q.attributes){if(S.__webglCustomAttributesList===void 0)S.__webglCustomAttributesList=[];var Ma=void 0;for(Ma in Q.attributes){var xa=Q.attributes[Ma],ta={},Na;for(Na in xa)ta[Na]=xa[Na];if(!ta.__webglInitialized||ta.createUniqueBuffers){ta.__webglInitialized=true;var ja=1;ta.type==="v2"?ja=2:ta.type==="v3"?ja=
-3:ta.type==="v4"?ja=4:ta.type==="c"&&(ja=3);ta.size=ja;ta.array=new Float32Array(ba*ja);ta.buffer=j.createBuffer();ta.buffer.belongsToAttribute=Ma;xa.needsUpdate=true;ta.__original=xa}S.__webglCustomAttributesList.push(ta)}}S.__inittedArrays=true;i.verticesNeedUpdate=true;i.morphTargetsNeedUpdate=true;i.elementsNeedUpdate=true;i.uvsNeedUpdate=true;i.normalsNeedUpdate=true;i.tangetsNeedUpdate=true;i.colorsNeedUpdate=true}}}}else if(g instanceof THREE.Ribbon){i=g.geometry;if(!i.__webglVertexBuffer){var Sa=
-i;Sa.__webglVertexBuffer=j.createBuffer();Sa.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var sa=i,ma=sa.vertices.length;sa.__vertexArray=new Float32Array(ma*3);sa.__colorArray=new Float32Array(ma*3);sa.__webglVertexCount=ma;i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){i=g.geometry;if(!i.__webglVertexBuffer){var va=i;va.__webglVertexBuffer=j.createBuffer();va.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var ua=i,Ha=g,Wa=ua.vertices.length;
-ua.__vertexArray=new Float32Array(Wa*3);ua.__colorArray=new Float32Array(Wa*3);ua.__webglLineCount=Wa;b(ua,Ha);i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){i=g.geometry;if(!i.__webglVertexBuffer){var Ya=i;Ya.__webglVertexBuffer=j.createBuffer();Ya.__webglColorBuffer=j.createBuffer();G.info.geometries++;var Oa=i,ab=g,Xa=Oa.vertices.length;Oa.__vertexArray=new Float32Array(Xa*3);Oa.__colorArray=new Float32Array(Xa*3);Oa.__sortArray=[];Oa.__webglParticleCount=
-Xa;b(Oa,ab);i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){i=g.geometry;if(i instanceof THREE.BufferGeometry)l(h.__webglObjects,i,g);else for(k in i.geometryGroups){m=i.geometryGroups[k];l(h.__webglObjects,m,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){i=g.geometry;l(h.__webglObjects,i,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,
+3:ta.type==="v4"?ja=4:ta.type==="c"&&(ja=3);ta.size=ja;ta.array=new Float32Array(ba*ja);ta.buffer=i.createBuffer();ta.buffer.belongsToAttribute=Ma;xa.needsUpdate=true;ta.__original=xa}S.__webglCustomAttributesList.push(ta)}}S.__inittedArrays=true;j.verticesNeedUpdate=true;j.morphTargetsNeedUpdate=true;j.elementsNeedUpdate=true;j.uvsNeedUpdate=true;j.normalsNeedUpdate=true;j.tangetsNeedUpdate=true;j.colorsNeedUpdate=true}}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Sa=
+j;Sa.__webglVertexBuffer=i.createBuffer();Sa.__webglColorBuffer=i.createBuffer();F.info.memory.geometries++;var sa=j,ma=sa.vertices.length;sa.__vertexArray=new Float32Array(ma*3);sa.__colorArray=new Float32Array(ma*3);sa.__webglVertexCount=ma;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var va=j;va.__webglVertexBuffer=i.createBuffer();va.__webglColorBuffer=i.createBuffer();F.info.memory.geometries++;var ua=j,Ha=g,Wa=ua.vertices.length;
+ua.__vertexArray=new Float32Array(Wa*3);ua.__colorArray=new Float32Array(Wa*3);ua.__webglLineCount=Wa;b(ua,Ha);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var Ya=j;Ya.__webglVertexBuffer=i.createBuffer();Ya.__webglColorBuffer=i.createBuffer();F.info.geometries++;var Oa=j,ab=g,Xa=Oa.vertices.length;Oa.__vertexArray=new Float32Array(Xa*3);Oa.__colorArray=new Float32Array(Xa*3);Oa.__sortArray=[];Oa.__webglParticleCount=
+Xa;b(Oa,ab);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.BufferGeometry)l(h.__webglObjects,j,g);else for(k in j.geometryGroups){o=j.geometryGroups[k];l(h.__webglObjects,o,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){j=g.geometry;l(h.__webglObjects,j,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,
 opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ja=a.__objectsRemoved[0],db=a;Ja instanceof THREE.Mesh||Ja instanceof THREE.ParticleSystem||Ja instanceof THREE.Ribbon||Ja instanceof THREE.Line?p(db.__webglObjects,Ja):Ja instanceof THREE.Sprite?r(db.__webglSprites,Ja):Ja instanceof THREE.LensFlare?r(db.__webglFlares,Ja):(Ja instanceof
 THREE.ImmediateRenderObject||Ja.immediateRenderCallback)&&p(db.__webglObjectsImmediate,Ja);Ja.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,mb=a.__webglObjects.length;hb<mb;hb++){var nb=a.__webglObjects[hb].object,ka=nb.geometry,qc=void 0,ic=void 0,bb=void 0;if(nb instanceof THREE.Mesh)if(ka instanceof THREE.BufferGeometry){ka.verticesNeedUpdate=false;ka.elementsNeedUpdate=false;ka.uvsNeedUpdate=false;ka.normalsNeedUpdate=false;ka.colorsNeedUpdate=false}else{for(var Uc=0,od=ka.geometryGroupsList.length;Uc<
-od;Uc++){qc=ka.geometryGroupsList[Uc];bb=c(nb,qc);ic=bb.attributes&&o(bb);if(ka.verticesNeedUpdate||ka.morphTargetsNeedUpdate||ka.elementsNeedUpdate||ka.uvsNeedUpdate||ka.normalsNeedUpdate||ka.colorsNeedUpdate||ka.tangetsNeedUpdate||ic){var ha=qc,pd=nb,eb=j.DYNAMIC_DRAW,qd=!ka.dynamic,bc=bb;if(ha.__inittedArrays){var dd=d(bc),Vc=bc.vertexColors?bc.vertexColors:false,ed=e(bc),Fc=dd===THREE.SmoothShading,I=void 0,V=void 0,lb=void 0,N=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,
+od;Uc++){qc=ka.geometryGroupsList[Uc];bb=c(nb,qc);ic=bb.attributes&&n(bb);if(ka.verticesNeedUpdate||ka.morphTargetsNeedUpdate||ka.elementsNeedUpdate||ka.uvsNeedUpdate||ka.normalsNeedUpdate||ka.colorsNeedUpdate||ka.tangetsNeedUpdate||ic){var ha=qc,pd=nb,eb=i.DYNAMIC_DRAW,qd=!ka.dynamic,bc=bb;if(ha.__inittedArrays){var dd=d(bc),Vc=bc.vertexColors?bc.vertexColors:false,ed=e(bc),Fc=dd===THREE.SmoothShading,I=void 0,V=void 0,lb=void 0,N=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,
 lc=void 0,Z=void 0,$=void 0,aa=void 0,qa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,na=void 0,fd=void 0,Vb=void 0,mc=void 0,nc=void 0,Pa=void 0,gd=void 0,Ka=void 0,La=void 0,Wb=void 0,Ib=void 0,Ea=0,Ia=0,Jb=0,Kb=0,ib=0,Va=0,ra=0,Za=0,Fa=0,L=0,ea=0,D=0,fb=void 0,
 Qa=ha.__vertexArray,wc=ha.__uvArray,xc=ha.__uv2Array,jb=ha.__normalArray,ya=ha.__tangentArray,Ra=ha.__colorArray,za=ha.__skinVertexAArray,Aa=ha.__skinVertexBArray,Ba=ha.__skinIndexArray,Ca=ha.__skinWeightArray,Wc=ha.__morphTargetsArrays,Xc=ha.__morphNormalsArrays,Yc=ha.__webglCustomAttributesList,y=void 0,Eb=ha.__faceArray,gb=ha.__lineArray,$a=pd.geometry,rd=$a.elementsNeedUpdate,hd=$a.uvsNeedUpdate,sd=$a.normalsNeedUpdate,td=$a.tangetsNeedUpdate,ud=$a.colorsNeedUpdate,vd=$a.morphTargetsNeedUpdate,
 cc=$a.vertices,oa=ha.faces3,pa=ha.faces4,Ga=$a.faces,Zc=$a.faceVertexUvs[0],$c=$a.faceVertexUvs[1],dc=$a.skinVerticesA,ec=$a.skinVerticesB,fc=$a.skinIndices,Xb=$a.skinWeights,Yb=$a.morphTargets,Jc=$a.morphNormals;if($a.verticesNeedUpdate){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Z=cc[N.a];$=cc[N.b];aa=cc[N.c];Qa[Ia]=Z.x;Qa[Ia+1]=Z.y;Qa[Ia+2]=Z.z;Qa[Ia+3]=$.x;Qa[Ia+4]=$.y;Qa[Ia+5]=$.z;Qa[Ia+6]=aa.x;Qa[Ia+7]=aa.y;Qa[Ia+8]=aa.z;Ia=Ia+9}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Z=cc[N.a];$=cc[N.b];aa=
-cc[N.c];qa=cc[N.d];Qa[Ia]=Z.x;Qa[Ia+1]=Z.y;Qa[Ia+2]=Z.z;Qa[Ia+3]=$.x;Qa[Ia+4]=$.y;Qa[Ia+5]=$.z;Qa[Ia+6]=aa.x;Qa[Ia+7]=aa.y;Qa[Ia+8]=aa.z;Qa[Ia+9]=qa.x;Qa[Ia+10]=qa.y;Qa[Ia+11]=qa.z;Ia=Ia+12}j.bindBuffer(j.ARRAY_BUFFER,ha.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Qa,eb)}if(vd){Pa=0;for(gd=Yb.length;Pa<gd;Pa++){I=ea=0;for(V=oa.length;I<V;I++){Wb=oa[I];N=Ga[Wb];Z=Yb[Pa].vertices[N.a];$=Yb[Pa].vertices[N.b];aa=Yb[Pa].vertices[N.c];Ka=Wc[Pa];Ka[ea]=Z.x;Ka[ea+1]=Z.y;Ka[ea+2]=Z.z;Ka[ea+3]=$.x;Ka[ea+
+cc[N.c];qa=cc[N.d];Qa[Ia]=Z.x;Qa[Ia+1]=Z.y;Qa[Ia+2]=Z.z;Qa[Ia+3]=$.x;Qa[Ia+4]=$.y;Qa[Ia+5]=$.z;Qa[Ia+6]=aa.x;Qa[Ia+7]=aa.y;Qa[Ia+8]=aa.z;Qa[Ia+9]=qa.x;Qa[Ia+10]=qa.y;Qa[Ia+11]=qa.z;Ia=Ia+12}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Qa,eb)}if(vd){Pa=0;for(gd=Yb.length;Pa<gd;Pa++){I=ea=0;for(V=oa.length;I<V;I++){Wb=oa[I];N=Ga[Wb];Z=Yb[Pa].vertices[N.a];$=Yb[Pa].vertices[N.b];aa=Yb[Pa].vertices[N.c];Ka=Wc[Pa];Ka[ea]=Z.x;Ka[ea+1]=Z.y;Ka[ea+2]=Z.z;Ka[ea+3]=$.x;Ka[ea+
 4]=$.y;Ka[ea+5]=$.z;Ka[ea+6]=aa.x;Ka[ea+7]=aa.y;Ka[ea+8]=aa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Pa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Jc[Pa].faceNormals[Wb];La=Xc[Pa];La[ea]=sb.x;La[ea+1]=sb.y;La[ea+2]=sb.z;La[ea+3]=tb.x;La[ea+4]=tb.y;La[ea+5]=tb.z;La[ea+6]=ub.x;La[ea+7]=ub.y;La[ea+8]=ub.z}ea=ea+9}I=0;for(V=pa.length;I<V;I++){Wb=pa[I];N=Ga[Wb];Z=Yb[Pa].vertices[N.a];$=Yb[Pa].vertices[N.b];aa=Yb[Pa].vertices[N.c];qa=Yb[Pa].vertices[N.d];Ka=Wc[Pa];Ka[ea]=Z.x;Ka[ea+1]=Z.y;Ka[ea+
-2]=Z.z;Ka[ea+3]=$.x;Ka[ea+4]=$.y;Ka[ea+5]=$.z;Ka[ea+6]=aa.x;Ka[ea+7]=aa.y;Ka[ea+8]=aa.z;Ka[ea+9]=qa.x;Ka[ea+10]=qa.y;Ka[ea+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Pa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=ub=tb=sb=Jc[Pa].faceNormals[Wb];La=Xc[Pa];La[ea]=sb.x;La[ea+1]=sb.y;La[ea+2]=sb.z;La[ea+3]=tb.x;La[ea+4]=tb.y;La[ea+5]=tb.z;La[ea+6]=ub.x;La[ea+7]=ub.y;La[ea+8]=ub.z;La[ea+9]=sc.x;La[ea+10]=sc.y;La[ea+11]=sc.z}ea=ea+12}j.bindBuffer(j.ARRAY_BUFFER,ha.__webglMorphTargetsBuffers[Pa]);
-j.bufferData(j.ARRAY_BUFFER,Wc[Pa],eb);if(bc.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,ha.__webglMorphNormalsBuffers[Pa]);j.bufferData(j.ARRAY_BUFFER,Xc[Pa],eb)}}}if(Xb.length){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];yb=Xb[N.a];zb=Xb[N.b];Ab=Xb[N.c];Ca[L]=yb.x;Ca[L+1]=yb.y;Ca[L+2]=yb.z;Ca[L+3]=yb.w;Ca[L+4]=zb.x;Ca[L+5]=zb.y;Ca[L+6]=zb.z;Ca[L+7]=zb.w;Ca[L+8]=Ab.x;Ca[L+9]=Ab.y;Ca[L+10]=Ab.z;Ca[L+11]=Ab.w;Bb=fc[N.a];Cb=fc[N.b];Db=fc[N.c];Ba[L]=Bb.x;Ba[L+1]=Bb.y;Ba[L+2]=Bb.z;Ba[L+3]=Bb.w;Ba[L+4]=Cb.x;
+2]=Z.z;Ka[ea+3]=$.x;Ka[ea+4]=$.y;Ka[ea+5]=$.z;Ka[ea+6]=aa.x;Ka[ea+7]=aa.y;Ka[ea+8]=aa.z;Ka[ea+9]=qa.x;Ka[ea+10]=qa.y;Ka[ea+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Pa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=ub=tb=sb=Jc[Pa].faceNormals[Wb];La=Xc[Pa];La[ea]=sb.x;La[ea+1]=sb.y;La[ea+2]=sb.z;La[ea+3]=tb.x;La[ea+4]=tb.y;La[ea+5]=tb.z;La[ea+6]=ub.x;La[ea+7]=ub.y;La[ea+8]=ub.z;La[ea+9]=sc.x;La[ea+10]=sc.y;La[ea+11]=sc.z}ea=ea+12}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglMorphTargetsBuffers[Pa]);
+i.bufferData(i.ARRAY_BUFFER,Wc[Pa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglMorphNormalsBuffers[Pa]);i.bufferData(i.ARRAY_BUFFER,Xc[Pa],eb)}}}if(Xb.length){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];yb=Xb[N.a];zb=Xb[N.b];Ab=Xb[N.c];Ca[L]=yb.x;Ca[L+1]=yb.y;Ca[L+2]=yb.z;Ca[L+3]=yb.w;Ca[L+4]=zb.x;Ca[L+5]=zb.y;Ca[L+6]=zb.z;Ca[L+7]=zb.w;Ca[L+8]=Ab.x;Ca[L+9]=Ab.y;Ca[L+10]=Ab.z;Ca[L+11]=Ab.w;Bb=fc[N.a];Cb=fc[N.b];Db=fc[N.c];Ba[L]=Bb.x;Ba[L+1]=Bb.y;Ba[L+2]=Bb.z;Ba[L+3]=Bb.w;Ba[L+4]=Cb.x;
 Ba[L+5]=Cb.y;Ba[L+6]=Cb.z;Ba[L+7]=Cb.w;Ba[L+8]=Db.x;Ba[L+9]=Db.y;Ba[L+10]=Db.z;Ba[L+11]=Db.w;Pb=dc[N.a];Qb=dc[N.b];Rb=dc[N.c];za[L]=Pb.x;za[L+1]=Pb.y;za[L+2]=Pb.z;za[L+3]=1;za[L+4]=Qb.x;za[L+5]=Qb.y;za[L+6]=Qb.z;za[L+7]=1;za[L+8]=Rb.x;za[L+9]=Rb.y;za[L+10]=Rb.z;za[L+11]=1;Sb=ec[N.a];Tb=ec[N.b];Ub=ec[N.c];Aa[L]=Sb.x;Aa[L+1]=Sb.y;Aa[L+2]=Sb.z;Aa[L+3]=1;Aa[L+4]=Tb.x;Aa[L+5]=Tb.y;Aa[L+6]=Tb.z;Aa[L+7]=1;Aa[L+8]=Ub.x;Aa[L+9]=Ub.y;Aa[L+10]=Ub.z;Aa[L+11]=1;L=L+12}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];
 yb=Xb[N.a];zb=Xb[N.b];Ab=Xb[N.c];uc=Xb[N.d];Ca[L]=yb.x;Ca[L+1]=yb.y;Ca[L+2]=yb.z;Ca[L+3]=yb.w;Ca[L+4]=zb.x;Ca[L+5]=zb.y;Ca[L+6]=zb.z;Ca[L+7]=zb.w;Ca[L+8]=Ab.x;Ca[L+9]=Ab.y;Ca[L+10]=Ab.z;Ca[L+11]=Ab.w;Ca[L+12]=uc.x;Ca[L+13]=uc.y;Ca[L+14]=uc.z;Ca[L+15]=uc.w;Bb=fc[N.a];Cb=fc[N.b];Db=fc[N.c];vc=fc[N.d];Ba[L]=Bb.x;Ba[L+1]=Bb.y;Ba[L+2]=Bb.z;Ba[L+3]=Bb.w;Ba[L+4]=Cb.x;Ba[L+5]=Cb.y;Ba[L+6]=Cb.z;Ba[L+7]=Cb.w;Ba[L+8]=Db.x;Ba[L+9]=Db.y;Ba[L+10]=Db.z;Ba[L+11]=Db.w;Ba[L+12]=vc.x;Ba[L+13]=vc.y;Ba[L+14]=vc.z;Ba[L+
 15]=vc.w;Pb=dc[N.a];Qb=dc[N.b];Rb=dc[N.c];Hc=dc[N.d];za[L]=Pb.x;za[L+1]=Pb.y;za[L+2]=Pb.z;za[L+3]=1;za[L+4]=Qb.x;za[L+5]=Qb.y;za[L+6]=Qb.z;za[L+7]=1;za[L+8]=Rb.x;za[L+9]=Rb.y;za[L+10]=Rb.z;za[L+11]=1;za[L+12]=Hc.x;za[L+13]=Hc.y;za[L+14]=Hc.z;za[L+15]=1;Sb=ec[N.a];Tb=ec[N.b];Ub=ec[N.c];Ic=ec[N.d];Aa[L]=Sb.x;Aa[L+1]=Sb.y;Aa[L+2]=Sb.z;Aa[L+3]=1;Aa[L+4]=Tb.x;Aa[L+5]=Tb.y;Aa[L+6]=Tb.z;Aa[L+7]=1;Aa[L+8]=Ub.x;Aa[L+9]=Ub.y;Aa[L+10]=Ub.z;Aa[L+11]=1;Aa[L+12]=Ic.x;Aa[L+13]=Ic.y;Aa[L+14]=Ic.z;Aa[L+15]=1;L=L+
-16}if(L>0){j.bindBuffer(j.ARRAY_BUFFER,ha.__webglSkinVertexABuffer);j.bufferData(j.ARRAY_BUFFER,za,eb);j.bindBuffer(j.ARRAY_BUFFER,ha.__webglSkinVertexBBuffer);j.bufferData(j.ARRAY_BUFFER,Aa,eb);j.bindBuffer(j.ARRAY_BUFFER,ha.__webglSkinIndicesBuffer);j.bufferData(j.ARRAY_BUFFER,Ba,eb);j.bindBuffer(j.ARRAY_BUFFER,ha.__webglSkinWeightsBuffer);j.bufferData(j.ARRAY_BUFFER,Ca,eb)}}if(ud&&Vc){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];ob=N.vertexColors;Gc=N.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=
+16}if(L>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinVertexABuffer);i.bufferData(i.ARRAY_BUFFER,za,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinVertexBBuffer);i.bufferData(i.ARRAY_BUFFER,Aa,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinIndicesBuffer);i.bufferData(i.ARRAY_BUFFER,Ba,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinWeightsBuffer);i.bufferData(i.ARRAY_BUFFER,Ca,eb)}}if(ud&&Vc){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];ob=N.vertexColors;Gc=N.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=
 ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Ra[Fa]=vb.r;Ra[Fa+1]=vb.g;Ra[Fa+2]=vb.b;Ra[Fa+3]=wb.r;Ra[Fa+4]=wb.g;Ra[Fa+5]=wb.b;Ra[Fa+6]=xb.r;Ra[Fa+7]=xb.g;Ra[Fa+8]=xb.b;Fa=Fa+9}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];ob=N.vertexColors;Gc=N.color;if(ob.length===4&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2];tc=ob[3]}else tc=xb=wb=vb=Gc;Ra[Fa]=vb.r;Ra[Fa+1]=vb.g;Ra[Fa+2]=vb.b;Ra[Fa+3]=wb.r;Ra[Fa+4]=wb.g;Ra[Fa+5]=wb.b;Ra[Fa+6]=xb.r;Ra[Fa+7]=xb.g;Ra[Fa+8]=xb.b;Ra[Fa+9]=tc.r;Ra[Fa+10]=tc.g;Ra[Fa+
-11]=tc.b;Fa=Fa+12}if(Fa>0){j.bindBuffer(j.ARRAY_BUFFER,ha.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Ra,eb)}}if(td&&$a.hasTangents){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Hb=N.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ra=ra+12}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Hb=N.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];rc=Hb[3];ya[ra]=
-pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ya[ra+12]=rc.x;ya[ra+13]=rc.y;ya[ra+14]=rc.z;ya[ra+15]=rc.w;ra=ra+16}j.bindBuffer(j.ARRAY_BUFFER,ha.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ya,eb)}if(sd&&dd){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===3&&Fc)for(na=0;na<3;na++){Vb=jc[na];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(na=
-0;na<3;na++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===4&&Fc)for(na=0;na<4;na++){Vb=jc[na];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(na=0;na<4;na++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}j.bindBuffer(j.ARRAY_BUFFER,ha.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){I=0;for(V=oa.length;I<V;I++){lb=oa[I];N=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(na=0;na<3;na++){mc=
-kc[na];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(V=pa.length;I<V;I++){lb=pa[I];N=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(na=0;na<4;na++){mc=kc[na];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}if(Jb>0){j.bindBuffer(j.ARRAY_BUFFER,ha.__webglUVBuffer);j.bufferData(j.ARRAY_BUFFER,wc,eb)}}if(hd&&$c&&ed){I=0;for(V=oa.length;I<V;I++){lb=oa[I];N=Ga[lb];lc=$c[lb];if(lc!==void 0)for(na=0;na<3;na++){nc=lc[na];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(V=pa.length;I<V;I++){lb=pa[I];N=Ga[lb];lc=$c[lb];if(lc!==void 0)for(na=
-0;na<4;na++){nc=lc[na];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){j.bindBuffer(j.ARRAY_BUFFER,ha.__webglUV2Buffer);j.bufferData(j.ARRAY_BUFFER,xc,eb)}}if(rd){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+2;ib=ib+3;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+2;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;Za=Za+6;Ea=Ea+3}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+3;Eb[ib+3]=Ea+1;Eb[ib+4]=Ea+2;Eb[ib+5]=Ea+3;ib=ib+6;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=
-Ea;gb[Za+3]=Ea+3;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;gb[Za+6]=Ea+2;gb[Za+7]=Ea+3;Za=Za+8;Ea=Ea+4}j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ha.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Eb,eb);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ha.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc){na=0;for(fd=Yc.length;na<fd;na++){y=Yc[na];if(y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];y.array[D]=y.value[N.a];y.array[D+
+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Ra,eb)}}if(td&&$a.hasTangents){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Hb=N.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ra=ra+12}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Hb=N.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];rc=Hb[3];ya[ra]=
+pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ya[ra+12]=rc.x;ya[ra+13]=rc.y;ya[ra+14]=rc.z;ya[ra+15]=rc.w;ra=ra+16}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglTangentBuffer);i.bufferData(i.ARRAY_BUFFER,ya,eb)}if(sd&&dd){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===3&&Fc)for(na=0;na<3;na++){Vb=jc[na];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(na=
+0;na<3;na++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===4&&Fc)for(na=0;na<4;na++){Vb=jc[na];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(na=0;na<4;na++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglNormalBuffer);i.bufferData(i.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){I=0;for(V=oa.length;I<V;I++){lb=oa[I];N=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(na=0;na<3;na++){mc=
+kc[na];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(V=pa.length;I<V;I++){lb=pa[I];N=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(na=0;na<4;na++){mc=kc[na];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}if(Jb>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglUVBuffer);i.bufferData(i.ARRAY_BUFFER,wc,eb)}}if(hd&&$c&&ed){I=0;for(V=oa.length;I<V;I++){lb=oa[I];N=Ga[lb];lc=$c[lb];if(lc!==void 0)for(na=0;na<3;na++){nc=lc[na];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(V=pa.length;I<V;I++){lb=pa[I];N=Ga[lb];lc=$c[lb];if(lc!==void 0)for(na=
+0;na<4;na++){nc=lc[na];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglUV2Buffer);i.bufferData(i.ARRAY_BUFFER,xc,eb)}}if(rd){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+2;ib=ib+3;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+2;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;Za=Za+6;Ea=Ea+3}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+3;Eb[ib+3]=Ea+1;Eb[ib+4]=Ea+2;Eb[ib+5]=Ea+3;ib=ib+6;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=
+Ea;gb[Za+3]=Ea+3;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;gb[Za+6]=Ea+2;gb[Za+7]=Ea+3;Za=Za+8;Ea=Ea+4}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ha.__webglFaceBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,Eb,eb);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ha.__webglLineBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc){na=0;for(fd=Yc.length;na<fd;na++){y=Yc[na];if(y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];y.array[D]=y.value[N.a];y.array[D+
 1]=y.value[N.b];y.array[D+2]=y.value[N.c];D=D+3}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];y.array[D]=y.value[N.a];y.array[D+1]=y.value[N.b];y.array[D+2]=y.value[N.c];y.array[D+3]=y.value[N.d];D=D+4}}else{if(y.boundTo==="faces"){I=0;for(V=oa.length;I<V;I++){fb=y.value[oa[I]];y.array[D]=fb;y.array[D+1]=fb;y.array[D+2]=fb;D=D+3}I=0;for(V=pa.length;I<V;I++){fb=y.value[pa[I]];y.array[D]=fb;y.array[D+1]=fb;y.array[D+2]=fb;y.array[D+3]=fb;D=D+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){I=
 0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=$.x;y.array[D+3]=$.y;y.array[D+4]=aa.x;y.array[D+5]=aa.y;D=D+6}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];qa=y.value[N.d];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=$.x;y.array[D+3]=$.y;y.array[D+4]=aa.x;y.array[D+5]=aa.y;y.array[D+6]=qa.x;y.array[D+7]=qa.y;D=D+8}}else{if(y.boundTo==="faces"){I=0;for(V=oa.length;I<V;I++){aa=
 $=Z=fb=y.value[oa[I]];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=$.x;y.array[D+3]=$.y;y.array[D+4]=aa.x;y.array[D+5]=aa.y;D=D+6}I=0;for(V=pa.length;I<V;I++){qa=aa=$=Z=fb=y.value[pa[I]];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=$.x;y.array[D+3]=$.y;y.array[D+4]=aa.x;y.array[D+5]=aa.y;y.array[D+6]=qa.x;y.array[D+7]=qa.y;D=D+8}}}else if(y.size===3){var ia;ia=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Z=y.value[N.a];
@@ -352,33 +353,33 @@ $=y.value[N.b];aa=y.value[N.c];y.array[D]=Z[ia[0]];y.array[D+1]=Z[ia[1]];y.array
 y.array[D+2]=Z[ia[2]];y.array[D+3]=$[ia[0]];y.array[D+4]=$[ia[1]];y.array[D+5]=$[ia[2]];y.array[D+6]=aa[ia[0]];y.array[D+7]=aa[ia[1]];y.array[D+8]=aa[ia[2]];y.array[D+9]=qa[ia[0]];y.array[D+10]=qa[ia[1]];y.array[D+11]=qa[ia[2]];D=D+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=Z.z;y.array[D+3]=Z.w;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=
 $.z;y.array[D+7]=$.w;y.array[D+8]=aa.x;y.array[D+9]=aa.y;y.array[D+10]=aa.z;y.array[D+11]=aa.w;D=D+12}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];qa=y.value[N.d];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=Z.z;y.array[D+3]=Z.w;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=$.z;y.array[D+7]=$.w;y.array[D+8]=aa.x;y.array[D+9]=aa.y;y.array[D+10]=aa.z;y.array[D+11]=aa.w;y.array[D+12]=qa.x;y.array[D+13]=qa.y;y.array[D+14]=qa.z;y.array[D+15]=qa.w;D=D+16}}else if(y.boundTo===
 "faces"){I=0;for(V=oa.length;I<V;I++){aa=$=Z=fb=y.value[oa[I]];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=Z.z;y.array[D+3]=Z.w;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=$.z;y.array[D+7]=$.w;y.array[D+8]=aa.x;y.array[D+9]=aa.y;y.array[D+10]=aa.z;y.array[D+11]=aa.w;D=D+12}I=0;for(V=pa.length;I<V;I++){qa=aa=$=Z=fb=y.value[pa[I]];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=Z.z;y.array[D+3]=Z.w;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=$.z;y.array[D+7]=$.w;y.array[D+8]=aa.x;y.array[D+9]=aa.y;
-y.array[D+10]=aa.z;y.array[D+11]=aa.w;y.array[D+12]=qa.x;y.array[D+13]=qa.y;y.array[D+14]=qa.z;y.array[D+15]=qa.w;D=D+16}}j.bindBuffer(j.ARRAY_BUFFER,y.buffer);j.bufferData(j.ARRAY_BUFFER,y.array,eb)}}}if(qd){delete ha.__inittedArrays;delete ha.__colorArray;delete ha.__normalArray;delete ha.__tangentArray;delete ha.__uvArray;delete ha.__uv2Array;delete ha.__faceArray;delete ha.__vertexArray;delete ha.__lineArray;delete ha.__skinVertexAArray;delete ha.__skinVertexBArray;delete ha.__skinIndexArray;
-delete ha.__skinWeightArray}}}}ka.verticesNeedUpdate=false;ka.morphTargetsNeedUpdate=false;ka.elementsNeedUpdate=false;ka.uvsNeedUpdate=false;ka.normalsNeedUpdate=false;ka.colorsNeedUpdate=false;ka.tangetsNeedUpdate=false;bb.attributes&&n(bb)}else if(nb instanceof THREE.Ribbon){if(ka.verticesNeedUpdate||ka.colorsNeedUpdate){var Zb=ka,id=j.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,$b=void 0,Lc=void 0,jd=Zb.vertices,kd=Zb.colors,wd=jd.length,xd=kd.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,yd=Zb.colorsNeedUpdate;
-if(Zb.verticesNeedUpdate){for(yc=0;yc<wd;yc++){Kc=jd[yc];$b=yc*3;Mc[$b]=Kc.x;Mc[$b+1]=Kc.y;Mc[$b+2]=Kc.z}j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Mc,id)}if(yd){for(zc=0;zc<xd;zc++){Lc=kd[zc];$b=zc*3;Nc[$b]=Lc.r;Nc[$b+1]=Lc.g;Nc[$b+2]=Lc.b}j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Nc,id)}}ka.verticesNeedUpdate=false;ka.colorsNeedUpdate=false}else if(nb instanceof THREE.Line){bb=c(nb,qc);ic=bb.attributes&&o(bb);if(ka.verticesNeedUpdate||
-ka.colorsNeedUpdate||ic){var Lb=ka,ad=j.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,Da=void 0,Pc=void 0,ld=Lb.vertices,md=Lb.colors,zd=ld.length,Ad=md.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Bd=Lb.colorsNeedUpdate,bd=Lb.__webglCustomAttributesList,Sc=void 0,nd=void 0,Ua=void 0,oc=void 0,cb=void 0,wa=void 0;if(Lb.verticesNeedUpdate){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac];Da=Ac*3;Qc[Da]=Oc.x;Qc[Da+1]=Oc.y;Qc[Da+2]=Oc.z}j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Qc,
-ad)}if(Bd){for(Bc=0;Bc<Ad;Bc++){Pc=md[Bc];Da=Bc*3;Rc[Da]=Pc.r;Rc[Da+1]=Pc.g;Rc[Da+2]=Pc.b}j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,ad)}if(bd){Sc=0;for(nd=bd.length;Sc<nd;Sc++){wa=bd[Sc];if(wa.needsUpdate&&(wa.boundTo===void 0||wa.boundTo==="vertices")){Da=0;oc=wa.value.length;if(wa.size===1)for(Ua=0;Ua<oc;Ua++)wa.array[Ua]=wa.value[Ua];else if(wa.size===2)for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;Da=Da+2}else if(wa.size===3)if(wa.type===
-"c")for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.r;wa.array[Da+1]=cb.g;wa.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;wa.array[Da+2]=cb.z;Da=Da+3}else if(wa.size===4)for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;wa.array[Da+2]=cb.z;wa.array[Da+3]=cb.w;Da=Da+4}j.bindBuffer(j.ARRAY_BUFFER,wa.buffer);j.bufferData(j.ARRAY_BUFFER,wa.array,ad)}}}}ka.verticesNeedUpdate=false;ka.colorsNeedUpdate=false;bb.attributes&&
-n(bb)}else if(nb instanceof THREE.ParticleSystem){bb=c(nb,qc);ic=bb.attributes&&o(bb);(ka.verticesNeedUpdate||ka.colorsNeedUpdate||nb.sortParticles||ic)&&f(ka,j.DYNAMIC_DRAW,nb);ka.verticesNeedUpdate=false;ka.colorsNeedUpdate=false;bb.attributes&&n(bb)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof
-THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var i,k,l,m,n;i=m=n=h=0;for(k=b.length;i<k;i++){l=b[i];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&h++}}if(n+h+m<=M){k=m;l=n;m=h}else{k=
-Math.ceil(M*m/(n+m));m=l=M-k}var o=0,h=0;for(n=b.length;h<n;h++){i=b[h];if(i.castShadow){i instanceof THREE.SpotLight&&o++;i instanceof THREE.DirectionalLight&&!i.shadowCascade&&o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{n=a.fragmentShader;i=a.vertexShader;var h=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,maxBones:p,morphTargets:a.morphTargets,
-morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(n);d.push(i)}for(q in c){d.push(q);
-d.push(c[q])}g=d.join();q=0;for(d=U.length;q<d;q++)if(U[q].code===g){r=U[q].program;break a}q=j.createProgram();d=["precision "+B+" float;",Xa>0?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
+y.array[D+10]=aa.z;y.array[D+11]=aa.w;y.array[D+12]=qa.x;y.array[D+13]=qa.y;y.array[D+14]=qa.z;y.array[D+15]=qa.w;D=D+16}}i.bindBuffer(i.ARRAY_BUFFER,y.buffer);i.bufferData(i.ARRAY_BUFFER,y.array,eb)}}}if(qd){delete ha.__inittedArrays;delete ha.__colorArray;delete ha.__normalArray;delete ha.__tangentArray;delete ha.__uvArray;delete ha.__uv2Array;delete ha.__faceArray;delete ha.__vertexArray;delete ha.__lineArray;delete ha.__skinVertexAArray;delete ha.__skinVertexBArray;delete ha.__skinIndexArray;
+delete ha.__skinWeightArray}}}}ka.verticesNeedUpdate=false;ka.morphTargetsNeedUpdate=false;ka.elementsNeedUpdate=false;ka.uvsNeedUpdate=false;ka.normalsNeedUpdate=false;ka.colorsNeedUpdate=false;ka.tangetsNeedUpdate=false;bb.attributes&&m(bb)}else if(nb instanceof THREE.Ribbon){if(ka.verticesNeedUpdate||ka.colorsNeedUpdate){var Zb=ka,id=i.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,$b=void 0,Lc=void 0,jd=Zb.vertices,kd=Zb.colors,wd=jd.length,xd=kd.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,yd=Zb.colorsNeedUpdate;
+if(Zb.verticesNeedUpdate){for(yc=0;yc<wd;yc++){Kc=jd[yc];$b=yc*3;Mc[$b]=Kc.x;Mc[$b+1]=Kc.y;Mc[$b+2]=Kc.z}i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Mc,id)}if(yd){for(zc=0;zc<xd;zc++){Lc=kd[zc];$b=zc*3;Nc[$b]=Lc.r;Nc[$b+1]=Lc.g;Nc[$b+2]=Lc.b}i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Nc,id)}}ka.verticesNeedUpdate=false;ka.colorsNeedUpdate=false}else if(nb instanceof THREE.Line){bb=c(nb,qc);ic=bb.attributes&&n(bb);if(ka.verticesNeedUpdate||
+ka.colorsNeedUpdate||ic){var Lb=ka,ad=i.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,Da=void 0,Pc=void 0,ld=Lb.vertices,md=Lb.colors,zd=ld.length,Ad=md.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Bd=Lb.colorsNeedUpdate,bd=Lb.__webglCustomAttributesList,Sc=void 0,nd=void 0,Ua=void 0,oc=void 0,cb=void 0,wa=void 0;if(Lb.verticesNeedUpdate){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac];Da=Ac*3;Qc[Da]=Oc.x;Qc[Da+1]=Oc.y;Qc[Da+2]=Oc.z}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Qc,
+ad)}if(Bd){for(Bc=0;Bc<Ad;Bc++){Pc=md[Bc];Da=Bc*3;Rc[Da]=Pc.r;Rc[Da+1]=Pc.g;Rc[Da+2]=Pc.b}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Rc,ad)}if(bd){Sc=0;for(nd=bd.length;Sc<nd;Sc++){wa=bd[Sc];if(wa.needsUpdate&&(wa.boundTo===void 0||wa.boundTo==="vertices")){Da=0;oc=wa.value.length;if(wa.size===1)for(Ua=0;Ua<oc;Ua++)wa.array[Ua]=wa.value[Ua];else if(wa.size===2)for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;Da=Da+2}else if(wa.size===3)if(wa.type===
+"c")for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.r;wa.array[Da+1]=cb.g;wa.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;wa.array[Da+2]=cb.z;Da=Da+3}else if(wa.size===4)for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;wa.array[Da+2]=cb.z;wa.array[Da+3]=cb.w;Da=Da+4}i.bindBuffer(i.ARRAY_BUFFER,wa.buffer);i.bufferData(i.ARRAY_BUFFER,wa.array,ad)}}}}ka.verticesNeedUpdate=false;ka.colorsNeedUpdate=false;bb.attributes&&
+m(bb)}else if(nb instanceof THREE.ParticleSystem){bb=c(nb,qc);ic=bb.attributes&&n(bb);(ka.verticesNeedUpdate||ka.colorsNeedUpdate||nb.sortParticles||ic)&&f(ka,i.DYNAMIC_DRAW,nb);ka.verticesNeedUpdate=false;ka.colorsNeedUpdate=false;bb.attributes&&m(bb)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof
+THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var j,k,l,m,n;j=m=n=h=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&h++}}if(n+h+m<=M){k=m;l=n;m=h}else{k=
+Math.ceil(M*m/(n+m));m=l=M-k}var o=0,h=0;for(n=b.length;h<n;h++){j=b[h];if(j.castShadow){j instanceof THREE.SpotLight&&o++;j instanceof THREE.DirectionalLight&&!j.shadowCascade&&o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{n=a.fragmentShader;j=a.vertexShader;var h=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,maxBones:p,morphTargets:a.morphTargets,
+morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(n);d.push(j)}for(q in c){d.push(q);
+d.push(c[q])}g=d.join();q=0;for(d=U.length;q<d;q++)if(U[q].code===g){r=U[q].program;break a}q=i.createProgram();d=["precision "+B+" float;",Xa>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#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.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":
 "",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-k=["precision "+B+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.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":
+k=["precision "+B+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-j.attachShader(q,t("fragment",k+n));j.attachShader(q,t("vertex",d+i));j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);s=d;d=0;for(h=s.length;d<h;d++){n=
-s[d];q.uniforms[n]=j.getUniformLocation(q,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=j.getAttribLocation(q,c)}q.id=U.length;U.push({program:q,code:g});G.info.memory.programs=U.length;r=q}a.program=r;r=a.program.attributes;r.position>=0&&j.enableVertexAttribArray(r.position);
-r.color>=0&&j.enableVertexAttribArray(r.color);r.normal>=0&&j.enableVertexAttribArray(r.normal);r.tangent>=0&&j.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){j.enableVertexAttribArray(r.skinVertexA);j.enableVertexAttribArray(r.skinVertexB);j.enableVertexAttribArray(r.skinIndex);j.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(f in a.attributes)r[f]!==void 0&&r[f]>=0&&j.enableVertexAttribArray(r[f]);if(a.morphTargets){a.numSupportedMorphTargets=
-0;q="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=q+f;if(r[s]>=0){j.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=q+f;if(r[s]>=0){j.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){if(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)}else j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(la!==a.doubleSided){a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE);la=a.doubleSided}if(P!==a.flipSided){a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW);P=a.flipSided}};this.setDepthTest=function(a){if(Ma!==a){a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST);Ma=a}};this.setDepthWrite=function(a){if(xa!==a){j.depthMask(a);xa=a}};this.setBlending=
-function(a,b,c,d){if(a!==S){switch(a){case THREE.NoBlending:j.disable(j.BLEND);break;case THREE.AdditiveBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;case THREE.CustomBlending:j.enable(j.BLEND);break;default:j.enable(j.BLEND);
-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)}S=a}if(a===THREE.CustomBlending){if(b!==ca){j.blendEquation(F(b));ca=b}if(c!==T||d!==fa){j.blendFunc(F(c),F(d));T=c;fa=d}}else fa=T=ca=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=j.createTexture();G.info.memory.textures++}j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
-a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=F(a.format),f=F(a.type);w(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof
-THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=j.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=F(a.format),e=F(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();
-j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);s(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=j.createFramebuffer();a.__webglRenderbuffer=j.createRenderbuffer();j.bindTexture(j.TEXTURE_2D,a.__webglTexture);w(j.TEXTURE_2D,a,c);j.texImage2D(j.TEXTURE_2D,
-0,d,a.width,a.height,0,d,e,null);d=j.TEXTURE_2D;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0);s(a.__webglRenderbuffer,a);c&&j.generateMipmap(j.TEXTURE_2D)}b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;
-c=Ja;a=db;d=Wa;e=Ya}if(b!==C){j.bindFramebuffer(j.FRAMEBUFFER,b);j.viewport(d,e,c,a);C=b}hb=c;mb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+i.attachShader(q,t("fragment",k+n));i.attachShader(q,t("vertex",d+j));i.linkProgram(q);i.getProgramParameter(q,i.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+i.getProgramParameter(q,i.VALIDATE_STATUS)+", gl error ["+i.getError()+"]");q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);s=d;d=0;for(h=s.length;d<h;d++){n=
+s[d];q.uniforms[n]=i.getUniformLocation(q,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=i.getAttribLocation(q,c)}q.id=U.length;U.push({program:q,code:g});F.info.memory.programs=U.length;r=q}a.program=r;r=a.program.attributes;r.position>=0&&i.enableVertexAttribArray(r.position);
+r.color>=0&&i.enableVertexAttribArray(r.color);r.normal>=0&&i.enableVertexAttribArray(r.normal);r.tangent>=0&&i.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){i.enableVertexAttribArray(r.skinVertexA);i.enableVertexAttribArray(r.skinVertexB);i.enableVertexAttribArray(r.skinIndex);i.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(f in a.attributes)r[f]!==void 0&&r[f]>=0&&i.enableVertexAttribArray(r[f]);if(a.morphTargets){a.numSupportedMorphTargets=
+0;q="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=q+f;if(r[s]>=0){i.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=q+f;if(r[s]>=0){i.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?i.frontFace(i.CCW):i.frontFace(i.CW);a==="back"?i.cullFace(i.BACK):
+a==="front"?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK);i.enable(i.CULL_FACE)}else i.disable(i.CULL_FACE)};this.setObjectFaces=function(a){if(la!==a.doubleSided){a.doubleSided?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE);la=a.doubleSided}if(P!==a.flipSided){a.flipSided?i.frontFace(i.CW):i.frontFace(i.CCW);P=a.flipSided}};this.setDepthTest=function(a){if(Ma!==a){a?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST);Ma=a}};this.setDepthWrite=function(a){if(xa!==a){i.depthMask(a);xa=a}};this.setBlending=
+function(a,b,c,d){if(a!==S){switch(a){case THREE.NoBlending:i.disable(i.BLEND);break;case THREE.AdditiveBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.SRC_ALPHA,i.ONE);break;case THREE.SubtractiveBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.ZERO,i.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.ZERO,i.SRC_COLOR);break;case THREE.CustomBlending:i.enable(i.BLEND);break;default:i.enable(i.BLEND);
+i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD);i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA)}S=a}if(a===THREE.CustomBlending){if(b!==ca){i.blendEquation(G(b));ca=b}if(c!==T||d!==fa){i.blendFunc(G(c),G(d));T=c;fa=d}}else fa=T=ca=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=i.createTexture();F.info.memory.textures++}i.activeTexture(i.TEXTURE0+b);i.bindTexture(i.TEXTURE_2D,a.__webglTexture);i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
+a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=G(a.format),f=G(a.type);x(i.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?i.texImage2D(i.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):i.texImage2D(i.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&i.generateMipmap(i.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{i.activeTexture(i.TEXTURE0+b);i.bindTexture(i.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof
+THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=i.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=G(a.format),e=G(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];i.bindTexture(i.TEXTURE_CUBE_MAP,a.__webglTexture);x(i.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=i.createFramebuffer();a.__webglRenderbuffer[f]=i.createRenderbuffer();
+i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=i.TEXTURE_CUBE_MAP_POSITIVE_X+f;i.bindFramebuffer(i.FRAMEBUFFER,a.__webglFramebuffer[f]);i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,h,g.__webglTexture,0);s(a.__webglRenderbuffer[f],a)}c&&i.generateMipmap(i.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=i.createFramebuffer();a.__webglRenderbuffer=i.createRenderbuffer();i.bindTexture(i.TEXTURE_2D,a.__webglTexture);x(i.TEXTURE_2D,a,c);i.texImage2D(i.TEXTURE_2D,
+0,d,a.width,a.height,0,d,e,null);d=i.TEXTURE_2D;i.bindFramebuffer(i.FRAMEBUFFER,a.__webglFramebuffer);i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,d,a.__webglTexture,0);s(a.__webglRenderbuffer,a);c&&i.generateMipmap(i.TEXTURE_2D)}b?i.bindTexture(i.TEXTURE_CUBE_MAP,null):i.bindTexture(i.TEXTURE_2D,null);i.bindRenderbuffer(i.RENDERBUFFER,null);i.bindFramebuffer(i.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;
+c=Ja;a=db;d=Wa;e=Ya}if(b!==C){i.bindFramebuffer(i.FRAMEBUFFER,b);i.viewport(d,e,c,a);C=b}hb=c;mb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -388,31 +389,31 @@ 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.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],o=f.faceVertexUvs[0],n={},p=0;p<a.materials.length;p++)n[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var m=h[p].clone();c&&c.multiplyVector3(m);g.push(m)}p=0;for(r=k.length;p<r;p++){var g=
-k[p],q,u,t=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=t.length;h<m;h++){u=t[h].clone();d&&d.multiplyVector3(u);q.vertexNormals.push(u)}q.color.copy(g.color);h=0;for(m=w.length;h<m;h++){u=w[h];q.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];m=h.id;w=n[m];if(w===void 0){w=
-a.materials.length;n[m]=w;a.materials.push(h)}q.materialIndex=w}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}p=0;for(r=o.length;p<r;p++){c=o[p];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],n=f.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var o=h[p].clone();c&&c.multiplyVector3(o);g.push(o)}p=0;for(r=k.length;p<r;p++){var g=
+k[p],q,u,t=g.vertexNormals,x=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(o=t.length;h<o;h++){u=t[h].clone();d&&d.multiplyVector3(u);q.vertexNormals.push(u)}q.color.copy(g.color);h=0;for(o=x.length;h<o;h++){u=x[h];q.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];o=h.id;x=m[o];if(x===void 0){x=
+a.materials.length;m[o]=x;a.materials.push(h)}q.materialIndex=x}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);j.push(q)}p=0;for(r=n.length;p<r;p++){c=n[p];d=[];h=0;for(o=c.length;h<o;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
 for(c=f.length;a<c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();if(d+e>1){d=1-d;e=1-e}f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof
 THREE.Face3){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b)}return THREE.GeometryUtils.random()*
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(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,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],l,o,n,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];o=g[d.b];n=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,o,n)}else if(d instanceof THREE.Face4){l=
-g[d.a];o=g[d.b];n=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,n,p);d._area=d._area1+d._area2}i=i+d._area;k[e]=i}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*i;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(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,e,f=a.faces,g=a.vertices,h=f.length,j=0,k=[],l,n,m,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];n=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,n,m)}else if(d instanceof THREE.Face4){l=
+g[d.a];n=g[d.b];m=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,n,p);d._area2=THREE.GeometryUtils.triangleArea(n,m,p);d._area=d._area1+d._area2}j=j+d._area;k[e]=j}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*j;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();
 var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
-c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var i=d.b,k=d.c,l=d.d,o=new THREE.Face3,n=new THREE.Face3;o.color.copy(d.color);n.color.copy(d.color);o.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;o.a=e;o.b=i;o.c=l;n.a=i;n.b=k;n.c=l;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();n.vertexColors[0]=d.vertexColors[1].clone();
-n.vertexColors[1]=d.vertexColors[2].clone();n.vertexColors[2]=d.vertexColors[3].clone()}f.push(o,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];i=o[1];k=o[2];l=o[3];o=[o[0].clone(),i.clone(),l.clone()];i=[i.clone(),k.clone(),l.clone()];h[d].push(o,i)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
-e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(k.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
-h=f.b;i=f.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,k,l,o,n,p,r,m,q,u,t,w,s,x=[],F=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)F[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;k=a.vertices[f];l=a.vertices[g];o=a.vertices[h];p=k.distanceTo(l);r=l.distanceTo(o);n=k.distanceTo(o);if(p>
-b||r>b||n>b){i=a.vertices.length;w=e.clone();s=e.clone();if(p>=r&&p>=n){k=k.clone();k.lerpSelf(l,0.5);w.a=f;w.b=i;w.c=h;s.a=i;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);w.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);w.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=n){k=l.clone();k.lerpSelf(o,0.5);w.a=f;w.b=g;w.c=
-i;s.a=i;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{k=k.clone();
-k.lerpSelf(o,0.5);w.a=f;w.b=g;w.c=i;s.a=i;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}x.push(w,s);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];w=k[2];if(e===
-0){l=s.clone();l.lerpSelf(h,0.5);k=[s.clone(),l.clone(),w.clone()];h=[l.clone(),h.clone(),w.clone()]}else if(e===1){l=h.clone();l.lerpSelf(w,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),w.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(w,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),w.clone()]}F[f].push(k,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;k=a.vertices[f];l=a.vertices[g];o=a.vertices[h];n=
-a.vertices[i];p=k.distanceTo(l);r=l.distanceTo(o);m=o.distanceTo(n);q=k.distanceTo(n);if(p>b||r>b||m>b||q>b){u=a.vertices.length;t=a.vertices.length+1;w=e.clone();s=e.clone();if(p>=r&&p>=m&&p>=q||m>=r&&m>=p&&m>=q){p=k.clone();p.lerpSelf(l,0.5);l=o.clone();l.lerpSelf(n,0.5);w.a=f;w.b=u;w.c=t;w.d=i;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);w.vertexNormals[1].copy(f);
-w.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);w.vertexColors[1].copy(f);w.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(o,0.5);l=n.clone();l.lerpSelf(k,0.5);w.a=f;w.b=g;w.c=u;w.d=t;s.a=t;s.b=u;s.c=h;s.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
-f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);w.vertexNormals[2].copy(f);w.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);w.vertexColors[2].copy(f);w.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(w,s);a.vertices.push(p,l);
-f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];w=k[2];k=k[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);o=w.clone();o.lerpSelf(k,0.5);s=[s.clone(),l.clone(),o.clone(),k.clone()];h=[l.clone(),h.clone(),w.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(w,0.5);o=k.clone();o.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),w.clone(),k.clone()]}F[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
-x;a.faceVertexUvs=F}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var j=d.b,k=d.c,l=d.d,n=new THREE.Face3,m=new THREE.Face3;n.color.copy(d.color);m.color.copy(d.color);n.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;n.a=e;n.b=j;n.c=l;m.a=j;m.b=k;m.c=l;if(d.vertexColors.length===4){n.vertexColors[0]=d.vertexColors[0].clone();n.vertexColors[1]=d.vertexColors[1].clone();n.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
+m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(n,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){n=a.faceVertexUvs[d][b];j=n[1];k=n[2];l=n[3];n=[n[0].clone(),j.clone(),l.clone()];j=[j.clone(),k.clone(),l.clone()];h[d].push(n,j)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){j=a.faceUvs[d][b];g[d].push(j,j)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
+e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,j=f.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());b.push(k.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
+h=f.b;j=f.c;g=a.vertices[g];h=a.vertices[h];j=a.vertices[j];b.push(g.clone());b.push(h.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,j,k,l,n,m,p,r,o,q,u,t,x,s,w=[],G=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)G[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;k=a.vertices[f];l=a.vertices[g];n=a.vertices[h];p=k.distanceTo(l);r=l.distanceTo(n);m=k.distanceTo(n);if(p>
+b||r>b||m>b){j=a.vertices.length;x=e.clone();s=e.clone();if(p>=r&&p>=m){k=k.clone();k.lerpSelf(l,0.5);x.a=f;x.b=j;x.c=h;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);x.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);x.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=m){k=l.clone();k.lerpSelf(n,0.5);x.a=f;x.b=g;x.c=
+j;s.a=j;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);x.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);x.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{k=k.clone();
+k.lerpSelf(n,0.5);x.a=f;x.b=g;x.c=j;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);x.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);x.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}w.push(x,s);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];x=k[2];if(e===
+0){l=s.clone();l.lerpSelf(h,0.5);k=[s.clone(),l.clone(),x.clone()];h=[l.clone(),h.clone(),x.clone()]}else if(e===1){l=h.clone();l.lerpSelf(x,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),x.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(x,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),x.clone()]}G[f].push(k,h)}}else{w.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)G[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;j=e.d;k=a.vertices[f];l=a.vertices[g];n=a.vertices[h];m=
+a.vertices[j];p=k.distanceTo(l);r=l.distanceTo(n);o=n.distanceTo(m);q=k.distanceTo(m);if(p>b||r>b||o>b||q>b){u=a.vertices.length;t=a.vertices.length+1;x=e.clone();s=e.clone();if(p>=r&&p>=o&&p>=q||o>=r&&o>=p&&o>=q){p=k.clone();p.lerpSelf(l,0.5);l=n.clone();l.lerpSelf(m,0.5);x.a=f;x.b=u;x.c=t;x.d=j;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);x.vertexNormals[1].copy(f);
+x.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);x.vertexColors[1].copy(f);x.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(n,0.5);l=m.clone();l.lerpSelf(k,0.5);x.a=f;x.b=g;x.c=u;x.d=t;s.a=t;s.b=u;s.c=h;s.d=j;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
+f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);x.vertexNormals[2].copy(f);x.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);x.vertexColors[2].copy(f);x.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}w.push(x,s);a.vertices.push(p,l);
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];x=k[2];k=k[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);n=x.clone();n.lerpSelf(k,0.5);s=[s.clone(),l.clone(),n.clone(),k.clone()];h=[l.clone(),h.clone(),x.clone(),n.clone()]}else{l=h.clone();l.lerpSelf(x,0.5);n=k.clone();n.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),n.clone()];h=[n.clone(),l.clone(),x.clone(),k.clone()]}G[f].push(s,h)}}else{w.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)G[f].push(a.faceVertexUvs[f][c])}}}a.faces=
+w;a.faceVertexUvs=G}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=true;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6)f.needsUpdate=true;c&&c(this)};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},getNormalMap:function(a,
-b){var c=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]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var o=1;o<e;o++){var n=o-1<0?e-1:o-1,p=(o+1)%e,r=l-1<0?d-1:l-1,m=(l+1)%d,q=[],u=[0,0,h[(o*d+l)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(n*d+r)*4]/255*b]);q.push([0,-1,
-h[(n*d+l)*4]/255*b]);q.push([1,-1,h[(n*d+m)*4]/255*b]);q.push([1,0,h[(o*d+m)*4]/255*b]);q.push([1,1,h[(p*d+m)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);n=[];r=q.length;for(p=0;p<r;p++){var m=q[p],t=q[(p+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]];n.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}q=[0,0,0];for(p=0;p<n.length;p++){q[0]=q[0]+n[p][0];q[1]=q[1]+n[p][1];q[2]=q[2]+n[p][2]}q[0]=q[0]/n.length;q[1]=q[1]/
-n.length;q[2]=q[2]/n.length;u=(o*d+l)*4;k[u]=(q[0]+1)/2*255|0;k[u+1]=(q[1]+0.5)*255|0;k[u+2]=q[2]*255|0;k[u+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=true;return a}};
+b){var c=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]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,j=g.createImageData(d,e),k=j.data,l=0;l<d;l++)for(var n=1;n<e;n++){var m=n-1<0?e-1:n-1,p=(n+1)%e,r=l-1<0?d-1:l-1,o=(l+1)%d,q=[],u=[0,0,h[(n*d+l)*4]/255*b];q.push([-1,0,h[(n*d+r)*4]/255*b]);q.push([-1,-1,h[(m*d+r)*4]/255*b]);q.push([0,-1,
+h[(m*d+l)*4]/255*b]);q.push([1,-1,h[(m*d+o)*4]/255*b]);q.push([1,0,h[(n*d+o)*4]/255*b]);q.push([1,1,h[(p*d+o)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);m=[];r=q.length;for(p=0;p<r;p++){var o=q[p],t=q[(p+1)%r],o=[o[0]-u[0],o[1]-u[1],o[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];m.push(c([o[1]*t[2]-o[2]*t[1],o[2]*t[0]-o[0]*t[2],o[0]*t[1]-o[1]*t[0]]))}q=[0,0,0];for(p=0;p<m.length;p++){q[0]=q[0]+m[p][0];q[1]=q[1]+m[p][1];q[2]=q[2]+m[p][2]}q[0]=q[0]/m.length;q[1]=q[1]/
+m.length;q[2]=q[2]/m.length;u=(n*d+l)*4;k[u]=(q[0]+1)/2*255|0;k[u+1]=(q[1]+0.5)*255|0;k[u+2]=q[2]*255|0;k[u+3]=255}g.putImageData(j,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=true;return a}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++){c=a.children[d];b(c);THREE.SceneUtils.traverseHierarchy(c,b)}},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;if(a instanceof THREE.MorphAnimMesh){b=new THREE.MorphAnimMesh(a.geometry,a.material);
 b.duration=a.duration;b.mirroredLoop=a.mirroredLoop;b.time=a.time;b.lastKeyframe=a.lastKeyframe;b.currentKeyframe=a.currentKeyframe;b.direction=a.direction;b.directionBackwards=a.directionBackwards}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
 else if(a instanceof THREE.ParticleSystem){b=new THREE.ParticleSystem(a.geometry,a.material);b.sortParticles=a.sortParticles}else if(a instanceof THREE.Particle)b=new THREE.Particle(a.material);else if(a instanceof THREE.Sprite){b=new THREE.Sprite({});b.color.copy(a.color);b.map=a.map;b.blending=a.blending;b.useScreenCoordinates=a.useScreenCoordinates;b.mergeWith3D=a.mergeWith3D;b.affectedByDistance=a.affectedByDistance;b.scaleByViewport=a.scaleByViewport;b.alignment=a.alignment;b.rotation3d.copy(a.rotation3d);
@@ -431,7 +432,7 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:
 THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
 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 b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
 THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++){c=this.getPoint(e/a);f=f+c.distanceTo(d);b.push(f);d=c}return this.cacheArcLengths=b};
-THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;){d=Math.floor(g+(h-g)/2);i=c[d]-f;if(i<0)g=d+1;else if(i>0)h=d-1;else{h=d;break}}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,j;g<=h;){d=Math.floor(g+(h-g)/2);j=c[d]-f;if(j<0)g=d+1;else if(j>0)h=d-1;else{h=d;break}}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-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 b=a-1.0E-4,a=a+1.0E-4;b<0&&(b=0);a>1&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;
 THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().subSelf(this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().subSelf(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
 THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=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(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=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);b=new THREE.Vector2(b,a);b.normalize();return b};
@@ -448,10 +449,10 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};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(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return a.getPointAt(b)}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=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++){b=b+this.curves[c].getLength();a.push(b)}return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,j;j=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;j.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:j.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
 THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return a};
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,j;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;j=g/c.maxX;j=b.getUtoTmapping(j,g);g=b.getPoint(j);h=b.getNormalVector(j).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return a};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]==void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
 THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){if(this.parent){this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix);this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld);this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject);this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)}else this.matrixWorld.copy(this.matrix);
 this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
@@ -462,37 +463,37 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
 THREE.Path.prototype.absarc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,i,k,l,o,n,p,r,m;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];n=f[1];if(c.length>0){g=c[c.length-1];
-p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){m=f/a;g=THREE.Shape.Utils.b2(m,p,o,h);m=THREE.Shape.Utils.b2(m,r,n,i);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];n=f[1];k=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){m=f/a;g=THREE.Shape.Utils.b3(m,p,o,k,h);m=THREE.Shape.Utils.b3(m,r,n,l,i);c.push(new THREE.Vector2(g,
-m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;m=m.concat(f[0]);m=new THREE.SplineCurve(m);for(f=1;f<=g;f++)c.push(m.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];k=f[2];o=f[3];n=!!f[5];l=f[4]-o;p=a*2;for(f=1;f<=p;f++){m=f/p;n||(m=1-m);m=o+m*l;g=h+k*Math.cos(m);m=i+k*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
-1,1);b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};THREE.Path.prototype.nltransform=function(a,b,c,d,e,f){var g=this.getPoints(),h,i,k,l,o;h=0;for(i=g.length;h<i;h++){k=g[h];l=k.x;o=k.y;k.x=a*l+b*o+c;k.y=d*o+e*l+f}return g};
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,j,k,l,n,m,p,r,o;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];j=f[3];n=f[0];m=f[1];if(c.length>0){g=c[c.length-1];
+p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){o=f/a;g=THREE.Shape.Utils.b2(o,p,n,h);o=THREE.Shape.Utils.b2(o,r,m,j);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];j=f[5];n=f[0];m=f[1];k=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){o=f/a;g=THREE.Shape.Utils.b3(o,p,n,k,h);o=THREE.Shape.Utils.b3(o,r,m,l,j);c.push(new THREE.Vector2(g,
+o))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;o=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;o=o.concat(f[0]);o=new THREE.SplineCurve(o);for(f=1;f<=g;f++)c.push(o.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];j=f[1];k=f[2];n=f[3];m=!!f[5];l=f[4]-n;p=a*2;for(f=1;f<=p;f++){o=f/p;m||(o=1-o);o=n+o*l;g=h+k*Math.cos(o);o=j+k*Math.sin(o);c.push(new THREE.Vector2(g,o))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
+1,1);b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};THREE.Path.prototype.nltransform=function(a,b,c,d,e,f){var g=this.getPoints(),h,j,k,l,n;h=0;for(j=g.length;h<j;h++){k=g[h];l=k.x;n=k.y;k.x=a*l+b*n+c;k.y=d*n+e*l+f}return g};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();if(!a){a=document.createElement("canvas");a.setAttribute("width",b.maxX+100);a.setAttribute("height",b.maxY+100);document.body.appendChild(a)}b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++){d=this.actions[a];e=d.args;d=d.action;d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e)}b.stroke();b.closePath();b.strokeStyle="red";
 d=this.getPoints();a=0;for(c=d.length;a<c;a++){e=d[a];b.beginPath();b.arc(e.x,e.y,1.5,0,Math.PI*2,false);b.stroke();b.closePath()}};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
 b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else g.holes.push(f)}d.push(g)}return d};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 b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,l,o,n,p,r=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){n=k[e];p=[];for(o=0;o<c.length;o++){l=c[o];l=n.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;var m=[k[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(m);var q=[k[g],k[f],c[h]];n=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;m=[k[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+n>m+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1}o=c.slice(0,h);n=c.slice(h);p=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];r.push([k[g],c[h],c[e]]);r.push(f);c=o.concat(p).concat(l).concat(n)}return{shape:c,
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,i,k={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;k[i]!==void 0&&console.log("Duplicate point",i);k[i]=f}f=0;for(g=c.length;f<g;f++){h=c[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(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=k[i];i!==void 0&&(h[d]=i)}}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,j,k,l,n,m,p,r=[];for(j=0;j<b.length;j++){k=b[j];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];p=[];for(n=0;n<c.length;n++){l=c[n];l=m.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=n}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;var o=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(o);var q=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;o=[k[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(o);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(n+m>o+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1}n=c.slice(0,h);m=c.slice(h);p=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];r.push([k[g],c[h],c[e]]);r.push(f);c=n.concat(p).concat(l).concat(m)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,j,k={};f=0;for(g=d.length;f<g;f++){j=d[f].x+":"+d[f].y;k[j]!==void 0&&console.log("Duplicate point",j);k[j]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=k[j];j!==void 0&&(h[d]=j)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=k[j];j!==void 0&&(h[d]=j)}}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",f=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={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){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==true){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=
-h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l={};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){l[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
+0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++){var k=a.hierarchy[c].keys[d].morphTargets[j];h[k]=-1}a.hierarchy[c].usedMorphTargets=
+h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l={};for(k in h){for(j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++)if(a.hierarchy[c].keys[d].morphTargets[j]===k){l[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
 d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return 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)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;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.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0){this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,k,l=this.data.JIT.hierarchy,o,n;n=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;k=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];i=a.animationCache;if(this.JITCompile&&l[p][k]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[p][k];a.matrixAutoUpdate=
-false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[p][k];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}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++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(o<n)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
-p,h.index+1)}while(h.time<o)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,j,k,l=this.data.JIT.hierarchy,n,m;m=this.currentTime=this.currentTime+a*this.timeScale;n=this.currentTime=this.currentTime%this.data.length;k=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];j=a.animationCache;if(this.JITCompile&&l[p][k]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[p][k];a.matrixAutoUpdate=
+false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[p][k];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var o=0;o<3;o++){c=b[o];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=m){if(n<m)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<n;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
+p,h.index+1)}while(h.time<n)}j.prevKey[c]=g;j.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(n-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
 THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",p,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(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(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,
 this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)l[p][k]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,k;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],k[2],e,c,g);return d};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,j,k;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];j=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],j[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],j[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],j[2],k[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
@@ -500,14 +501,14 @@ false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
 e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
-this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
-true}else if(l.length){if(this.JITCompile&&o)d instanceof THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!i)for(var n=l.length-1;c.time<g&&c.index!==n;){b=c;c=l[b.index+1]}o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,j;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((j=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
+this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,n=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
+true}else if(l.length){if(this.JITCompile&&n)d instanceof THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix;b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=h){if(j&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!j)for(var m=l.length-1;c.time<g&&c.index!==m;){b=c;c=l[b.index+1]}n.prevKey=b;n.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
 for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c%b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
 THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
-1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,n=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
-2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=n;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=new THREE.Object3D;THREE.CubeCamera.prototype.constructor=THREE.CubeCamera;
+1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var j=new THREE.PerspectiveCamera(90,1,a,b);j.up.set(0,-1,0);j.lookAt(new THREE.Vector3(0,0,-1));this.add(j);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,m=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
+2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,j,c)}};THREE.CubeCamera.prototype=new THREE.Object3D;THREE.CubeCamera.prototype.constructor=THREE.CubeCamera;
 THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CombinedCamera;
 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=true;this.inOrthographicMode=false};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=false;this.inOrthographicMode=true};
@@ -542,78 +543,78 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
 this.object.matrixWorldNeedsUpdate=true};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",c(this,this.mousemove),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
 c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=false,h=1,i=0,k=0,l=0,o=0,n=0,p=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
-a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*l);if(g)this.roll=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()}e.copy(this.forward);
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=false,h=1,j=0,k=0,l=0,n=0,m=0,p=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
+a*this.lookSpeed;this.rotateHorizontally(b*n);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(j>0||this.autoForward&&!(j<0)?1:j));this.object.translateX(b*k);this.object.translateY(b*l);if(g)this.roll=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()}e.copy(this.forward);
 d.set(0,1,0);c.cross(d,e).normalize();d.cross(e,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
 Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
 a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;n=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);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:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);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:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false)};
+false);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-p)/window.innerWidth;m=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=1;break;case 2:j=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=0;break;case 2:j=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:j=
+1;break;case 37:case 65:k=-1;break;case 40:case 83:j=-1;break;case 39:case 68:k=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:j=0;break;case 37:case 65:k=0;break;case 40:case 83:j=0;break;case 39:case 68:k=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;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=this.noRotate=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
-this.target=new THREE.Vector3;var d=new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,n=new THREE.Vector2,p={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
-c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-k.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?k=l:k.y=k.y+(l.y-k.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=n.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
-b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=n:o.addSelf(a.sub(n,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);k=l=c.getMouseOnScreen(a.clientX,a.clientY);o=
-n=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=l=c.getMouseOnScreen(a.clientX,
-a.clientY):this.noPan||(o=n=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false)};
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,l,n){var m,o=d||1,p=e||1,r=h/2,q=i/2,t=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){m="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";o=f||1}var j=o+1,u=p+1,w=h/o,C=i/p,Y=new THREE.Vector3;Y[m]=l>0?1:-1;for(h=0;h<u;h++)for(i=0;i<j;i++){var H=new THREE.Vector3;H[a]=(i*w-r)*c;H[b]=(h*C-q)*g;H[m]=l;k.vertices.push(H)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
-j*h+t,i+j*(h+1)+t,i+1+j*(h+1)+t,i+1+j*h+t);a.normal.copy(Y);a.vertexNormals.push(Y.clone(),Y.clone(),Y.clone(),Y.clone());a.materialIndex=n;k.faces.push(a);k.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 k=this,l=a/2,o=b/2,n=c/2,p,r,m,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;u=3;m=4;t=5}else this.materials=
-[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var w in h)this.sides[w]!==void 0&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,l,p);this.sides.nx&&i("z","y",1,-1,c,b,-l,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,u);this.sides.pz&&i("x","y",1,-1,a,b,n,m);this.sides.nz&&i("x","y",-1,-1,a,b,-n,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+this.target=new THREE.Vector3;var d=new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,n=new THREE.Vector2,m=new THREE.Vector2,p={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
+c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(j)/h.length()/j.length());if(a){var b=(new THREE.Vector3).cross(h,j).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(j);if(c.staticMoving)h=j;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-k.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?k=l:k.y=k.y+(l.y-k.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=m.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
+b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?n=m:n.addSelf(a.sub(m,n).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);k=l=c.getMouseOnScreen(a.clientX,a.clientY);n=
+m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=l=c.getMouseOnScreen(a.clientX,
+a.clientY):this.noPan||(n=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false)};
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function j(a,b,c,g,h,j,l,m){var n,o=d||1,p=e||1,r=h/2,q=j/2,t=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";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var i=o+1,u=p+1,x=h/o,C=j/p,Y=new THREE.Vector3;Y[n]=l>0?1:-1;for(h=0;h<u;h++)for(j=0;j<i;j++){var H=new THREE.Vector3;H[a]=(j*x-r)*c;H[b]=(h*C-q)*g;H[n]=l;k.vertices.push(H)}for(h=0;h<p;h++)for(j=0;j<o;j++){a=new THREE.Face4(j+
+i*h+t,j+i*(h+1)+t,j+1+i*(h+1)+t,j+1+i*h+t);a.normal.copy(Y);a.vertexNormals.push(Y.clone(),Y.clone(),Y.clone(),Y.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(j/o,h/p),new THREE.UV(j/o,(h+1)/p),new THREE.UV((j+1)/o,(h+1)/p),new THREE.UV((j+1)/o,h/p)])}}THREE.Geometry.call(this);var k=this,l=a/2,n=b/2,m=c/2,p,r,o,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;u=3;o=4;t=5}else this.materials=
+[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var x in h)this.sides[x]!==void 0&&(this.sides[x]=h[x]);this.sides.px&&j("z","y",-1,-1,c,b,l,p);this.sides.nx&&j("z","y",1,-1,c,b,-l,q);this.sides.py&&j("x","z",1,1,a,c,n,r);this.sides.ny&&j("x","z",1,-1,a,c,-n,u);this.sides.pz&&j("x","y",1,-1,a,b,m,o);this.sides.nz&&j("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var o=[],n=[],p=i/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,q=new THREE.Vector3;q.x=r*Math.sin(m*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(m*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);n.push(new THREE.UV(m,p))}k.push(o);l.push(n)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],o=k[i+1][h],n=k[i+1][h+1],
-p=k[i][h+1],r=this.vertices[c].clone().setY(0).normalize(),m=this.vertices[o].clone().setY(0).normalize(),q=this.vertices[n].clone().setY(0).normalize(),u=this.vertices[p].clone().setY(0).normalize(),t=l[i][h].clone(),w=l[i+1][h].clone(),s=l[i+1][h+1].clone(),x=l[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,n,p,[r,m,q,u]));this.faceVertexUvs[0].push([t,w,s,x])}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){c=k[0][h];o=k[0][h+1];n=this.vertices.length-1;r=new THREE.Vector3(0,
-1,0);m=new THREE.Vector3(0,1,0);q=new THREE.Vector3(0,1,0);t=l[0][h].clone();w=l[0][h+1].clone();s=new THREE.UV(w.u,0);this.faces.push(new THREE.Face3(c,o,n,[r,m,q]));this.faceVertexUvs[0].push([t,w,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){c=k[i][h+1];o=k[i][h];n=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);m=new THREE.Vector3(0,-1,0);q=new THREE.Vector3(0,-1,0);t=l[i][h+1].clone();w=l[i][h].clone();s=new THREE.UV(w.u,1);this.faces.push(new THREE.Face3(c,
-o,n,[r,m,q]));this.faceVertexUvs[0].push([t,w,s])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,j,k=[],l=[];for(j=0;j<=e;j++){var n=[],m=[],p=j/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var o=h/d,q=new THREE.Vector3;q.x=r*Math.sin(o*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(o*Math.PI*2);this.vertices.push(q);n.push(this.vertices.length-1);m.push(new THREE.UV(o,p))}k.push(n);l.push(m)}for(j=0;j<e;j++)for(h=0;h<d;h++){var c=k[j][h],n=k[j+1][h],m=k[j+1][h+1],
+p=k[j][h+1],r=this.vertices[c].clone().setY(0).normalize(),o=this.vertices[n].clone().setY(0).normalize(),q=this.vertices[m].clone().setY(0).normalize(),u=this.vertices[p].clone().setY(0).normalize(),t=l[j][h].clone(),x=l[j+1][h].clone(),s=l[j+1][h+1].clone(),w=l[j][h+1].clone();this.faces.push(new THREE.Face4(c,n,m,p,[r,o,q,u]));this.faceVertexUvs[0].push([t,x,s,w])}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){c=k[0][h];n=k[0][h+1];m=this.vertices.length-1;r=new THREE.Vector3(0,
+1,0);o=new THREE.Vector3(0,1,0);q=new THREE.Vector3(0,1,0);t=l[0][h].clone();x=l[0][h+1].clone();s=new THREE.UV(x.u,0);this.faces.push(new THREE.Face3(c,n,m,[r,o,q]));this.faceVertexUvs[0].push([t,x,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){c=k[j][h+1];n=k[j][h];m=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);o=new THREE.Vector3(0,-1,0);q=new THREE.Vector3(0,-1,0);t=l[j][h+1].clone();x=l[j][h].clone();s=new THREE.UV(x.u,1);this.faces.push(new THREE.Face3(c,
+n,m,[r,o,q]));this.faceVertexUvs[0].push([t,x,s])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;
 THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(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,j=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);j.copy(a).addSelf(g);if(h.equals(j))return g.clone();
-h.copy(b).addSelf(f);j.copy(c).addSelf(g);f=d.dot(g);g=j.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(H=c.length;--H>=0;){e=H;f=H-1;f<0&&(f=
-c.length-1);for(var g=0,h=n+l*2,g=0;g<h;g++){var j=W*g,i=W*(g+1),k=d+e+j,j=d+f+j,m=d+f+i,i=d+e+i,o=c,p=g,r=h,k=k+J,j=j+J,m=m+J,i=i+J;z.faces.push(new THREE.Face4(k,j,m,i,null,null,t));k=P.generateSideWallUV(z,a,o,b,k,j,m,i,p,r);z.faceVertexUvs[0].push(k)}}}function f(a,b,c){z.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+J;d=d+J;e=e+J;z.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?P.generateBottomUV(z,a,b,c,d,e):P.generateTopUV(z,a,b,c,d,e);z.faceVertexUvs[0].push(c)}var h=
-b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,n=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,m,q=false,u=b.material,t=b.extrudeMaterial,w,s,x,F;if(r){m=r.getSpacedPoints(n);q=true;o=false;w=new THREE.TubeGeometry.FrenetFrames(r,n,false);s=new THREE.Vector3;x=new THREE.Vector3;F=new THREE.Vector3}if(!o)k=i=l=0;var E,B,v,z=this,
-J=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,K=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();B=0;for(v=K.length;B<v;B++){E=K[B];THREE.Shape.Utils.isClockWise(E)&&(K[B]=E.reverse())}r=false}var X=THREE.Shape.Utils.triangulateShape(p,K),Q=p;B=0;for(v=K.length;B<v;B++){E=K[B];p=p.concat(E)}var A,M,G,j,U,W=p.length,C,Y=X.length,r=[],H=0;G=Q.length;A=G-1;for(M=H+1;H<G;H++,A++,M++){A===G&&(A=0);M===G&&(M=0);r[H]=d(Q[H],Q[A],Q[M])}var ba=[],ga,la=r.concat();
-B=0;for(v=K.length;B<v;B++){E=K[B];ga=[];H=0;G=E.length;A=G-1;for(M=H+1;H<G;H++,A++,M++){A===G&&(A=0);M===G&&(M=0);ga[H]=d(E[H],E[A],E[M])}ba.push(ga);la=la.concat(ga)}for(A=0;A<l;A++){G=A/l;j=i*(1-G);M=k*Math.sin(G*Math.PI/2);H=0;for(G=Q.length;H<G;H++){U=c(Q[H],r[H],M);f(U.x,U.y,-j)}B=0;for(v=K.length;B<v;B++){E=K[B];ga=ba[B];H=0;for(G=E.length;H<G;H++){U=c(E[H],ga[H],M);f(U.x,U.y,-j)}}}M=k;for(H=0;H<W;H++){U=o?c(p[H],la[H],M):p[H];if(q){x.copy(w.normals[0]).multiplyScalar(U.x);s.copy(w.binormals[0]).multiplyScalar(U.y);
-F.copy(m[0]).addSelf(x).addSelf(s);f(F.x,F.y,F.z)}else f(U.x,U.y,0)}for(G=1;G<=n;G++)for(H=0;H<W;H++){U=o?c(p[H],la[H],M):p[H];if(q){x.copy(w.normals[G]).multiplyScalar(U.x);s.copy(w.binormals[G]).multiplyScalar(U.y);F.copy(m[G]).addSelf(x).addSelf(s);f(F.x,F.y,F.z)}else f(U.x,U.y,h/n*G)}for(A=l-1;A>=0;A--){G=A/l;j=i*(1-G);M=k*Math.sin(G*Math.PI/2);H=0;for(G=Q.length;H<G;H++){U=c(Q[H],r[H],M);f(U.x,U.y,h+j)}B=0;for(v=K.length;B<v;B++){E=K[B];ga=ba[B];H=0;for(G=E.length;H<G;H++){U=c(E[H],ga[H],M);
-q?f(U.x,U.y+m[n-1].y,m[n-1].x+j):f(U.x,U.y,h+j)}}}var P=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(o){var a;a=W*0;for(H=0;H<Y;H++){C=X[H];g(C[2]+a,C[1]+a,C[0]+a,true)}a=n+l*2;a=W*a;for(H=0;H<Y;H++){C=X[H];g(C[0]+a,C[1]+a,C[2]+a,false)}}else{for(H=0;H<Y;H++){C=X[H];g(C[2],C[1],C[0],true)}for(H=0;H<Y;H++){C=X[H];g(C[0]+W*n,C[1]+W*n,C[2]+W*n,false)}}})();(function(){var a=0;e(Q,a);a=a+Q.length;B=0;for(v=K.length;B<v;B++){E=K[B];e(E,a);a=a+E.length}})()};
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,l=
-a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(n,a)]}};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.prototype.addShape=function(a,b){function c(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);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(H=c.length;--H>=0;){e=H;f=H-1;f<0&&(f=
+c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=W*g,j=W*(g+1),k=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,r=h,k=k+J,i=i+J,n=n+J,j=j+J;A.faces.push(new THREE.Face4(k,i,n,j,null,null,t));k=P.generateSideWallUV(A,a,o,b,k,i,n,j,p,r);A.faceVertexUvs[0].push(k)}}}function f(a,b,c){A.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+J;d=d+J;e=e+J;A.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?P.generateBottomUV(A,a,b,c,d,e):P.generateTopUV(A,a,b,c,d,e);A.faceVertexUvs[0].push(c)}var h=
+b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:j-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,o,q=false,u=b.material,t=b.extrudeMaterial,x,s,w,G;if(r){o=r.getSpacedPoints(m);q=true;n=false;x=new THREE.TubeGeometry.FrenetFrames(r,m,false);s=new THREE.Vector3;w=new THREE.Vector3;G=new THREE.Vector3}if(!n)k=j=l=0;var E,B,v,A=this,
+J=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,K=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();B=0;for(v=K.length;B<v;B++){E=K[B];THREE.Shape.Utils.isClockWise(E)&&(K[B]=E.reverse())}r=false}var X=THREE.Shape.Utils.triangulateShape(p,K),Q=p;B=0;for(v=K.length;B<v;B++){E=K[B];p=p.concat(E)}var z,M,F,i,U,W=p.length,C,Y=X.length,r=[],H=0;F=Q.length;z=F-1;for(M=H+1;H<F;H++,z++,M++){z===F&&(z=0);M===F&&(M=0);r[H]=d(Q[H],Q[z],Q[M])}var ba=[],ga,la=r.concat();
+B=0;for(v=K.length;B<v;B++){E=K[B];ga=[];H=0;F=E.length;z=F-1;for(M=H+1;H<F;H++,z++,M++){z===F&&(z=0);M===F&&(M=0);ga[H]=d(E[H],E[z],E[M])}ba.push(ga);la=la.concat(ga)}for(z=0;z<l;z++){F=z/l;i=j*(1-F);M=k*Math.sin(F*Math.PI/2);H=0;for(F=Q.length;H<F;H++){U=c(Q[H],r[H],M);f(U.x,U.y,-i)}B=0;for(v=K.length;B<v;B++){E=K[B];ga=ba[B];H=0;for(F=E.length;H<F;H++){U=c(E[H],ga[H],M);f(U.x,U.y,-i)}}}M=k;for(H=0;H<W;H++){U=n?c(p[H],la[H],M):p[H];if(q){w.copy(x.normals[0]).multiplyScalar(U.x);s.copy(x.binormals[0]).multiplyScalar(U.y);
+G.copy(o[0]).addSelf(w).addSelf(s);f(G.x,G.y,G.z)}else f(U.x,U.y,0)}for(F=1;F<=m;F++)for(H=0;H<W;H++){U=n?c(p[H],la[H],M):p[H];if(q){w.copy(x.normals[F]).multiplyScalar(U.x);s.copy(x.binormals[F]).multiplyScalar(U.y);G.copy(o[F]).addSelf(w).addSelf(s);f(G.x,G.y,G.z)}else f(U.x,U.y,h/m*F)}for(z=l-1;z>=0;z--){F=z/l;i=j*(1-F);M=k*Math.sin(F*Math.PI/2);H=0;for(F=Q.length;H<F;H++){U=c(Q[H],r[H],M);f(U.x,U.y,h+i)}B=0;for(v=K.length;B<v;B++){E=K[B];ga=ba[B];H=0;for(F=E.length;H<F;H++){U=c(E[H],ga[H],M);
+q?f(U.x,U.y+o[m-1].y,o[m-1].x+i):f(U.x,U.y,h+i)}}}var P=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(n){var a;a=W*0;for(H=0;H<Y;H++){C=X[H];g(C[2]+a,C[1]+a,C[0]+a,true)}a=m+l*2;a=W*a;for(H=0;H<Y;H++){C=X[H];g(C[0]+a,C[1]+a,C[2]+a,false)}}else{for(H=0;H<Y;H++){C=X[H];g(C[2],C[1],C[0],true)}for(H=0;H<Y;H++){C=X[H];g(C[0]+W*m,C[1]+W*m,C[2]+W*m,false)}}})();(function(){var a=0;e(Q,a);a=a+Q.length;B=0;for(v=K.length;B<v;B++){E=K[B];e(E,a);a=a+E.length}})()};
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,j=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,l=
+a.vertices[g].y,g=a.vertices[g].z,n=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(n,a)]:[new THREE.UV(c,e),new THREE.UV(j,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};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.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(d[f])}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(d[f])}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/e),new THREE.UV(1-
 (c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,k=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,0,a*k-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+1)/d),new THREE.UV((b+
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,j=a/c,k=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*j-e,0,a*k-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+1)/d),new THREE.UV((b+
 1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],l=[];for(i=0;i<=c;i++){var o=[],n=[];for(h=0;h<=b;h++){var p=h/b,r=i/c,m=new THREE.Vector3;m.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);m.y=a*Math.cos(f+r*g);m.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(m);o.push(this.vertices.length-1);n.push(new THREE.UV(p,
-r))}k.push(o);l.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],f=k[i+1][h],g=k[i+1][h+1],o=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),m=l[i][h+1].clone(),q=l[i][h].clone(),u=l[i+1][h].clone(),t=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([m,u,t])}else if(Math.abs(this.vertices[f].y)==
-a){this.faces.push(new THREE.Face3(d,e,f,[o,n,p]));this.faceVertexUvs[0].push([m,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,n,p,r]));this.faceVertexUvs[0].push([m,q,u,t])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,k=[],l=[];for(j=0;j<=c;j++){var n=[],m=[];for(h=0;h<=b;h++){var p=h/b,r=j/c,o=new THREE.Vector3;o.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);o.y=a*Math.cos(f+r*g);o.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(o);n.push(this.vertices.length-1);m.push(new THREE.UV(p,
+r))}k.push(n);l.push(m)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=k[j][h+1],e=k[j][h],f=k[j+1][h],g=k[j+1][h+1],n=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),o=l[j][h+1].clone(),q=l[j][h].clone(),u=l[j+1][h].clone(),t=l[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[n,p,r]));this.faceVertexUvs[0].push([o,u,t])}else if(Math.abs(this.vertices[f].y)==
+a){this.faces.push(new THREE.Face3(d,e,f,[n,m,p]));this.faceVertexUvs[0].push([o,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[n,m,p,r]));this.faceVertexUvs[0].push([o,q,u,t])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 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 b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,l,o,n,p,r,m,q,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(i,l));e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(i,
-l));e.lineTo(i,l);break;case "q":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,i,l);if(g=f[f.length-1]){o=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h,w=THREE.Shape.Utils.b2(t,o,p,i),t=THREE.Shape.Utils.b2(t,n,r,l);f.push(new THREE.Vector2(w,t))}}break;case "b":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;m=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(i,l,p,r,m,q);if(g=f[f.length-1]){o=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;w=THREE.Shape.Utils.b3(t,o,p,
-m,i);t=THREE.Shape.Utils.b3(t,n,r,q,l);f.push(new THREE.Vector2(w,t))}}}}}return{offset:u.ha*c,points:f,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,k,l;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var o=2*e;for(k=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{n=a;var p=i,r=k,m=l,q=e,u=g,t=void 0,w=void 0,s=void 0,x=void 0,F=void 0,
-E=void 0,B=void 0,v=void 0,z=void 0,w=n[u[p]].x,s=n[u[p]].y,x=n[u[r]].x,F=n[u[r]].y,E=n[u[m]].x,B=n[u[m]].y;if(1.0E-10>(x-w)*(B-s)-(F-s)*(E-w))n=false;else{for(t=0;t<q;t++)if(!(t==p||t==r||t==m)){var v=n[u[t]].x,z=n[u[t]].y,J=void 0,K=void 0,X=void 0,Q=void 0,A=void 0,M=void 0,G=void 0,j=void 0,U=void 0,W=void 0,C=void 0,Y=void 0,J=X=A=void 0,J=E-x,K=B-F,X=w-E,Q=s-B,A=x-w,M=F-s,G=v-w,j=z-s,U=v-x,W=z-F,C=v-E,Y=z-B,J=J*W-K*U,A=A*j-M*G,X=X*Y-Q*C;if(J>=0&&X>=0&&A>=0){n=false;break a}}n=true}}if(n){f.push([a[g[i]],
-a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);i=k;for(l=k+1;l<e;i++,l++)g[i]=g[l];e--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,j,k,l,n,m,p,r,o,q,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;){j=b[a++];switch(j){case "m":j=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(j,l));e.moveTo(j,l);break;case "l":j=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(j,
+l));e.lineTo(j,l);break;case "q":j=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,j,l);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h,x=THREE.Shape.Utils.b2(t,n,p,j),t=THREE.Shape.Utils.b2(t,m,r,l);f.push(new THREE.Vector2(x,t))}}break;case "b":j=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;o=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(j,l,p,r,o,q);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;x=THREE.Shape.Utils.b3(t,n,p,
+o,j);t=THREE.Shape.Utils.b3(t,m,r,q,l);f.push(new THREE.Vector2(x,t))}}}}}return{offset:u.ha*c,points:f,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],j,k,l;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var n=2*e;for(k=e-1;e>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}j=k;e<=j&&(j=0);k=j+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{m=a;var p=j,r=k,o=l,q=e,u=g,t=void 0,x=void 0,s=void 0,w=void 0,G=void 0,
+E=void 0,B=void 0,v=void 0,A=void 0,x=m[u[p]].x,s=m[u[p]].y,w=m[u[r]].x,G=m[u[r]].y,E=m[u[o]].x,B=m[u[o]].y;if(1.0E-10>(w-x)*(B-s)-(G-s)*(E-x))m=false;else{for(t=0;t<q;t++)if(!(t==p||t==r||t==o)){var v=m[u[t]].x,A=m[u[t]].y,J=void 0,K=void 0,X=void 0,Q=void 0,z=void 0,M=void 0,F=void 0,i=void 0,U=void 0,W=void 0,C=void 0,Y=void 0,J=X=z=void 0,J=E-w,K=B-G,X=x-E,Q=s-B,z=w-x,M=G-s,F=v-x,i=A-s,U=v-w,W=A-G,C=v-E,Y=A-B,J=J*W-K*U,z=z*i-M*F,X=X*Y-Q*C;if(J>=0&&X>=0&&z>=0){m=false;break a}}m=true}}if(m){f.push([a[g[j]],
+a[g[k]],a[g[l]]]);h.push([g[j],g[k],g[l]]);j=k;for(l=k+1;l<e;j++,l++)g[j]=g[l];e--;n=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
-this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
+this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,j=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);j.normal.addSelf(b[e]);j.normal.addSelf(b[f]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
 this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=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(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(i*d.x+g*e.x);f.y=f.y+(i*d.y+g*e.y);f.z=f.z+(i*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}}for(a=0;a<
-this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,k,l])}this.computeCentroids();this.computeFaceNormals();
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,f);d.add(j,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(j*d.x+g*e.x);f.y=f.y+(j*d.y+g*e.y);f.z=f.z+(j*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}}for(a=0;a<
+this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,j,k,l])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,i,k,l,o=new THREE.Vector3,n,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);n=b.tangents;p=b.normals;r=b.binormals;this.tangents=n;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=n[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
-l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);o.copy(l);o.x=o.x+(k*g.x+i*h.x);o.y=o.y+(k*g.y+i*h.y);o.z=o.z+(k*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
-a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];n=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([n,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,j,k,l,n=new THREE.Vector3,m,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;p=b.normals;r=b.binormals;this.tangents=m;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);n.copy(l);n.x=n.x+(k*g.x+j*h.x);n.y=n.y+(k*g.y+j*h.y);n.z=n.z+(k*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(n.x,n.y,n.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;n=(d+1)%this.segmentsRadius;
+a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][n];n=this.grid[b][n];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,n));this.faceVertexUvs[0].push([m,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
 THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,k,l,o;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++){l=k/(b-1);e[k]=a.getTangentAt(l);e[k].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);o=Math.abs(e[0].z);if(k<=a){a=k;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
-f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(k=1;k<b;k++){f[k]=f[k-1].clone();g[k]=g[k-1].clone();h.cross(e[k-1],e[k]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[k-1].dot(e[k]));i.makeRotationAxis(h,d).multiplyVector3(f[k])}g[k].cross(e[k],f[k])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(k=1;k<b;k++){i.makeRotationAxis(e[k],d*k).multiplyVector3(f[k]);g[k].cross(e[k],f[k])}}};
-THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
-i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(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);
-for(var c=c||1,d=d||0,i=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var o=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,j=new THREE.Matrix4,b=b+1,k,l,n;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++){l=k/(b-1);e[k]=a.getTangentAt(l);e[k].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);n=Math.abs(e[0].z);if(k<=a){a=k;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}n<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
+f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(k=1;k<b;k++){f[k]=f[k-1].clone();g[k]=g[k-1].clone();h.cross(e[k-1],e[k]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[k-1].dot(e[k]));j.makeRotationAxis(h,d).multiplyVector3(f[k])}g[k].cross(e[k],f[k])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(k=1;k<b;k++){j.makeRotationAxis(e[k],d*k).multiplyVector3(f[k]);g[k].cross(e[k],f[k])}}};
+THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=j.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();j.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
+j.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){n[a.index]||(n[a.index]=[]);n[b.index]||(n[b.index]=[]);var c=n[a.index][b.index];c===void 0&&(n[a.index][b.index]=n[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(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);
+for(var c=c||1,d=d||0,j=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var n=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
 THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
-THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],g,h,i,k;for(g=0;g<=a;g++){h=g/a;for(i=0;i<b;i++){k=i/b;k=c(h,k);d.push(k)}}for(g=c=0;g<a;g++){for(i=0;i<b;i++){d=(i+1)%b;e.push(new THREE.Face3(c+i,c+d,c+i+b));e.push(new THREE.Face3(c+d,c+d+b,c+i+b));f.push([new THREE.UV(g/a,i/b),new THREE.UV(g/a,(i+1)/b),new THREE.UV((g+1)/a,i/b)]);f.push([new THREE.UV(g/a,(i+1)/b),new THREE.UV((g+1)/a,(i+1)/b),new THREE.UV((g+1)/a,i/b)])}c=
+THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],g,h,j,k;for(g=0;g<=a;g++){h=g/a;for(j=0;j<b;j++){k=j/b;k=c(h,k);d.push(k)}}for(g=c=0;g<a;g++){for(j=0;j<b;j++){d=(j+1)%b;e.push(new THREE.Face3(c+j,c+d,c+j+b));e.push(new THREE.Face3(c+d,c+d+b,c+j+b));f.push([new THREE.UV(g/a,j/b),new THREE.UV(g/a,(j+1)/b),new THREE.UV((g+1)/a,j/b)]);f.push([new THREE.UV(g/a,(j+1)/b),new THREE.UV((g+1)/a,(j+1)/b),new THREE.UV((g+1)/a,j/b)])}c=
 c+b}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=new THREE.Geometry;THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry;
 THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3);a.vertices.push(new THREE.Vector3(0,100,0));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
@@ -626,183 +627,177 @@ this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);
 THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
 1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){n.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,j){var i=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(n.useOldVertexColors){i.vertexColors=[];for(var k,m,p,r=0;r<4;r++){p=h[r];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<p.length;q++){m=g.vertexColors[p[q]-1];k.r=k.r+m.r;k.g=k.g+m.g;k.b=k.b+m.b}k.r=k.r/p.length;k.g=k.g/p.length;k.b=k.b/p.length;
-i.vertexColors[r]=k}}l.push(i);if(n.supportUVs){g=[f(a,""),f(c,j),f(d,j),f(e,j)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",e+":"+j):b("c :( ",d+":"+j):b("b :( ",c+":"+j):b("a :( ",a+":"+j)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=w&&a<w+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
-b){X[a]===void 0&&(X[a]=[]);X[a].push(b)}function i(a,b,c){Q[a]===void 0&&(Q[a]={});Q[a][b]=c}var k=[],l=[],o=[],n=this,p=a.vertices,r=a.faces,k=p.concat(),m=[],q={},u={},t={},w=p.length,s,x,F,E,B,v=a.faceVertexUvs[0],z;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,w);if(n.supportUVs){s=0;for(x=v.length;s<x;s++){F=0;for(E=v[s].length;F<E;F++){z=r[s]["abcd".charAt(F)];g(z,s,v[s][F])}}}if(v.length==0)n.supportUVs=false;s=0;for(B in t)s++;if(!s){n.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-t,"vs",v.length);s=0;for(x=r.length;s<x;s++){B=r[s];m.push(B.centroid);k.push(B.centroid);if(n.supportUVs){v=new THREE.UV;if(B instanceof THREE.Face3){v.u=f(B.a,s).u+f(B.b,s).u+f(B.c,s).u;v.v=f(B.a,s).v+f(B.b,s).v+f(B.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(B instanceof THREE.Face4){v.u=f(B.a,s).u+f(B.b,s).u+f(B.c,s).u+f(B.d,s).u;v.v=f(B.a,s).v+f(B.b,s).v+f(B.c,s).v+f(B.d,s).v;v.u=v.u/4;v.v=v.v/4}g(w+s,"",v)}}b("-- added UVs for new Faces",t);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
-var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);z=0;var J,K,X={},Q={};for(s in x){v=x[s];J=s.split("_");K=J[0];J=J[1];h(K,[K,J]);h(J,[K,J]);F=0;for(E=v.length;F<E;F++){B=v[F];i(K,B,s);i(J,B,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",X,"vertexFaceMap",Q);for(s in x){v=
-x[s];B=v[0];E=v[1];J=s.split("_");K=J[0];J=J[1];v=new THREE.Vector3;if(u[s]){v.addSelf(p[K]);v.addSelf(p[J]);v.multiplyScalar(0.5)}else{v.addSelf(m[B]);v.addSelf(m[E]);v.addSelf(p[K]);v.addSelf(p[J]);v.multiplyScalar(0.25)}q[s]=w+r.length+z;k.push(v);z++;if(n.supportUVs){v=new THREE.UV;v.u=f(K,B).u+f(J,B).u;v.v=f(K,B).v+f(J,B).v;v.u=v.u/2;v.v=v.v/2;g(q[s],B,v);if(!u[s]){v=new THREE.UV;v.u=f(K,E).u+f(J,E).u;v.v=f(K,E).v+f(J,E).v;v.u=v.u/2;v.v=v.v/2;g(q[s],E,v)}}}b("-- Step 2 done");var A,M;E=["123",
-"12","2","23"];J=["123","23","3","31"];var G=["123","31","1","12"],j=["1234","12","2","23"],U=["1234","23","3","34"],W=["1234","34","4","41"],C=["1234","41","1","12"];s=0;for(x=m.length;s<x;s++){B=r[s];v=w+s;if(B instanceof THREE.Face3){z=e(B.a,B.b);K=e(B.b,B.c);A=e(B.c,B.a);d(v,q[z],B.b,q[K],B,E,s);d(v,q[K],B.c,q[A],B,J,s);d(v,q[A],B.a,q[z],B,G,s)}else if(B instanceof THREE.Face4){z=e(B.a,B.b);K=e(B.b,B.c);A=e(B.c,B.d);M=e(B.d,B.a);d(v,q[z],B.b,q[K],B,j,s);d(v,q[K],B.c,q[A],B,U,s);d(v,q[A],B.d,q[M],
-B,W,s);d(v,q[M],B.a,q[z],B,C,s)}else b("face should be a face!",B)}q=new THREE.Vector3;B=new THREE.Vector3;s=0;for(x=p.length;s<x;s++)if(X[s]!==void 0){q.set(0,0,0);B.set(0,0,0);K=new THREE.Vector3(0,0,0);v=0;for(F in Q[s]){q.addSelf(m[F]);v++}E=0;z=X[s].length;for(F=0;F<z;F++)u[e(X[s][F][0],X[s][F][1])]&&E++;if(E!=2){q.divideScalar(v);for(F=0;F<z;F++){v=X[s][F];v=p[v[0]].clone().addSelf(p[v[1]]).divideScalar(2);B.addSelf(v)}B.divideScalar(z);K.addSelf(p[s]);K.multiplyScalar(z-3);K.addSelf(q);K.addSelf(B.multiplyScalar(2));
-K.divideScalar(z);k[s]=K}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=o;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.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(m.useOldVertexColors){j.vertexColors=[];for(var k,o,p,r=0;r<4;r++){p=h[r];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<p.length;q++){o=g.vertexColors[p[q]-1];k.r=k.r+o.r;k.g=k.g+o.g;k.b=k.b+o.b}k.r=k.r/p.length;k.g=k.g/p.length;k.b=k.b/p.length;
+j.vertexColors[r]=k}}l.push(j);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?n.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=x&&a<x+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
+b){X[a]===void 0&&(X[a]=[]);X[a].push(b)}function j(a,b,c){Q[a]===void 0&&(Q[a]={});Q[a][b]=c}var k=[],l=[],n=[],m=this,p=a.vertices,r=a.faces,k=p.concat(),o=[],q={},u={},t={},x=p.length,s,w,G,E,B,v=a.faceVertexUvs[0],A;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,x);if(m.supportUVs){s=0;for(w=v.length;s<w;s++){G=0;for(E=v[s].length;G<E;G++){A=r[s]["abcd".charAt(G)];g(A,s,v[s][G])}}}if(v.length==0)m.supportUVs=false;s=0;for(B in t)s++;if(!s){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
+t,"vs",v.length);s=0;for(w=r.length;s<w;s++){B=r[s];o.push(B.centroid);k.push(B.centroid);if(m.supportUVs){v=new THREE.UV;if(B instanceof THREE.Face3){v.u=f(B.a,s).u+f(B.b,s).u+f(B.c,s).u;v.v=f(B.a,s).v+f(B.b,s).v+f(B.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(B instanceof THREE.Face4){v.u=f(B.a,s).u+f(B.b,s).u+f(B.c,s).u+f(B.d,s).u;v.v=f(B.a,s).v+f(B.b,s).v+f(B.c,s).v+f(B.d,s).v;v.u=v.u/4;v.v=v.v/4}g(x+s,"",v)}}b("-- added UVs for new Faces",t);w=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
+var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);A=0;var J,K,X={},Q={};for(s in w){v=w[s];J=s.split("_");K=J[0];J=J[1];h(K,[K,J]);h(J,[K,J]);G=0;for(E=v.length;G<E;G++){B=v[G];j(K,B,s);j(J,B,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",X,"vertexFaceMap",Q);for(s in w){v=
+w[s];B=v[0];E=v[1];J=s.split("_");K=J[0];J=J[1];v=new THREE.Vector3;if(u[s]){v.addSelf(p[K]);v.addSelf(p[J]);v.multiplyScalar(0.5)}else{v.addSelf(o[B]);v.addSelf(o[E]);v.addSelf(p[K]);v.addSelf(p[J]);v.multiplyScalar(0.25)}q[s]=x+r.length+A;k.push(v);A++;if(m.supportUVs){v=new THREE.UV;v.u=f(K,B).u+f(J,B).u;v.v=f(K,B).v+f(J,B).v;v.u=v.u/2;v.v=v.v/2;g(q[s],B,v);if(!u[s]){v=new THREE.UV;v.u=f(K,E).u+f(J,E).u;v.v=f(K,E).v+f(J,E).v;v.u=v.u/2;v.v=v.v/2;g(q[s],E,v)}}}b("-- Step 2 done");var z,M;E=["123",
+"12","2","23"];J=["123","23","3","31"];var F=["123","31","1","12"],i=["1234","12","2","23"],U=["1234","23","3","34"],W=["1234","34","4","41"],C=["1234","41","1","12"];s=0;for(w=o.length;s<w;s++){B=r[s];v=x+s;if(B instanceof THREE.Face3){A=e(B.a,B.b);K=e(B.b,B.c);z=e(B.c,B.a);d(v,q[A],B.b,q[K],B,E,s);d(v,q[K],B.c,q[z],B,J,s);d(v,q[z],B.a,q[A],B,F,s)}else if(B instanceof THREE.Face4){A=e(B.a,B.b);K=e(B.b,B.c);z=e(B.c,B.d);M=e(B.d,B.a);d(v,q[A],B.b,q[K],B,i,s);d(v,q[K],B.c,q[z],B,U,s);d(v,q[z],B.d,q[M],
+B,W,s);d(v,q[M],B.a,q[A],B,C,s)}else b("face should be a face!",B)}q=new THREE.Vector3;B=new THREE.Vector3;s=0;for(w=p.length;s<w;s++)if(X[s]!==void 0){q.set(0,0,0);B.set(0,0,0);K=new THREE.Vector3(0,0,0);v=0;for(G in Q[s]){q.addSelf(o[G]);v++}E=0;A=X[s].length;for(G=0;G<A;G++)u[e(X[s][G][0],X[s][G][1])]&&E++;if(E!=2){q.divideScalar(v);for(G=0;G<A;G++){v=X[s][G];v=p[v[0]].clone().addSelf(p[v[1]]).divideScalar(2);B.addSelf(v)}B.divideScalar(A);K.addSelf(p[s]);K.multiplyScalar(A-3);K.addSelf(q);K.addSelf(B.multiplyScalar(2));
+K.divideScalar(A);k[s]=K}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=n;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.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
-d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
+d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,j="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
+if(a.shading){var l=a.shading.toLowerCase();l==="phong"?j="MeshPhongMaterial":l==="basic"&&(j="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;
 if(a.colorDiffuse)k.color=g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=k.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(k.map){l.tDiffuse.texture=k.map;l.enableDiffuse.value=true}if(k.specularMap){l.tSpecular.texture=k.specularMap;l.enableSpecular.value=true}if(k.lightMap){l.tAO.texture=k.lightMap;
-l.enableAO.value=true}l.uDiffuseColor.value.setHex(k.color);l.uSpecularColor.value.setHex(k.specular);l.uAmbientColor.value.setHex(k.ambient);l.uShininess.value=k.shininess;if(k.opacity!==void 0)l.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else k=new THREE[i](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){j=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(j.uniforms);l.tNormal.texture=k.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(k.map){l.tDiffuse.texture=k.map;l.enableDiffuse.value=true}if(k.specularMap){l.tSpecular.texture=k.specularMap;l.enableSpecular.value=true}if(k.lightMap){l.tAO.texture=k.lightMap;
+l.enableAO.value=true}l.uDiffuseColor.value.setHex(k.color);l.uSpecularColor.value.setHex(k.specular);l.uAmbientColor.value.setHex(k.ambient);l.uShininess.value=k.shininess;if(k.opacity!==void 0)l.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:l,lights:true,fog:true})}else k=new THREE[j](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};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,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,l,o,n,p,r,m,q,u,t,w,s;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function B(b,c){var d,e,f,g,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=G[e*2];e=G[e*2+1];j=G[f*2];i=G[f*2+1];f=G[g*2];k=G[g*2+1];g=Q.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(j,i));m.push(new THREE.UV(f,
-k));g.push(m)}}function v(b,c){var d,e,f,g,h,j,i,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];j=G[e*2];e=G[e*2+1];i=G[f*2];l=G[f*2+1];k=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=Q.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function z(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=j[d];
-Q.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function J(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];Q.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}}function K(b,c,d,e){for(var f,g,h,j,i,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];i=d[e*3];k=d[e*3+1];l=d[e*3+2];j=m[e];var n=M[k*3],o=M[k*3+1];k=M[k*3+2];var p=M[l*3],
-r=M[l*3+1];l=M[l*3+2];Q.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(M[i*3],M[i*3+1],M[i*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,j))}}function X(b,c,d,e){for(var f,g,h,j,i,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];j=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];i=o[e];var p=M[l*3],r=M[l*3+1];l=M[l*3+2];var q=M[m*3],s=M[m*3+1];m=M[m*3+2];var t=M[n*3],u=M[n*3+1];n=M[n*3+2];Q.faces.push(new THREE.Face4(f,
-g,h,j,[new THREE.Vector3(M[k*3],M[k*3+1],M[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,i))}}var Q=this,A=0,M=[],G=[],j,U,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Q,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,A,12);c=F(a,A+12);F(a,A+13);F(a,A+14);F(a,A+15);e=F(a,A+16);i=F(a,A+17);k=F(a,A+18);l=F(a,A+19);o=E(a,A+20);n=E(a,A+20+4);p=E(a,A+20+8);b=E(a,A+20+12);r=
-E(a,A+20+16);m=E(a,A+20+20);q=E(a,A+20+24);u=E(a,A+20+28);t=E(a,A+20+32);w=E(a,A+20+36);s=E(a,A+20+40);A=A+c;c=e*3+l;W=e*4+l;j=b*c;U=r*(c+i*3);e=m*(c+k*3);l=q*(c+i*3+k*3);c=u*W;i=t*(W+i*4);k=w*(W+k*4);A=A+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];Q.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(A);A=A+function(b){if(n){var b=new Int8Array(a,b,n*3),c,d,e,f;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];M.push(d/
-127,e/127,f/127)}}return n*3*Int8Array.BYTES_PER_ELEMENT}(A);A=A+x(n*3);A=A+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(A);j=A+j+x(b*2);U=j+U+x(r*2);e=U+e+x(m*2);l=e+l+x(q*2);c=l+c+x(u*2);i=c+i+x(t*2);k=i+k+x(w*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;z(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);B(m,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-q*Uint32Array.BYTES_PER_ELEMENT*3;K(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);B(q,c)}})(e);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;J(w,a,b+w*Uint32Array.BYTES_PER_ELEMENT*4);v(w,b)}})(i);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;X(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(k);b&&z(b,A,A+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;K(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(j);u&&J(u,l,l+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;X(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
-THREE.ColladaLoader=function(){function a(a,d,e){fa=a;d=d||ta;if(e!==void 0){a=e.split("/");a.pop();ua=(a.length<1?".":a.join("/"))+"/"}if((a=fa.evaluate("//dae:asset",fa,Y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var j=a.childNodes[e];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":Xa=j.textContent.charAt(0)}}if(!Ha.convertUpAxis||Xa===Ha.upAxis)ma=null;else switch(Xa){case "X":ma=Ha.upAxis===
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,j,k,l,n,m,p,r,o,q,u,t,x,s;function w(a){return a%4?4-a%4:0}function G(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function B(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=F[e*2];e=F[e*2+1];i=F[f*2];j=F[f*2+1];f=F[g*2];k=F[g*2+1];g=Q.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
+k));g.push(m)}}function v(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=F[e*2];e=F[e*2+1];j=F[f*2];l=F[f*2+1];k=F[g*2];m=F[g*2+1];g=F[h*2];f=F[h*2+1];h=Q.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function A(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
+Q.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function J(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];Q.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function K(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var n=M[k*3],o=M[k*3+1];k=M[k*3+2];var p=M[l*3],
+r=M[l*3+1];l=M[l*3+2];Q.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(M[j*3],M[j*3+1],M[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,i))}}function X(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];j=o[e];var p=M[l*3],r=M[l*3+1];l=M[l*3+2];var q=M[m*3],s=M[m*3+1];m=M[m*3+2];var t=M[n*3],u=M[n*3+1];n=M[n*3+2];Q.faces.push(new THREE.Face4(f,
+g,h,i,[new THREE.Vector3(M[k*3],M[k*3+1],M[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,j))}}var Q=this,z=0,M=[],F=[],i,U,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Q,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,z,12);c=G(a,z+12);G(a,z+13);G(a,z+14);G(a,z+15);e=G(a,z+16);j=G(a,z+17);k=G(a,z+18);l=G(a,z+19);n=E(a,z+20);m=E(a,z+20+4);p=E(a,z+20+8);b=E(a,z+20+12);r=
+E(a,z+20+16);o=E(a,z+20+20);q=E(a,z+20+24);u=E(a,z+20+28);t=E(a,z+20+32);x=E(a,z+20+36);s=E(a,z+20+40);z=z+c;c=e*3+l;W=e*4+l;i=b*c;U=r*(c+j*3);e=o*(c+k*3);l=q*(c+j*3+k*3);c=u*W;j=t*(W+j*4);k=x*(W+k*4);z=z+function(b){var b=new Float32Array(a,b,n*3),c,d,e,f;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];Q.vertices.push(new THREE.Vector3(d,e,f))}return n*3*Float32Array.BYTES_PER_ELEMENT}(z);z=z+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];M.push(d/
+127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(z);z=z+w(m*3);z=z+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];F.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(z);i=z+i+w(b*2);U=i+U+w(r*2);e=U+e+w(o*2);l=e+l+w(q*2);c=l+c+w(u*2);j=c+j+w(t*2);k=j+k+w(x*2);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*3;A(o,a,b+o*Uint32Array.BYTES_PER_ELEMENT*3);B(o,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+q*Uint32Array.BYTES_PER_ELEMENT*3;K(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);B(q,c)}})(e);(function(a){if(x){var b=a+x*Uint32Array.BYTES_PER_ELEMENT*4;J(x,a,b+x*Uint32Array.BYTES_PER_ELEMENT*4);v(x,b)}})(j);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;X(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(k);b&&A(b,z,z+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;K(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
+3)}})(i);u&&J(u,l,l+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;X(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+THREE.ColladaLoader=function(){function a(a,d,e){fa=a;d=d||ta;if(e!==void 0){a=e.split("/");a.pop();ua=(a.length<1?".":a.join("/"))+"/"}if((a=fa.evaluate("//dae:asset",fa,Y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Xa=i.textContent.charAt(0)}}if(!Ha.convertUpAxis||Xa===Ha.upAxis)ma=null;else switch(Xa){case "X":ma=Ha.upAxis===
 "Y"?"XtoY":"XtoZ";break;case "Y":ma=Ha.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":ma=Ha.upAxis==="X"?"ZtoX":"ZtoY"}Sa=b("//dae:library_images/dae:image",g,"image");Ja=b("//dae:library_materials/dae:material",v,"material");db=b("//dae:library_effects/dae:effect",Q,"effect");Ya=b("//dae:library_geometries/dae:geometry",q,"geometry");hb=b(".//dae:library_cameras/dae:camera",W,"camera");Wa=b("//dae:library_controllers/dae:controller",h,"controller");sa=b("//dae:library_animations/dae:animation",M,"animation");
 Oa=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");va=[];ab=[];if(a=fa.evaluate(".//dae:scene/dae:instance_visual_scene",fa,Y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext()){a=a.getAttribute("url").replace(/^#/,"");xa=Oa[a.length>0?a:"visual_scene0"]}else xa=null;Ma=new THREE.Object3D;for(a=0;a<xa.nodes.length;a++)Ma.add(f(xa.nodes[a]));mb=[];c(Ma);a={scene:Ma,morphs:va,skins:ab,animations:mb,dae:{images:Sa,materials:Ja,cameras:hb,effects:db,geometries:Ya,controllers:Wa,
 animations:sa,visualScenes:Oa,scene:xa}};d&&d(a);return a}function b(a,b,c){for(var a=fa.evaluate(a,fa,Y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=xa.getChildById(a.name,true),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};mb.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,
 b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}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 e(a,b,c){var e,
-f=Wa[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in sa)for(var j=sa[e],i=0;i<j.sampler.length;i++){var k=j.sampler[i];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=xa.getChildById(b.skeleton[0],true)||xa.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,
-n,i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i]);for(c=0;c<e;c++){h=[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vector3);d(b,h,c);i=h;k=f.skin;for(m=0;m<i.length;m++){l=i[m];n=-1;if(l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var r=
-k.weights[o][p];r.joint==n&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}}for(i=0;i<h.length;i++)if(h[i].type=="JOINT")for(k=0;k<h[i].weights.length;k++){l=h[i].weights[k];m=l.index;l=l.weight;n=a.vertices[m];m=j[m];g.x=n.x;g.y=n.y;g.z=n.z;h[i].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*l;m.y=m.y+g.y*l;m.z=m.z+g.z*l}a.morphTargets.push({name:"target_"+c,vertices:j})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=Wa[a.controllers[g].url];
-switch(j.type){case "skin":if(Ya[j.skin.source]){var i=new m;i.url=j.skin.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(Wa[j.skin.source]){d=j=Wa[j.skin.source];if(j.morph&&Ya[j.morph.source]){i=new m;i.url=j.morph.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i)}}break;case "morph":if(Ya[j.morph.source]){i=new m;i.url=j.morph.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);
-d=a.controllers[g]}console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=Ya[j.url],k={},l=[],n=0,o;if(j&&j.mesh&&j.mesh.primitives){if(b.name.length==0)b.name=j.id;if(i)for(h=0;h<i.length;h++){o=i[h];var r=Ja[o.target],q=db[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[o.symbol]=n;l.push(q.material);o=q.material;o.name=r.name==null||r.name===""?r.id:r.name;
-n++}i=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(n>1){i=new THREE.MeshFaceMaterial;j.materials=l;for(h=0;h<j.faces.length;h++){l=j.faces[h];l.materialIndex=k[l.daeMaterial]}}if(c!==void 0){e(j,c);i.morphTargets=true;i=new THREE.SkinnedMesh(j,i);i.skeleton=c.skeleton;i.skinController=Wa[c.url];i.skinInstanceController=c;i.name="skin_"+ab.length;ab.push(i)}else if(d!==void 0){h=j;k=d instanceof p?Wa[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++){n=Ya[k.targets[l]];if(n.mesh&&n.mesh.primitives&&n.mesh.primitives.length){n=n.mesh.primitives[0].geometry;n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=true;i=new THREE.Mesh(j,i);i.name="morph_"+va.length;va.push(i)}else i=new THREE.Mesh(j,i);a.geometries.length>1?b.add(i):b=i}}for(g=0;g<a.cameras.length;g++){b=hb[a.cameras[g].url];
+f=Wa[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in sa)for(var i=sa[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=xa.getChildById(b.skeleton[0],true)||xa.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,
+n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j]);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vector3);d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){l=j[m];n=-1;if(l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var r=
+k.weights[o][p];r.joint==n&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++){l=h[j].weights[k];m=l.index;l=l.weight;n=a.vertices[m];m=i[m];g.x=n.x;g.y=n.y;g.z=n.z;h[j].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*l;m.y=m.y+g.y*l;m.z=m.z+g.z*l}a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=Wa[a.controllers[g].url];
+switch(i.type){case "skin":if(Ya[i.skin.source]){var j=new o;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(Wa[i.skin.source]){d=i=Wa[i.skin.source];if(i.morph&&Ya[i.morph.source]){j=new o;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j)}}break;case "morph":if(Ya[i.morph.source]){j=new o;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);
+d=a.controllers[g]}console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=Ya[i.url],k={},l=[],m=0,n;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){n=j[h];var r=Ja[n.target],q=db[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[n.symbol]=m;l.push(q.material);n=q.material;n.name=r.name==null||r.name===""?r.id:r.name;
+m++}j=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++){l=i.faces[h];l.materialIndex=k[l.daeMaterial]}}if(c!==void 0){e(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=Wa[c.url];j.skinInstanceController=c;j.name="skin_"+ab.length;ab.push(j)}else if(d!==void 0){h=i;k=d instanceof p?Wa[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++){m=Ya[k.targets[l]];if(m.mesh&&m.mesh.primitives&&m.mesh.primitives.length){m=m.mesh.primitives[0].geometry;m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+va.length;va.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=hb[a.cameras[g].url];
 b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar)}b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=true;b.scale=g[2];if(Ha.centerGeometry&&b.geometry){g=THREE.GeometryUtils.center(b.geometry);b.quaternion.multiplyVector3(g.multiplySelf(b.scale));b.position.subSelf(g)}for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){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 n(){this.type=this.sid="";this.data=[];this.obj=null}function p(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){t.call(this);this.vcount=[]}function s(){t.call(this);this.vcount=3}function x(){this.source="";this.stride=
-this.count=0;this.params=[]}function F(){this.input={}}function E(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function z(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function J(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=
-null}function X(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function A(){this.url=""}function M(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function j(a){this.id="";this.animation=a;this.inputs=[];
+null}function j(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.obj=null}function p(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function o(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function x(){t.call(this);this.vcount=[]}function s(){t.call(this);this.vcount=3}function w(){this.source="";this.stride=
+this.count=0;this.params=[]}function G(){this.input={}}function E(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function J(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=
+null}function X(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function z(){this.url=""}function M(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function i(a){this.id="";this.animation=a;this.inputs=[];
 this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function U(a){this.targets=[];this.time=a}function W(){this.technique=this.name=this.id=""}function C(){this.url=""}function Y(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function H(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function ba(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function ga(a){return a.length>
 0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(a,b){if(Ha.convertUpAxis&&Xa!==Ha.upAxis)switch(ma){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1];a[1]=a[2];a[2]=b*c}}function S(a,b){var c=[a[b],
 a[b+1],a[b+2]];P(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ca(a){if(Ha.convertUpAxis){var b=[a[0],a[4],a[8]];P(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];P(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];P(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];P(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];P(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];P(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];P(b,-1);a[3]=b[0];a[7]=b[1];a[11]=
 b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}function T(a){if(Ha.convertUpAxis)switch(a){case "X":switch(ma){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ma){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ma){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var fa=null,Ma=null,xa,ta=null,Na={},
 Sa={},sa={},Wa={},Ya={},Ja={},db={},hb={},mb,Oa,ua,va,ab,ja=THREE.SmoothShading,Ha={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y"},Xa="Y",ma=null,Fb=Math.PI/180;g.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 B).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++){a=c[d];e=b[a.source];switch(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=[];
+a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new j).parse(c);this.type=c.nodeName}}return this};j.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 B).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++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};j.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=ca(f);break;case "source":f=(new B).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=ba(g.textContent);break;case "vcount":d=ba(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){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]}}j.push(k);g=g+e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};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=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){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return 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");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++){b=a.childNodes[c];
-if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":this.cameras.push((new C).parse(b));break;case "instance_controller":this.controllers.push((new p).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=fa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",fa,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 n).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in sa)for(var e=sa[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=[];a=[];c=0;for(e=this.channels.length;c<e;c++){var j=this.channels[c],f=j.fullSid,g=j.sampler,h=g.input,i=this.getTransformBySid(j.sid),k;if(j.arrIndices){k=[];b=0;for(var l=j.arrIndices.length;b<l;b++){var r=k,q=b,s=j.arrIndices[b];if(s>-1&&s<3){s=T(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[q]=s}}else k=T(j.member);if(i){a.indexOf(f)===-1&&a.push(f);b=0;for(l=h.length;b<l;b++){for(var r=h[b],j=g.getData(i.type,b),q=null,s=0,t=d.length;s<t&&q==null;s++){var u=d[s];if(u.time===
-r)q=u;else if(u.time>r)break}if(!q){q=new U(r);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=r&&(s=t);r=s;d.splice(r==-1?d.length:r,0,q)}q.addTarget(f,i,k,j)}}else console.log('Could not find transform "'+j.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){q=d[b];if(!q.hasTarget(e)){h=d;f=q;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=i>=0?i:i+h.length;i>=0;i--){l=h[i];if(l.hasTarget(g)){i=l;break a}}i=null}l=void 0;a:{for(k=k+1;k<h.length;k++){l=h[k];if(l.hasTarget(g))break a}l=
-null}if(i&&l){h=(f.time-i.time)/(l.time-i.time);i=i.getTarget(g);k=l.getTarget(g).data;l=i.data;j=void 0;if(i.type==="matrix")j=l;else if(l.length){j=[];for(r=0;r<l.length;++r)j[r]=l[r]+(k[r]-l[r])*h}else j=l+(k-l)*h;f.addTarget(g,i.transform,i.member,j)}}}}this.keys=d;this.sids=a}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");
-this.type=a.nodeName;this.data=H(a.textContent);this.convert();return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ca(this.data);break;case "rotate":this.angle=this.data[3]*Fb;case "translate":P(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":P(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};n.prototype.apply=
-function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};n.prototype.update=function(a,b){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;
+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 n).parse(c))}}return this};n.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){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return c}}return null};n.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};n.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};n.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};n.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.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++){b=a.childNodes[c];
+if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new n).parse(b));break;case "instance_camera":this.cameras.push((new C).parse(b));break;case "instance_controller":this.controllers.push((new p).parse(b));break;case "instance_geometry":this.geometries.push((new o).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=fa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",fa,Y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&
+this.nodes.push((new n).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 sa)for(var e=sa[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=[];a=[];c=0;for(e=this.channels.length;c<e;c++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),k;if(i.arrIndices){k=[];b=0;for(var l=i.arrIndices.length;b<l;b++){var r=k,q=b,s=i.arrIndices[b];if(s>-1&&s<3){s=T(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[q]=s}}else k=T(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(l=h.length;b<l;b++){for(var r=h[b],i=g.getData(j.type,b),q=null,s=0,t=d.length;s<t&&q==null;s++){var u=d[s];if(u.time===
+r)q=u;else if(u.time>r)break}if(!q){q=new U(r);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=r&&(s=t);r=s;d.splice(r==-1?d.length:r,0,q)}q.addTarget(f,j,k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){q=d[b];if(!q.hasTarget(e)){h=d;f=q;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){l=h[j];if(l.hasTarget(g)){j=l;break a}}j=null}l=void 0;a:{for(k=k+1;k<h.length;k++){l=h[k];if(l.hasTarget(g))break a}l=
+null}if(j&&l){h=(f.time-j.time)/(l.time-j.time);j=j.getTarget(g);k=l.getTarget(g).data;l=j.data;i=void 0;if(j.type==="matrix")i=l;else if(l.length){i=[];for(r=0;r<l.length;++r)i[r]=l[r]+(k[r]-l[r])*h}else i=l+(k-l)*h;f.addTarget(g,j.transform,j.member,i)}}}}this.keys=d;this.sids=a}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");
+this.type=a.nodeName;this.data=H(a.textContent);this.convert();return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ca(this.data);break;case "rotate":this.angle=this.data[3]*Fb;case "translate":P(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":P(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};m.prototype.apply=
+function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};m.prototype.update=function(a,b){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;
 case 2:this.obj.n13=a[0];this.obj.n23=a[1];this.obj.n33=a[2];this.obj.n43=a[3];break;case 3:this.obj.n14=a[0];this.obj.n24=a[1];this.obj.n34=a[2];this.obj.n44=a[3]}else b.length===2?this.obj["n"+(b[0]+1)+(b[1]+1)]=a:console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(a);break;case "translate":case "scale":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=
 a[0];this.obj.y=a[1];this.obj.z=a[2]}break;case "rotate":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*Fb;break;default:this.obj.x=a[0];this.obj.y=a[1];this.obj.z=a[2];this.angle=a[3]*Fb}}};p.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=fa.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=
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=fa.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};o.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=fa.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};q.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){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");Na[d]==void 0&&(Na[d]=(new B(d)).parse(c));break;case "vertices":this.vertices=(new F).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":this.primitives.push((new t).parse(c));break;case "polylist":this.primitives.push((new w).parse(c))}}this.geometry3js=
+(new u(this)).parse(c)}}return this};u.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");Na[d]==void 0&&(Na[d]=(new B(d)).parse(c));break;case "vertices":this.vertices=(new G).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":this.primitives.push((new t).parse(c));break;case "polylist":this.primitives.push((new x).parse(c))}}this.geometry3js=
 new THREE.Geometry;a=Na[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push(S(a,b).clone());for(b=0;b<this.primitives.length;b++){a=this.primitives[b];a.setVertices(this.vertices);this.handlePrimitive(a,this.geometry3js)}this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();return this};
-u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,k=0,l=3,m=0,n=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+1;m=m<l?l:m;switch(g.semantic){case "TEXCOORD":n.push(g.set)}}for(var o=0;o<e.length;++o)for(var p=e[o],r=0;r<p.length;){var q=[],s=[],t={},u=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Na[g.source];h=p[r+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":q.push(h);break;
-case "NORMAL":s.push(S(j.data,i));break;case "TEXCOORD":t[g.set]===void 0&&(t[g.set]=[]);t[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));break;case "COLOR":u.push((new THREE.Color).setRGB(j.data[i],j.data[i+1],j.data[i+2]))}}d=null;c=[];if(s.length==0)if(g=this.vertices.input.NORMAL){j=Na[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push(S(j.data,q[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(q[0],q[1],q[2],s,u.length?u:new THREE.Color));else if(l===4)c.push(new THREE.Face4(q[0],
+u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,j,i,k=0,l=3,m=0,n=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+1;m=m<l?l:m;switch(g.semantic){case "TEXCOORD":n.push(g.set)}}for(var o=0;o<e.length;++o)for(var p=e[o],r=0;r<p.length;){var q=[],s=[],t={},u=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];i=Na[g.source];h=p[r+c*m+g.offset];j=i.accessor.params.length;j=h*j;switch(g.semantic){case "VERTEX":q.push(h);break;
+case "NORMAL":s.push(S(i.data,j));break;case "TEXCOORD":t[g.set]===void 0&&(t[g.set]=[]);t[g.set].push(new THREE.UV(i.data[j],1-i.data[j+1]));break;case "COLOR":u.push((new THREE.Color).setRGB(i.data[j],i.data[j+1],i.data[j+2]))}}d=null;c=[];if(s.length==0)if(g=this.vertices.input.NORMAL){i=Na[g.source];j=i.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push(S(i.data,q[g]*j))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(q[0],q[1],q[2],s,u.length?u:new THREE.Color));else if(l===4)c.push(new THREE.Face4(q[0],
 q[1],q[2],q[3],s,u.length?u:new THREE.Color));else if(l>4&&Ha.subdivideFaces){u=u.length?u:new THREE.Color;for(d=1;d<l-1;)c.push(new THREE.Face3(q[0],q[d],q[d+1],[s[0],s[d++],s[d]],u))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<n.length;d++){q=t[n[d]];q=l>4?[q[0],q[g+1],q[g+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(q)}}}else console.log("dropped face with vcount "+l+" for geometry with id: "+
 b.id);r=r+m*l}};t.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};t.prototype.parse=function(a){this.material=a.getAttribute("material");this.count=la(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=ba(c.textContent);break;case "p":this.p.push(ba(c.textContent));
-break;case "ph":console.warn("polygon holes not yet supported!")}}return this};w.prototype=new t;w.prototype.constructor=w;s.prototype=new t;s.prototype.constructor=s;x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(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};F.prototype.parse=
+break;case "ph":console.warn("polygon holes not yet supported!")}}return this};x.prototype=new t;x.prototype.constructor=x;s.prototype=new t;s.prototype.constructor=s;w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(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};G.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=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};B.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=ga(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:false);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=ba(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ga(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 x).parse(c.childNodes[d]);break}}}return this};B.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=b+16){var c=this.data.slice(b,b+16),c=ca(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};v.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 A).parse(a.childNodes[b]);break}return this};z.prototype.isColor=function(){return this.texture==null};z.prototype.isTexture=function(){return this.texture!=null};z.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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");this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1};this.parseTexture(c)}}return this};z.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1])}for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=
-parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};J.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 z).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=fa.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};J.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 z)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+"accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};B.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=b+16){var c=this.data.slice(b,b+16),c=ca(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};v.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 z).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.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");this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1};this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1])}for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=
+parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};J.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 A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=fa.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};J.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 A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
 this.effect.surface.sid){var e=Sa[this.effect.surface.init_from];if(e){e=THREE.ImageUtils.loadTexture(ua+e.init_from);e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;e.offset.x=d.texOpts.offsetU;e.offset.y=d.texOpts.offsetV;e.repeat.x=d.texOpts.repeatU;e.repeat.y=d.texOpts.repeatV;a.map=e;c=="emission"&&(a.emissive=16777215)}}}else if(c=="diffuse"||!b)c=="emission"?a.emissive=d.color.getHex():a[c]=d.color.getHex();
 break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=ja;switch(this.type){case "constant":a.color=a.emission;this.material=new THREE.MeshBasicMaterial(a);break;case "phong":case "blinn":a.color=a.diffuse;this.material=new THREE.MeshPhongMaterial(a);break;default:a.color=a.diffuse;this.material=new THREE.MeshLambertMaterial(a)}return this.material};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 "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};X.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};Q.prototype.create=function(){if(this.shader==null)return null};Q.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};
 Q.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 K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new X(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};Q.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 "image":d=(new g).parse(d);Sa[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};Q.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 "constant":case "lambert":case "blinn":case "phong":this.shader=(new J(c.nodeName,this)).parse(c)}}};A.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
-"");return this};M.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 "animation":var c=(new M).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new B).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new j(this)).parse(c));
-break;case "channel":this.channel.push((new G(this)).parse(c))}}return this};G.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;if(c){b=a.split(".");this.sid=b.shift();this.member=b.shift()}else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=
-a;this.dotSyntax=c;this.arrSyntax=d;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 E).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();this.strideOut=
-c.accessor.stride;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}};j.prototype.getData=function(a,b){var c;if(a==="matrix"&&
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "image":d=(new g).parse(d);Sa[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};Q.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 "constant":case "lambert":case "blinn":case "phong":this.shader=(new J(c.nodeName,this)).parse(c)}}};z.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
+"");return this};M.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 "animation":var c=(new M).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new B).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new i(this)).parse(c));
+break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.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;if(c){b=a.split(".");this.sid=b.shift();this.member=b.shift()}else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=
+a;this.dotSyntax=c;this.arrSyntax=d;return this};i.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};i.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();this.strideOut=
+c.accessor.stride;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}};i.prototype.getData=function(a,b){var c;if(a==="matrix"&&
 this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":P(c,-1);break;case "scale":P(c,1)}else this.strideOut===4&&a==="matrix"&&P(c,-1)}else c=this.output[b];return c};U.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};U.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];
 (!a||c.sid===a)&&c.transform.update(c.data,c.member)}};U.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};U.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return true;return false};U.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(d.transform.type!=="matrix"&&e){var f=(b-this.time)/(a.time-this.time),
-g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?0:1}if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};W.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};W.prototype.parseOptics=function(a){for(var b=
+g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?0:1}if(h.length)for(var e=[],j=0;j<h.length;++j)e[j]=h[j]+(g[j]-h[j])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};W.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};W.prototype.parseOptics=function(a){for(var b=
 0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="technique_common")for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++){this.technique=c.childNodes[d].nodeName;if(this.technique=="perspective")for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "yfov":this.yfov=g.textContent;break;case "xfov":this.xfov=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=
 g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(g.nodeName){case "xmag":this.xmag=g.textContent;break;case "ymag":this.ymag=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}}}return this};C.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=
 0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4){if(f.status==0||f.status==200)if(f.responseXML){ta=c;a(f.responseXML,void 0,b)}else console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else if(f.readyState==3&&d){e==0&&(e=f.getResponseHeader("Content-Length"));d({total:e,loaded:f.responseText.length})}};f.open("GET",b,true);f.send(null)}else alert("Don't know how to parse XML!")},
 parse:a,setPreferredShading:function(a){ja=a},applySkin:e,geometries:Ya,options:Ha}};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,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
 e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,k,l,o,n,p,r,m,q,u,t,w,s=a.faces;o=a.vertices;var x=a.normals,F=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(l=o.length;k<l;){n=new THREE.Vector3;n.x=o[k++]*b;n.y=o[k++]*b;n.z=o[k++]*b;d.vertices.push(n)}k=0;for(l=s.length;k<l;){b=s[k++];o=b&1;i=b&2;c=b&
-4;e=b&8;p=b&16;n=b&32;m=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=s[k++];q.b=s[k++];q.c=s[k++];q.d=s[k++];o=4}else{q=new THREE.Face3;q.a=s[k++];q.b=s[k++];q.c=s[k++];o=3}if(i){i=s[k++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<E;c++){u=a.uvs[c];r=s[k++];w=u[r*2];r=u[r*2+1];d.faceUvs[c][i]=new THREE.UV(w,r)}if(e)for(c=0;c<E;c++){u=a.uvs[c];t=[];for(e=0;e<o;e++){r=s[k++];w=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(w,r)}d.faceVertexUvs[c][i]=t}if(p){p=s[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
-e.z=x[p];q.normal=e}if(n)for(c=0;c<o;c++){p=s[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(m){n=s[k++];n=new THREE.Color(F[n]);q.color=n}if(b)for(c=0;c<o;c++){n=s[k++];n=new THREE.Color(F[n]);q.vertexColors.push(n)}d.faces.push(q)}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){e=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,l,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;i=0;for(k=o.length;i<k;i=i+3){var n=new THREE.Vector3;n.x=o[i]*b;n.y=o[i+1]*b;n.z=o[i+2]*b;l.push(n)}}}if(a.morphColors!==
-void 0){c=0;for(e=a.morphColors.length;c<e;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=b+3){o=new THREE.Color(16755200);o.setRGB(l[b],l[b+1],l[b+2]);k.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,j,k,l,n,m,p,r,o,q,u,t,x,s=a.faces;n=a.vertices;var w=a.normals,G=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(l=n.length;k<l;){m=new THREE.Vector3;m.x=n[k++]*b;m.y=n[k++]*b;m.z=n[k++]*b;d.vertices.push(m)}k=0;for(l=s.length;k<l;){b=s[k++];n=b&1;j=b&2;c=b&
+4;e=b&8;p=b&16;m=b&32;o=b&64;b=b&128;if(n){q=new THREE.Face4;q.a=s[k++];q.b=s[k++];q.c=s[k++];q.d=s[k++];n=4}else{q=new THREE.Face3;q.a=s[k++];q.b=s[k++];q.c=s[k++];n=3}if(j){j=s[k++];q.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<E;c++){u=a.uvs[c];r=s[k++];x=u[r*2];r=u[r*2+1];d.faceUvs[c][j]=new THREE.UV(x,r)}if(e)for(c=0;c<E;c++){u=a.uvs[c];t=[];for(e=0;e<n;e++){r=s[k++];x=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(x,r)}d.faceVertexUvs[c][j]=t}if(p){p=s[k++]*3;e=new THREE.Vector3;e.x=w[p++];e.y=w[p++];
+e.z=w[p];q.normal=e}if(m)for(c=0;c<n;c++){p=s[k++]*3;e=new THREE.Vector3;e.x=w[p++];e.y=w[p++];e.z=w[p];q.vertexNormals.push(e)}if(o){m=s[k++];m=new THREE.Color(G[m]);q.color=m}if(b)for(c=0;c<n;c++){m=s[k++];m=new THREE.Color(G[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,k,l,n;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;j=0;for(k=n.length;j<k;j=j+3){var m=new THREE.Vector3;m.x=n[j]*b;m.y=n[j+1]*b;m.z=n[j+2]*b;l.push(m)}}}if(a.morphColors!==
+void 0){c=0;for(e=a.morphColors.length;c<e;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(j=l.length;b<j;b=b+3){n=new THREE.Color(16755200);n.setRGB(l[b],l[b+1],l[b+2]);k.push(n)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(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,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(n in A.objects)if(!C.objects[n]){u=A.objects[n];if(u.geometry!==void 0){if(J=C.geometries[u.geometry]){a=false;K=C.materials[u.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&J.computeTangents();x=u.position;F=u.rotation;E=u.quaternion;B=u.scale;t=u.matrix;E=0;u.materials.length==0&&(K=new THREE.MeshFaceMaterial);u.materials.length>1&&(K=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(J,K);a.name=n;if(t){a.matrixAutoUpdate=false;a.matrix.set(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}else{a.position.set(x[0],x[1],x[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(B[0],B[1],B[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;C.scene.add(a);C.objects[n]=a}}else{x=u.position;F=u.rotation;E=u.quaternion;
-B=u.scale;E=0;a=new THREE.Object3D;a.name=n;a.position.set(x[0],x[1],x[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(B[0],B[1],B[2]);a.visible=u.visible!==void 0?u.visible:false;C.scene.add(a);C.objects[n]=a;C.empties[n]=a}}}function f(a){return function(b){C.geometries[a]=b;e();G=G-1;i.onLoadComplete();h()}}function g(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:U,totalTextures:W,loadedModels:U-
-G,loadedTextures:W-j},C);i.onLoadProgress();G==0&&j==0&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlBase(c),l,o,n,p,r,m,q,u,t,w,s,x,F,E,B,v,z,J,K,X,Q,A,M,G,j,U,W,C;A=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;j=G=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(A.transform){a=A.transform.position;w=A.transform.rotation;v=A.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);w&&C.scene.rotation.set(w[0],w[1],
-w[2]);v&&C.scene.scale.set(v[0],v[1],v[2]);if(a||w||v){C.scene.updateMatrix();C.scene.updateMatrixWorld()}}a=function(){j=j-1;h();i.onLoadComplete()};for(r in A.cameras){v=A.cameras[r];v.type=="perspective"?X=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(X=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));x=v.position;w=v.target;v=v.up;X.position.set(x[0],x[1],x[2]);X.target=new THREE.Vector3(w[0],w[1],w[2]);v&&X.up.set(v[0],v[1],v[2]);C.cameras[r]=
-X}for(p in A.lights){w=A.lights[p];r=w.color!==void 0?w.color:16777215;X=w.intensity!==void 0?w.intensity:1;if(w.type=="directional"){x=w.direction;s=new THREE.DirectionalLight(r,X);s.position.set(x[0],x[1],x[2]);s.position.normalize()}else if(w.type=="point"){x=w.position;s=w.distance;s=new THREE.PointLight(r,X,s);s.position.set(x[0],x[1],x[2])}else w.type=="ambient"&&(s=new THREE.AmbientLight(r));C.scene.add(s);C.lights[p]=s}for(m in A.fogs){p=A.fogs[m];p.type=="linear"?Q=new THREE.Fog(0,p.near,
-p.far):p.type=="exp2"&&(Q=new THREE.FogExp2(0,p.density));v=p.color;Q.color.setRGB(v[0],v[1],v[2]);C.fogs[m]=Q}if(C.cameras&&A.defaults.camera)C.currentCamera=C.cameras[A.defaults.camera];if(C.fogs&&A.defaults.fog)C.scene.fog=C.fogs[A.defaults.fog];v=A.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(v[0],v[1],v[2]);C.bgColorAlpha=A.defaults.bgalpha;for(l in A.geometries){m=A.geometries[l];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){G=G+1;i.onLoadStart()}}U=G;for(l in A.geometries){m=
-A.geometries[l];if(m.type=="cube"){J=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);C.geometries[l]=J}else if(m.type=="plane"){J=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);C.geometries[l]=J}else if(m.type=="sphere"){J=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);C.geometries[l]=J}else if(m.type=="cylinder"){J=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,
-m.heightSegs);C.geometries[l]=J}else if(m.type=="torus"){J=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);C.geometries[l]=J}else if(m.type=="icosahedron"){J=new THREE.IcosahedronGeometry(m.radius,m.subdivisions);C.geometries[l]=J}else if(m.type=="bin_mesh")c.load(d(m.url,A.urlBaseType),f(l));else if(m.type=="ascii_mesh")M.load(d(m.url,A.urlBaseType),f(l));else if(m.type=="embedded_mesh"){m=A.embeds[m.id];m.metadata=A.metadata;m&&M.createModel(m,g(l),"")}}for(q in A.textures){l=A.textures[q];
-if(l.url instanceof Array){j=j+l.url.length;for(m=0;m<l.url.length;m++)i.onLoadStart()}else{j=j+1;i.onLoadStart()}}W=j;for(q in A.textures){l=A.textures[q];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=[];for(Q=0;Q<l.url.length;Q++)m[Q]=d(l.url[Q],A.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,l.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(l.url,A.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){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[l.wrap[0]]!==void 0)m.wrapS=Q[l.wrap[0]];if(Q[l.wrap[1]]!==void 0)m.wrapT=Q[l.wrap[1]]}}C.textures[q]=m}for(o in A.materials){t=A.materials[o];for(z in t.parameters)if(z==
-"envMap"||z=="map"||z=="lightMap")t.parameters[z]=C.textures[t.parameters[z]];else if(z=="shading")t.parameters[z]=t.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")t.parameters[z]=THREE[t.parameters[z]]?THREE[t.parameters[z]]:THREE.NormalBlending;else if(z=="combine")t.parameters[z]=t.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z=="vertexColors")if(t.parameters[z]=="face")t.parameters[z]=THREE.FaceColors;else if(t.parameters[z])t.parameters[z]=
-THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=true;if(t.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=t.parameters.color;m=t.parameters.specular;Q=t.parameters.ambient;c=t.parameters.shininess;a.tNormal.texture=C.textures[t.parameters.normalMap];if(t.parameters.normalMapFactor)a.uNormalScale.value=t.parameters.normalMapFactor;if(t.parameters.map){a.tDiffuse.texture=t.parameters.map;a.enableDiffuse.value=
-true}if(t.parameters.lightMap){a.tAO.texture=t.parameters.lightMap;a.enableAO.value=true}if(t.parameters.specularMap){a.tSpecular.texture=C.textures[t.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(m);a.uAmbientColor.value.setHex(Q);a.uShininess.value=c;if(t.parameters.opacity)a.uOpacity.value=t.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else K=
-new THREE[t.type](t.parameters);C.materials[o]=K}e();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};
-THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,f=c.offsetX!==void 0?c.offsetX:0,g=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,f,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,
-true);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b=b-2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d=d+b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++){h=a.charCodeAt(e+d);f[e]=g-h;h==0&&g++}return[c,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,g,i){for(var k,l,q,u=a.length;i<u;i=i+g){k=a[i];l=a[i+1];q=a[i+2];k=k/16383*c;l=l/16383*c;q=q/16383*c;k=k+d;l=l+e;q=q+f;b.vertices.push(new THREE.Vector3(k,l,q))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;l.push(d,1-e)}})(g[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c=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)}})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,w,s,x=a.length;for(c=0;c<x;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;w=d;s=e;i=f;var F=k[e*3],E=k[e*3+1],B=k[e*3+2],v=k[f*3],z=k[f*3+1],J=k[f*3+2];t=new THREE.Vector3(k[d*3],k[d*3+1],k[d*3+2]);F=new THREE.Vector3(F,E,B);v=new THREE.Vector3(v,z,J);g.faces.push(new THREE.Face3(w,s,i,[t,F,v],null,0));g=l[d*2];d=l[d*2+1];i=l[e*2];t=l[e*2+1];w=
-l[f*2];s=l[f*2+1];f=b.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(w,s));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
-THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
-THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(m in z.objects)if(!C.objects[m]){u=z.objects[m];if(u.geometry!==void 0){if(J=C.geometries[u.geometry]){a=false;K=C.materials[u.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&J.computeTangents();w=u.position;G=u.rotation;E=u.quaternion;B=u.scale;t=u.matrix;E=0;u.materials.length==0&&(K=new THREE.MeshFaceMaterial);u.materials.length>1&&(K=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(J,K);a.name=m;if(t){a.matrixAutoUpdate=false;a.matrix.set(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}else{a.position.set(w[0],w[1],w[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(G[0],G[1],G[2]);a.scale.set(B[0],B[1],B[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;C.scene.add(a);C.objects[m]=a}}else{w=u.position;G=u.rotation;E=u.quaternion;
+B=u.scale;E=0;a=new THREE.Object3D;a.name=m;a.position.set(w[0],w[1],w[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(G[0],G[1],G[2]);a.scale.set(B[0],B[1],B[2]);a.visible=u.visible!==void 0?u.visible:false;C.scene.add(a);C.objects[m]=a;C.empties[m]=a}}}function f(a){return function(b){C.geometries[a]=b;e();F=F-1;j.onLoadComplete();h()}}function g(a){return function(b){C.geometries[a]=b}}function h(){j.callbackProgress({totalModels:U,totalTextures:W,loadedModels:U-
+F,loadedTextures:W-i},C);j.onLoadProgress();F==0&&i==0&&b(C)}var j=this,k=THREE.Loader.prototype.extractUrlBase(c),l,n,m,p,r,o,q,u,t,x,s,w,G,E,B,v,A,J,K,X,Q,z,M,F,i,U,W,C;z=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;i=F=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(z.transform){a=z.transform.position;x=z.transform.rotation;v=z.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);x&&C.scene.rotation.set(x[0],x[1],
+x[2]);v&&C.scene.scale.set(v[0],v[1],v[2]);if(a||x||v){C.scene.updateMatrix();C.scene.updateMatrixWorld()}}a=function(){i=i-1;h();j.onLoadComplete()};for(r in z.cameras){v=z.cameras[r];v.type=="perspective"?X=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(X=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));w=v.position;x=v.target;v=v.up;X.position.set(w[0],w[1],w[2]);X.target=new THREE.Vector3(x[0],x[1],x[2]);v&&X.up.set(v[0],v[1],v[2]);C.cameras[r]=
+X}for(p in z.lights){x=z.lights[p];r=x.color!==void 0?x.color:16777215;X=x.intensity!==void 0?x.intensity:1;if(x.type=="directional"){w=x.direction;s=new THREE.DirectionalLight(r,X);s.position.set(w[0],w[1],w[2]);s.position.normalize()}else if(x.type=="point"){w=x.position;s=x.distance;s=new THREE.PointLight(r,X,s);s.position.set(w[0],w[1],w[2])}else x.type=="ambient"&&(s=new THREE.AmbientLight(r));C.scene.add(s);C.lights[p]=s}for(o in z.fogs){p=z.fogs[o];p.type=="linear"?Q=new THREE.Fog(0,p.near,
+p.far):p.type=="exp2"&&(Q=new THREE.FogExp2(0,p.density));v=p.color;Q.color.setRGB(v[0],v[1],v[2]);C.fogs[o]=Q}if(C.cameras&&z.defaults.camera)C.currentCamera=C.cameras[z.defaults.camera];if(C.fogs&&z.defaults.fog)C.scene.fog=C.fogs[z.defaults.fog];v=z.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(v[0],v[1],v[2]);C.bgColorAlpha=z.defaults.bgalpha;for(l in z.geometries){o=z.geometries[l];if(o.type=="bin_mesh"||o.type=="ascii_mesh"){F=F+1;j.onLoadStart()}}U=F;for(l in z.geometries){o=
+z.geometries[l];if(o.type=="cube"){J=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);C.geometries[l]=J}else if(o.type=="plane"){J=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);C.geometries[l]=J}else if(o.type=="sphere"){J=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight);C.geometries[l]=J}else if(o.type=="cylinder"){J=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,
+o.heightSegs);C.geometries[l]=J}else if(o.type=="torus"){J=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);C.geometries[l]=J}else if(o.type=="icosahedron"){J=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);C.geometries[l]=J}else if(o.type=="bin_mesh")c.load(d(o.url,z.urlBaseType),f(l));else if(o.type=="ascii_mesh")M.load(d(o.url,z.urlBaseType),f(l));else if(o.type=="embedded_mesh"){o=z.embeds[o.id];o.metadata=z.metadata;o&&M.createModel(o,g(l),"")}}for(q in z.textures){l=z.textures[q];
+if(l.url instanceof Array){i=i+l.url.length;for(o=0;o<l.url.length;o++)j.onLoadStart()}else{i=i+1;j.onLoadStart()}}W=i;for(q in z.textures){l=z.textures[q];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){o=[];for(Q=0;Q<l.url.length;Q++)o[Q]=d(l.url[Q],z.urlBaseType);o=THREE.ImageUtils.loadTextureCube(o,l.mapping,a)}else{o=THREE.ImageUtils.loadTexture(d(l.url,z.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)o.minFilter=THREE[l.minFilter];
+if(THREE[l.magFilter]!=void 0)o.magFilter=THREE[l.magFilter];if(l.repeat){o.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)o.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)o.wrapT=THREE.RepeatWrapping}l.offset&&o.offset.set(l.offset[0],l.offset[1]);if(l.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[l.wrap[0]]!==void 0)o.wrapS=Q[l.wrap[0]];if(Q[l.wrap[1]]!==void 0)o.wrapT=Q[l.wrap[1]]}}C.textures[q]=o}for(n in z.materials){t=z.materials[n];for(A in t.parameters)if(A==
+"envMap"||A=="map"||A=="lightMap")t.parameters[A]=C.textures[t.parameters[A]];else if(A=="shading")t.parameters[A]=t.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")t.parameters[A]=THREE[t.parameters[A]]?THREE[t.parameters[A]]:THREE.NormalBlending;else if(A=="combine")t.parameters[A]=t.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A=="vertexColors")if(t.parameters[A]=="face")t.parameters[A]=THREE.FaceColors;else if(t.parameters[A])t.parameters[A]=
+THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=true;if(t.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=t.parameters.color;o=t.parameters.specular;Q=t.parameters.ambient;c=t.parameters.shininess;a.tNormal.texture=C.textures[t.parameters.normalMap];if(t.parameters.normalMapFactor)a.uNormalScale.value=t.parameters.normalMapFactor;if(t.parameters.map){a.tDiffuse.texture=t.parameters.map;a.enableDiffuse.value=
+true}if(t.parameters.lightMap){a.tAO.texture=t.parameters.lightMap;a.enableAO.value=true}if(t.parameters.specularMap){a.tSpecular.texture=C.textures[t.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(o);a.uAmbientColor.value.setHex(Q);a.uShininess.value=c;if(t.parameters.opacity)a.uOpacity.value=t.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else K=
+new THREE[t.type](t.parameters);C.materials[n]=K}e();j.callbackSync(C);h()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};
+THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
 THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:false,time:0,direction:1,weight:1,directionBackwards:false,mirroredLoop:false};this.animationsMap[a]=b;this.animationsList.push(b)};
-THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&h.length>1){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(f<h.start)h.start=f;if(f>h.end)h.end=f;c||(c=i)}}for(i in d){h=d[i];this.createAnimation(i,h.start,h.end,a)}this.firstAnimation=c};
+THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&h.length>1){var j=h[1];d[j]||(d[j]={start:Infinity,end:-Infinity});h=d[j];if(f<h.start)h.start=f;if(f>h.end)h.end=f;c||(c=j)}}for(j in d){h=d[j];this.createAnimation(j,h.start,h.end,a)}this.firstAnimation=c};
 THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a]){a.direction=1;a.directionBackwards=false}};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a]){a.direction=-1;a.directionBackwards=true}};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];if(c){c.fps=b;c.duration=(c.end-c.start)/c.fps}};
 THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];if(c){c.duration=b;c.fps=(c.end-c.start)/c.duration}};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];if(c)c.weight=b};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];if(c)c.time=b};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
 e),0,d.length-1),g=d.weight;if(f!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[f]=0;d.lastFrame=d.currentFrame;d.currentFrame=f}e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,k,l,o,n,p;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
-0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){k=false;l=a(THREE.ShaderFlares.lensFlare)}else{k=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};n={};o.vertex=b.getAttribLocation(l,"position");o.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
-"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,u){var a=a.__webglFlares,t=a.length;if(t){var w=new THREE.Vector3,s=u/e,x=e*0.5,F=u*0.5,E=16/u,B=new THREE.Vector2(E*s,E),v=new THREE.Vector3(1,1,0),z=new THREE.Vector2(1,1),J=n,E=o;b.useProgram(l);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(E.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var K,X,Q,A,M;for(K=0;K<t;K++){E=16/u;B.set(E*s,E);A=a[K];w.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(w);d.projectionMatrix.multiplyVector3(w);v.copy(w);z.x=v.x*x+x;z.y=v.y*F+F;if(k||z.x>0&&z.x<e&&z.y>0&&
-z.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,z.x-8,z.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,B.x,B.y);b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,z.x-8,z.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(v);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);X=0;for(Q=A.lensFlares.length;X<Q;X++){M=A.lensFlares[X];if(M.opacity>0.001&&M.scale>0.001){v.x=M.x;v.y=M.y;v.z=M.z;E=M.size*M.scale/u;B.x=E*s;B.y=E;b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.uniform2f(J.scale,B.x,B.y);b.uniform1f(J.rotation,M.rotation);b.uniform1f(J.opacity,M.opacity);
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,j,k,l,n,m,p;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
+0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,j);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){k=false;l=a(THREE.ShaderFlares.lensFlare)}else{k=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}n={};m={};n.vertex=b.getAttribLocation(l,"position");n.uv=b.getAttribLocation(l,"uv");m.renderType=b.getUniformLocation(l,"renderType");m.map=b.getUniformLocation(l,"map");m.occlusionMap=b.getUniformLocation(l,"occlusionMap");m.opacity=b.getUniformLocation(l,"opacity");m.color=b.getUniformLocation(l,
+"color");m.scale=b.getUniformLocation(l,"scale");m.rotation=b.getUniformLocation(l,"rotation");m.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,u){var a=a.__webglFlares,t=a.length;if(t){var x=new THREE.Vector3,s=u/e,w=e*0.5,G=u*0.5,E=16/u,B=new THREE.Vector2(E*s,E),v=new THREE.Vector3(1,1,0),A=new THREE.Vector2(1,1),J=m,E=n;b.useProgram(l);if(!p){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);p=true}b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(E.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var K,X,Q,z,M;for(K=0;K<t;K++){E=16/u;B.set(E*s,E);z=a[K];x.set(z.matrixWorld.elements[12],z.matrixWorld.elements[13],z.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(x);d.projectionMatrix.multiplyVector3(x);v.copy(x);A.x=v.x*w+w;A.y=v.y*G+G;if(k||A.x>0&&A.x<e&&A.y>0&&
+A.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,A.x-8,A.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,B.x,B.y);b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,A.x-8,A.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
+b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(v);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);X=0;for(Q=z.lensFlares.length;X<Q;X++){M=z.lensFlares[X];if(M.opacity>0.001&&M.scale>0.001){v.x=M.x;v.y=M.y;v.z=M.z;E=M.size*M.scale/u;B.x=E*s;B.y=E;b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.uniform2f(J.scale,B.x,B.y);b.uniform1f(J.rotation,M.rotation);b.uniform1f(J.opacity,M.opacity);
 b.uniform3f(J.color,M.color.r,M.color.g,M.color.b);c.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst);c.setTexture(M.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var l,o,n,p,r,m,q,u,t,w=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);l=0;for(o=i.__lights.length;l<o;l++){n=i.__lights[l];if(n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(r=0;r<n.shadowCascadeCount;r++){var s;if(n.shadowCascadeArray[r])s=n.shadowCascadeArray[r];else{t=n;q=r;s=new THREE.DirectionalLight;
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,k){var l,n,m,p,r,o,q,u,t,x=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);l=0;for(n=j.__lights.length;l<n;l++){m=j.__lights[l];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(r=0;r<m.shadowCascadeCount;r++){var s;if(m.shadowCascadeArray[r])s=m.shadowCascadeArray[r];else{t=m;q=r;s=new THREE.DirectionalLight;
 s.isVirtual=true;s.onlyShadow=true;s.castShadow=true;s.shadowCameraNear=t.shadowCameraNear;s.shadowCameraFar=t.shadowCameraFar;s.shadowCameraLeft=t.shadowCameraLeft;s.shadowCameraRight=t.shadowCameraRight;s.shadowCameraBottom=t.shadowCameraBottom;s.shadowCameraTop=t.shadowCameraTop;s.shadowCameraVisible=t.shadowCameraVisible;s.shadowDarkness=t.shadowDarkness;s.shadowBias=t.shadowCascadeBias[q];s.shadowMapWidth=t.shadowCascadeWidth[q];s.shadowMapHeight=t.shadowCascadeHeight[q];s.pointsWorld=[];s.pointsFrustum=
-[];u=s.pointsWorld;m=s.pointsFrustum;for(var x=0;x<8;x++){u[x]=new THREE.Vector3;m[x]=new THREE.Vector3}u=t.shadowCascadeNearZ[q];t=t.shadowCascadeFarZ[q];m[0].set(-1,-1,u);m[1].set(1,-1,u);m[2].set(-1,1,u);m[3].set(1,1,u);m[4].set(-1,-1,t);m[5].set(1,-1,t);m[6].set(-1,1,t);m[7].set(1,1,t);s.originalCamera=k;m=new THREE.Gyroscope;m.position=n.shadowCascadeOffset;m.add(s);m.add(s.target);k.add(m);n.shadowCascadeArray[r]=s;console.log("Created virtualLight",s)}q=n;u=r;t=q.shadowCascadeArray[u];t.position.copy(q.position);
-t.target.position.copy(q.target.position);t.lookAt(t.target);t.shadowCameraVisible=q.shadowCameraVisible;t.shadowDarkness=q.shadowDarkness;t.shadowBias=q.shadowCascadeBias[u];m=q.shadowCascadeNearZ[u];q=q.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=m;t[1].z=m;t[2].z=m;t[3].z=m;t[4].z=q;t[5].z=q;t[6].z=q;t[7].z=q;w[p]=s;p++}else{w[p]=n;p++}}l=0;for(o=w.length;l<o;l++){n=w[l];if(!n.shadowMap){n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight);n.shadowMatrix=new THREE.Matrix4}if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,
-n.shadowCameraNear,n.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(n.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(n.shadowCameraVisible&&!n.cameraHelper){n.cameraHelper=new THREE.CameraHelper(n.shadowCamera);n.shadowCamera.add(n.cameraHelper)}if(n.isVirtual&&s.originalCamera==k){r=k;p=n.shadowCamera;m=n.pointsFrustum;t=n.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=0;q<8;q++){u=t[q];u.copy(m[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
-r);p.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}p.left=g.x;p.right=h.x;p.top=h.y;p.bottom=g.y;p.updateProjectionMatrix()}p=n.shadowMap;m=n.shadowMatrix;r=n.shadowCamera;r.position.copy(n.matrixWorld.getPosition());r.lookAt(n.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(n.cameraHelper)n.cameraHelper.lines.visible=n.shadowCameraVisible;
-n.shadowCameraVisible&&n.cameraHelper.update();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(r.projectionMatrix);m.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);f.multiply(r.projectionMatrix,r.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(p);
-b.clear();t=i.__webglObjects;n=0;for(p=t.length;n<p;n++){q=t[n];m=q.object;q.render=false;if(m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(r.matrixWorldInverse,m.matrixWorld);q.render=true}}n=0;for(p=t.length;n<p;n++){q=t[n];if(q.render){m=q.object;q=q.buffer;b.setObjectFaces(m);u=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?b.renderBufferDirect(r,i.__lights,null,
-u,q,m):b.renderBuffer(r,i.__lights,null,u,q,m)}}t=i.__webglObjectsImmediate;n=0;for(p=t.length;n<p;n++){q=t[n];m=q.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(r.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(r,i.__lights,null,c,m)}}}l=b.getClearColor();o=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,k,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(n,p);b.attachShader(n,r);b.linkProgram(n);h=n;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
+[];u=s.pointsWorld;o=s.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;o[w]=new THREE.Vector3}u=t.shadowCascadeNearZ[q];t=t.shadowCascadeFarZ[q];o[0].set(-1,-1,u);o[1].set(1,-1,u);o[2].set(-1,1,u);o[3].set(1,1,u);o[4].set(-1,-1,t);o[5].set(1,-1,t);o[6].set(-1,1,t);o[7].set(1,1,t);s.originalCamera=k;o=new THREE.Gyroscope;o.position=m.shadowCascadeOffset;o.add(s);o.add(s.target);k.add(o);m.shadowCascadeArray[r]=s;console.log("Created virtualLight",s)}q=m;u=r;t=q.shadowCascadeArray[u];t.position.copy(q.position);
+t.target.position.copy(q.target.position);t.lookAt(t.target);t.shadowCameraVisible=q.shadowCameraVisible;t.shadowDarkness=q.shadowDarkness;t.shadowBias=q.shadowCascadeBias[u];o=q.shadowCascadeNearZ[u];q=q.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=o;t[1].z=o;t[2].z=o;t[3].z=o;t[4].z=q;t[5].z=q;t[6].z=q;t[7].z=q;x[p]=s;p++}else{x[p]=m;p++}}l=0;for(n=x.length;l<n;l++){m=x[l];if(!m.shadowMap){m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:THREE.LinearFilter,
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight);m.shadowMatrix=new THREE.Matrix4}if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,m.shadowCameraTop,m.shadowCameraBottom,
+m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(m.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper){m.cameraHelper=new THREE.CameraHelper(m.shadowCamera);m.shadowCamera.add(m.cameraHelper)}if(m.isVirtual&&s.originalCamera==k){r=k;p=m.shadowCamera;o=m.pointsFrustum;t=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=0;q<8;q++){u=t[q];u.copy(o[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
+r);p.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}p.left=g.x;p.right=h.x;p.top=h.y;p.bottom=g.y;p.updateProjectionMatrix()}p=m.shadowMap;o=m.shadowMatrix;r=m.shadowCamera;r.position.copy(m.matrixWorld.getPosition());r.lookAt(m.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;
+m.shadowCameraVisible&&m.cameraHelper.update();o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(r.projectionMatrix);o.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);f.multiply(r.projectionMatrix,r.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(p);
+b.clear();t=j.__webglObjects;m=0;for(p=t.length;m<p;m++){q=t[m];o=q.object;q.render=false;if(o.visible&&o.castShadow&&(!(o instanceof THREE.Mesh)||!o.frustumCulled||e.contains(o))){o._modelViewMatrix.multiply(r.matrixWorldInverse,o.matrixWorld);q.render=true}}m=0;for(p=t.length;m<p;m++){q=t[m];if(q.render){o=q.object;q=q.buffer;b.setObjectFaces(o);u=o.customDepthMaterial?o.customDepthMaterial:o.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?b.renderBufferDirect(r,j.__lights,null,
+u,q,o):b.renderBuffer(r,j.__lights,null,u,q,o)}}t=j.__webglObjectsImmediate;m=0;for(p=t.length;m<p;m++){q=t[m];o=q.object;if(o.visible&&o.castShadow){o._modelViewMatrix.multiply(r.matrixWorldInverse,o.matrixWorld);b.renderImmediateObject(r,j.__lights,null,c,o)}}}l=b.getClearColor();n=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,n);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,j,k,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(m,p);b.attachShader(m,r);b.linkProgram(m);h=m;j={};k={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
 "uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,m=d.length;if(m){var q=i,u=k,t=r/p,p=p*0.5,w=r*0.5,s=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.uniformMatrix4fv(u.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var x,F=[],q=0;q<m;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<m;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
-b.uniform3f(u.screenPosition,(x.position.x-p)/p,(w-x.position.y)/w,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?r:1);F[0]=e*t*x.scale.x;F[1]=e*x.scale.y;b.uniform2f(u.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(u.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(u.alignment,x.alignment.x,x.alignment.y);
-b.uniform1f(u.opacity,x.opacity);b.uniform3f(u.color,x.color.r,x.color.g,x.color.b);b.uniform1f(u.rotation,x.rotation);b.uniform2fv(u.scale,F);if(x.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!x.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,o=d.length;if(o){var q=j,u=k,t=r/p,p=p*0.5,x=r*0.5,s=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.uniformMatrix4fv(u.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var w,G=[],q=0;q<o;q++){w=d[q];if(w.visible&&w.opacity!==0)if(w.useScreenCoordinates)w.z=-w.position.z;else{w._modelViewMatrix.multiply(e.matrixWorldInverse,w.matrixWorld);w.z=-w._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<o;q++){w=d[q];if(w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width){if(w.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
+b.uniform3f(u.screenPosition,(w.position.x-p)/p,(x-w.position.y)/x,Math.max(0,Math.min(1,w.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,w.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,w._modelViewMatrix.elements)}e=w.map.image.width/(w.scaleByViewport?r:1);G[0]=e*t*w.scale.x;G[1]=e*w.scale.y;b.uniform2f(u.uvScale,w.uvScale.x,w.uvScale.y);b.uniform2f(u.uvOffset,w.uvOffset.x,w.uvOffset.y);b.uniform2f(u.alignment,w.alignment.x,w.alignment.y);
+b.uniform1f(u.opacity,w.opacity);b.uniform3f(u.color,w.color.r,w.color.g,w.color.b);b.uniform1f(u.rotation,w.rotation);b.uniform2fv(u.scale,G);if(w.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!w.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst);c.setTexture(w.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,k,l,o,n,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(k=p.length;i<k;i++){l=p[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(k=p.length;i<k;i++){l=p[i];if(l.render){n=l.object;l=l.buffer;b.setObjectFaces(n);o=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;l instanceof
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,l,n):b.renderBuffer(h,g.__lights,null,o,l,n)}}p=g.__webglObjectsImmediate;i=0;for(k=p.length;i<k;i++){l=p[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}i=b.getClearColor();k=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,k);a.enable(a.BLEND)}};
-THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,o;e.matrixAutoUpdate=f.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),p=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:n},mapRight:{type:"t",value:1,texture:p}},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,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(r);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;p.width=a;p.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||l!==c.far||o!==c.fov){i=c.aspect;k=c.near;l=c.far;o=c.fov;var t=c.projectionMatrix.clone(),w=125/30*0.5,s=w*k/125,x=k*Math.tan(o*Math.PI/360),F;g.elements[12]=w;h.elements[12]=-w;w=-x*i+s;F=x*i+s;t.elements[0]=2*k/(F-w);t.elements[8]=
-(F+w)/(F-w);e.projectionMatrix.copy(t);w=-x*i-s;F=x*i-s;t.elements[0]=2*k/(F-w);t.elements[8]=(F+w)/(F-w);f.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,true);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,p,true);m.updateMatrixWorld();d.call(b,m,r)}});
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,k,l,n,m,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;j=0;for(k=p.length;j<k;j++){l=p[j];m=l.object;l.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);l.render=true}}j=0;for(k=p.length;j<k;j++){l=p[j];if(l.render){m=l.object;l=l.buffer;b.setObjectFaces(m);n=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;l instanceof
+THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,n,l,m):b.renderBuffer(h,g.__lights,null,n,l,m)}}p=g.__webglObjectsImmediate;j=0;for(k=p.length;j<k;j++){l=p[j];m=l.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}j=b.getClearColor();k=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,k);a.enable(a.BLEND)}};
+THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,j,k,l,n;e.matrixAutoUpdate=f.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),p=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:m},mapRight:{type:"t",value:1,texture:p}},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}"}),
+o=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;o.add(a);o.add(r);this.setSize=function(a,d){c.call(b,a,d);m.width=a;m.height=d;p.width=a;p.height=d};this.render=function(a,c){a.updateMatrixWorld();if(j!==c.aspect||k!==c.near||l!==c.far||n!==c.fov){j=c.aspect;k=c.near;l=c.far;n=c.fov;var t=c.projectionMatrix.clone(),x=125/30*0.5,s=x*k/125,w=k*Math.tan(n*Math.PI/360),G;g.elements[12]=x;h.elements[12]=-x;x=-w*j+s;G=w*j+s;t.elements[0]=2*k/(G-x);t.elements[8]=
+(G+x)/(G-x);e.projectionMatrix.copy(t);x=-w*j-s;G=w*j-s;t.elements[0]=2*k/(G-x);t.elements[8]=(G+x)/(G-x);f.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,m,true);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,p,true);o.updateMatrixWorld();d.call(b,o,r)}});
 THREE.WebGLRenderer&&(THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=false;var b=this,c=this.setSize,d=this.render,e,f,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;
 g.far=c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);d.call(b,a,h,false)}});
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 2 - 2
build/custom/ThreeCanvas.js

@@ -98,8 +98,8 @@ j=a.vertices[d];i=g[e];m=g[f];n=g[C];o=k.x-h.x;p=j.x-h.x;l=k.y-h.y;r=j.y-h.y;u=k
 this.vertices.length;b<c;b++){s[b]=new THREE.Vector3;w[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var Q=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){O.copy(f.vertexNormals[d]);e=f[Q[d]];G=s[e];$.copy(G);$.subSelf(O.multiplyScalar(O.dot(G))).normalize();
 da.cross(f.vertexNormals[d],G);e=da.dot(w[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
-e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d]}}this.vertices=b}};THREE.GeometryCount=0;
-THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
+e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];e=[a.a,a.b,a.c,a.d];for(d=3;d>0;d--)if(e.indexOf(a["abcd"[d]])!=d){e.splice(d,1);this.faces[f]=new THREE.Face3(e[0],e[1],e[2]);this.faceVertexUvs[0][f].splice(d,1)}}}this.vertices=
+b}};THREE.GeometryCount=0;THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
 THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};

+ 116 - 122
build/custom/ThreeExtras.js

@@ -1,9 +1,9 @@
 // ThreeExtras.js - http://github.com/mrdoob/three.js
 'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,e=Math.max(Math.max(c,d),f),g=Math.min(Math.min(c,d),f);if(g===e)g=c=0;else{var h=e-g,g=h/e,c=(c===e?(d-f)/h:d===e?2+(f-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=e;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,j=e.faces,k=a.faceVertexUvs[0],o=e.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale));for(var n=0,q=h.length;n<q;n++){var m=h[n].clone();c&&c.multiplyVector3(m);g.push(m)}n=0;for(q=j.length;n<q;n++){var g=j[n],
-r,u,s=g.vertexNormals,t=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=s.length;h<m;h++)u=s[h].clone(),d&&d.multiplyVector3(u),r.vertexNormals.push(u);r.color.copy(g.color);h=0;for(m=t.length;h<m;h++)u=t[h],r.vertexColors.push(u.clone());void 0!==g.materialIndex&&(h=e.materials[g.materialIndex],m=h.id,t=l[m],void 0===t&&(t=a.materials.length,
-l[m]=t,a.materials.push(h)),r.materialIndex=t);r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}n=0;for(q=o.length;n<q;n++){c=o[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];a.materials&&(b.materials=a.materials.slice());a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;for(c=e.length;a<
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,j=e.faces,k=a.faceVertexUvs[0],o=e.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale));for(var n=0,r=h.length;n<r;n++){var m=h[n].clone();c&&c.multiplyVector3(m);g.push(m)}n=0;for(r=j.length;n<r;n++){var g=j[n],
+q,u,s=g.vertexNormals,t=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=s.length;h<m;h++)u=s[h].clone(),d&&d.multiplyVector3(u),q.vertexNormals.push(u);q.color.copy(g.color);h=0;for(m=t.length;h<m;h++)u=t[h],q.vertexColors.push(u.clone());void 0!==g.materialIndex&&(h=e.materials[g.materialIndex],m=h.id,t=l[m],void 0===t&&(t=a.materials.length,
+l[m]=t,a.materials.push(h)),q.materialIndex=t);q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}n=0;for(r=o.length;n<r;n++){c=o[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];a.materials&&(b.materials=a.materials.slice());a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;for(c=e.length;a<
 c;a++){for(var d=e[a],f=[],g=0,h=d.length;g<h;g++)f.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,e,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();1<d+f&&(d=1-d,f=1-f);e=1-d-f;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);g.addSelf(h);h.copy(c);h.multiplyScalar(e);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,f,e;if(a instanceof THREE.Face3)return d=
 b.vertices[a.a],f=b.vertices[a.b],e=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,f,e);if(a instanceof THREE.Face4){d=b.vertices[a.a];f=b.vertices[a.b];e=b.vertices[a.c];var b=b.vertices[a.d],g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,
 f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,j=[],k,o,l,n;for(f=0;f<h;f++)d=e[f],d instanceof THREE.Face3?(k=g[d.a],o=g[d.b],l=g[d.c],d._area=THREE.GeometryUtils.triangleArea(k,o,l)):d instanceof THREE.Face4&&(k=g[d.a],o=g[d.b],l=g[d.c],n=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(k,
@@ -12,19 +12,19 @@ b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(
 a.faces[b],d instanceof THREE.Face4){f=d.a;var i=d.b,j=d.c,k=d.d,o=new THREE.Face3,l=new THREE.Face3;o.color.copy(d.color);l.color.copy(d.color);o.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;o.a=f;o.b=i;o.c=k;l.a=i;l.b=j;l.c=k;4===d.vertexColors.length&&(o.vertexColors[0]=d.vertexColors[0].clone(),o.vertexColors[1]=d.vertexColors[1].clone(),o.vertexColors[2]=d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=
 d.vertexColors[3].clone());e.push(o,l);d=0;for(f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(o=a.faceVertexUvs[d][b],i=o[1],j=o[2],k=o[3],o=[o[0].clone(),i.clone(),k.clone()],i=[i.clone(),j.clone(),k.clone()],h[d].push(o,i));d=0;for(f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{e.push(d);d=0;for(f=a.faceUvs.length;d<f;d++)g[d].push(a.faceUvs[d]);d=0;for(f=a.faceVertexUvs.length;d<f;d++)h[d].push(a.faceVertexUvs[d])}a.faces=e;a.faceUvs=g;a.faceVertexUvs=
 h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,e=a.faces[c];if(e instanceof THREE.Face4){var g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),
-b.push(h.clone()),b.push(i.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,j,k,o,l,n,q,m,r,u,s,t,p,w=[],A=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)A[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,j=a.vertices[e],k=a.vertices[g],o=a.vertices[h],n=j.distanceTo(k),q=k.distanceTo(o),l=j.distanceTo(o),n>b||q>b||l>b){i=a.vertices.length;t=f.clone();p=f.clone();n>=q&&n>=l?(j=j.clone(),
-j.lerpSelf(k,0.5),t.a=e,t.b=i,t.c=h,p.a=i,p.b=g,p.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),t.vertexNormals[1].copy(e),p.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),t.vertexColors[1].copy(e),p.vertexColors[0].copy(e)),f=0):q>=n&&q>=l?(j=k.clone(),j.lerpSelf(o,0.5),t.a=e,t.b=g,t.c=i,p.a=i,p.b=h,p.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],
+b.push(h.clone()),b.push(i.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,j,k,o,l,n,r,m,q,u,s,t,p,w=[],A=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)A[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,j=a.vertices[e],k=a.vertices[g],o=a.vertices[h],n=j.distanceTo(k),r=k.distanceTo(o),l=j.distanceTo(o),n>b||r>b||l>b){i=a.vertices.length;t=f.clone();p=f.clone();n>=r&&n>=l?(j=j.clone(),
+j.lerpSelf(k,0.5),t.a=e,t.b=i,t.c=h,p.a=i,p.b=g,p.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),t.vertexNormals[1].copy(e),p.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),t.vertexColors[1].copy(e),p.vertexColors[0].copy(e)),f=0):r>=n&&r>=l?(j=k.clone(),j.lerpSelf(o,0.5),t.a=e,t.b=g,t.c=i,p.a=i,p.b=h,p.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],
 0.5),t.vertexNormals[2].copy(e),p.vertexNormals[0].copy(e),p.vertexNormals[1].copy(f.vertexNormals[2]),p.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),t.vertexColors[2].copy(e),p.vertexColors[0].copy(e),p.vertexColors[1].copy(f.vertexColors[2]),p.vertexColors[2].copy(f.vertexColors[0])),f=1):(j=j.clone(),j.lerpSelf(o,0.5),t.a=e,t.b=g,t.c=i,p.a=i,p.b=g,p.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),
 e.lerpSelf(f.vertexNormals[2],0.5),t.vertexNormals[2].copy(e),p.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),t.vertexColors[2].copy(e),p.vertexColors[0].copy(e)),f=2);w.push(t,p);a.vertices.push(j);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],p=j[0],h=j[1],t=j[2],0===f?(k=p.clone(),k.lerpSelf(h,0.5),j=[p.clone(),k.clone(),t.clone()],h=[k.clone(),h.clone(),t.clone()]):1===f?(k=h.clone(),
-k.lerpSelf(t,0.5),j=[p.clone(),h.clone(),k.clone()],h=[k.clone(),t.clone(),p.clone()]):(k=p.clone(),k.lerpSelf(t,0.5),j=[p.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),t.clone()]),A[e].push(j,h))}else{w.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)A[e].push(a.faceVertexUvs[e][c])}else if(e=f.a,g=f.b,h=f.c,i=f.d,j=a.vertices[e],k=a.vertices[g],o=a.vertices[h],l=a.vertices[i],n=j.distanceTo(k),q=k.distanceTo(o),m=o.distanceTo(l),r=j.distanceTo(l),n>b||q>b||m>b||r>b){u=a.vertices.length;s=
-a.vertices.length+1;t=f.clone();p=f.clone();n>=q&&n>=m&&n>=r||m>=q&&m>=n&&m>=r?(n=j.clone(),n.lerpSelf(k,0.5),k=o.clone(),k.lerpSelf(l,0.5),t.a=e,t.b=u,t.c=s,t.d=i,p.a=u,p.b=g,p.c=h,p.d=s,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),t.vertexNormals[1].copy(e),t.vertexNormals[2].copy(g),p.vertexNormals[0].copy(e),p.vertexNormals[3].copy(g)),4===f.vertexColors.length&&(e=f.vertexColors[0].clone(),
+k.lerpSelf(t,0.5),j=[p.clone(),h.clone(),k.clone()],h=[k.clone(),t.clone(),p.clone()]):(k=p.clone(),k.lerpSelf(t,0.5),j=[p.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),t.clone()]),A[e].push(j,h))}else{w.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)A[e].push(a.faceVertexUvs[e][c])}else if(e=f.a,g=f.b,h=f.c,i=f.d,j=a.vertices[e],k=a.vertices[g],o=a.vertices[h],l=a.vertices[i],n=j.distanceTo(k),r=k.distanceTo(o),m=o.distanceTo(l),q=j.distanceTo(l),n>b||r>b||m>b||q>b){u=a.vertices.length;s=
+a.vertices.length+1;t=f.clone();p=f.clone();n>=r&&n>=m&&n>=q||m>=r&&m>=n&&m>=q?(n=j.clone(),n.lerpSelf(k,0.5),k=o.clone(),k.lerpSelf(l,0.5),t.a=e,t.b=u,t.c=s,t.d=i,p.a=u,p.b=g,p.c=h,p.d=s,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),t.vertexNormals[1].copy(e),t.vertexNormals[2].copy(g),p.vertexNormals[0].copy(e),p.vertexNormals[3].copy(g)),4===f.vertexColors.length&&(e=f.vertexColors[0].clone(),
 e.lerpSelf(f.vertexColors[1],0.5),g=f.vertexColors[2].clone(),g.lerpSelf(f.vertexColors[3],0.5),t.vertexColors[1].copy(e),t.vertexColors[2].copy(g),p.vertexColors[0].copy(e),p.vertexColors[3].copy(g)),f=0):(n=k.clone(),n.lerpSelf(o,0.5),k=l.clone(),k.lerpSelf(j,0.5),t.a=e,t.b=g,t.c=u,t.d=s,p.a=s,p.b=u,p.c=h,p.d=i,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),t.vertexNormals[2].copy(e),t.vertexNormals[3].copy(g),
 p.vertexNormals[0].copy(g),p.vertexNormals[1].copy(e)),4===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),g=f.vertexColors[3].clone(),g.lerpSelf(f.vertexColors[0],0.5),t.vertexColors[2].copy(e),t.vertexColors[3].copy(g),p.vertexColors[0].copy(g),p.vertexColors[1].copy(e)),f=1);w.push(t,p);a.vertices.push(n,k);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],p=j[0],h=j[1],t=j[2],j=j[3],0===f?(k=p.clone(),k.lerpSelf(h,
 0.5),o=t.clone(),o.lerpSelf(j,0.5),p=[p.clone(),k.clone(),o.clone(),j.clone()],h=[k.clone(),h.clone(),t.clone(),o.clone()]):(k=h.clone(),k.lerpSelf(t,0.5),o=j.clone(),o.lerpSelf(p,0.5),p=[p.clone(),h.clone(),k.clone(),o.clone()],h=[o.clone(),k.clone(),t.clone(),j.clone()]),A[e].push(p,h))}else{w.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)A[e].push(a.faceVertexUvs[e][c])}a.faces=w;a.faceVertexUvs=A}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],e=new THREE.Texture(f,b),b=f.loadCount=0;for(d=a.length;b<d;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;6===f.loadCount&&(e.needsUpdate=!0);c&&c(this)},f[b].crossOrigin=this.crossOrigin,f[b].src=a[b];return e},getNormalMap:function(a,b){var c=
-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]},b=b|1,d=a.width,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,i=g.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var o=1;o<f;o++){var l=0>o-1?f-1:o-1,n=(o+1)%f,q=0>k-1?d-1:k-1,m=(k+1)%d,r=[],u=[0,0,h[4*(o*d+k)]/255*b];r.push([-1,0,h[4*(o*d+q)]/255*b]);r.push([-1,-1,h[4*(l*d+q)]/255*b]);r.push([0,-1,h[4*(l*d+
-k)]/255*b]);r.push([1,-1,h[4*(l*d+m)]/255*b]);r.push([1,0,h[4*(o*d+m)]/255*b]);r.push([1,1,h[4*(n*d+m)]/255*b]);r.push([0,1,h[4*(n*d+k)]/255*b]);r.push([-1,1,h[4*(n*d+q)]/255*b]);l=[];q=r.length;for(n=0;n<q;n++){var m=r[n],s=r[(n+1)%q],m=[m[0]-u[0],m[1]-u[1],m[2]-u[2]],s=[s[0]-u[0],s[1]-u[1],s[2]-u[2]];l.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}r=[0,0,0];for(n=0;n<l.length;n++)r[0]+=l[n][0],r[1]+=l[n][1],r[2]+=l[n][2];r[0]/=l.length;r[1]/=l.length;r[2]/=l.length;u=4*
-(o*d+k);j[u]=255*((r[0]+1)/2)|0;j[u+1]=255*(r[1]+0.5)|0;j[u+2]=255*r[2]|0;j[u+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
+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]},b=b|1,d=a.width,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,i=g.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var o=1;o<f;o++){var l=0>o-1?f-1:o-1,n=(o+1)%f,r=0>k-1?d-1:k-1,m=(k+1)%d,q=[],u=[0,0,h[4*(o*d+k)]/255*b];q.push([-1,0,h[4*(o*d+r)]/255*b]);q.push([-1,-1,h[4*(l*d+r)]/255*b]);q.push([0,-1,h[4*(l*d+
+k)]/255*b]);q.push([1,-1,h[4*(l*d+m)]/255*b]);q.push([1,0,h[4*(o*d+m)]/255*b]);q.push([1,1,h[4*(n*d+m)]/255*b]);q.push([0,1,h[4*(n*d+k)]/255*b]);q.push([-1,1,h[4*(n*d+r)]/255*b]);l=[];r=q.length;for(n=0;n<r;n++){var m=q[n],s=q[(n+1)%r],m=[m[0]-u[0],m[1]-u[1],m[2]-u[2]],s=[s[0]-u[0],s[1]-u[1],s[2]-u[2]];l.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}q=[0,0,0];for(n=0;n<l.length;n++)q[0]+=l[n][0],q[1]+=l[n][1],q[2]+=l[n][2];q[0]/=l.length;q[1]/=l.length;q[2]/=l.length;u=4*
+(o*d+k);j[u]=255*((q[0]+1)/2)|0;j[u+1]=255*(q[1]+0.5)|0;j[u+2]=255*q[2]|0;j[u+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var e=new THREE.Mesh(a,b[c]);f.add(e)}return f},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -74,8 +74,8 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,e){var g=Array.prototype.s
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,f,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,f,e);this.curves.push(h);h=h.getPoint(e?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
 THREE.Path.prototype.absarc=function(a,b,c,d,f,e){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,f,e);this.curves.push(h);h=h.getPoint(e?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,i,j,k,o,l,n,q,m;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];o=e[0];l=e[1];if(c.length>0){g=c[c.length-1];
-n=g.x;q=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];q=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b2(m,n,o,h);m=THREE.Shape.Utils.b2(m,q,l,i);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];o=e[0];l=e[1];j=e[2];k=e[3];if(c.length>0){g=c[c.length-1];n=g.x;q=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];q=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b3(m,n,o,j,h);m=THREE.Shape.Utils.b3(m,q,l,k,i);c.push(new THREE.Vector2(g,
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,i,j,k,o,l,n,r,m;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];o=e[0];l=e[1];if(c.length>0){g=c[c.length-1];
+n=g.x;r=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];r=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b2(m,n,o,h);m=THREE.Shape.Utils.b2(m,r,l,i);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];o=e[0];l=e[1];j=e[2];k=e[3];if(c.length>0){g=c[c.length-1];n=g.x;r=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];r=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b3(m,n,o,j,h);m=THREE.Shape.Utils.b3(m,r,l,k,i);c.push(new THREE.Vector2(g,
 m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;m=m.concat(e[0]);m=new THREE.SplineCurve(m);for(e=1;e<=g;e++)c.push(m.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];j=e[2];o=e[3];l=!!e[5];k=e[4]-o;n=a*2;for(e=1;e<=n;e++){m=e/n;l||(m=1-m);m=o+m*k;g=h+j*Math.cos(m);m=i+j*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
 1,1);b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};THREE.Path.prototype.nltransform=function(a,b,c,d,f,e){var g=this.getPoints(),h,i,j,k,o;h=0;for(i=g.length;h<i;h++){j=g[h];k=j.x;o=j.y;j.x=a*k+b*o+c;j.y=d*o+f*k+e}return g};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();if(!a){a=document.createElement("canvas");a.setAttribute("width",b.maxX+100);a.setAttribute("height",b.maxY+100);document.body.appendChild(a)}b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,f,a=0;for(c=this.actions.length;a<c;a++){d=this.actions[a];f=d.args;d=d.action;d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,f)}b.stroke();b.closePath();b.strokeStyle="red";
@@ -84,9 +84,9 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],e=new THREE.Path;a=0;f
 b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g.actions=e.actions;g.curves=e.curves;d.push(g);g=new THREE.Shape}else g.holes.push(e)}}else{a=0;for(b=f.length;a<b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves}else g.holes.push(e)}d.push(g)}return d};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 b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,i,j,k,o,l,n,q=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);e=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){l=j[f];n=[];for(o=0;o<c.length;o++){k=c[o];k=l.distanceToSquared(k);n.push(k);if(k<e){e=k;g=f;h=o}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;var m=[j[g],c[h],c[f]];o=THREE.FontUtils.Triangulate.area(m);var r=[j[g],j[e],c[h]];l=THREE.FontUtils.Triangulate.area(r);n=h;k=g;h=h+1;g=g+
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;m=[j[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);r=[j[g],j[e],c[h]];r=THREE.FontUtils.Triangulate.area(r);if(o+l>m+r){h=n;g=k;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1}o=c.slice(0,h);l=c.slice(h);n=j.slice(g);k=j.slice(0,g);e=[j[g],j[e],c[h]];q.push([j[g],c[h],c[f]]);q.push(e);c=o.concat(n).concat(k).concat(l)}return{shape:c,
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,i,j={};e=0;for(g=d.length;e<g;e++){i=d[e].x+":"+d[e].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}return c.concat(f)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,i,j,k,o,l,n,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);e=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){l=j[f];n=[];for(o=0;o<c.length;o++){k=c[o];k=l.distanceToSquared(k);n.push(k);if(k<e){e=k;g=f;h=o}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;var m=[j[g],c[h],c[f]];o=THREE.FontUtils.Triangulate.area(m);var q=[j[g],j[e],c[h]];l=THREE.FontUtils.Triangulate.area(q);n=h;k=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;m=[j[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);q=[j[g],j[e],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+l>m+q){h=n;g=k;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1}o=c.slice(0,h);l=c.slice(h);n=j.slice(g);k=j.slice(0,g);e=[j[g],j[e],c[h]];r.push([j[g],c[h],c[f]]);r.push(e);c=o.concat(n).concat(k).concat(l)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,i,j={};e=0;for(g=d.length;e<g;e++){i=d[e].x+":"+d[e].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}return c.concat(f)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",e=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=e};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
@@ -99,7 +99,7 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 f instanceof THREE.Bone?f.skinMatrix:f.matrix}var e=f.animationCache.prevKey;f=f.animationCache.nextKey;e.pos=this.data.hierarchy[c].keys[0];e.rot=this.data.hierarchy[c].keys[0];e.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;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.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0){this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,e,g,h,i,j,k=this.data.JIT.hierarchy,o,l;l=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,q=this.hierarchy.length;n<q;n++){a=this.hierarchy[n];i=a.animationCache;if(this.JITCompile&&k[n][j]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=k[n][j];a.matrixAutoUpdate=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,e,g,h,i,j,k=this.data.JIT.hierarchy,o,l;l=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;j=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++){a=this.hierarchy[n];i=a.animationCache;if(this.JITCompile&&k[n][j]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=k[n][j];a.matrixAutoUpdate=
 false;a.matrixWorldNeedsUpdate=false}else{a.matrix=k[n][j];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}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++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(o<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<o;){g=h;h=this.getNextKeyWith(c,n,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
 n,h.index+1)}while(h.time<o)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);f=g[c];e=h[c];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(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
 THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=f;this.points[2]=e;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);c.x=f[0];c.y=f[1];c.z=f[2];if(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(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,
@@ -136,7 +136,7 @@ this.moveRight&&this.object.translateX(b);this.moveUp&&this.object.translateY(b)
 Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*a*b;this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+
 100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",
 c(this,this.onKeyUp),false)};
-THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,u=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
+THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,u=0;f=q-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<q-1;f++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}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.Vector3(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
 this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;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;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=
 this.domElement.offsetHeight/2;this.domElement.setAttribute("tabindex",-1)}var g=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=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%g;this.phi=a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
@@ -154,13 +154,13 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
 this.object.matrixWorldNeedsUpdate=true};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",c(this,this.mousemove),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
 c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Matrix4,g=false,h=1,i=0,j=0,k=0,o=0,l=0,n=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Matrix4,g=false,h=1,i=0,j=0,k=0,o=0,l=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
 a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);if(g)this.roll=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()}f.copy(this.forward);
 d.set(0,1,0);c.cross(d,f).normalize();d.cross(f,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=f.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=f.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=f.z;e.identity();e.elements[0]=Math.cos(this.roll);e.elements[4]=-Math.sin(this.roll);e.elements[1]=Math.sin(this.roll);e.elements[5]=
 Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
 a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-n)/window.innerWidth;l=(a.clientY-q)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
+false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-n)/window.innerWidth;l=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
 1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:k=1;break;case 70:k=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:g=false;break;case 69:g=false;break;case 82:k=0;break;case 70:k=0}},false)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;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=this.noRotate=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
 this.target=new THREE.Vector3;var d=new THREE.Vector3,f=false,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,l=new THREE.Vector2,n={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
@@ -170,22 +170,22 @@ b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.tar
 c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(n);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(f){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);j=k=c.getMouseOnScreen(a.clientX,a.clientY);o=
 l=c.getMouseOnScreen(a.clientX,a.clientY);f=false}e!==-1&&(e===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):e===2&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(e===-1){e=a.button;e===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,
 a.clientY):this.noPan||(o=l=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();e=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&e===-1){a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2);e!==-1&&(f=true)}},false);window.addEventListener("keyup",function(){c.enabled&&e!==-1&&(e=-1)},false)};
-THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,i,l,k){var o,m=d||1,n=f||1,q=h/2,r=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){o="y";n=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){o="x";m=e||1}var u=m+1,t=n+1,M=h/m,F=i/n,N=new THREE.Vector3;N[o]=l>0?1:-1;for(h=0;h<t;h++)for(i=0;i<u;i++){var D=new THREE.Vector3;D[a]=(i*M-q)*c;D[b]=(h*F-r)*g;D[o]=l;j.vertices.push(D)}for(h=0;h<n;h++)for(i=0;i<m;i++){a=new THREE.Face4(i+
-u*h+s,i+u*(h+1)+s,i+1+u*(h+1)+s,i+1+u*h+s);a.normal.copy(N);a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone());a.materialIndex=k;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/m,h/n),new THREE.UV(i/m,(h+1)/n),new THREE.UV((i+1)/m,(h+1)/n),new THREE.UV((i+1)/m,h/n)])}}THREE.Geometry.call(this);var j=this,k=a/2,o=b/2,l=c/2,n,q,m,r,u,s;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(g)}n=0;r=1;q=2;u=3;m=4;s=5}else this.materials=
-[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,o,q);this.sides.ny&&i("x","z",1,-1,a,c,-o,u);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,i,l,k){var o,m=d||1,n=f||1,r=h/2,q=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){o="y";n=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){o="x";m=e||1}var u=m+1,t=n+1,M=h/m,F=i/n,N=new THREE.Vector3;N[o]=l>0?1:-1;for(h=0;h<t;h++)for(i=0;i<u;i++){var D=new THREE.Vector3;D[a]=(i*M-r)*c;D[b]=(h*F-q)*g;D[o]=l;j.vertices.push(D)}for(h=0;h<n;h++)for(i=0;i<m;i++){a=new THREE.Face4(i+
+u*h+s,i+u*(h+1)+s,i+1+u*(h+1)+s,i+1+u*h+s);a.normal.copy(N);a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone());a.materialIndex=k;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/m,h/n),new THREE.UV(i/m,(h+1)/n),new THREE.UV((i+1)/m,(h+1)/n),new THREE.UV((i+1)/m,h/n)])}}THREE.Geometry.call(this);var j=this,k=a/2,o=b/2,l=c/2,n,r,m,q,u,s;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(g)}n=0;q=1;r=2;u=3;m=4;s=5}else this.materials=
+[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,u);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var o=[],l=[],n=i/f,q=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=new THREE.Vector3;r.x=q*Math.sin(m*Math.PI*2);r.y=-n*c+g;r.z=q*Math.cos(m*Math.PI*2);this.vertices.push(r);o.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}j.push(o);k.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],o=j[i+1][h],l=j[i+1][h+1],
-n=j[i][h+1],q=this.vertices[c].clone().setY(0).normalize(),m=this.vertices[o].clone().setY(0).normalize(),r=this.vertices[l].clone().setY(0).normalize(),u=this.vertices[n].clone().setY(0).normalize(),s=k[i][h].clone(),t=k[i+1][h].clone(),p=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,l,n,[q,m,r,u]));this.faceVertexUvs[0].push([s,t,p,w])}if(!e&&a>0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){c=j[0][h];o=j[0][h+1];l=this.vertices.length-1;q=new THREE.Vector3(0,
-1,0);m=new THREE.Vector3(0,1,0);r=new THREE.Vector3(0,1,0);s=k[0][h].clone();t=k[0][h+1].clone();p=new THREE.UV(t.u,0);this.faces.push(new THREE.Face3(c,o,l,[q,m,r]));this.faceVertexUvs[0].push([s,t,p])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){c=j[i][h+1];o=j[i][h];l=this.vertices.length-1;q=new THREE.Vector3(0,-1,0);m=new THREE.Vector3(0,-1,0);r=new THREE.Vector3(0,-1,0);s=k[i][h+1].clone();t=k[i][h].clone();p=new THREE.UV(t.u,1);this.faces.push(new THREE.Face3(c,
-o,l,[q,m,r]));this.faceVertexUvs[0].push([s,t,p])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;
+THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var o=[],l=[],n=i/f,r=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,q=new THREE.Vector3;q.x=r*Math.sin(m*Math.PI*2);q.y=-n*c+g;q.z=r*Math.cos(m*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}j.push(o);k.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],o=j[i+1][h],l=j[i+1][h+1],
+n=j[i][h+1],r=this.vertices[c].clone().setY(0).normalize(),m=this.vertices[o].clone().setY(0).normalize(),q=this.vertices[l].clone().setY(0).normalize(),u=this.vertices[n].clone().setY(0).normalize(),s=k[i][h].clone(),t=k[i+1][h].clone(),p=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,l,n,[r,m,q,u]));this.faceVertexUvs[0].push([s,t,p,w])}if(!e&&a>0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){c=j[0][h];o=j[0][h+1];l=this.vertices.length-1;r=new THREE.Vector3(0,
+1,0);m=new THREE.Vector3(0,1,0);q=new THREE.Vector3(0,1,0);s=k[0][h].clone();t=k[0][h+1].clone();p=new THREE.UV(t.u,0);this.faces.push(new THREE.Face3(c,o,l,[r,m,q]));this.faceVertexUvs[0].push([s,t,p])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){c=j[i][h+1];o=j[i][h];l=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);m=new THREE.Vector3(0,-1,0);q=new THREE.Vector3(0,-1,0);s=k[i][h+1].clone();t=k[i][h].clone();p=new THREE.UV(t.u,1);this.faces.push(new THREE.Face3(c,
+o,l,[r,m,q]));this.faceVertexUvs[0].push([s,t,p])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;
 THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(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);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(D=c.length;--D>=0;){e=D;f=D-1;f<0&&(f=
-c.length-1);for(var g=0,h=l+k*2,g=0;g<h;g++){var i=M*g,j=M*(g+1),m=d+e+i,i=d+f+i,o=d+f+j,j=d+e+j,n=c,q=g,r=h,m=m+E,i=i+E,o=o+E,j=j+E;B.faces.push(new THREE.Face4(m,i,o,j,null,null,s));m=O.generateSideWallUV(B,a,n,b,m,i,o,j,q,r);B.faceVertexUvs[0].push(m)}}}function e(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+E;d=d+E;e=e+E;B.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?O.generateBottomUV(B,a,b,c,d,e):O.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var h=
-b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,l=b.steps!==void 0?b.steps:1,n=b.bendPath,q=b.extrudePath,m,r=false,u=b.material,s=b.extrudeMaterial,t,p,w,A;if(q){m=q.getSpacedPoints(l);r=true;o=false;t=new THREE.TubeGeometry.FrenetFrames(q,l,false);p=new THREE.Vector3;w=new THREE.Vector3;A=new THREE.Vector3}if(!o)j=i=k=0;var z,x,v,B=this,
-E=this.vertices.length;n&&a.addWrapPath(n);var q=a.extractPoints(),n=q.shape,H=q.holes;if(q=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();x=0;for(v=H.length;x<v;x++){z=H[x];THREE.Shape.Utils.isClockWise(z)&&(H[x]=z.reverse())}q=false}var K=THREE.Shape.Utils.triangulateShape(n,H),I=n;x=0;for(v=H.length;x<v;x++){z=H[x];n=n.concat(z)}var y,C,G,L,J,M=n.length,F,N=K.length,q=[],D=0;G=I.length;y=G-1;for(C=D+1;D<G;D++,y++,C++){y===G&&(y=0);C===G&&(C=0);q[D]=d(I[D],I[y],I[C])}var T=[],P,S=q.concat();x=
-0;for(v=H.length;x<v;x++){z=H[x];P=[];D=0;G=z.length;y=G-1;for(C=D+1;D<G;D++,y++,C++){y===G&&(y=0);C===G&&(C=0);P[D]=d(z[D],z[y],z[C])}T.push(P);S=S.concat(P)}for(y=0;y<k;y++){G=y/k;L=i*(1-G);C=j*Math.sin(G*Math.PI/2);D=0;for(G=I.length;D<G;D++){J=c(I[D],q[D],C);e(J.x,J.y,-L)}x=0;for(v=H.length;x<v;x++){z=H[x];P=T[x];D=0;for(G=z.length;D<G;D++){J=c(z[D],P[D],C);e(J.x,J.y,-L)}}}C=j;for(D=0;D<M;D++){J=o?c(n[D],S[D],C):n[D];if(r){w.copy(t.normals[0]).multiplyScalar(J.x);p.copy(t.binormals[0]).multiplyScalar(J.y);
-A.copy(m[0]).addSelf(w).addSelf(p);e(A.x,A.y,A.z)}else e(J.x,J.y,0)}for(G=1;G<=l;G++)for(D=0;D<M;D++){J=o?c(n[D],S[D],C):n[D];if(r){w.copy(t.normals[G]).multiplyScalar(J.x);p.copy(t.binormals[G]).multiplyScalar(J.y);A.copy(m[G]).addSelf(w).addSelf(p);e(A.x,A.y,A.z)}else e(J.x,J.y,h/l*G)}for(y=k-1;y>=0;y--){G=y/k;L=i*(1-G);C=j*Math.sin(G*Math.PI/2);D=0;for(G=I.length;D<G;D++){J=c(I[D],q[D],C);e(J.x,J.y,h+L)}x=0;for(v=H.length;x<v;x++){z=H[x];P=T[x];D=0;for(G=z.length;D<G;D++){J=c(z[D],P[D],C);r?e(J.x,
+c.length-1);for(var g=0,h=l+k*2,g=0;g<h;g++){var i=M*g,j=M*(g+1),o=d+e+i,i=d+f+i,m=d+f+j,j=d+e+j,n=c,r=g,p=h,o=o+E,i=i+E,m=m+E,j=j+E;C.faces.push(new THREE.Face4(o,i,m,j,null,null,s));o=O.generateSideWallUV(C,a,n,b,o,i,m,j,r,p);C.faceVertexUvs[0].push(o)}}}function e(a,b,c){C.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+E;d=d+E;e=e+E;C.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?O.generateBottomUV(C,a,b,c,d,e):O.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=
+b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,l=b.steps!==void 0?b.steps:1,n=b.bendPath,r=b.extrudePath,m,q=false,u=b.material,s=b.extrudeMaterial,t,p,w,A;if(r){m=r.getSpacedPoints(l);q=true;o=false;t=new THREE.TubeGeometry.FrenetFrames(r,l,false);p=new THREE.Vector3;w=new THREE.Vector3;A=new THREE.Vector3}if(!o)j=i=k=0;var z,x,v,C=this,
+E=this.vertices.length;n&&a.addWrapPath(n);var r=a.extractPoints(),n=r.shape,H=r.holes;if(r=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();x=0;for(v=H.length;x<v;x++){z=H[x];THREE.Shape.Utils.isClockWise(z)&&(H[x]=z.reverse())}r=false}var K=THREE.Shape.Utils.triangulateShape(n,H),I=n;x=0;for(v=H.length;x<v;x++){z=H[x];n=n.concat(z)}var y,B,G,L,J,M=n.length,F,N=K.length,r=[],D=0;G=I.length;y=G-1;for(B=D+1;D<G;D++,y++,B++){y===G&&(y=0);B===G&&(B=0);r[D]=d(I[D],I[y],I[B])}var T=[],P,S=r.concat();x=
+0;for(v=H.length;x<v;x++){z=H[x];P=[];D=0;G=z.length;y=G-1;for(B=D+1;D<G;D++,y++,B++){y===G&&(y=0);B===G&&(B=0);P[D]=d(z[D],z[y],z[B])}T.push(P);S=S.concat(P)}for(y=0;y<k;y++){G=y/k;L=i*(1-G);B=j*Math.sin(G*Math.PI/2);D=0;for(G=I.length;D<G;D++){J=c(I[D],r[D],B);e(J.x,J.y,-L)}x=0;for(v=H.length;x<v;x++){z=H[x];P=T[x];D=0;for(G=z.length;D<G;D++){J=c(z[D],P[D],B);e(J.x,J.y,-L)}}}B=j;for(D=0;D<M;D++){J=o?c(n[D],S[D],B):n[D];if(q){w.copy(t.normals[0]).multiplyScalar(J.x);p.copy(t.binormals[0]).multiplyScalar(J.y);
+A.copy(m[0]).addSelf(w).addSelf(p);e(A.x,A.y,A.z)}else e(J.x,J.y,0)}for(G=1;G<=l;G++)for(D=0;D<M;D++){J=o?c(n[D],S[D],B):n[D];if(q){w.copy(t.normals[G]).multiplyScalar(J.x);p.copy(t.binormals[G]).multiplyScalar(J.y);A.copy(m[G]).addSelf(w).addSelf(p);e(A.x,A.y,A.z)}else e(J.x,J.y,h/l*G)}for(y=k-1;y>=0;y--){G=y/k;L=i*(1-G);B=j*Math.sin(G*Math.PI/2);D=0;for(G=I.length;D<G;D++){J=c(I[D],r[D],B);e(J.x,J.y,h+L)}x=0;for(v=H.length;x<v;x++){z=H[x];P=T[x];D=0;for(G=z.length;D<G;D++){J=c(z[D],P[D],B);q?e(J.x,
 J.y+m[l-1].y,m[l-1].x+L):e(J.x,J.y,h+L)}}}var O=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(o){var a;a=M*0;for(D=0;D<N;D++){F=K[D];g(F[2]+a,F[1]+a,F[0]+a,true)}a=l+k*2;a=M*a;for(D=0;D<N;D++){F=K[D];g(F[0]+a,F[1]+a,F[2]+a,false)}}else{for(D=0;D<N;D++){F=K[D];g(F[2],F[1],F[0],true)}for(D=0;D<N;D++){F=K[D];g(F[0]+M*l,F[1]+M*l,F[2]+M*l,false)}}})();(function(){var a=0;f(I,a);a=a+I.length;x=0;for(v=H.length;x<v;x++){z=H[x];f(z,a);a=a+z.length}})()};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,f,e){b=a.vertices[f].x;f=a.vertices[f].y;c=a.vertices[e].x;e=a.vertices[e].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-f),new THREE.UV(c,1-e)]},generateBottomUV:function(a,b,c,d,f,e){return this.generateTopUV(a,b,c,d,f,e)},generateSideWallUV:function(a,b,c,d,f,e,g,h){var b=a.vertices[f].x,c=a.vertices[f].y,f=a.vertices[f].z,d=a.vertices[e].x,i=a.vertices[e].y,e=a.vertices[e].z,j=a.vertices[g].x,k=
 a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,l=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(j,g),new THREE.UV(o,a)]:[new THREE.UV(c,f),new THREE.UV(i,e),new THREE.UV(k,g),new THREE.UV(l,a)]}};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;
@@ -194,17 +194,17 @@ THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=
 (c+1)/b,d/f),new THREE.UV(1-(c+1)/b,(d+1)/f),new THREE.UV(1-c/b,(d+1)/f)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-f,0,a*j-e));for(a=0;a<d;a++)for(b=0;b<c;b++){f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);f.normal.copy(k);f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone());this.faces.push(f);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+1)/d),new THREE.UV((b+
 1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var o=[],l=[];for(h=0;h<=b;h++){var n=h/b,q=i/c,m=new THREE.Vector3;m.x=-a*Math.cos(d+n*f)*Math.sin(e+q*g);m.y=a*Math.cos(e+q*g);m.z=a*Math.sin(d+n*f)*Math.sin(e+q*g);this.vertices.push(m);o.push(this.vertices.length-1);l.push(new THREE.UV(n,
-q))}j.push(o);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],e=j[i+1][h],g=j[i+1][h+1],o=this.vertices[d].clone().normalize(),l=this.vertices[f].clone().normalize(),n=this.vertices[e].clone().normalize(),q=this.vertices[g].clone().normalize(),m=k[i][h+1].clone(),r=k[i][h].clone(),u=k[i+1][h].clone(),s=k[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,e,g,[o,n,q]));this.faceVertexUvs[0].push([m,u,s])}else if(Math.abs(this.vertices[e].y)==
-a){this.faces.push(new THREE.Face3(d,f,e,[o,l,n]));this.faceVertexUvs[0].push([m,r,u])}else{this.faces.push(new THREE.Face4(d,f,e,g,[o,l,n,q]));this.faceVertexUvs[0].push([m,r,u,s])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var o=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=i/c,m=new THREE.Vector3;m.x=-a*Math.cos(d+n*f)*Math.sin(e+r*g);m.y=a*Math.cos(e+r*g);m.z=a*Math.sin(d+n*f)*Math.sin(e+r*g);this.vertices.push(m);o.push(this.vertices.length-1);l.push(new THREE.UV(n,
+r))}j.push(o);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],e=j[i+1][h],g=j[i+1][h+1],o=this.vertices[d].clone().normalize(),l=this.vertices[f].clone().normalize(),n=this.vertices[e].clone().normalize(),r=this.vertices[g].clone().normalize(),m=k[i][h+1].clone(),q=k[i][h].clone(),u=k[i+1][h].clone(),s=k[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,e,g,[o,n,r]));this.faceVertexUvs[0].push([m,u,s])}else if(Math.abs(this.vertices[e].y)==
+a){this.faces.push(new THREE.Face3(d,f,e,[o,l,n]));this.faceVertexUvs[0].push([m,q,u])}else{this.faces.push(new THREE.Face4(d,f,e,g,[o,l,n,r]));this.faceVertexUvs[0].push([m,q,u,s])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 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 b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,f=(""+a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var e=[],g,h,i,j,k,o,l,n,q,m,r,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,k));f.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,
-k));f.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;q=b[a++]*c;f.quadraticCurveTo(n,q,i,k);if(g=e[e.length-1]){o=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var s=g/h,t=THREE.Shape.Utils.b2(s,o,n,i),s=THREE.Shape.Utils.b2(s,l,q,k);e.push(new THREE.Vector2(t,s))}}break;case "b":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;q=b[a++]*-c;m=b[a++]*c+d;r=b[a++]*-c;f.bezierCurveTo(i,k,n,q,m,r);if(g=e[e.length-1]){o=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){s=g/h;t=THREE.Shape.Utils.b3(s,o,n,
-m,i);s=THREE.Shape.Utils.b3(s,l,q,r,k);e.push(new THREE.Vector2(t,s))}}}}}return{offset:u.ha*c,points:e,path:f}}}};
-(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],i,j,k;if(b(a)>0)for(j=0;j<f;j++)g[j]=j;else for(j=0;j<f;j++)g[j]=f-1-j;var o=2*f;for(j=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var l;a:{l=a;var n=i,q=j,m=k,r=f,u=g,s=void 0,t=void 0,p=void 0,w=void 0,A=void 0,
-z=void 0,x=void 0,v=void 0,B=void 0,t=l[u[n]].x,p=l[u[n]].y,w=l[u[q]].x,A=l[u[q]].y,z=l[u[m]].x,x=l[u[m]].y;if(1.0E-10>(w-t)*(x-p)-(A-p)*(z-t))l=false;else{for(s=0;s<r;s++)if(!(s==n||s==q||s==m)){var v=l[u[s]].x,B=l[u[s]].y,E=void 0,H=void 0,K=void 0,I=void 0,y=void 0,C=void 0,G=void 0,L=void 0,J=void 0,M=void 0,F=void 0,N=void 0,E=K=y=void 0,E=z-w,H=x-A,K=t-z,I=p-x,y=w-t,C=A-p,G=v-t,L=B-p,J=v-w,M=B-A,F=v-z,N=B-x,E=E*M-H*J,y=y*L-C*G,K=K*N-I*F;if(E>=0&&K>=0&&y>=0){l=false;break a}}l=true}}if(l){e.push([a[g[i]],
+0,f=(""+a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var e=[],g,h,i,j,k,o,l,n,r,m,q,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,k));f.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,
+k));f.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*c;f.quadraticCurveTo(n,r,i,k);if(g=e[e.length-1]){o=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var s=g/h,t=THREE.Shape.Utils.b2(s,o,n,i),s=THREE.Shape.Utils.b2(s,l,r,k);e.push(new THREE.Vector2(t,s))}}break;case "b":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*-c;m=b[a++]*c+d;q=b[a++]*-c;f.bezierCurveTo(i,k,n,r,m,q);if(g=e[e.length-1]){o=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){s=g/h;t=THREE.Shape.Utils.b3(s,o,n,
+m,i);s=THREE.Shape.Utils.b3(s,l,r,q,k);e.push(new THREE.Vector2(t,s))}}}}}return{offset:u.ha*c,points:e,path:f}}}};
+(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],i,j,k;if(b(a)>0)for(j=0;j<f;j++)g[j]=j;else for(j=0;j<f;j++)g[j]=f-1-j;var o=2*f;for(j=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var l;a:{l=a;var n=i,r=j,m=k,q=f,u=g,s=void 0,t=void 0,p=void 0,w=void 0,A=void 0,
+z=void 0,x=void 0,v=void 0,C=void 0,t=l[u[n]].x,p=l[u[n]].y,w=l[u[r]].x,A=l[u[r]].y,z=l[u[m]].x,x=l[u[m]].y;if(1.0E-10>(w-t)*(x-p)-(A-p)*(z-t))l=false;else{for(s=0;s<q;s++)if(!(s==n||s==r||s==m)){var v=l[u[s]].x,C=l[u[s]].y,E=void 0,H=void 0,K=void 0,I=void 0,y=void 0,B=void 0,G=void 0,L=void 0,J=void 0,M=void 0,F=void 0,N=void 0,E=K=y=void 0,E=z-w,H=x-A,K=t-z,I=p-x,y=w-t,B=A-p,G=v-t,L=C-p,J=v-w,M=C-A,F=v-z,N=C-x,E=E*M-H*J,y=y*L-B*G,K=K*N-I*F;if(E>=0&&K>=0&&y>=0){l=false;break a}}l=true}}if(l){e.push([a[g[i]],
 a[g[j]],a[g[k]]]);h.push([g[i],g[j],g[k]]);i=j;for(k=j+1;k<f;i++,k++)g[i]=g[k];f--;o=2*f}}return d?h:e};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(e);f.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(e);h.z=
 this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
@@ -213,9 +213,9 @@ THREE.TorusKnotGeometry=function(a,b,c,d,f,e,g){function h(a,b,c,d,e,f){var g=Ma
 Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,e);d.add(i,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(i*d.x+g*f.x);e.y=e.y+(i*d.y+g*f.y);e.z=e.z+(i*d.z+g*f.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(e.x,e.y,e.z))-1}}for(a=0;a<
 this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,e=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
-THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,i,j,k,o=new THREE.Vector3,l,n,q,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);l=b.tangents;n=b.normals;q=b.binormals;this.tangents=l;this.normals=n;this.binormals=q;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);k=a.getPointAt(d);d=l[b];g=n[b];h=q[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,i,j,k,o=new THREE.Vector3,l,n,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);l=b.tangents;n=b.normals;r=b.binormals;this.tangents=l;this.normals=n;this.binormals=r;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);k=a.getPointAt(d);d=l[b];g=n[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
 k,c,255));this.debug.add(new THREE.ArrowHelper(g,k,c,16711680));this.debug.add(new THREE.ArrowHelper(h,k,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);o.copy(k);o.x=o.x+(j*g.x+i*h.x);o.y=o.y+(j*g.y+i*h.y);o.z=o.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){e=f?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
-a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][o];o=this.grid[b][o];l=new THREE.UV(b/this.segments,d/this.segmentsRadius);n=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);q=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,e,o));this.faceVertexUvs[0].push([l,n,q,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
+a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][o];o=this.grid[b][o];l=new THREE.UV(b/this.segments,d/this.segmentsRadius);n=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,e,o));this.faceVertexUvs[0].push([l,n,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
 THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
 THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,k,o;this.tangents=f;this.normals=e;this.binormals=g;for(j=0;j<b;j++){k=j/(b-1);f[j]=a.getTangentAt(k);f[j].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(f[0].x);k=Math.abs(f[0].y);o=Math.abs(f[0].z);if(j<=a){a=j;d.set(1,0,0)}if(k<=a){a=k;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
 e[0].cross(f[0],h);g[0].cross(f[0],e[0]);for(j=1;j<b;j++){e[j]=e[j-1].clone();g[j]=g[j-1].clone();h.cross(f[j-1],f[j]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(f[j-1].dot(f[j]));i.makeRotationAxis(h,d).multiplyVector3(e[j])}g[j].cross(f[j],e[j])}if(c){d=Math.acos(e[0].dot(e[b-1]));d=d/(b-1);f[0].dot(h.cross(e[0],e[b-1]))>0&&(d=-d);for(j=1;j<b;j++){i.makeRotationAxis(f[j],d*j).multiplyVector3(e[j]);g[j].cross(f[j],e[j])}}};
@@ -238,15 +238,15 @@ this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);
 THREE.CameraHelper.prototype.update=function(){function a(a,d,f,e){THREE.CameraHelper.__v.set(d,f,e);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(f=a.length;d<f;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
 1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,i){var j=new THREE.Face4(a,c,d,f,null,g.color,g.material);if(l.useOldVertexColors){j.vertexColors=[];for(var m,n,q,r=0;r<4;r++){q=h[r];m=new THREE.Color;m.setRGB(0,0,0);for(var p=0;p<q.length;p++){n=g.vertexColors[q[p]-1];m.r=m.r+n.r;m.g=m.g+n.g;m.b=m.b+n.b}m.r=m.r/q.length;m.g=m.g/q.length;m.b=m.b/q.length;
-j.vertexColors[r]=m}}k.push(j);if(l.supportUVs){g=[e(a,""),e(c,i),e(d,i),e(f,i)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",f+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=s[e];if(!f){a>=t&&a<t+q.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in s?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,s[e]):s[e]=d}function h(a,
-b){K[a]===void 0&&(K[a]=[]);K[a].push(b)}function i(a,b,c){I[a]===void 0&&(I[a]={});I[a][b]=c}var j=[],k=[],o=[],l=this,n=a.vertices,q=a.faces,j=n.concat(),m=[],r={},u={},s={},t=n.length,p,w,A,z,x,v=a.faceVertexUvs[0],B;b("originalFaces, uvs, originalVerticesLength",q.length,v.length,t);if(l.supportUVs){p=0;for(w=v.length;p<w;p++){A=0;for(z=v[p].length;A<z;A++){B=q[p]["abcd".charAt(A)];g(B,p,v[p][A])}}}if(v.length==0)l.supportUVs=false;p=0;for(x in s)p++;if(!p){l.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-s,"vs",v.length);p=0;for(w=q.length;p<w;p++){x=q[p];m.push(x.centroid);j.push(x.centroid);if(l.supportUVs){v=new THREE.UV;if(x instanceof THREE.Face3){v.u=e(x.a,p).u+e(x.b,p).u+e(x.c,p).u;v.v=e(x.a,p).v+e(x.b,p).v+e(x.c,p).v;v.u=v.u/3;v.v=v.v/3}else if(x instanceof THREE.Face4){v.u=e(x.a,p).u+e(x.b,p).u+e(x.c,p).u+e(x.d,p).u;v.v=e(x.a,p).v+e(x.b,p).v+e(x.c,p).v+e(x.d,p).v;v.u=v.u/4;v.v=v.v/4}g(t+p,"",v)}}b("-- added UVs for new Faces",s);w=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
-var c,d,e,g,h={};c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.a);b(g,c)}else if(e instanceof THREE.Face4){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.d);b(g,c);g=f(e.d,e.a);b(g,c)}}return h}(a);B=0;var E,H,K={},I={};for(p in w){v=w[p];E=p.split("_");H=E[0];E=E[1];h(H,[H,E]);h(E,[H,E]);A=0;for(z=v.length;A<z;A++){x=v[A];i(H,x,p);i(E,x,p)}v.length<2&&(u[p]=true)}b("vertexEdgeMap",K,"vertexFaceMap",I);for(p in w){v=
-w[p];x=v[0];z=v[1];E=p.split("_");H=E[0];E=E[1];v=new THREE.Vector3;if(u[p]){v.addSelf(n[H]);v.addSelf(n[E]);v.multiplyScalar(0.5)}else{v.addSelf(m[x]);v.addSelf(m[z]);v.addSelf(n[H]);v.addSelf(n[E]);v.multiplyScalar(0.25)}r[p]=t+q.length+B;j.push(v);B++;if(l.supportUVs){v=new THREE.UV;v.u=e(H,x).u+e(E,x).u;v.v=e(H,x).v+e(E,x).v;v.u=v.u/2;v.v=v.v/2;g(r[p],x,v);if(!u[p]){v=new THREE.UV;v.u=e(H,z).u+e(E,z).u;v.v=e(H,z).v+e(E,z).v;v.u=v.u/2;v.v=v.v/2;g(r[p],z,v)}}}b("-- Step 2 done");var y,C;z=["123",
-"12","2","23"];E=["123","23","3","31"];var G=["123","31","1","12"],L=["1234","12","2","23"],J=["1234","23","3","34"],M=["1234","34","4","41"],F=["1234","41","1","12"];p=0;for(w=m.length;p<w;p++){x=q[p];v=t+p;if(x instanceof THREE.Face3){B=f(x.a,x.b);H=f(x.b,x.c);y=f(x.c,x.a);d(v,r[B],x.b,r[H],x,z,p);d(v,r[H],x.c,r[y],x,E,p);d(v,r[y],x.a,r[B],x,G,p)}else if(x instanceof THREE.Face4){B=f(x.a,x.b);H=f(x.b,x.c);y=f(x.c,x.d);C=f(x.d,x.a);d(v,r[B],x.b,r[H],x,L,p);d(v,r[H],x.c,r[y],x,J,p);d(v,r[y],x.d,r[C],
-x,M,p);d(v,r[C],x.a,r[B],x,F,p)}else b("face should be a face!",x)}r=new THREE.Vector3;x=new THREE.Vector3;p=0;for(w=n.length;p<w;p++)if(K[p]!==void 0){r.set(0,0,0);x.set(0,0,0);H=new THREE.Vector3(0,0,0);v=0;for(A in I[p]){r.addSelf(m[A]);v++}z=0;B=K[p].length;for(A=0;A<B;A++)u[f(K[p][A][0],K[p][A][1])]&&z++;if(z!=2){r.divideScalar(v);for(A=0;A<B;A++){v=K[p][A];v=n[v[0]].clone().addSelf(n[v[1]]).divideScalar(2);x.addSelf(v)}x.divideScalar(B);H.addSelf(n[p]);H.multiplyScalar(B-3);H.addSelf(r);H.addSelf(x.multiplyScalar(2));
-H.divideScalar(B);j[p]=H}}a.vertices=j;a.faces=k;a.faceVertexUvs[0]=o;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.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,i){var j=new THREE.Face4(a,c,d,f,null,g.color,g.material);if(l.useOldVertexColors){j.vertexColors=[];for(var m,n,r,p=0;p<4;p++){r=h[p];m=new THREE.Color;m.setRGB(0,0,0);for(var q=0;q<r.length;q++){n=g.vertexColors[r[q]-1];m.r=m.r+n.r;m.g=m.g+n.g;m.b=m.b+n.b}m.r=m.r/r.length;m.g=m.g/r.length;m.b=m.b/r.length;
+j.vertexColors[p]=m}}k.push(j);if(l.supportUVs){g=[e(a,""),e(c,i),e(d,i),e(f,i)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",f+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=s[e];if(!f){a>=t&&a<t+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in s?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,s[e]):s[e]=d}function h(a,
+b){K[a]===void 0&&(K[a]=[]);K[a].push(b)}function i(a,b,c){I[a]===void 0&&(I[a]={});I[a][b]=c}var j=[],k=[],o=[],l=this,n=a.vertices,r=a.faces,j=n.concat(),m=[],q={},u={},s={},t=n.length,p,w,A,z,x,v=a.faceVertexUvs[0],C;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,t);if(l.supportUVs){p=0;for(w=v.length;p<w;p++){A=0;for(z=v[p].length;A<z;A++){C=r[p]["abcd".charAt(A)];g(C,p,v[p][A])}}}if(v.length==0)l.supportUVs=false;p=0;for(x in s)p++;if(!p){l.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
+s,"vs",v.length);p=0;for(w=r.length;p<w;p++){x=r[p];m.push(x.centroid);j.push(x.centroid);if(l.supportUVs){v=new THREE.UV;if(x instanceof THREE.Face3){v.u=e(x.a,p).u+e(x.b,p).u+e(x.c,p).u;v.v=e(x.a,p).v+e(x.b,p).v+e(x.c,p).v;v.u=v.u/3;v.v=v.v/3}else if(x instanceof THREE.Face4){v.u=e(x.a,p).u+e(x.b,p).u+e(x.c,p).u+e(x.d,p).u;v.v=e(x.a,p).v+e(x.b,p).v+e(x.c,p).v+e(x.d,p).v;v.u=v.u/4;v.v=v.v/4}g(t+p,"",v)}}b("-- added UVs for new Faces",s);w=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
+var c,d,e,g,h={};c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.a);b(g,c)}else if(e instanceof THREE.Face4){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.d);b(g,c);g=f(e.d,e.a);b(g,c)}}return h}(a);C=0;var E,H,K={},I={};for(p in w){v=w[p];E=p.split("_");H=E[0];E=E[1];h(H,[H,E]);h(E,[H,E]);A=0;for(z=v.length;A<z;A++){x=v[A];i(H,x,p);i(E,x,p)}v.length<2&&(u[p]=true)}b("vertexEdgeMap",K,"vertexFaceMap",I);for(p in w){v=
+w[p];x=v[0];z=v[1];E=p.split("_");H=E[0];E=E[1];v=new THREE.Vector3;if(u[p]){v.addSelf(n[H]);v.addSelf(n[E]);v.multiplyScalar(0.5)}else{v.addSelf(m[x]);v.addSelf(m[z]);v.addSelf(n[H]);v.addSelf(n[E]);v.multiplyScalar(0.25)}q[p]=t+r.length+C;j.push(v);C++;if(l.supportUVs){v=new THREE.UV;v.u=e(H,x).u+e(E,x).u;v.v=e(H,x).v+e(E,x).v;v.u=v.u/2;v.v=v.v/2;g(q[p],x,v);if(!u[p]){v=new THREE.UV;v.u=e(H,z).u+e(E,z).u;v.v=e(H,z).v+e(E,z).v;v.u=v.u/2;v.v=v.v/2;g(q[p],z,v)}}}b("-- Step 2 done");var y,B;z=["123",
+"12","2","23"];E=["123","23","3","31"];var G=["123","31","1","12"],L=["1234","12","2","23"],J=["1234","23","3","34"],M=["1234","34","4","41"],F=["1234","41","1","12"];p=0;for(w=m.length;p<w;p++){x=r[p];v=t+p;if(x instanceof THREE.Face3){C=f(x.a,x.b);H=f(x.b,x.c);y=f(x.c,x.a);d(v,q[C],x.b,q[H],x,z,p);d(v,q[H],x.c,q[y],x,E,p);d(v,q[y],x.a,q[C],x,G,p)}else if(x instanceof THREE.Face4){C=f(x.a,x.b);H=f(x.b,x.c);y=f(x.c,x.d);B=f(x.d,x.a);d(v,q[C],x.b,q[H],x,L,p);d(v,q[H],x.c,q[y],x,J,p);d(v,q[y],x.d,q[B],
+x,M,p);d(v,q[B],x.a,q[C],x,F,p)}else b("face should be a face!",x)}q=new THREE.Vector3;x=new THREE.Vector3;p=0;for(w=n.length;p<w;p++)if(K[p]!==void 0){q.set(0,0,0);x.set(0,0,0);H=new THREE.Vector3(0,0,0);v=0;for(A in I[p]){q.addSelf(m[A]);v++}z=0;C=K[p].length;for(A=0;A<C;A++)u[f(K[p][A][0],K[p][A][1])]&&z++;if(z!=2){q.divideScalar(v);for(A=0;A<C;A++){v=K[p][A];v=n[v[0]].clone().addSelf(n[v[1]]).divideScalar(2);x.addSelf(v)}x.divideScalar(C);H.addSelf(n[p]);H.multiplyScalar(C-3);H.addSelf(q);H.addSelf(x.multiplyScalar(2));
+H.divideScalar(C);j[p]=H}}a.vertices=j;a.faces=k;a.faceVertexUvs[0]=o;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.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=h.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
@@ -259,32 +259,32 @@ THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.const
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){h==0&&(h=e.getResponseHeader("Content-Length"));f({total:h,loaded:e.responseText.length})}}else e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};
 e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,k,o,l,n,q,m,r,u,s,t,p;function w(a){return a%4?4-a%4:0}function A(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function x(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=G[e*2];e=G[e*2+1];i=G[f*2];j=G[f*2+1];f=G[g*2];k=G[g*2+1];g=I.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(i,j));l.push(new THREE.UV(f,
-k));g.push(l)}}function v(b,c){var d,e,f,g,h,i,j,k,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=G[e*2];e=G[e*2+1];j=G[f*2];l=G[f*2+1];k=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=I.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,l));n.push(new THREE.UV(k,m));n.push(new THREE.UV(g,f));h.push(n)}}function B(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
-I.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function E(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];I.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function H(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var o=C[k*3],n=C[k*3+1];k=C[k*3+2];var q=C[l*3],
-r=C[l*3+1];l=C[l*3+2];I.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(C[j*3],C[j*3+1],C[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(q,r,l)],null,i))}}function K(b,c,d,e){for(var f,g,h,i,j,k,l,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];o=d[e*4+3];j=n[e];var q=C[l*3],r=C[l*3+1];l=C[l*3+2];var p=C[m*3],s=C[m*3+1];m=C[m*3+2];var u=C[o*3],t=C[o*3+1];o=C[o*3+2];I.faces.push(new THREE.Face4(f,
-g,h,i,[new THREE.Vector3(C[k*3],C[k*3+1],C[k*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(p,s,m),new THREE.Vector3(u,t,o)],null,j))}}var I=this,y=0,C=[],G=[],L,J,M;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(I,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,y,12);c=A(a,y+12);A(a,y+13);A(a,y+14);A(a,y+15);f=A(a,y+16);i=A(a,y+17);j=A(a,y+18);k=A(a,y+19);o=z(a,y+20);l=z(a,y+20+4);n=z(a,y+20+8);b=z(a,y+20+12);q=
-z(a,y+20+16);m=z(a,y+20+20);r=z(a,y+20+24);u=z(a,y+20+28);s=z(a,y+20+32);t=z(a,y+20+36);p=z(a,y+20+40);y=y+c;c=f*3+k;M=f*4+k;L=b*c;J=q*(c+i*3);f=m*(c+j*3);k=r*(c+i*3+j*3);c=u*M;i=s*(M+i*4);j=t*(M+j*4);y=y+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];I.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(y);y=y+function(b){if(l){var b=new Int8Array(a,b,l*3),c,d,e,f;for(c=0;c<l;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];C.push(d/
-127,e/127,f/127)}}return l*3*Int8Array.BYTES_PER_ELEMENT}(y);y=y+w(l*3);y=y+function(b){if(n){var b=new Float32Array(a,b,n*2),c,d,e;for(c=0;c<n;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return n*2*Float32Array.BYTES_PER_ELEMENT}(y);L=y+L+w(b*2);J=L+J+w(q*2);f=J+f+w(m*2);k=f+k+w(r*2);c=k+c+w(u*2);i=c+i+w(s*2);j=i+j+w(t*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;B(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);x(m,b)}})(J);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-r*Uint32Array.BYTES_PER_ELEMENT*3;H(r,a,b,c+r*Uint32Array.BYTES_PER_ELEMENT*3);x(r,c)}})(f);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;E(t,a,b+t*Uint32Array.BYTES_PER_ELEMENT*4);v(t,b)}})(i);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*4,c=b+p*Uint32Array.BYTES_PER_ELEMENT*4;K(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*4);v(p,c)}})(j);b&&B(b,y,y+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,k,o,l,n,r,m,q,u,s,t,p;function w(a){return a%4?4-a%4:0}function A(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function x(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=G[e*2];e=G[e*2+1];i=G[f*2];j=G[f*2+1];f=G[g*2];k=G[g*2+1];g=I.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
+k));g.push(m)}}function v(b,c){var d,e,f,g,h,i,j,k,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=G[e*2];e=G[e*2+1];j=G[f*2];l=G[f*2+1];k=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=I.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,l));n.push(new THREE.UV(k,m));n.push(new THREE.UV(g,f));h.push(n)}}function C(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
+I.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function E(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];I.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function H(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var o=B[k*3],n=B[k*3+1];k=B[k*3+2];var p=B[l*3],
+r=B[l*3+1];l=B[l*3+2];I.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(B[j*3],B[j*3+1],B[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(p,r,l)],null,i))}}function K(b,c,d,e){for(var f,g,h,i,j,k,l,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];o=d[e*4+3];j=n[e];var p=B[l*3],r=B[l*3+1];l=B[l*3+2];var q=B[m*3],s=B[m*3+1];m=B[m*3+2];var u=B[o*3],t=B[o*3+1];o=B[o*3+2];I.faces.push(new THREE.Face4(f,
+g,h,i,[new THREE.Vector3(B[k*3],B[k*3+1],B[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(u,t,o)],null,j))}}var I=this,y=0,B=[],G=[],L,J,M;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(I,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,y,12);c=A(a,y+12);A(a,y+13);A(a,y+14);A(a,y+15);f=A(a,y+16);i=A(a,y+17);j=A(a,y+18);k=A(a,y+19);o=z(a,y+20);l=z(a,y+20+4);n=z(a,y+20+8);b=z(a,y+20+12);r=
+z(a,y+20+16);m=z(a,y+20+20);q=z(a,y+20+24);u=z(a,y+20+28);s=z(a,y+20+32);t=z(a,y+20+36);p=z(a,y+20+40);y=y+c;c=f*3+k;M=f*4+k;L=b*c;J=r*(c+i*3);f=m*(c+j*3);k=q*(c+i*3+j*3);c=u*M;i=s*(M+i*4);j=t*(M+j*4);y=y+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];I.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(y);y=y+function(b){if(l){var b=new Int8Array(a,b,l*3),c,d,e,f;for(c=0;c<l;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];B.push(d/
+127,e/127,f/127)}}return l*3*Int8Array.BYTES_PER_ELEMENT}(y);y=y+w(l*3);y=y+function(b){if(n){var b=new Float32Array(a,b,n*2),c,d,e;for(c=0;c<n;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return n*2*Float32Array.BYTES_PER_ELEMENT}(y);L=y+L+w(b*2);J=L+J+w(r*2);f=J+f+w(m*2);k=f+k+w(q*2);c=k+c+w(u*2);i=c+i+w(s*2);j=i+j+w(t*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;C(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);x(m,b)}})(J);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);x(q,c)}})(f);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;E(t,a,b+t*Uint32Array.BYTES_PER_ELEMENT*4);v(t,b)}})(i);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*4,c=b+p*Uint32Array.BYTES_PER_ELEMENT*4;K(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*4);v(p,c)}})(j);b&&C(b,y,y+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;H(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(L);u&&E(u,k,k+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4;K(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
 THREE.ColladaLoader=function(){function a(a,d,f){Q=a;d=d||na;if(f!==void 0){a=f.split("/");a.pop();oa=(a.length<1?".":a.join("/"))+"/"}if((a=Q.evaluate("//dae:asset",Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var i=a.childNodes[f];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":ba=i.textContent.charAt(0)}}if(!R.convertUpAxis||ba===R.upAxis)X=null;else switch(ba){case "X":X=R.upAxis===
-"Y"?"XtoY":"XtoZ";break;case "Y":X=R.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":X=R.upAxis==="X"?"ZtoX":"ZtoY"}aa=b("//dae:library_images/dae:image",g,"image");ga=b("//dae:library_materials/dae:material",v,"material");ha=b("//dae:library_effects/dae:effect",I,"effect");W=b("//dae:library_geometries/dae:geometry",r,"geometry");ia=b(".//dae:library_cameras/dae:camera",M,"camera");V=b("//dae:library_controllers/dae:controller",h,"controller");Y=b("//dae:library_animations/dae:animation",C,"animation");
+"Y"?"XtoY":"XtoZ";break;case "Y":X=R.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":X=R.upAxis==="X"?"ZtoX":"ZtoY"}aa=b("//dae:library_images/dae:image",g,"image");ga=b("//dae:library_materials/dae:material",v,"material");ha=b("//dae:library_effects/dae:effect",I,"effect");W=b("//dae:library_geometries/dae:geometry",q,"geometry");ia=b(".//dae:library_cameras/dae:camera",M,"camera");V=b("//dae:library_controllers/dae:controller",h,"controller");Y=b("//dae:library_animations/dae:animation",B,"animation");
 ja=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");ca=[];da=[];if(a=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext()){a=a.getAttribute("url").replace(/^#/,"");U=ja[a.length>0?a:"visual_scene0"]}else U=null;$=new THREE.Object3D;for(a=0;a<U.nodes.length;a++)$.add(e(U.nodes[a]));ka=[];c($);a={scene:$,morphs:ca,skins:da,animations:ka,dae:{images:aa,materials:ga,cameras:ia,effects:ha,geometries:W,controllers:V,animations:Y,
 visualScenes:ja,scene:U}};d&&d(a);return a}function b(a,b,c){for(var a=Q.evaluate(a,Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=U.getChildById(a.name,true),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ka.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
 {hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}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 f(a,b,c){var e,f=V[b.url];if(!f||
 !f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in Y)for(var i=Y[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=U.getChildById(b.skeleton[0],true)||U.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,o,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j]);
-for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vector3);d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){l=j[m];o=-1;if(l.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){o=n;break}if(o>=0){n=k.invBindMatrices[o];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var q=0;q<k.weights[n].length;q++){var r=k.weights[n][q];r.joint==o&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
+for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vector3);d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){l=j[m];o=-1;if(l.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){o=n;break}if(o>=0){n=k.invBindMatrices[o];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==o&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
 l.sid+"'.";}}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++){l=h[j].weights[k];m=l.index;l=l.weight;o=a.vertices[m];m=i[m];g.x=o.x;g.y=o.y;g.z=o.z;h[j].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*l;m.y=m.y+g.y*l;m.z=m.z+g.z*l}a.morphTargets.push({name:"target_"+c,vertices:i})}}}function e(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=V[a.controllers[g].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=new m;j.url=i.skin.source;
 j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(V[i.skin.source]){d=i=V[i.skin.source];if(i.morph&&W[i.morph.source]){j=new m;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j)}}break;case "morph":if(W[i.morph.source]){j=new m;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);d=a.controllers[g]}console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
-0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=W[i.url],k={},l=[],o=0,q;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++){q=j[h];var r=ga[q.target],p=ha[r.instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;k[q.symbol]=o;l.push(p.material);q=p.material;q.name=r.name==null||r.name===""?r.id:r.name;o++}j=q||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;
+0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=W[i.url],k={},l=[],o=0,p;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++){p=j[h];var r=ga[p.target],q=ha[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=o;l.push(q.material);p=q.material;p.name=r.name==null||r.name===""?r.id:r.name;o++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;
 if(o>1){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++){l=i.faces[h];l.materialIndex=k[l.daeMaterial]}}if(c!==void 0){f(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=V[c.url];j.skinInstanceController=c;j.name="skin_"+da.length;da.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(l=0;l<k.targets.length;l++){o=W[k.targets[l]];if(o.mesh&&
 o.mesh.primitives&&o.mesh.primitives.length){o=o.mesh.primitives[0].geometry;o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+ca.length;ca.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=ia[a.cameras[g].url];b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar)}b.name=
 a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=true;b.scale=g[2];if(R.centerGeometry&&b.geometry){g=THREE.GeometryUtils.center(b.geometry);b.quaternion.multiplyVector3(g.multiplySelf(b.scale));b.position.subSelf(g)}for(g=0;g<a.nodes.length;g++)b.add(e(a.nodes[g],a));return b}function g(){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 j(){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 l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=
-this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function t(){s.call(this);this.vcount=[]}function p(){s.call(this);this.vcount=3}function w(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function z(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function B(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function E(a,b){this.type=a;this.effect=b;this.material=null}function H(a){this.effect=a;this.format=this.init_from=null}function K(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 y(){this.url=""}function C(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function L(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;
+null}function j(){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 l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=
+this.symbol=""}function m(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function t(){s.call(this);this.vcount=[]}function p(){s.call(this);this.vcount=3}function w(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function z(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function v(){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.texOpts=this.texcoord=this.texture=null}function E(a,b){this.type=a;this.effect=b;this.material=null}function H(a){this.effect=a;this.format=this.init_from=null}function K(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 y(){this.url=""}function B(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function L(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;
 this.duration=0}function J(a){this.targets=[];this.time=a}function M(){this.technique=this.name=this.id=""}function F(){this.url=""}function N(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function D(a){for(var a=P(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function T(a){for(var a=P(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function P(a){return a.length>0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function S(a,b,c){return a.hasAttribute(b)?
 parseInt(a.getAttribute(b),10):c}function O(a,b){if(R.convertUpAxis&&ba!==R.upAxis)switch(X){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1];a[1]=a[2];a[2]=b*c}}function ea(a,b){var c=[a[b],a[b+1],a[b+2]];O(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function fa(a){if(R.convertUpAxis){var b=
 [a[0],a[4],a[8]];O(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];O(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];O(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];O(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];O(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];O(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];O(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],
@@ -300,36 +300,36 @@ o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=
 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.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++){b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":this.cameras.push((new F).parse(b));
 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=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Q,N,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 l).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=[];a=[];c=0;for(e=this.channels.length;c<e;c++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),
-k;if(i.arrIndices){k=[];b=0;for(var q=i.arrIndices.length;b<q;b++){var r=k,p=b,s=i.arrIndices[b];if(s>-1&&s<3){s=ma(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[p]=s}}else k=ma(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(q=h.length;b<q;b++){for(var r=h[b],i=g.getData(j.type,b),p=null,s=0,u=d.length;s<u&&p==null;s++){var t=d[s];if(t.time===r)p=t;else if(t.time>r)break}if(!p){p=new J(r);s=-1;u=0;for(t=d.length;u<t&&s==-1;u++)d[u].time>=r&&(s=u);r=s;d.splice(r==-1?d.length:r,0,p)}p.addTarget(f,j,
-k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){p=d[b];if(!p.hasTarget(e)){h=d;f=p;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){q=h[j];if(q.hasTarget(g)){j=q;break a}}j=null}q=void 0;a:{for(k=k+1;k<h.length;k++){q=h[k];if(q.hasTarget(g))break a}q=null}if(j&&q){h=(f.time-j.time)/(q.time-j.time);j=j.getTarget(g);k=q.getTarget(g).data;q=j.data;i=void 0;if(j.type==="matrix")i=q;else if(q.length){i=
-[];for(r=0;r<q.length;++r)i[r]=q[r]+(k[r]-q[r])*h}else i=q+(k-q)*h;f.addTarget(g,j.transform,j.member,i)}}}}this.keys=d;this.sids=a}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=D(a.textContent);this.convert();return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=
+k;if(i.arrIndices){k=[];b=0;for(var p=i.arrIndices.length;b<p;b++){var r=k,q=b,s=i.arrIndices[b];if(s>-1&&s<3){s=ma(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[q]=s}}else k=ma(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(p=h.length;b<p;b++){for(var r=h[b],i=g.getData(j.type,b),q=null,s=0,u=d.length;s<u&&q==null;s++){var t=d[s];if(t.time===r)q=t;else if(t.time>r)break}if(!q){q=new J(r);s=-1;u=0;for(t=d.length;u<t&&s==-1;u++)d[u].time>=r&&(s=u);r=s;d.splice(r==-1?d.length:r,0,q)}q.addTarget(f,j,
+k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){q=d[b];if(!q.hasTarget(e)){h=d;f=q;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){p=h[j];if(p.hasTarget(g)){j=p;break a}}j=null}p=void 0;a:{for(k=k+1;k<h.length;k++){p=h[k];if(p.hasTarget(g))break a}p=null}if(j&&p){h=(f.time-j.time)/(p.time-j.time);j=j.getTarget(g);k=p.getTarget(g).data;p=j.data;i=void 0;if(j.type==="matrix")i=p;else if(p.length){i=
+[];for(r=0;r<p.length;++r)i[r]=p[r]+(k[r]-p[r])*h}else i=p+(k-p)*h;f.addTarget(g,j.transform,j.member,i)}}}}this.keys=d;this.sids=a}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=D(a.textContent);this.convert();return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=
 fa(this.data);break;case "rotate":this.angle=this.data[3]*la;case "translate":O(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":O(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};l.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,
 this.angle);break;case "scale":a.scale(this.obj)}};l.prototype.update=function(a,b){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;case 2:this.obj.n13=a[0];this.obj.n23=a[1];this.obj.n33=a[2];this.obj.n43=a[3];break;case 3:this.obj.n14=a[0];this.obj.n24=a[1];this.obj.n34=a[2];this.obj.n44=
 a[3]}else b.length===2?this.obj["n"+(b[0]+1)+(b[1]+1)]=a:console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(a);break;case "translate":case "scale":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0];this.obj.y=a[1];this.obj.z=a[2]}break;case "rotate":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);switch(b){case "X":this.obj.x=
 a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*la;break;default:this.obj.x=a[0];this.obj.y=a[1];this.obj.z=a[2];this.angle=a[3]*la}}};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=Q.evaluate(".//dae:instance_material",
-c,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;){this.instance_material.push((new q).parse(d));d=c.iterateNext()}}}return this};q.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=
-Q.evaluate(".//dae:instance_material",c,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;){this.instance_material.push((new q).parse(b));b=a.iterateNext()}break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new u(this)).parse(c)}}return this};u.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+c,N,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=
+Q.evaluate(".//dae:instance_material",c,N,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};q.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){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 switch(c.nodeName){case "source":var d=c.getAttribute("id");Z[d]==void 0&&(Z[d]=(new x(d)).parse(c));break;case "vertices":this.vertices=(new A).parse(c);break;case "triangles":this.primitives.push((new p).parse(c));break;case "polygons":this.primitives.push((new s).parse(c));break;case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=Z[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push(ea(a,b).clone());for(b=0;b<
 this.primitives.length;b++){a=this.primitives[b];a.setVertices(this.vertices);this.handlePrimitive(a,this.geometry3js)}this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();return this};u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,k=0,l=3,m=0,o=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+1;m=m<l?l:m;switch(g.semantic){case "TEXCOORD":o.push(g.set)}}for(var n=
-0;n<e.length;++n)for(var q=e[n],r=0;r<q.length;){var p=[],s=[],u={},t=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:q.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Z[g.source];h=q[r+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":p.push(h);break;case "NORMAL":s.push(ea(j.data,i));break;case "TEXCOORD":u[g.set]===void 0&&(u[g.set]=[]);u[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(j.data[i],
-j.data[i+1],j.data[i+2]))}}d=null;c=[];if(s.length==0)if(g=this.vertices.input.NORMAL){j=Z[g.source];i=j.accessor.params.length;g=0;for(h=p.length;g<h;g++)s.push(ea(j.data,p[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(p[0],p[1],p[2],s,t.length?t:new THREE.Color));else if(l===4)c.push(new THREE.Face4(p[0],p[1],p[2],p[3],s,t.length?t:new THREE.Color));else if(l>4&&R.subdivideFaces){t=t.length?t:new THREE.Color;for(d=1;d<l-1;)c.push(new THREE.Face3(p[0],p[d],p[d+1],[s[0],s[d++],s[d]],
-t))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<o.length;d++){p=u[o[d]];p=l>4?[p[0],p[g+1],p[g+2]]:l===4?[p[0],p[1],p[2],p[3]]:[p[0],p[1],p[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(p)}}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);r=r+m*l}};s.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};
+0;n<e.length;++n)for(var p=e[n],r=0;r<p.length;){var q=[],s=[],u={},t=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Z[g.source];h=p[r+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":q.push(h);break;case "NORMAL":s.push(ea(j.data,i));break;case "TEXCOORD":u[g.set]===void 0&&(u[g.set]=[]);u[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(j.data[i],
+j.data[i+1],j.data[i+2]))}}d=null;c=[];if(s.length==0)if(g=this.vertices.input.NORMAL){j=Z[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push(ea(j.data,q[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(q[0],q[1],q[2],s,t.length?t:new THREE.Color));else if(l===4)c.push(new THREE.Face4(q[0],q[1],q[2],q[3],s,t.length?t:new THREE.Color));else if(l>4&&R.subdivideFaces){t=t.length?t:new THREE.Color;for(d=1;d<l-1;)c.push(new THREE.Face3(q[0],q[d],q[d+1],[s[0],s[d++],s[d]],
+t))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<o.length;d++){q=u[o[d]];q=l>4?[q[0],q[g+1],q[g+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(q)}}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);r=r+m*l}};s.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};
 s.prototype.parse=function(a){this.material=a.getAttribute("material");this.count=S(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 z).parse(a.childNodes[b]));break;case "vcount":this.vcount=T(c.textContent);break;case "p":this.p.push(T(c.textContent));break;case "ph":console.warn("polygon holes not yet supported!")}}return this};t.prototype=new s;t.prototype.constructor=t;p.prototype=new s;p.prototype.constructor=p;w.prototype.parse=
 function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=S(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};A.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 z).parse(a.childNodes[b]);this.input[c.semantic]=
 c}return this};z.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(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=P(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:
 false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=D(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=T(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=P(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 w).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=b+16){var c=this.data.slice(b,b+16),c=fa(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};v.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 y).parse(a.childNodes[b]);
-break}return this};B.prototype.isColor=function(){return this.texture==null};B.prototype.isTexture=function(){return this.texture!=null};B.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=D(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");this.texOpts={offsetU:0,
-offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1};this.parseTexture(c)}}return this};B.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1])}for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=
-parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new B).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Q.evaluate(".//dae:float",c,N,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};E.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 B)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=aa[this.effect.surface.init_from];if(e){e=
+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=D(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");this.texOpts={offsetU:0,
+offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1};this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1])}for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=
+parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};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 "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=Q.evaluate(".//dae:float",c,N,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};E.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){var e=aa[this.effect.surface.init_from];if(e){e=
 THREE.ImageUtils.loadTexture(oa+e.init_from);e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;e.offset.x=d.texOpts.offsetU;e.offset.y=d.texOpts.offsetV;e.repeat.x=d.texOpts.repeatU;e.repeat.y=d.texOpts.repeatV;a.map=e;c=="emission"&&(a.emissive=16777215)}}}else if(c=="diffuse"||!b)c=="emission"?a.emissive=d.color.getHex():a[c]=d.color.getHex();break;case "shininess":case "reflectivity":a[c]=this[c];break;
 case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=pa;switch(this.type){case "constant":a.color=a.emission;this.material=new THREE.MeshBasicMaterial(a);break;case "phong":case "blinn":a.color=a.diffuse;this.material=new THREE.MeshPhongMaterial(a);break;default:a.color=a.diffuse;this.material=new THREE.MeshLambertMaterial(a)}return this.material};H.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};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 "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};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 H(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new K(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 "image":d=(new g).parse(d);aa[d.id]=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 "constant":case "lambert":case "blinn":case "phong":this.shader=(new E(c.nodeName,this)).parse(c)}}};y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
-"");return this};C.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 "animation":var c=(new C).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new x).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new L(this)).parse(c));
+"");return this};B.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 "animation":var c=(new B).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new x).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new L(this)).parse(c));
 break;case "channel":this.channel.push((new G(this)).parse(c))}}return this};G.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;if(c){b=a.split(".");this.sid=b.shift();this.member=b.shift()}else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=
 a;this.dotSyntax=c;this.arrSyntax=d;return this};L.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 z).parse(c))}}return this};L.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();this.strideOut=
 c.accessor.stride;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}};L.prototype.getData=function(a,b){var c;if(a==="matrix"&&
@@ -342,9 +342,9 @@ g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0
 parse:a,setPreferredShading:function(a){pa=a},applySkin:f,geometries:W,options:R}};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,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(e.status===200||e.status===0){if(e.responseText){var h=JSON.parse(e.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else if(e.readyState===e.LOADING){if(f){g===0&&(g=e.getResponseHeader("Content-Length"));
 f({total:g,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,true);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,i,j,k,o,l,n,q,m,r,u,s,t,p=a.faces;o=a.vertices;var w=a.normals,A=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(k=o.length;j<k;){l=new THREE.Vector3;l.x=o[j++]*b;l.y=o[j++]*b;l.z=o[j++]*b;d.vertices.push(l)}j=0;for(k=p.length;j<k;){b=p[j++];o=b&1;i=b&2;c=b&
-4;f=b&8;n=b&16;l=b&32;m=b&64;b=b&128;if(o){r=new THREE.Face4;r.a=p[j++];r.b=p[j++];r.c=p[j++];r.d=p[j++];o=4}else{r=new THREE.Face3;r.a=p[j++];r.b=p[j++];r.c=p[j++];o=3}if(i){i=p[j++];r.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<z;c++){u=a.uvs[c];q=p[j++];t=u[q*2];q=u[q*2+1];d.faceUvs[c][i]=new THREE.UV(t,q)}if(f)for(c=0;c<z;c++){u=a.uvs[c];s=[];for(f=0;f<o;f++){q=p[j++];t=u[q*2];q=u[q*2+1];s[f]=new THREE.UV(t,q)}d.faceVertexUvs[c][i]=s}if(n){n=p[j++]*3;f=new THREE.Vector3;f.x=w[n++];f.y=w[n++];
-f.z=w[n];r.normal=f}if(l)for(c=0;c<o;c++){n=p[j++]*3;f=new THREE.Vector3;f.x=w[n++];f.y=w[n++];f.z=w[n];r.vertexNormals.push(f)}if(m){l=p[j++];l=new THREE.Color(A[l]);r.color=l}if(b)for(c=0;c<o;c++){l=p[j++];l=new THREE.Color(A[l]);r.vertexColors.push(l)}d.faces.push(r)}})(f);(function(){var b,c,f,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,i,j,k,o,l,n,r,m,q,u,s,t,p=a.faces;o=a.vertices;var w=a.normals,A=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(k=o.length;j<k;){l=new THREE.Vector3;l.x=o[j++]*b;l.y=o[j++]*b;l.z=o[j++]*b;d.vertices.push(l)}j=0;for(k=p.length;j<k;){b=p[j++];o=b&1;i=b&2;c=b&
+4;f=b&8;n=b&16;l=b&32;m=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=p[j++];q.b=p[j++];q.c=p[j++];q.d=p[j++];o=4}else{q=new THREE.Face3;q.a=p[j++];q.b=p[j++];q.c=p[j++];o=3}if(i){i=p[j++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<z;c++){u=a.uvs[c];r=p[j++];t=u[r*2];r=u[r*2+1];d.faceUvs[c][i]=new THREE.UV(t,r)}if(f)for(c=0;c<z;c++){u=a.uvs[c];s=[];for(f=0;f<o;f++){r=p[j++];t=u[r*2];r=u[r*2+1];s[f]=new THREE.UV(t,r)}d.faceVertexUvs[c][i]=s}if(n){n=p[j++]*3;f=new THREE.Vector3;f.x=w[n++];f.y=w[n++];
+f.z=w[n];q.normal=f}if(l)for(c=0;c<o;c++){n=p[j++]*3;f=new THREE.Vector3;f.x=w[n++];f.y=w[n++];f.z=w[n];q.vertexNormals.push(f)}if(m){l=p[j++];l=new THREE.Color(A[l]);q.color=l}if(b)for(c=0;c<o;c++){l=p[j++];l=new THREE.Color(A[l]);q.vertexColors.push(l)}d.faces.push(q)}})(f);(function(){var b,c,f,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
 b+2){f=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,i,j,k,o;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];k=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;i=0;for(j=o.length;i<j;i=i+3){var l=new THREE.Vector3;l.x=o[i]*b;l.y=o[i+1]*b;l.z=o[i+2]*b;k.push(l)}}}if(a.morphColors!==
 void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b=b+3){o=new THREE.Color(16755200);o.setRGB(k[b],k[b+1],k[b+2]);j.push(o)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(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;
@@ -352,25 +352,19 @@ THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d
 THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function f(){var a;for(l in y.objects)if(!F.objects[l]){u=y.objects[l];if(u.geometry!==void 0){if(E=F.geometries[u.geometry]){a=false;H=F.materials[u.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&E.computeTangents();w=u.position;A=u.rotation;z=u.quaternion;x=u.scale;s=u.matrix;z=0;u.materials.length==0&&(H=new THREE.MeshFaceMaterial);u.materials.length>1&&(H=new THREE.MeshFaceMaterial);
 a=new THREE.Mesh(E,H);a.name=l;if(s){a.matrixAutoUpdate=false;a.matrix.set(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15])}else{a.position.set(w[0],w[1],w[2]);if(z){a.quaternion.set(z[0],z[1],z[2],z[3]);a.useQuaternion=true}else a.rotation.set(A[0],A[1],A[2]);a.scale.set(x[0],x[1],x[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;F.scene.add(a);F.objects[l]=a}}else{w=u.position;A=u.rotation;z=u.quaternion;
 x=u.scale;z=0;a=new THREE.Object3D;a.name=l;a.position.set(w[0],w[1],w[2]);if(z){a.quaternion.set(z[0],z[1],z[2],z[3]);a.useQuaternion=true}else a.rotation.set(A[0],A[1],A[2]);a.scale.set(x[0],x[1],x[2]);a.visible=u.visible!==void 0?u.visible:false;F.scene.add(a);F.objects[l]=a;F.empties[l]=a}}}function e(a){return function(b){F.geometries[a]=b;f();G=G-1;i.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){i.callbackProgress({totalModels:J,totalTextures:M,loadedModels:J-
-G,loadedTextures:M-L},F);i.onLoadProgress();G==0&&L==0&&b(F)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,o,l,n,q,m,r,u,s,t,p,w,A,z,x,v,B,E,H,K,I,y,C,G,L,J,M,F;y=a;c=new THREE.BinaryLoader;C=new THREE.JSONLoader;L=G=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(y.transform){a=y.transform.position;t=y.transform.rotation;v=y.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);t&&F.scene.rotation.set(t[0],t[1],
-t[2]);v&&F.scene.scale.set(v[0],v[1],v[2]);if(a||t||v){F.scene.updateMatrix();F.scene.updateMatrixWorld()}}a=function(){L=L-1;h();i.onLoadComplete()};for(q in y.cameras){v=y.cameras[q];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));w=v.position;t=v.target;v=v.up;K.position.set(w[0],w[1],w[2]);K.target=new THREE.Vector3(t[0],t[1],t[2]);v&&K.up.set(v[0],v[1],v[2]);F.cameras[q]=
-K}for(n in y.lights){t=y.lights[n];q=t.color!==void 0?t.color:16777215;K=t.intensity!==void 0?t.intensity:1;if(t.type=="directional"){w=t.direction;p=new THREE.DirectionalLight(q,K);p.position.set(w[0],w[1],w[2]);p.position.normalize()}else if(t.type=="point"){w=t.position;p=t.distance;p=new THREE.PointLight(q,K,p);p.position.set(w[0],w[1],w[2])}else t.type=="ambient"&&(p=new THREE.AmbientLight(q));F.scene.add(p);F.lights[n]=p}for(m in y.fogs){n=y.fogs[m];n.type=="linear"?I=new THREE.Fog(0,n.near,
+G,loadedTextures:M-L},F);i.onLoadProgress();G==0&&L==0&&b(F)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,o,l,n,r,m,q,u,s,t,p,w,A,z,x,v,C,E,H,K,I,y,B,G,L,J,M,F;y=a;c=new THREE.BinaryLoader;B=new THREE.JSONLoader;L=G=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(y.transform){a=y.transform.position;t=y.transform.rotation;v=y.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);t&&F.scene.rotation.set(t[0],t[1],
+t[2]);v&&F.scene.scale.set(v[0],v[1],v[2]);if(a||t||v){F.scene.updateMatrix();F.scene.updateMatrixWorld()}}a=function(){L=L-1;h();i.onLoadComplete()};for(r in y.cameras){v=y.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));w=v.position;t=v.target;v=v.up;K.position.set(w[0],w[1],w[2]);K.target=new THREE.Vector3(t[0],t[1],t[2]);v&&K.up.set(v[0],v[1],v[2]);F.cameras[r]=
+K}for(n in y.lights){t=y.lights[n];r=t.color!==void 0?t.color:16777215;K=t.intensity!==void 0?t.intensity:1;if(t.type=="directional"){w=t.direction;p=new THREE.DirectionalLight(r,K);p.position.set(w[0],w[1],w[2]);p.position.normalize()}else if(t.type=="point"){w=t.position;p=t.distance;p=new THREE.PointLight(r,K,p);p.position.set(w[0],w[1],w[2])}else t.type=="ambient"&&(p=new THREE.AmbientLight(r));F.scene.add(p);F.lights[n]=p}for(m in y.fogs){n=y.fogs[m];n.type=="linear"?I=new THREE.Fog(0,n.near,
 n.far):n.type=="exp2"&&(I=new THREE.FogExp2(0,n.density));v=n.color;I.color.setRGB(v[0],v[1],v[2]);F.fogs[m]=I}if(F.cameras&&y.defaults.camera)F.currentCamera=F.cameras[y.defaults.camera];if(F.fogs&&y.defaults.fog)F.scene.fog=F.fogs[y.defaults.fog];v=y.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(v[0],v[1],v[2]);F.bgColorAlpha=y.defaults.bgalpha;for(k in y.geometries){m=y.geometries[k];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){G=G+1;i.onLoadStart()}}J=G;for(k in y.geometries){m=
 y.geometries[k];if(m.type=="cube"){E=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);F.geometries[k]=E}else if(m.type=="plane"){E=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);F.geometries[k]=E}else if(m.type=="sphere"){E=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);F.geometries[k]=E}else if(m.type=="cylinder"){E=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,
-m.heightSegs);F.geometries[k]=E}else if(m.type=="torus"){E=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);F.geometries[k]=E}else if(m.type=="icosahedron"){E=new THREE.IcosahedronGeometry(m.radius,m.subdivisions);F.geometries[k]=E}else if(m.type=="bin_mesh")c.load(d(m.url,y.urlBaseType),e(k));else if(m.type=="ascii_mesh")C.load(d(m.url,y.urlBaseType),e(k));else if(m.type=="embedded_mesh"){m=y.embeds[m.id];m.metadata=y.metadata;m&&C.createModel(m,g(k),"")}}for(r in y.textures){k=y.textures[r];
-if(k.url instanceof Array){L=L+k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else{L=L+1;i.onLoadStart()}}M=L;for(r in y.textures){k=y.textures[r];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(I=0;I<k.url.length;I++)m[I]=d(k.url[I],y.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,y.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){I={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(I[k.wrap[0]]!==void 0)m.wrapS=I[k.wrap[0]];if(I[k.wrap[1]]!==void 0)m.wrapT=I[k.wrap[1]]}}F.textures[r]=m}for(o in y.materials){s=y.materials[o];for(B in s.parameters)if(B==
-"envMap"||B=="map"||B=="lightMap")s.parameters[B]=F.textures[s.parameters[B]];else if(B=="shading")s.parameters[B]=s.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")s.parameters[B]=THREE[s.parameters[B]]?THREE[s.parameters[B]]:THREE.NormalBlending;else if(B=="combine")s.parameters[B]=s.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(s.parameters[B]=="face")s.parameters[B]=THREE.FaceColors;else if(s.parameters[B])s.parameters[B]=
-THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=true;if(s.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);k=s.parameters.color;m=s.parameters.specular;I=s.parameters.ambient;c=s.parameters.shininess;a.tNormal.texture=F.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=
-true}if(s.parameters.lightMap){a.tAO.texture=s.parameters.lightMap;a.enableAO.value=true}if(s.parameters.specularMap){a.tSpecular.texture=F.textures[s.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(k);a.uSpecularColor.value.setHex(m);a.uAmbientColor.value.setHex(I);a.uShininess.value=c;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else H=
-new THREE[s.type](s.parameters);F.materials[o]=H}f();i.callbackSync(F);h()};THREE.UTF8Loader=function(){};
-THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,e=c.offsetX!==void 0?c.offsetX:0,g=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,b,f,e,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,
-true);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b=b-2048);b++;for(var c=new Float32Array(8*b),d=1,f=0;f<8;f++){for(var e=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),e=e+(h>>1^-(h&1));c[8*g+f]=e}d=d+b}b=a.length-d;e=new Uint16Array(b);for(f=g=0;f<b;f++){h=a.charCodeAt(f+d);e[f]=g-h;h==0&&g++}return[c,e]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,e){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,g,i){for(var j,k,r,u=a.length;i<u;i=i+g){j=a[i];k=a[i+1];r=a[i+2];j=j/16383*c;k=k/16383*c;r=r/16383*c;j=j+d;k=k+f;r=r+e;b.vertices.push(new THREE.Vector3(j,k,r))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;k.push(d,1-e)}})(g[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c=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;j.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,i,s,t,p,w=a.length;for(c=0;c<w;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;p=e;i=f;var A=j[e*3],z=j[e*3+1],x=j[e*3+2],v=j[f*3],B=j[f*3+1],E=j[f*3+2];s=new THREE.Vector3(j[d*3],j[d*3+1],j[d*3+2]);A=new THREE.Vector3(A,z,x);v=new THREE.Vector3(v,B,E);g.faces.push(new THREE.Face3(t,p,i,[s,A,v],null,0));g=k[d*2];d=k[d*2+1];i=k[e*2];s=k[e*2+1];t=
-k[f*2];p=k[f*2+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(t,p));f.push(s)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
-THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
-THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){b===void 0&&(b=-1);c===void 0&&(c=0);e===void 0&&(e=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:e,color:f,blending:d})};
+m.heightSegs);F.geometries[k]=E}else if(m.type=="torus"){E=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);F.geometries[k]=E}else if(m.type=="icosahedron"){E=new THREE.IcosahedronGeometry(m.radius,m.subdivisions);F.geometries[k]=E}else if(m.type=="bin_mesh")c.load(d(m.url,y.urlBaseType),e(k));else if(m.type=="ascii_mesh")B.load(d(m.url,y.urlBaseType),e(k));else if(m.type=="embedded_mesh"){m=y.embeds[m.id];m.metadata=y.metadata;m&&B.createModel(m,g(k),"")}}for(q in y.textures){k=y.textures[q];
+if(k.url instanceof Array){L=L+k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else{L=L+1;i.onLoadStart()}}M=L;for(q in y.textures){k=y.textures[q];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(I=0;I<k.url.length;I++)m[I]=d(k.url[I],y.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,y.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){I={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(I[k.wrap[0]]!==void 0)m.wrapS=I[k.wrap[0]];if(I[k.wrap[1]]!==void 0)m.wrapT=I[k.wrap[1]]}}F.textures[q]=m}for(o in y.materials){s=y.materials[o];for(C in s.parameters)if(C==
+"envMap"||C=="map"||C=="lightMap")s.parameters[C]=F.textures[s.parameters[C]];else if(C=="shading")s.parameters[C]=s.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")s.parameters[C]=THREE[s.parameters[C]]?THREE[s.parameters[C]]:THREE.NormalBlending;else if(C=="combine")s.parameters[C]=s.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(s.parameters[C]=="face")s.parameters[C]=THREE.FaceColors;else if(s.parameters[C])s.parameters[C]=
+THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=true;if(s.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);k=s.parameters.color;m=s.parameters.specular;I=s.parameters.ambient;c=s.parameters.shininess;a.tNormal.texture=F.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=
+true}if(s.parameters.lightMap){a.tAO.texture=s.parameters.lightMap;a.enableAO.value=true}if(s.parameters.specularMap){a.tSpecular.texture=F.textures[s.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(k);a.uSpecularColor.value.setHex(m);a.uAmbientColor.value.setHex(I);a.uShininess.value=c;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else H=
+new THREE[s.type](s.parameters);F.materials[o]=H}f();i.callbackSync(F);h()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,f)};
+THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){b===void 0&&(b=-1);c===void 0&&(c=0);e===void 0&&(e=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:e,color:f,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,f=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+f*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
 THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:false,time:0,direction:1,weight:1,directionBackwards:false,mirroredLoop:false};this.animationsMap[a]=b;this.animationsList.push(b)};
@@ -380,41 +374,41 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var f=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var e=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
 f),0,d.length-1),g=d.weight;if(e!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[e]=0;d.lastFrame=d.currentFrame;d.currentFrame=e}f=d.time%f/f;d.directionBackwards&&(f=1-f);this.morphTargetInfluences[d.currentFrame]=f*g;this.morphTargetInfluences[d.lastFrame]=(1-f)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,i,j,k,o,l,n;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);f=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
-0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,i,j,k,o,l,n;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
+0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
 b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;k=a(THREE.ShaderFlares.lensFlare)}else{j=true;k=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};l={};o.vertex=b.getAttribLocation(k,"position");o.uv=b.getAttribLocation(k,"uv");l.renderType=b.getUniformLocation(k,"renderType");l.map=b.getUniformLocation(k,"map");l.occlusionMap=b.getUniformLocation(k,"occlusionMap");l.opacity=b.getUniformLocation(k,"opacity");l.color=b.getUniformLocation(k,
-"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");n=false};this.render=function(a,d,f,u){var a=a.__webglFlares,s=a.length;if(s){var t=new THREE.Vector3,p=u/f,w=f*0.5,A=u*0.5,z=16/u,x=new THREE.Vector2(z*p,z),v=new THREE.Vector3(1,1,0),B=new THREE.Vector2(1,1),E=l,z=o;b.useProgram(k);if(!n){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);n=true}b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var H,K,I,y,C;for(H=0;H<s;H++){z=16/u;x.set(z*p,z);y=a[H];t.set(y.matrixWorld.elements[12],y.matrixWorld.elements[13],y.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);v.copy(t);B.x=v.x*w+w;B.y=v.y*A+A;if(j||B.x>0&&B.x<f&&B.y>0&&
-B.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,B.x-8,B.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,x.x,x.y);b.uniform3f(E.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,B.x-8,B.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(v);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);K=0;for(I=y.lensFlares.length;K<I;K++){C=y.lensFlares[K];if(C.opacity>0.001&&C.scale>0.001){v.x=C.x;v.y=C.y;v.z=C.z;z=C.size*C.scale/u;x.x=z*p;x.y=z;b.uniform3f(E.screenPosition,v.x,v.y,v.z);b.uniform2f(E.scale,x.x,x.y);b.uniform1f(E.rotation,C.rotation);b.uniform1f(E.opacity,C.opacity);
-b.uniform3f(E.color,C.color.r,C.color.g,C.color.b);c.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst);c.setTexture(C.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");n=false};this.render=function(a,d,f,u){var a=a.__webglFlares,s=a.length;if(s){var t=new THREE.Vector3,p=u/f,w=f*0.5,A=u*0.5,z=16/u,x=new THREE.Vector2(z*p,z),v=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),E=l,z=o;b.useProgram(k);if(!n){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);n=true}b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var H,K,I,y,B;for(H=0;H<s;H++){z=16/u;x.set(z*p,z);y=a[H];t.set(y.matrixWorld.elements[12],y.matrixWorld.elements[13],y.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);v.copy(t);C.x=v.x*w+w;C.y=v.y*A+A;if(j||C.x>0&&C.x<f&&C.y>0&&
+C.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,C.x-8,C.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,x.x,x.y);b.uniform3f(E.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,C.x-8,C.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
+b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(v);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);K=0;for(I=y.lensFlares.length;K<I;K++){B=y.lensFlares[K];if(B.opacity>0.001&&B.scale>0.001){v.x=B.x;v.y=B.y;v.z=B.z;z=B.size*B.scale/u;x.x=z*p;x.y=z;b.uniform3f(E.screenPosition,v.x,v.y,v.z);b.uniform2f(E.scale,x.x,x.y);b.uniform1f(E.rotation,B.rotation);b.uniform1f(E.opacity,B.opacity);
+b.uniform3f(E.color,B.color.r,B.color.g,B.color.b);c.setBlending(B.blending,B.blendEquation,B.blendSrc,B.blendDst);c.setTexture(B.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,o,l,n,q,m,r,u,s,t=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);k=0;for(o=i.__lights.length;k<o;k++){l=i.__lights[k];if(l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(q=0;q<l.shadowCascadeCount;q++){var p;if(l.shadowCascadeArray[q])p=l.shadowCascadeArray[q];else{s=l;r=q;p=new THREE.DirectionalLight;
-p.isVirtual=true;p.onlyShadow=true;p.castShadow=true;p.shadowCameraNear=s.shadowCameraNear;p.shadowCameraFar=s.shadowCameraFar;p.shadowCameraLeft=s.shadowCameraLeft;p.shadowCameraRight=s.shadowCameraRight;p.shadowCameraBottom=s.shadowCameraBottom;p.shadowCameraTop=s.shadowCameraTop;p.shadowCameraVisible=s.shadowCameraVisible;p.shadowDarkness=s.shadowDarkness;p.shadowBias=s.shadowCascadeBias[r];p.shadowMapWidth=s.shadowCascadeWidth[r];p.shadowMapHeight=s.shadowCascadeHeight[r];p.pointsWorld=[];p.pointsFrustum=
-[];u=p.pointsWorld;m=p.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;m[w]=new THREE.Vector3}u=s.shadowCascadeNearZ[r];s=s.shadowCascadeFarZ[r];m[0].set(-1,-1,u);m[1].set(1,-1,u);m[2].set(-1,1,u);m[3].set(1,1,u);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);p.originalCamera=j;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(p);m.add(p.target);j.add(m);l.shadowCascadeArray[q]=p;console.log("Created virtualLight",p)}r=l;u=q;s=r.shadowCascadeArray[u];s.position.copy(r.position);
-s.target.position.copy(r.target.position);s.lookAt(s.target);s.shadowCameraVisible=r.shadowCameraVisible;s.shadowDarkness=r.shadowDarkness;s.shadowBias=r.shadowCascadeBias[u];m=r.shadowCascadeNearZ[u];r=r.shadowCascadeFarZ[u];s=s.pointsFrustum;s[0].z=m;s[1].z=m;s[2].z=m;s[3].z=m;s[4].z=r;s[5].z=r;s[6].z=r;s[7].z=r;t[n]=p;n++}else{t[n]=l;n++}}k=0;for(o=t.length;k<o;k++){l=t[k];if(!l.shadowMap){l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,o,l,n,r,m,q,u,s,t=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);k=0;for(o=i.__lights.length;k<o;k++){l=i.__lights[k];if(l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var p;if(l.shadowCascadeArray[r])p=l.shadowCascadeArray[r];else{s=l;q=r;p=new THREE.DirectionalLight;
+p.isVirtual=true;p.onlyShadow=true;p.castShadow=true;p.shadowCameraNear=s.shadowCameraNear;p.shadowCameraFar=s.shadowCameraFar;p.shadowCameraLeft=s.shadowCameraLeft;p.shadowCameraRight=s.shadowCameraRight;p.shadowCameraBottom=s.shadowCameraBottom;p.shadowCameraTop=s.shadowCameraTop;p.shadowCameraVisible=s.shadowCameraVisible;p.shadowDarkness=s.shadowDarkness;p.shadowBias=s.shadowCascadeBias[q];p.shadowMapWidth=s.shadowCascadeWidth[q];p.shadowMapHeight=s.shadowCascadeHeight[q];p.pointsWorld=[];p.pointsFrustum=
+[];u=p.pointsWorld;m=p.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;m[w]=new THREE.Vector3}u=s.shadowCascadeNearZ[q];s=s.shadowCascadeFarZ[q];m[0].set(-1,-1,u);m[1].set(1,-1,u);m[2].set(-1,1,u);m[3].set(1,1,u);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);p.originalCamera=j;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(p);m.add(p.target);j.add(m);l.shadowCascadeArray[r]=p;console.log("Created virtualLight",p)}q=l;u=r;s=q.shadowCascadeArray[u];s.position.copy(q.position);
+s.target.position.copy(q.target.position);s.lookAt(s.target);s.shadowCameraVisible=q.shadowCameraVisible;s.shadowDarkness=q.shadowDarkness;s.shadowBias=q.shadowCascadeBias[u];m=q.shadowCascadeNearZ[u];q=q.shadowCascadeFarZ[u];s=s.pointsFrustum;s[0].z=m;s[1].z=m;s[2].z=m;s[3].z=m;s[4].z=q;s[5].z=q;s[6].z=q;s[7].z=q;t[n]=p;n++}else{t[n]=l;n++}}k=0;for(o=t.length;k<o;k++){l=t[k];if(!l.shadowMap){l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,
 magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight);l.shadowMatrix=new THREE.Matrix4}if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,l.shadowCameraTop,l.shadowCameraBottom,
-l.shadowCameraNear,l.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper){l.cameraHelper=new THREE.CameraHelper(l.shadowCamera);l.shadowCamera.add(l.cameraHelper)}if(l.isVirtual&&p.originalCamera==j){q=j;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;r<8;r++){u=s[r];u.copy(m[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
-q);n.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}n.left=g.x;n.right=h.x;n.top=h.y;n.bottom=g.y;n.updateProjectionMatrix()}n=l.shadowMap;m=l.shadowMatrix;q=l.shadowCamera;q.position.copy(l.matrixWorld.getPosition());q.lookAt(l.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
-l.shadowCameraVisible&&l.cameraHelper.update();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(q.projectionMatrix);m.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);e.multiply(q.projectionMatrix,q.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(n);
-b.clear();s=i.__webglObjects;l=0;for(n=s.length;l<n;l++){r=s[l];m=r.object;r.render=false;if(m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m._modelViewMatrix.multiply(q.matrixWorldInverse,m.matrixWorld);r.render=true}}l=0;for(n=s.length;l<n;l++){r=s[l];if(r.render){m=r.object;r=r.buffer;b.setObjectFaces(m);u=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,i.__lights,null,
-u,r,m):b.renderBuffer(q,i.__lights,null,u,r,m)}}s=i.__webglObjectsImmediate;l=0;for(n=s.length;l<n;l++){r=s[l];m=r.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(q.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(q,i.__lights,null,c,m)}}}k=b.getClearColor();o=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
+l.shadowCameraNear,l.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper){l.cameraHelper=new THREE.CameraHelper(l.shadowCamera);l.shadowCamera.add(l.cameraHelper)}if(l.isVirtual&&p.originalCamera==j){r=j;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=0;q<8;q++){u=s[q];u.copy(m[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
+r);n.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}n.left=g.x;n.right=h.x;n.top=h.y;n.bottom=g.y;n.updateProjectionMatrix()}n=l.shadowMap;m=l.shadowMatrix;r=l.shadowCamera;r.position.copy(l.matrixWorld.getPosition());r.lookAt(l.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
+l.shadowCameraVisible&&l.cameraHelper.update();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(r.projectionMatrix);m.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);e.multiply(r.projectionMatrix,r.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(n);
+b.clear();s=i.__webglObjects;l=0;for(n=s.length;l<n;l++){q=s[l];m=q.object;q.render=false;if(m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m._modelViewMatrix.multiply(r.matrixWorldInverse,m.matrixWorld);q.render=true}}l=0;for(n=s.length;l<n;l++){q=s[l];if(q.render){m=q.object;q=q.buffer;b.setObjectFaces(m);u=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?b.renderBufferDirect(r,i.__lights,null,
+u,q,m):b.renderBuffer(r,i.__lights,null,u,q,m)}}s=i.__webglObjectsImmediate;l=0;for(n=s.length;l<n;l++){q=s[l];m=q.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(r.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(r,i.__lights,null,c,m)}}}k=b.getClearColor();o=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,g,h,i,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(n);b.compileShader(q);b.attachShader(l,n);b.attachShader(l,q);b.linkProgram(l);h=l;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(n);b.compileShader(r);b.attachShader(l,n);b.attachShader(l,r);b.linkProgram(l);h=l;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
 "uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=false};this.render=function(d,f,n,q){var d=d.__webglSprites,m=d.length;if(m){var r=i,u=j,s=q/n,n=n*0.5,t=q*0.5,p=true;b.useProgram(h);if(!k){b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);k=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.uniformMatrix4fv(u.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var w,A=[],r=0;r<m;r++){w=d[r];if(w.visible&&w.opacity!==0)if(w.useScreenCoordinates)w.z=-w.position.z;else{w._modelViewMatrix.multiply(f.matrixWorldInverse,w.matrixWorld);w.z=-w._modelViewMatrix.elements[14]}}d.sort(a);for(r=0;r<m;r++){w=d[r];if(w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width){if(w.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
-b.uniform3f(u.screenPosition,(w.position.x-n)/n,(t-w.position.y)/t,Math.max(0,Math.min(1,w.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,w.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,w._modelViewMatrix.elements)}f=w.map.image.width/(w.scaleByViewport?q:1);A[0]=f*s*w.scale.x;A[1]=f*w.scale.y;b.uniform2f(u.uvScale,w.uvScale.x,w.uvScale.y);b.uniform2f(u.uvOffset,w.uvOffset.x,w.uvOffset.y);b.uniform2f(u.alignment,w.alignment.x,w.alignment.y);
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=false};this.render=function(d,f,n,r){var d=d.__webglSprites,m=d.length;if(m){var q=i,u=j,s=r/n,n=n*0.5,t=r*0.5,p=true;b.useProgram(h);if(!k){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);k=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.uniformMatrix4fv(u.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var w,A=[],q=0;q<m;q++){w=d[q];if(w.visible&&w.opacity!==0)if(w.useScreenCoordinates)w.z=-w.position.z;else{w._modelViewMatrix.multiply(f.matrixWorldInverse,w.matrixWorld);w.z=-w._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<m;q++){w=d[q];if(w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width){if(w.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
+b.uniform3f(u.screenPosition,(w.position.x-n)/n,(t-w.position.y)/t,Math.max(0,Math.min(1,w.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,w.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,w._modelViewMatrix.elements)}f=w.map.image.width/(w.scaleByViewport?r:1);A[0]=f*s*w.scale.x;A[1]=f*w.scale.y;b.uniform2f(u.uvScale,w.uvScale.x,w.uvScale.y);b.uniform2f(u.uvOffset,w.uvOffset.x,w.uvOffset.y);b.uniform2f(u.alignment,w.alignment.x,w.alignment.y);
 b.uniform1f(u.opacity,w.opacity);b.uniform3f(u.color,w.color.r,w.color.g,w.color.b);b.uniform1f(u.rotation,w.rotation);b.uniform2fv(u.scale,A);if(w.mergeWith3D&&!p){b.enable(b.DEPTH_TEST);p=true}else if(!w.mergeWith3D&&p){b.disable(b.DEPTH_TEST);p=false}c.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst);c.setTexture(w.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
 function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,k,o,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
 h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();n=g.__webglObjects;i=0;for(j=n.length;i<j;i++){k=n[i];l=k.object;k.render=false;if(l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l))){l._modelViewMatrix.multiply(h.matrixWorldInverse,l.matrixWorld);k.render=true}}i=0;for(j=n.length;i<j;i++){k=n[i];if(k.render){l=k.object;k=k.buffer;b.setObjectFaces(l);o=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c;k instanceof
 THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,k,l):b.renderBuffer(h,g.__lights,null,o,k,l)}}n=g.__webglObjectsImmediate;i=0;for(j=n.length;i<j;i++){k=n[i];l=k.object;if(l.visible&&l.castShadow){l._modelViewMatrix.multiply(h.matrixWorldInverse,l.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,l)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
-THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,o;f.matrixAutoUpdate=e.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
-1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},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,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(q);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||o!==c.fov){i=c.aspect;j=c.near;k=c.far;o=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,p=t*j/125,w=j*Math.tan(o*Math.PI/360),A;g.elements[12]=t;h.elements[12]=-t;t=-w*i+p;A=w*i+p;s.elements[0]=2*j/(A-t);s.elements[8]=
-(A+t)/(A-t);f.projectionMatrix.copy(s);t=-w*i-p;A=w*i-p;s.elements[0]=2*j/(A-t);s.elements[8]=(A+t)/(A-t);e.projectionMatrix.copy(s)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,true);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,true);m.updateMatrixWorld();d.call(b,m,q)}});
+THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,o;f.matrixAutoUpdate=e.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=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:l},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,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(r);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||o!==c.fov){i=c.aspect;j=c.near;k=c.far;o=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,p=t*j/125,w=j*Math.tan(o*Math.PI/360),A;g.elements[12]=t;h.elements[12]=-t;t=-w*i+p;A=w*i+p;s.elements[0]=2*j/(A-t);s.elements[8]=
+(A+t)/(A-t);f.projectionMatrix.copy(s);t=-w*i-p;A=w*i-p;s.elements[0]=2*j/(A-t);s.elements[8]=(A+t)/(A-t);e.projectionMatrix.copy(s)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,true);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,true);m.updateMatrixWorld();d.call(b,m,r)}});
 THREE.WebGLRenderer&&(THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=false;var b=this,c=this.setSize,d=this.render,f,e,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);f=a/2;e=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;
 g.far=c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,f,e);d.call(b,a,g);this.setViewport(f,0,f,e);d.call(b,a,h,false)}});
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 2 - 2
build/custom/ThreeSVG.js

@@ -98,8 +98,8 @@ k=a.vertices[d];h=g[e];m=g[f];n=g[w];l=j.x-i.x;o=k.x-i.x;p=j.y-i.y;r=k.y-i.y;x=j
 this.vertices.length;b<c;b++){F[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var R=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){M.copy(f.vertexNormals[d]);e=f[R[d]];A=F[e];L.copy(A);L.subSelf(M.multiplyScalar(M.dot(A))).normalize();
 P.cross(f.vertexNormals[d],A);e=P.dot(C[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
-e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d]}}this.vertices=b}};THREE.GeometryCount=0;
-THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
+e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];e=[a.a,a.b,a.c,a.d];for(d=3;d>0;d--)if(e.indexOf(a["abcd"[d]])!=d){e.splice(d,1);this.faces[f]=new THREE.Face3(e[0],e[1],e[2]);this.faceVertexUvs[0][f].splice(d,1)}}}this.vertices=
+b}};THREE.GeometryCount=0;THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
 THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};

+ 2 - 1
build/custom/ThreeWebGL.js

@@ -98,7 +98,8 @@ l=a.vertices[d];j=i[f];t=i[g];k=i[L];r=m.x-h.x;n=l.x-h.x;o=m.y-h.y;q=l.y-h.y;u=m
 this.vertices.length;b<c;b++){S[b]=new THREE.Vector3;K[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];i=this.faceVertexUvs[0][b];if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.d,0,1,3);a(this,g.b,g.c,g.d,1,2,3)}}var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++){R.copy(g.vertexNormals[d]);f=g[I[d]];J=S[f];za.copy(J);za.subSelf(R.multiplyScalar(R.dot(J))).normalize();
 U.cross(g.vertexNormals[d],J);f=U.dot(K[f]);f=f<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(za.x,za.y,za.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),g,i;g=0;for(i=this.vertices.length;g<i;g++){d=this.vertices[g];d=[Math.round(d.x*
-f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=g;b.push(this.vertices[g]);c[g]=b.length-1}else c[g]=c[a[d]]}g=0;for(i=this.faces.length;g<i;g++){a=this.faces[g];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d]}}this.vertices=b}};THREE.GeometryCount=0;
+f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=g;b.push(this.vertices[g]);c[g]=b.length-1}else c[g]=c[a[d]]}g=0;for(i=this.faces.length;g<i;g++){a=this.faces[g];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];f=[a.a,a.b,a.c,a.d];for(d=3;d>0;d--)if(f.indexOf(a["abcd"[d]])!=d){f.splice(d,1);this.faces[g]=new THREE.Face3(f[0],f[1],f[2]);this.faceVertexUvs[0][g].splice(d,1)}}}this.vertices=
+b}};THREE.GeometryCount=0;
 THREE.Spline=function(a){function b(a,b,c,d,f,g,i){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*i+(-3*(b-c)-2*a-d)*g+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,g,i,h,m,l,j,t,k;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);i=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?this.points.length-1:g+1;c[3]=g>this.points.length-3?this.points.length-1:
 g+2;l=this.points[c[0]];j=this.points[c[1]];t=this.points[c[2]];k=this.points[c[3]];h=i*i;m=i*h;d.x=b(l.x,j.x,t.x,k.x,i,h,m);d.y=b(l.y,j.y,t.y,k.y,i,h,m);d.z=b(l.z,j.z,t.z,k.z,i,h,m);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,f=b=b=0,g=new THREE.Vector3,i=new THREE.Vector3,h=[],j=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);i.copy(d);j=j+i.distanceTo(g);g.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){h[b]=j;f=b}}h[h.length]=j;return{chunks:h,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,f,g,i,h=[],j=new THREE.Vector3,k=this.getLength();h.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];i=Math.ceil(a*c/k.total);f=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<i-1;c++){d=f+c*(1/i)*(g-f);d=this.getPoint(d);

+ 0 - 0
src/extras/loaders/UTF8Loader.js → examples/js/loaders/UTF8Loader.js


+ 1 - 1
examples/js/ctm/CTMLoader.js → examples/js/loaders/ctm/CTMLoader.js

@@ -109,7 +109,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, useWorker, useBuffers,
 
 				if ( useWorker ) {
 
-					var worker = new Worker( "js/ctm/CTMWorker.js" );
+					var worker = new Worker( "js/loaders/ctm/CTMWorker.js" );
 
 					worker.onmessage = function( event ) {
 

+ 0 - 0
examples/js/ctm/CTMWorker.js → examples/js/loaders/ctm/CTMWorker.js


+ 0 - 0
examples/js/ctm/ctm.js → examples/js/loaders/ctm/ctm.js


+ 0 - 0
examples/js/ctm/license/OpenCTM.txt → examples/js/loaders/ctm/license/OpenCTM.txt


+ 0 - 0
examples/js/ctm/license/js-lzma.txt → examples/js/loaders/ctm/license/js-lzma.txt


+ 0 - 0
examples/js/ctm/license/js-openctm.txt → examples/js/loaders/ctm/license/js-openctm.txt


+ 0 - 0
examples/js/ctm/lzma.js → examples/js/loaders/ctm/lzma.js


+ 3 - 3
examples/webgl_loader_ctm.html

@@ -37,9 +37,9 @@
 
 		<script src="../build/Three.js"></script>
 
-		<script src="js/ctm/lzma.js"></script>
-		<script src="js/ctm/ctm.js"></script>
-		<script src="js/ctm/CTMLoader.js"></script>
+		<script src="js/loaders/ctm/lzma.js"></script>
+		<script src="js/loaders/ctm/ctm.js"></script>
+		<script src="js/loaders/ctm/CTMLoader.js"></script>
 
 		<script src="js/Detector.js"></script>
 		<script src="js/Stats.js"></script>

+ 3 - 3
examples/webgl_loader_ctm_materials.html

@@ -39,9 +39,9 @@
 
 		<script src="../build/Three.js"></script>
 
-		<script src="js/ctm/lzma.js"></script>
-		<script src="js/ctm/ctm.js"></script>
-		<script src="js/ctm/CTMLoader.js"></script>
+		<script src="js/loaders/ctm/lzma.js"></script>
+		<script src="js/loaders/ctm/ctm.js"></script>
+		<script src="js/loaders/ctm/CTMLoader.js"></script>
 
 		<script src="js/Detector.js"></script>
 		<script src="js/Stats.js"></script>

+ 1 - 0
examples/webgl_loader_utf8.html

@@ -33,6 +33,7 @@
 		</div>
 
 		<script src="../build/Three.js"></script>
+		<script src="js/loaders/UTF8Loader.js"></script>
 
 		<script src="js/Detector.js"></script>
 		<script src="js/Stats.js"></script>

+ 0 - 1
utils/build.py

@@ -131,7 +131,6 @@ EXTRAS_FILES = [
 'extras/loaders/ColladaLoader.js',
 'extras/loaders/JSONLoader.js',
 'extras/loaders/SceneLoader.js',
-'extras/loaders/UTF8Loader.js',
 'extras/objects/ImmediateRenderObject.js',
 'extras/objects/LensFlare.js',
 'extras/objects/MorphBlendMesh.js',