Browse Source

Updated builds.

alteredq 13 years ago
parent
commit
38d6c4b183
4 changed files with 585 additions and 585 deletions
  1. 270 270
      build/Three.js
  2. 109 109
      build/custom/ThreeCanvas.js
  3. 2 2
      build/custom/ThreeExtras.js
  4. 204 204
      build/custom/ThreeWebGL.js

+ 270 - 270
build/Three.js

@@ -17,83 +17,83 @@ 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},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],m=d[2],l=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-j,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(h,i);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(j));if(Math.abs(j)<
-0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-m,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(l));if(Math.abs(l)<0.99999){this.y=Math.atan2(-m,d);this.z=Math.atan2(-f,i)}else{this.y=0;this.z=Math.atan2(g,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(m));if(Math.abs(m)<0.99999){this.x=Math.atan2(l,d);this.z=Math.atan2(h,e)}else{this.x=0;this.z=Math.atan2(-f,i)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-j,i);this.y=Math.atan2(-m,
-e)}else{this.x=0;this.y=Math.atan2(m,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(l,i);this.y=Math.atan2(g,e)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)}else if(b===
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],j=d[5],i=d[9],m=d[2],l=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-i,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(h,j);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(i));if(Math.abs(i)<
+0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,j)}else{this.y=Math.atan2(-m,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(l));if(Math.abs(l)<0.99999){this.y=Math.atan2(-m,d);this.z=Math.atan2(-f,j)}else{this.y=0;this.z=Math.atan2(g,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(m));if(Math.abs(m)<0.99999){this.x=Math.atan2(l,d);this.z=Math.atan2(h,e)}else{this.x=0;this.z=Math.atan2(-f,j)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-i,j);this.y=Math.atan2(-m,
+e)}else{this.x=0;this.y=Math.atan2(m,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(l,j);this.y=Math.atan2(g,e)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)}else if(b===
 "YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 a.y),g-d+e-f);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}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;return this},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)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
-a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(e+h+j-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;if(e>h&&e>j)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
-j)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};
+a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],j=a[9];c=a[2];b=a[6];var i=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(j-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(j+b)<0.1&&Math.abs(e+h+i-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;i=(i+1)/2;d=(d+g)/4;f=(f+c)/4;j=(j+b)/4;if(e>h&&e>i)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
+i)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=j/c}else if(i<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(i);b=f/d;c=j/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-j)*(b-j)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-j)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+i-1)/2);return this}};
 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.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=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],m=c[8],l=c[9],n=c[10],p=c[11],r=c[12],o=c[13],q=c[14],c=c[15];b[0].set(f-a,j-g,p-m,c-r);b[1].set(f+a,j+g,p+m,c+r);b[2].set(f+d,j+h,p+l,c+o);b[3].set(f-d,j-h,p-l,c-o);b[4].set(f-e,j-i,p-n,c-q);b[5].set(f+e,j+i,p+n,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
+THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],j=c[6],i=c[7],m=c[8],l=c[9],n=c[10],p=c[11],r=c[12],o=c[13],q=c[14],c=c[15];b[0].set(f-a,i-g,p-m,c-r);b[1].set(f+a,i+g,p+m,c+r);b[2].set(f+d,i+h,p+l,c+o);b[3].set(f-d,i-h,p-l,c-o);b[4].set(f-e,i-j,p-n,c-q);b[5].set(f+e,i+j,p+n,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,s,x,u,t=function(a,b,c){r.sub(c,a);s=r.dot(b);x=o.add(a,q.copy(b).multiplyScalar(s));
+THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,s,x,u,t=function(a,b,c){r.sub(c,a);s=r.dot(b);x=o.add(a,q.copy(b).multiplyScalar(s));
 return u=c.distanceTo(x)},z,D,G,A,w,C,H,O,N=function(a,b,c,d){r.sub(d,b);o.sub(c,b);q.sub(a,b);z=r.dot(r);D=r.dot(o);G=r.dot(q);A=o.dot(o);w=o.dot(q);C=1/(z*A-D*D);H=(A*G-D*w)*C;O=(z*w-D*G)*C;return H>=0&&O>=0&&H+O<1},$=1.0E-4;this.setPrecision=function(a){$=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var o=0,r=a.children.length;o<r;o++)Array.prototype.push.apply(d,this.intersectObject(a.children[o],b));if(a instanceof THREE.Particle){u=t(this.origin,this.direction,a.matrixWorld.getPosition());
 if(u>a.scale.x)return[];c={distance:u,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){o=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());o=a.geometry.boundingSphere.radius*Math.max(o.x,Math.max(o.y,o.z));u=t(this.origin,this.direction,a.matrixWorld.getPosition());if(u>o)return d;var q,s,w=a.geometry,x=w.vertices,z;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(r=w.faces.length;o<
-r;o++){c=w.faces[o];i.copy(this.origin);j.copy(this.direction);z=a.matrixWorld;m=z.multiplyVector3(m.copy(c.centroid)).subSelf(i);l=a.matrixRotationWorld.multiplyVector3(l.copy(c.normal));q=j.dot(l);if(!(Math.abs(q)<$)){s=l.dot(m)/q;if(!(s<0)&&(a.doubleSided||(a.flipSided?q>0:q<0))){n.add(i,j.multiplyScalar(s));u=i.distanceTo(n);if(!(u<this.near)&&!(u>this.far))if(c instanceof THREE.Face3){e=z.multiplyVector3(e.copy(x[c.a]));f=z.multiplyVector3(f.copy(x[c.b]));g=z.multiplyVector3(g.copy(x[c.c]));
+r;o++){c=w.faces[o];j.copy(this.origin);i.copy(this.direction);z=a.matrixWorld;m=z.multiplyVector3(m.copy(c.centroid)).subSelf(j);l=a.matrixRotationWorld.multiplyVector3(l.copy(c.normal));q=i.dot(l);if(!(Math.abs(q)<$)){s=l.dot(m)/q;if(!(s<0)&&(a.doubleSided||(a.flipSided?q>0:q<0))){n.add(j,i.multiplyScalar(s));u=j.distanceTo(n);if(!(u<this.near)&&!(u>this.far))if(c instanceof THREE.Face3){e=z.multiplyVector3(e.copy(x[c.a]));f=z.multiplyVector3(f.copy(x[c.b]));g=z.multiplyVector3(g.copy(x[c.c]));
 if(N(n,e,f,g)){c={distance:u,point:n.clone(),face:c,faceIndex:o,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=z.multiplyVector3(e.copy(x[c.a]));f=z.multiplyVector3(f.copy(x[c.b]));g=z.multiplyVector3(g.copy(x[c.c]));h=z.multiplyVector3(h.copy(x[c.d]));if(N(n,e,f,h)||N(n,f,g,h)){c={distance:u,point:n.clone(),face:c,faceIndex:o,object:a};d.push(c)}}}}}}d.sort(p);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],
 b));c.sort(p);return c}};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,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,m,l){h=false;b=f;c=g;d=m;e=l;a()};this.addPoint=function(f,g){if(h===true){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,m,l,n,p){if(h===true){h=false;b=f<m?f<n?f:n:m<n?m:n;c=g<l?g<p?g:p:l<p?l:p;d=f>m?f>n?f:n:m>n?m:n;e=g>l?g>p?g:p:l>p?l:p}else{b=f<m?f<n?f<b?f:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b;c=g<l?g<p?g<c?g:c:p<c?p:c:l<p?l<c?l:c:p<c?p:c;d=f>m?f>n?f>d?f:d:n>d?n:d:m>n?m>d?m:d:n>d?n:d;e=g>l?g>p?g>e?g:e:p>e?p:e:l>p?l>e?l:e:p>e?p:e}a()};this.addRectangle=function(f){if(h===true){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],j=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,m=this.elements;m[0]=b*a;m[1]=b*c;m[2]=b*d;m[3]=b*e;m[4]=b*f;m[5]=b*g;m[6]=b*h;m[7]=b*i;m[8]=b*j;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,j,m,l,n,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,i||0,j||0,m!==void 0?m:1,l||0,n||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,i,j,m,l,n,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]=i;q[6]=j;q[10]=m;q[14]=l;q[3]=n;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],i=c[12],j=c[1],m=c[5],l=c[9],n=c[13],p=c[2],r=c[6],o=c[10],q=c[14],s=c[3],x=c[7],u=c[11],c=c[15],t=d[0],z=d[4],
-D=d[8],G=d[12],A=d[1],w=d[5],C=d[9],H=d[13],O=d[2],N=d[6],$=d[10],E=d[14],F=d[3],Q=d[7],L=d[11],d=d[15];e[0]=f*t+g*A+h*O+i*F;e[4]=f*z+g*w+h*N+i*Q;e[8]=f*D+g*C+h*$+i*L;e[12]=f*G+g*H+h*E+i*d;e[1]=j*t+m*A+l*O+n*F;e[5]=j*z+m*w+l*N+n*Q;e[9]=j*D+m*C+l*$+n*L;e[13]=j*G+m*H+l*E+n*d;e[2]=p*t+r*A+o*O+q*F;e[6]=p*z+r*w+o*N+q*Q;e[10]=p*D+r*C+o*$+q*L;e[14]=p*G+r*H+o*E+q*d;e[3]=s*t+x*A+u*O+c*F;e[7]=s*z+x*w+u*N+c*Q;e[11]=s*D+x*C+u*$+c*L;e[15]=s*G+x*H+u*E+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],i=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,m=this.elements;m[0]=b*a;m[1]=b*c;m[2]=b*d;m[3]=b*e;m[4]=b*f;m[5]=b*g;m[6]=b*h;m[7]=b*j;m[8]=b*i;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,i,m,l,n,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,i||0,m!==void 0?m:1,l||0,n||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,i,m,l,n,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]=i;q[10]=m;q[14]=l;q[3]=n;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],i=c[1],m=c[5],l=c[9],n=c[13],p=c[2],r=c[6],o=c[10],q=c[14],s=c[3],x=c[7],u=c[11],c=c[15],t=d[0],z=d[4],
+D=d[8],G=d[12],A=d[1],w=d[5],C=d[9],H=d[13],O=d[2],N=d[6],$=d[10],E=d[14],F=d[3],Q=d[7],L=d[11],d=d[15];e[0]=f*t+g*A+h*O+j*F;e[4]=f*z+g*w+h*N+j*Q;e[8]=f*D+g*C+h*$+j*L;e[12]=f*G+g*H+h*E+j*d;e[1]=i*t+m*A+l*O+n*F;e[5]=i*z+m*w+l*N+n*Q;e[9]=i*D+m*C+l*$+n*L;e[13]=i*G+m*H+l*E+n*d;e[2]=p*t+r*A+o*O+q*F;e[6]=p*z+r*w+o*N+q*Q;e[10]=p*D+r*C+o*$+q*L;e[14]=p*G+r*H+o*E+q*d;e[3]=s*t+x*A+u*O+c*F;e[7]=s*z+x*w+u*N+c*Q;e[11]=s*D+x*C+u*$+c*L;e[15]=s*G+x*H+u*E+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},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
 c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}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],j=a[2],m=a[6],l=a[10],n=a[14],p=a[3],r=a[7],o=a[11],a=a[15];return e*h*m*p-d*i*m*p-e*g*l*p+c*i*l*p+d*g*n*p-c*h*n*p-e*h*j*r+d*i*j*r+e*f*l*r-b*i*l*r-d*f*n*r+b*h*n*r+e*g*j*o-c*i*j*o-e*f*m*o+b*i*m*o+c*f*n*o-b*g*n*o-d*g*j*a+c*h*j*a+d*f*m*a-b*h*m*a-c*f*l*a+b*g*l*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;
+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],i=a[2],m=a[6],l=a[10],n=a[14],p=a[3],r=a[7],o=a[11],a=a[15];return e*h*m*p-d*j*m*p-e*g*l*p+c*j*l*p+d*g*n*p-c*h*n*p-e*h*i*r+d*j*i*r+e*f*l*r-b*j*l*r-d*f*n*r+b*h*n*r+e*g*i*o-c*j*i*o-e*f*m*o+b*j*m*o+c*f*n*o-b*g*n*o-d*g*i*a+c*h*i*a+d*f*m*a-b*h*m*a-c*f*l*a+b*g*l*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],j=c[9],m=c[13],l=c[2],n=c[6],p=c[10],r=c[14],o=c[3],q=c[7],s=c[11],c=c[15];b[0]=j*r*q-m*p*q+m*n*s-i*r*s-j*n*c+i*p*c;b[4]=g*p*q-f*r*q-g*n*s+e*r*s+f*n*c-e*p*c;b[8]=f*m*q-g*j*q+g*i*s-e*m*s-f*i*c+e*j*c;b[12]=g*j*n-f*m*n-g*i*p+e*m*p+f*i*r-e*j*r;b[1]=m*p*o-j*r*o-m*l*s+h*r*s+j*l*c-h*p*c;b[5]=f*r*o-g*p*o+g*l*s-d*r*s-f*l*c+d*p*c;b[9]=g*j*o-f*m*o-g*h*s+d*m*s+f*h*c-d*j*c;b[13]=f*m*l-g*j*l+g*h*p-d*
-m*p-f*h*r+d*j*r;b[2]=i*r*o-m*n*o+m*l*q-h*r*q-i*l*c+h*n*c;b[6]=g*n*o-e*r*o-g*l*q+d*r*q+e*l*c-d*n*c;b[10]=e*m*o-g*i*o+g*h*q-d*m*q-e*h*c+d*i*c;b[14]=g*i*l-e*m*l-g*h*n+d*m*n+e*h*r-d*i*r;b[3]=j*n*o-i*p*o-j*l*q+h*p*q+i*l*s-h*n*s;b[7]=e*p*o-f*n*o+f*l*q-d*p*q-e*l*s+d*n*s;b[11]=f*i*o-e*j*o-f*h*q+d*j*q+e*h*s-d*i*s;b[15]=e*j*l-f*i*l+f*h*n-d*j*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);if(b===void 0||b==="XYZ"){var j=g*i,m=g*f,l=d*i,n=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=m+l*e;c[5]=j-n*e;c[9]=-d*h;c[2]=n-j*e;c[6]=l+m*e;c[10]=g*h}else if(b==="YXZ"){j=h*i;m=h*f;l=e*i;n=e*f;c[0]=j+n*d;c[4]=l*d-m;c[8]=g*e;c[1]=g*f;c[5]=g*i;c[9]=-d;c[2]=m*d-l;c[6]=n+j*d;c[10]=g*h}else if(b==="ZXY"){j=h*i;m=h*f;l=e*i;n=e*f;c[0]=j-n*d;c[4]=-g*f;c[8]=l+m*d;c[1]=m+l*d;c[5]=g*i;c[9]=n-j*d;c[2]=-g*e;c[6]=d;c[10]=g*h}else if(b==="ZYX"){j=g*i;m=g*f;l=d*i;
-n=d*f;c[0]=h*i;c[4]=l*e-m;c[8]=j*e+n;c[1]=h*f;c[5]=n*e+j;c[9]=m*e-l;c[2]=-e;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){j=g*h;m=g*e;l=d*h;n=d*e;c[0]=h*i;c[4]=n-j*f;c[8]=l*f+m;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=m*f+l;c[10]=j-n*f}else if(b==="XZY"){j=g*h;m=g*e;l=d*h;n=d*e;c[0]=h*i;c[4]=-f;c[8]=e*i;c[1]=j*f+n;c[5]=g*i;c[9]=m*f-l;c[2]=l*f-m;c[6]=d*i;c[10]=n*f+j}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,j=c*h,c=c*i,m=d*h,d=d*
-i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(m+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+m);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]);
+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],i=c[9],m=c[13],l=c[2],n=c[6],p=c[10],r=c[14],o=c[3],q=c[7],s=c[11],c=c[15];b[0]=i*r*q-m*p*q+m*n*s-j*r*s-i*n*c+j*p*c;b[4]=g*p*q-f*r*q-g*n*s+e*r*s+f*n*c-e*p*c;b[8]=f*m*q-g*i*q+g*j*s-e*m*s-f*j*c+e*i*c;b[12]=g*i*n-f*m*n-g*j*p+e*m*p+f*j*r-e*i*r;b[1]=m*p*o-i*r*o-m*l*s+h*r*s+i*l*c-h*p*c;b[5]=f*r*o-g*p*o+g*l*s-d*r*s-f*l*c+d*p*c;b[9]=g*i*o-f*m*o-g*h*s+d*m*s+f*h*c-d*i*c;b[13]=f*m*l-g*i*l+g*h*p-d*
+m*p-f*h*r+d*i*r;b[2]=j*r*o-m*n*o+m*l*q-h*r*q-j*l*c+h*n*c;b[6]=g*n*o-e*r*o-g*l*q+d*r*q+e*l*c-d*n*c;b[10]=e*m*o-g*j*o+g*h*q-d*m*q-e*h*c+d*j*c;b[14]=g*j*l-e*m*l-g*h*n+d*m*n+e*h*r-d*j*r;b[3]=i*n*o-j*p*o-i*l*q+h*p*q+j*l*s-h*n*s;b[7]=e*p*o-f*n*o+f*l*q-d*p*q-e*l*s+d*n*s;b[11]=f*j*o-e*i*o-f*h*q+d*i*q+e*h*s-d*j*s;b[15]=e*i*l-f*j*l+f*h*n-d*i*n-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);if(b===void 0||b==="XYZ"){var i=g*j,m=g*f,l=d*j,n=d*f;c[0]=h*j;c[4]=-h*f;c[8]=e;c[1]=m+l*e;c[5]=i-n*e;c[9]=-d*h;c[2]=n-i*e;c[6]=l+m*e;c[10]=g*h}else if(b==="YXZ"){i=h*j;m=h*f;l=e*j;n=e*f;c[0]=i+n*d;c[4]=l*d-m;c[8]=g*e;c[1]=g*f;c[5]=g*j;c[9]=-d;c[2]=m*d-l;c[6]=n+i*d;c[10]=g*h}else if(b==="ZXY"){i=h*j;m=h*f;l=e*j;n=e*f;c[0]=i-n*d;c[4]=-g*f;c[8]=l+m*d;c[1]=m+l*d;c[5]=g*j;c[9]=n-i*d;c[2]=-g*e;c[6]=d;c[10]=g*h}else if(b==="ZYX"){i=g*j;m=g*f;l=d*j;
+n=d*f;c[0]=h*j;c[4]=l*e-m;c[8]=i*e+n;c[1]=h*f;c[5]=n*e+i;c[9]=m*e-l;c[2]=-e;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){i=g*h;m=g*e;l=d*h;n=d*e;c[0]=h*j;c[4]=n-i*f;c[8]=l*f+m;c[1]=f;c[5]=g*j;c[9]=-d*j;c[2]=-e*j;c[6]=m*f+l;c[10]=i-n*f}else if(b==="XZY"){i=g*h;m=g*e;l=d*h;n=d*e;c[0]=h*j;c[4]=-f;c[8]=e*j;c[1]=i*f+n;c[5]=g*j;c[9]=m*f-l;c[2]=l*f-m;c[6]=d*j;c[10]=n*f+i}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,i=c*h,c=c*j,m=d*h,d=d*
+j,e=e*j,g=f*g,h=f*h,f=f*j;b[0]=1-(m+e);b[4]=i-f;b[8]=c+h;b[1]=i+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+m);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],j=b[11],m=Math.cos(a),a=Math.sin(a);b[4]=m*c+a*g;b[5]=m*d+a*h;b[6]=m*e+a*i;b[7]=m*f+a*j;b[8]=m*g-a*c;b[9]=m*h-a*d;b[10]=m*i-a*e;b[11]=m*j-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],j=b[11],m=Math.cos(a),a=Math.sin(a);b[0]=m*c-a*g;b[1]=m*d-a*h;b[2]=m*e-a*i;b[3]=m*f-a*j;b[8]=m*g+a*c;b[9]=m*h+a*d;b[10]=m*i+a*e;b[11]=m*j+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],j=b[7],m=Math.cos(a),a=Math.sin(a);b[0]=m*c+a*g;b[1]=m*d+a*h;b[2]=m*e+a*i;b[3]=m*f+a*j;b[4]=m*g-a*c;b[5]=m*h-a*d;b[6]=m*i-a*e;b[7]=m*j-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,j=Math.cos(b),m=Math.sin(b),l=1-j,n=d*e*l,p=d*f*l,l=e*f*l,d=d*m,r=e*m,m=f*m,f=g+(1-g)*j,g=n+m,e=p-r,n=n-m,h=h+(1-h)*j,m=l+d,p=p+r,l=l-d,i=i+(1-i)*j,j=c[0],d=c[1],r=c[2],o=c[3],q=c[4],s=c[5],x=c[6],u=c[7],t=c[8],z=c[9],D=c[10],G=c[11];c[0]=f*j+g*q+e*t;c[1]=f*d+g*
-s+e*z;c[2]=f*r+g*x+e*D;c[3]=f*o+g*u+e*G;c[4]=n*j+h*q+m*t;c[5]=n*d+h*s+m*z;c[6]=n*r+h*x+m*D;c[7]=n*o+h*u+m*G;c[8]=p*j+l*q+i*t;c[9]=p*d+l*s+i*z;c[10]=p*r+l*x+i*D;c[11]=p*o+l*u+i*G;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]+
+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],j=b[10],i=b[11],m=Math.cos(a),a=Math.sin(a);b[4]=m*c+a*g;b[5]=m*d+a*h;b[6]=m*e+a*j;b[7]=m*f+a*i;b[8]=m*g-a*c;b[9]=m*h-a*d;b[10]=m*j-a*e;b[11]=m*i-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],i=b[11],m=Math.cos(a),a=Math.sin(a);b[0]=m*c-a*g;b[1]=m*d-a*h;b[2]=m*e-a*j;b[3]=m*f-a*i;b[8]=m*g+a*c;b[9]=m*h+a*d;b[10]=m*j+a*e;b[11]=m*i+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],i=b[7],m=Math.cos(a),a=Math.sin(a);b[0]=m*c+a*g;b[1]=m*d+a*h;b[2]=m*e+a*j;b[3]=m*f+a*i;b[4]=m*g-a*c;b[5]=m*h-a*d;b[6]=m*j-a*e;b[7]=m*i-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,i=Math.cos(b),m=Math.sin(b),l=1-i,n=d*e*l,p=d*f*l,l=e*f*l,d=d*m,r=e*m,m=f*m,f=g+(1-g)*i,g=n+m,e=p-r,n=n-m,h=h+(1-h)*i,m=l+d,p=p+r,l=l-d,j=j+(1-j)*i,i=c[0],d=c[1],r=c[2],o=c[3],q=c[4],s=c[5],x=c[6],u=c[7],t=c[8],z=c[9],D=c[10],G=c[11];c[0]=f*i+g*q+e*t;c[1]=f*d+g*
+s+e*z;c[2]=f*r+g*x+e*D;c[3]=f*o+g*u+e*G;c[4]=n*i+h*q+m*t;c[5]=n*d+h*s+m*z;c[6]=n*r+h*x+m*D;c[7]=n*o+h*u+m*G;c[8]=p*i+l*q+j*t;c[9]=p*d+l*s+j*z;c[10]=p*r+l*x+j*D;c[11]=p*o+l*u+j*G;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,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*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,j=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/j;g[14]=-((f+e)/j);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],
+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,i=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,i*g+c,i*h-d*f,0,j*h-d*g,i*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,j=c-d,i=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/i;g[14]=-((f+e)/i);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.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};
+THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.properties={};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.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};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.setEulerFromRotationMatrix((new THREE.Matrix4).extractRotation(this.matrix),this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=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===true?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===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?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)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)},clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(a,c){g=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var e=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||H.contains(a)===true)){G.copy(a.matrixWorld.getPosition());w.multiplyVector3(G);f=b();f.object=a;f.z=G.z;D.objects.push(f)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){G.copy(a.matrixWorld.getPosition());w.multiplyVector3(G);f=b();f.object=a;f.z=G.z;D.sprites.push(f)}else a instanceof
-THREE.Light&&D.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&D.objects.sort(d);return D}function b(){var a;if(g===h.length){a=new THREE.RenderableObject;h.push(a)}else a=h[g];g++;return a}function c(){var a;if(j===m.length){a=new THREE.RenderableVertex;m.push(a)}else a=m[j];j++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;
-f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));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 f,g,h=[],i,j,m=[],l,n,p=[],r,o=[],q,s,x=[],u,t,z=[],D={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,A=new THREE.Vector4,w=new THREE.Matrix4,C=new THREE.Matrix4,H=new THREE.Frustum,O=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);w.multiply(b.projectionMatrix,
+THREE.Light&&D.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&D.objects.sort(d);return D}function b(){var a;if(g===h.length){a=new THREE.RenderableObject;h.push(a)}else a=h[g];g++;return a}function c(){var a;if(i===m.length){a=new THREE.RenderableVertex;m.push(a)}else a=m[i];i++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;
+f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));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 f,g,h=[],j,i,m=[],l,n,p=[],r,o=[],q,s,x=[],u,t,z=[],D={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,A=new THREE.Vector4,w=new THREE.Matrix4,C=new THREE.Matrix4,H=new THREE.Frustum,O=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);w.multiply(b.projectionMatrix,
 b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.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.projectScene=function(b,f,g){var h=f.near,G=f.far,K=false,V,P,aa,da,I,ca,ia,Y,W,R,Z,ja,Fa,
-na,Aa,ea,Ia;t=s=r=n=0;D.elements.length=0;b.updateMatrixWorld();f.parent===void 0&&f.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);w.multiply(f.projectionMatrix,f.matrixWorldInverse);H.setFromMatrix(w);D=a(b,false);b=0;for(V=D.objects.length;b<V;b++){W=D.objects[b].object;R=W.matrixWorld;j=0;if(W instanceof THREE.Mesh){Z=W.geometry;ja=W.geometry.materials;da=Z.vertices;Fa=Z.faces;Aa=Z.faceVertexUvs;Z=W.matrixRotationWorld.extractRotation(R);Ia=W.material instanceof THREE.MeshFaceMaterial;
-P=0;for(aa=da.length;P<aa;P++){i=c();i.positionWorld.copy(da[P]);R.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);w.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>h&&i.positionScreen.z<G}da=0;for(P=Fa.length;da<P;da++){Y=Fa[da];aa=Ia===true?ja[Y.materialIndex]:W.material;if(aa!==void 0){ia=aa.side;if(Y instanceof THREE.Face3){I=m[Y.a];ca=m[Y.b];
+na,Aa,ea,Ia;t=s=r=n=0;D.elements.length=0;b.updateMatrixWorld();f.parent===void 0&&f.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);w.multiply(f.projectionMatrix,f.matrixWorldInverse);H.setFromMatrix(w);D=a(b,false);b=0;for(V=D.objects.length;b<V;b++){W=D.objects[b].object;R=W.matrixWorld;i=0;if(W instanceof THREE.Mesh){Z=W.geometry;ja=W.geometry.materials;da=Z.vertices;Fa=Z.faces;Aa=Z.faceVertexUvs;Z=W.matrixRotationWorld.extractRotation(R);Ia=W.material instanceof THREE.MeshFaceMaterial;
+P=0;for(aa=da.length;P<aa;P++){j=c();j.positionWorld.copy(da[P]);R.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);w.multiplyVector4(j.positionScreen);j.positionScreen.x=j.positionScreen.x/j.positionScreen.w;j.positionScreen.y=j.positionScreen.y/j.positionScreen.w;j.visible=j.positionScreen.z>h&&j.positionScreen.z<G}da=0;for(P=Fa.length;da<P;da++){Y=Fa[da];aa=Ia===true?ja[Y.materialIndex]:W.material;if(aa!==void 0){ia=aa.side;if(Y instanceof THREE.Face3){I=m[Y.a];ca=m[Y.b];
 na=m[Y.c];if(I.visible===true&&ca.visible===true&&na.visible===true){K=(na.positionScreen.x-I.positionScreen.x)*(ca.positionScreen.y-I.positionScreen.y)-(na.positionScreen.y-I.positionScreen.y)*(ca.positionScreen.x-I.positionScreen.x)<0;if(ia===THREE.DoubleSide||K===(ia===THREE.FrontSide)){ea=void 0;if(n===p.length){ea=new THREE.RenderableFace3;p.push(ea)}else ea=p[n];n++;l=ea;l.v1.copy(I);l.v2.copy(ca);l.v3.copy(na)}else continue}else continue}else if(Y instanceof THREE.Face4){I=m[Y.a];ca=m[Y.b];
 na=m[Y.c];ea=m[Y.d];if(I.visible===true&&ca.visible===true&&na.visible===true&&ea.visible===true){K=(ea.positionScreen.x-I.positionScreen.x)*(ca.positionScreen.y-I.positionScreen.y)-(ea.positionScreen.y-I.positionScreen.y)*(ca.positionScreen.x-I.positionScreen.x)<0||(ca.positionScreen.x-na.positionScreen.x)*(ea.positionScreen.y-na.positionScreen.y)-(ca.positionScreen.y-na.positionScreen.y)*(ea.positionScreen.x-na.positionScreen.x)<0;if(ia===THREE.DoubleSide||K===(ia===THREE.FrontSide)){var Sa=void 0;
 if(r===o.length){Sa=new THREE.RenderableFace4;o.push(Sa)}else Sa=o[r];r++;l=Sa;l.v1.copy(I);l.v2.copy(ca);l.v3.copy(na);l.v4.copy(ea)}else continue}else continue}l.normalWorld.copy(Y.normal);K===false&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&l.normalWorld.negate();Z.multiplyVector3(l.normalWorld);l.centroidWorld.copy(Y.centroid);R.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);w.multiplyVector3(l.centroidScreen);Y=Y.vertexNormals;I=0;for(ca=Y.length;I<ca;I++){na=l.vertexNormalsWorld[I];
 na.copy(Y[I]);K===false&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&na.negate();Z.multiplyVector3(na)}I=0;for(ca=Aa.length;I<ca;I++){na=Aa[I][da];if(na!==void 0){ia=0;for(Y=na.length;ia<Y;ia++)l.uvs[I][ia]=na[ia]}}l.material=aa;l.z=l.centroidScreen.z;D.elements.push(l)}}}else if(W instanceof THREE.Line){C.multiply(w,R);da=W.geometry.vertices;I=c();I.positionScreen.copy(da[0]);C.multiplyVector4(I.positionScreen);R=W.type===THREE.LinePieces?2:1;P=1;for(aa=da.length;P<aa;P++){I=c();I.positionScreen.copy(da[P]);
-C.multiplyVector4(I.positionScreen);if(!((P+1)%R>0)){ca=m[j-2];O.copy(I.positionScreen);N.copy(ca.positionScreen);if(e(O,N)===true){O.multiplyScalar(1/O.w);N.multiplyScalar(1/N.w);ja=void 0;if(s===x.length){ja=new THREE.RenderableLine;x.push(ja)}else ja=x[s];s++;q=ja;q.v1.positionScreen.copy(O);q.v2.positionScreen.copy(N);q.z=Math.max(O.z,N.z);q.material=W.material;D.elements.push(q)}}}}}b=0;for(V=D.sprites.length;b<V;b++){W=D.sprites[b].object;R=W.matrixWorld;if(W instanceof THREE.Particle){A.set(R.elements[12],
+C.multiplyVector4(I.positionScreen);if(!((P+1)%R>0)){ca=m[i-2];O.copy(I.positionScreen);N.copy(ca.positionScreen);if(e(O,N)===true){O.multiplyScalar(1/O.w);N.multiplyScalar(1/N.w);ja=void 0;if(s===x.length){ja=new THREE.RenderableLine;x.push(ja)}else ja=x[s];s++;q=ja;q.v1.positionScreen.copy(O);q.v2.positionScreen.copy(N);q.z=Math.max(O.z,N.z);q.material=W.material;D.elements.push(q)}}}}}b=0;for(V=D.sprites.length;b<V;b++){W=D.sprites[b].object;R=W.matrixWorld;if(W instanceof THREE.Particle){A.set(R.elements[12],
 R.elements[13],R.elements[14],1);w.multiplyVector4(A);A.z=A.z/A.w;if(A.z>0&&A.z<1){h=void 0;if(t===z.length){h=new THREE.RenderableParticle;z.push(h)}else h=z[t];t++;u=h;u.object=W;u.x=A.x/A.w;u.y=A.y/A.w;u.z=A.z;u.rotation=W.rotation.z;u.scale.x=W.scale.x*Math.abs(u.x-(A.x+f.projectionMatrix.elements[0])/(A.w+f.projectionMatrix.elements[12]));u.scale.y=W.scale.y*Math.abs(u.y-(A.y+f.projectionMatrix.elements[5])/(A.w+f.projectionMatrix.elements[13]));u.material=W.material;D.elements.push(u)}}}g&&
 D.elements.sort(d);return D}};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,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="YXZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=
 c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="ZXY"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="ZYX"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="YZX"){this.x=f*d*e+c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e-f*g*h}else if(b==="XZY"){this.x=f*d*e-c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e+f*g*h}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=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
-(d+h)/c;this.y=(g+i)/c;this.z=0.25*c}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,j=i*c+g*e-h*d,m=i*d+h*c-f*e,l=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+m*-h-l*-g;b.y=m*i+c*-g+l*-f-j*-h;b.z=l*i+c*-h+j*-g-m*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
-this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],j=b[6],b=b[10],i=c+f+b;if(i>0){c=0.5/Math.sqrt(i+1);this.w=0.25/c;this.x=(j-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(j-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+j)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
+(d+h)/c;this.y=(g+j)/c;this.z=0.25*c}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){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,h=b.y,j=b.z,i=b.w;this.x=c*i+d*j-e*h+f*g;this.y=-c*j+d*i+e*g+f*h;this.z=c*h-d*g+e*i+f*j;this.w=-c*g-d*h-e*j+f*i;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,j=this.w,i=j*c+g*e-h*d,m=j*d+h*c-f*e,l=j*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=i*j+c*-f+m*-h-l*-g;b.y=m*j+c*-g+l*-f-i*-h;b.z=l*j+c*-h+i*-g-m*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);this.y=0.5*
+(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/j;h=Math.sin(b*h)/j;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},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 b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};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();
@@ -107,18 +107,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,j;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;j=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(j)}}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];j=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2])}else{j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2]);j.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,f,e,A){h=a.vertices[b];i=a.vertices[c];
-j=a.vertices[d];m=g[f];l=g[e];n=g[A];p=i.x-h.x;r=j.x-h.x;o=i.y-h.y;q=j.y-h.y;s=i.z-h.z;x=j.z-h.z;u=l.u-m.u;t=n.u-m.u;z=l.v-m.v;D=n.v-m.v;G=1/(u*D-t*z);H.set((D*p-z*r)*G,(D*o-z*q)*G,(D*s-z*x)*G);O.set((u*r-t*p)*G,(u*q-t*o)*G,(u*x-t*s)*G);w[b].addSelf(H);w[c].addSelf(H);w[d].addSelf(H);C[b].addSelf(O);C[c].addSelf(O);C[d].addSelf(O)}var b,c,d,e,f,g,h,i,j,m,l,n,p,r,o,q,s,x,u,t,z,D,G,A,w=[],C=[],H=new THREE.Vector3,O=new THREE.Vector3,N=new THREE.Vector3,$=new THREE.Vector3,E=new THREE.Vector3;b=0;for(c=
+[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,j,i;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;i=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(i)}}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];i=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){i.a.copy(e.vertexNormals[0]);i.b.copy(e.vertexNormals[1]);i.c.copy(e.vertexNormals[2])}else{i.a.copy(e.vertexNormals[0]);i.b.copy(e.vertexNormals[1]);i.c.copy(e.vertexNormals[2]);i.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,f,e,A){h=a.vertices[b];j=a.vertices[c];
+i=a.vertices[d];m=g[f];l=g[e];n=g[A];p=j.x-h.x;r=i.x-h.x;o=j.y-h.y;q=i.y-h.y;s=j.z-h.z;x=i.z-h.z;u=l.u-m.u;t=n.u-m.u;z=l.v-m.v;D=n.v-m.v;G=1/(u*D-t*z);H.set((D*p-z*r)*G,(D*o-z*q)*G,(D*s-z*x)*G);O.set((u*r-t*p)*G,(u*q-t*o)*G,(u*x-t*s)*G);w[b].addSelf(H);w[c].addSelf(H);w[d].addSelf(H);C[b].addSelf(O);C[c].addSelf(O);C[d].addSelf(O)}var b,c,d,e,f,g,h,j,i,m,l,n,p,r,o,q,s,x,u,t,z,D,G,A,w=[],C=[],H=new THREE.Vector3,O=new THREE.Vector3,N=new THREE.Vector3,$=new THREE.Vector3,E=new THREE.Vector3;b=0;for(c=
 this.vertices.length;b<c;b++){w[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 F=["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++){E.copy(f.vertexNormals[d]);e=f[F[d]];A=w[e];N.copy(A);N.subSelf(E.multiplyScalar(E.dot(A))).normalize();
 $.cross(f.vertexNormals[d],A);e=$.dot(C[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(N.x,N.y,N.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,h,i;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=
+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,h,j;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];d=[a.a,a.b,a.c,a.d];for(e=3;e>0;e--)if(d.indexOf(a["abcd"[e]])!==e){d.splice(e,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);
-d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexUvs[d][f])&&i.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,m,l,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;j=this.points[c[0]];m=this.points[c[1]];l=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,m.x,l.x,n.x,g,h,i);d.y=b(j.y,m.y,l.y,n.y,g,h,i);d.z=b(j.z,m.z,l.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,f=b=b=0,e=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;e.copy(this.points[0]);for(a=1;a<c;a++){b=
-a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(e);e.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){h[b]=i;f=b}}h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,e,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);f=(b-1)/(this.points.length-1);e=b/(this.points.length-1);for(c=1;c<g-1;c++){d=f+c*(1/g)*(e-f);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=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
+d=0;for(h=this.faceVertexUvs.length;d<h;d++)(j=this.faceVertexUvs[d][f])&&j.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,j,i,m,l,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;i=this.points[c[0]];m=this.points[c[1]];l=this.points[c[2]];n=this.points[c[3]];h=g*g;j=g*h;d.x=b(i.x,m.x,l.x,n.x,g,h,j);d.y=b(i.y,m.y,l.y,n.y,g,h,j);d.z=b(i.z,m.z,l.z,n.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,f=b=b=0,e=new THREE.Vector3,g=new THREE.Vector3,h=[],j=0;h[0]=0;a||(a=100);c=this.points.length*a;e.copy(this.points[0]);for(a=1;a<c;a++){b=
+a/c;d=this.getPoint(b);g.copy(d);j=j+g.distanceTo(e);e.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,e,g,h=[],j=new THREE.Vector3,i=this.getLength();h.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=i.chunks[b]-i.chunks[b-1];g=Math.ceil(a*c/i.total);f=(b-1)/(this.points.length-1);e=b/(this.points.length-1);for(c=1;c<g-1;c++){d=f+c*(1/g)*(e-f);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=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
 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=Object.create(THREE.Camera.prototype);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=Object.create(THREE.Camera.prototype);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()};
@@ -131,63 +131,63 @@ THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new T
 this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);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 f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=h.crossOrigin;f.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",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};
-if(a.shading){var m=a.shading.toLowerCase();m==="phong"?i="MeshPhongMaterial":m==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.visible!==void 0)j.visible=a.visible;if(a.flipSided!==void 0)j.side=THREE.BackSide;if(a.doubleSided!==void 0)j.side=THREE.DoubleSide;if(a.wireframe!==
-void 0)j.wireframe=a.wireframe;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,
-a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapBump&&b&&f(j,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;m=THREE.UniformsUtils.clone(i.uniforms);m.tNormal.texture=
-j.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(j.map){m.tDiffuse.texture=j.map;m.enableDiffuse.value=true}if(j.specularMap){m.tSpecular.texture=j.specularMap;m.enableSpecular.value=true}if(j.lightMap){m.tAO.texture=j.lightMap;m.enableAO.value=true}m.uDiffuseColor.value.setHex(j.color);m.uSpecularColor.value.setHex(j.specular);m.uAmbientColor.value.setHex(j.ambient);m.uShininess.value=j.shininess;if(j.opacity!==void 0)m.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,
-vertexShader:i.vertexShader,uniforms:m,lights:true,fog:true})}else j=new THREE[i](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(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)};
+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 f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=h.crossOrigin;f.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",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};
+if(a.shading){var m=a.shading.toLowerCase();m==="phong"?j="MeshPhongMaterial":m==="basic"&&(j="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)i.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)i.transparent=a.transparent;if(a.depthTest!==void 0)i.depthTest=a.depthTest;if(a.depthWrite!==void 0)i.depthWrite=a.depthWrite;if(a.visible!==void 0)i.visible=a.visible;if(a.flipSided!==void 0)i.side=THREE.BackSide;if(a.doubleSided!==void 0)i.side=THREE.DoubleSide;if(a.wireframe!==
+void 0)i.wireframe=a.wireframe;if(a.vertexColors!==void 0)if(a.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(a.vertexColors)i.vertexColors=THREE.VertexColors;if(a.colorDiffuse)i.color=g(a.colorDiffuse);else if(a.DbgColor)i.color=a.DbgColor;if(a.colorSpecular)i.specular=g(a.colorSpecular);if(a.colorAmbient)i.ambient=g(a.colorAmbient);if(a.transparency)i.opacity=a.transparency;if(a.specularCoef)i.shininess=a.specularCoef;a.mapDiffuse&&b&&f(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,
+a.mapDiffuseWrap);a.mapLight&&b&&f(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapBump&&b&&f(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap);a.mapNormal&&b&&f(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){j=THREE.ShaderUtils.lib.normal;m=THREE.UniformsUtils.clone(j.uniforms);m.tNormal.texture=
+i.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(i.map){m.tDiffuse.texture=i.map;m.enableDiffuse.value=true}if(i.specularMap){m.tSpecular.texture=i.specularMap;m.enableSpecular.value=true}if(i.lightMap){m.tAO.texture=i.lightMap;m.enableAO.value=true}m.uDiffuseColor.value.setHex(i.color);m.uSpecularColor.value.setHex(i.specular);m.uAmbientColor.value.setHex(i.ambient);m.uShininess.value=i.shininess;if(i.opacity!==void 0)m.uOpacity.value=i.opacity;i=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+vertexShader:j.vertexShader,uniforms:m,lights:true,fog:true})}else i=new THREE[j](i);if(a.DbgName!==void 0)i.name=a.DbgName;return i}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(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)if(f.status==200||f.status==0){var c=f.response;if(c===void 0)c=(new Uint8Array(f.responseBody)).buffer;THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else 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,j,m,l,n,p,r,o,q,s,x,u,t;function z(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function G(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,f,e,g,h,i,j,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=l[d*3];e=l[d*3+1];g=l[d*3+2];h=Q[f*2];f=Q[f*2+1];i=Q[e*2];j=Q[e*2+1];e=Q[g*2];m=Q[g*2+1];g=$.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,f));n.push(new THREE.UV(i,j));n.push(new THREE.UV(e,
-m));g.push(n)}}function w(b,c){var d,f,e,g,h,i,j,m,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=Q[f*2];f=Q[f*2+1];j=Q[e*2];l=Q[e*2+1];m=Q[g*2];n=Q[g*2+1];g=Q[h*2];e=Q[h*2+1];h=$.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(j,l));p.push(new THREE.UV(m,n));p.push(new THREE.UV(g,e));h.push(p)}}function C(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=i[d];
-$.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function H(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];$.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}}function O(b,c,d,f){for(var e,g,h,i,j,m,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];j=d[f*3];m=d[f*3+1];l=d[f*3+2];i=n[f];var o=F[m*3],p=F[m*3+1];m=F[m*3+2];var r=F[l*3],
-q=F[l*3+1];l=F[l*3+2];$.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(F[j*3],F[j*3+1],F[j*3+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(r,q,l)],null,i))}}function N(b,c,d,f){for(var e,g,h,i,j,m,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];m=d[f*4];l=d[f*4+1];n=d[f*4+2];o=d[f*4+3];j=p[f];var r=F[l*3],q=F[l*3+1];l=F[l*3+2];var s=F[n*3],w=F[n*3+1];n=F[n*3+2];var u=F[o*3],t=F[o*3+1];o=F[o*3+2];$.faces.push(new THREE.Face4(e,
-g,h,i,[new THREE.Vector3(F[m*3],F[m*3+1],F[m*3+2]),new THREE.Vector3(r,q,l),new THREE.Vector3(s,w,n),new THREE.Vector3(u,t,o)],null,j))}}var $=this,E=0,F=[],Q=[],L,K,V;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials($,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,E,12);c=D(a,E+12);D(a,E+13);D(a,E+14);D(a,E+15);e=D(a,E+16);i=D(a,E+17);j=D(a,E+18);m=D(a,E+19);l=G(a,E+20);n=G(a,E+20+4);p=G(a,E+20+8);b=G(a,E+20+12);r=
-G(a,E+20+16);o=G(a,E+20+20);q=G(a,E+20+24);s=G(a,E+20+28);x=G(a,E+20+32);u=G(a,E+20+36);t=G(a,E+20+40);E=E+c;c=e*3+m;V=e*4+m;L=b*c;K=r*(c+i*3);e=o*(c+j*3);m=q*(c+i*3+j*3);c=s*V;i=x*(V+i*4);j=u*(V+j*4);E=E+function(b){var b=new Float32Array(a,b,l*3),c,d,f,e;for(c=0;c<l;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];$.vertices.push(new THREE.Vector3(d,f,e))}return l*3*Float32Array.BYTES_PER_ELEMENT}(E);E=E+function(b){if(n){var b=new Int8Array(a,b,n*3),c,d,f,e;for(c=0;c<n;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];F.push(d/
-127,f/127,e/127)}}return n*3*Int8Array.BYTES_PER_ELEMENT}(E);E=E+z(n*3);E=E+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,f;for(c=0;c<p;c++){d=b[c*2];f=b[c*2+1];Q.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(E);L=E+L+z(b*2);K=L+K+z(r*2);e=K+e+z(o*2);m=e+m+z(q*2);c=m+c+z(s*2);i=c+i+z(x*2);j=i+j+z(u*2);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*3;C(o,a,b+o*Uint32Array.BYTES_PER_ELEMENT*3);A(o,b)}})(K);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-q*Uint32Array.BYTES_PER_ELEMENT*3;O(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);A(q,c)}})(e);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;H(u,a,b+u*Uint32Array.BYTES_PER_ELEMENT*4);w(u,b)}})(i);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4,c=b+t*Uint32Array.BYTES_PER_ELEMENT*4;N(t,a,b,c+t*Uint32Array.BYTES_PER_ELEMENT*4);w(t,c)}})(j);b&&C(b,E,E+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;O(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,j,i,m,l,n,p,r,o,q,s,x,u,t;function z(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function G(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,f,e,g,h,j,i,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=l[d*3];e=l[d*3+1];g=l[d*3+2];h=Q[f*2];f=Q[f*2+1];j=Q[e*2];i=Q[e*2+1];e=Q[g*2];m=Q[g*2+1];g=$.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,f));n.push(new THREE.UV(j,i));n.push(new THREE.UV(e,
+m));g.push(n)}}function w(b,c){var d,f,e,g,h,j,i,m,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];g=o[d*4+2];h=o[d*4+3];j=Q[f*2];f=Q[f*2+1];i=Q[e*2];l=Q[e*2+1];m=Q[g*2];n=Q[g*2+1];g=Q[h*2];e=Q[h*2+1];h=$.faceVertexUvs[0];var p=[];p.push(new THREE.UV(j,f));p.push(new THREE.UV(i,l));p.push(new THREE.UV(m,n));p.push(new THREE.UV(g,e));h.push(p)}}function C(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=j[d];
+$.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function H(b,c,d){for(var f,e,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];$.faces.push(new THREE.Face4(f,e,g,h,null,null,j))}}function O(b,c,d,f){for(var e,g,h,j,i,m,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];i=d[f*3];m=d[f*3+1];l=d[f*3+2];j=n[f];var o=F[m*3],p=F[m*3+1];m=F[m*3+2];var r=F[l*3],
+q=F[l*3+1];l=F[l*3+2];$.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(F[i*3],F[i*3+1],F[i*3+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(r,q,l)],null,j))}}function N(b,c,d,f){for(var e,g,h,j,i,m,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];j=c[f*4+3];m=d[f*4];l=d[f*4+1];n=d[f*4+2];o=d[f*4+3];i=p[f];var r=F[l*3],q=F[l*3+1];l=F[l*3+2];var s=F[n*3],w=F[n*3+1];n=F[n*3+2];var u=F[o*3],t=F[o*3+1];o=F[o*3+2];$.faces.push(new THREE.Face4(e,
+g,h,j,[new THREE.Vector3(F[m*3],F[m*3+1],F[m*3+2]),new THREE.Vector3(r,q,l),new THREE.Vector3(s,w,n),new THREE.Vector3(u,t,o)],null,i))}}var $=this,E=0,F=[],Q=[],L,K,V;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials($,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,E,12);c=D(a,E+12);D(a,E+13);D(a,E+14);D(a,E+15);e=D(a,E+16);j=D(a,E+17);i=D(a,E+18);m=D(a,E+19);l=G(a,E+20);n=G(a,E+20+4);p=G(a,E+20+8);b=G(a,E+20+12);r=
+G(a,E+20+16);o=G(a,E+20+20);q=G(a,E+20+24);s=G(a,E+20+28);x=G(a,E+20+32);u=G(a,E+20+36);t=G(a,E+20+40);E=E+c;c=e*3+m;V=e*4+m;L=b*c;K=r*(c+j*3);e=o*(c+i*3);m=q*(c+j*3+i*3);c=s*V;j=x*(V+j*4);i=u*(V+i*4);E=E+function(b){var b=new Float32Array(a,b,l*3),c,d,f,e;for(c=0;c<l;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];$.vertices.push(new THREE.Vector3(d,f,e))}return l*3*Float32Array.BYTES_PER_ELEMENT}(E);E=E+function(b){if(n){var b=new Int8Array(a,b,n*3),c,d,f,e;for(c=0;c<n;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];F.push(d/
+127,f/127,e/127)}}return n*3*Int8Array.BYTES_PER_ELEMENT}(E);E=E+z(n*3);E=E+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,f;for(c=0;c<p;c++){d=b[c*2];f=b[c*2+1];Q.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(E);L=E+L+z(b*2);K=L+K+z(r*2);e=K+e+z(o*2);m=e+m+z(q*2);c=m+c+z(s*2);j=c+j+z(x*2);i=j+i+z(u*2);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*3;C(o,a,b+o*Uint32Array.BYTES_PER_ELEMENT*3);A(o,b)}})(K);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+q*Uint32Array.BYTES_PER_ELEMENT*3;O(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);A(q,c)}})(e);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;H(u,a,b+u*Uint32Array.BYTES_PER_ELEMENT*4);w(u,b)}})(j);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4,c=b+t*Uint32Array.BYTES_PER_ELEMENT*4;N(t,a,b,c+t*Uint32Array.BYTES_PER_ELEMENT*4);w(t,c)}})(i);b&&C(b,E,E+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;O(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(L);s&&H(s,m,m+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(x){var b=a+x*Uint32Array.BYTES_PER_ELEMENT*4;N(x,a,b,b+x*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;b===void 0&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},false);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(c.crossOrigin)b.crossOrigin=c.crossOrigin;b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(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,j,m,l,n,p,r,o,q,s,x,u,t=a.faces;l=a.vertices;var z=a.normals,D=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(m=l.length;j<m;){n=new THREE.Vector3;n.x=l[j++]*b;n.y=l[j++]*b;n.z=l[j++]*b;d.vertices.push(n)}j=0;for(m=t.length;j<m;){b=t[j++];l=b&1;i=b&2;c=b&
-4;e=b&8;p=b&16;n=b&32;o=b&64;b=b&128;if(l){q=new THREE.Face4;q.a=t[j++];q.b=t[j++];q.c=t[j++];q.d=t[j++];l=4}else{q=new THREE.Face3;q.a=t[j++];q.b=t[j++];q.c=t[j++];l=3}if(i){i=t[j++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<G;c++){s=a.uvs[c];r=t[j++];u=s[r*2];r=s[r*2+1];d.faceUvs[c][i]=new THREE.UV(u,r)}if(e)for(c=0;c<G;c++){s=a.uvs[c];x=[];for(e=0;e<l;e++){r=t[j++];u=s[r*2];r=s[r*2+1];x[e]=new THREE.UV(u,r)}d.faceVertexUvs[c][i]=x}if(p){p=t[j++]*3;e=new THREE.Vector3;e.x=z[p++];e.y=z[p++];
-e.z=z[p];q.normal=e}if(n)for(c=0;c<l;c++){p=t[j++]*3;e=new THREE.Vector3;e.x=z[p++];e.y=z[p++];e.z=z[p];q.vertexNormals.push(e)}if(o){n=t[j++];n=new THREE.Color(D[n]);q.color=n}if(b)for(c=0;c<l;c++){n=t[j++];n=new THREE.Color(D[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,j,m,l;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=[];m=d.morphTargets[c].vertices;l=a.morphTargets[c].vertices;i=0;for(j=l.length;i<j;i=i+3){var n=new THREE.Vector3;n.x=l[i]*b;n.y=l[i+1]*b;n.z=l[i+2]*b;m.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=[];j=d.morphColors[c].colors;m=a.morphColors[c].colors;b=0;for(i=m.length;b<i;b=b+3){l=new THREE.Color(16755200);l.setRGB(m[b],m[b+1],m[b+2]);j.push(l)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=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,j,i,m,l,n,p,r,o,q,s,x,u,t=a.faces;l=a.vertices;var z=a.normals,D=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}i=0;for(m=l.length;i<m;){n=new THREE.Vector3;n.x=l[i++]*b;n.y=l[i++]*b;n.z=l[i++]*b;d.vertices.push(n)}i=0;for(m=t.length;i<m;){b=t[i++];l=b&1;j=b&2;c=b&
+4;e=b&8;p=b&16;n=b&32;o=b&64;b=b&128;if(l){q=new THREE.Face4;q.a=t[i++];q.b=t[i++];q.c=t[i++];q.d=t[i++];l=4}else{q=new THREE.Face3;q.a=t[i++];q.b=t[i++];q.c=t[i++];l=3}if(j){j=t[i++];q.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<G;c++){s=a.uvs[c];r=t[i++];u=s[r*2];r=s[r*2+1];d.faceUvs[c][j]=new THREE.UV(u,r)}if(e)for(c=0;c<G;c++){s=a.uvs[c];x=[];for(e=0;e<l;e++){r=t[i++];u=s[r*2];r=s[r*2+1];x[e]=new THREE.UV(u,r)}d.faceVertexUvs[c][j]=x}if(p){p=t[i++]*3;e=new THREE.Vector3;e.x=z[p++];e.y=z[p++];
+e.z=z[p];q.normal=e}if(n)for(c=0;c<l;c++){p=t[i++]*3;e=new THREE.Vector3;e.x=z[p++];e.y=z[p++];e.z=z[p];q.vertexNormals.push(e)}if(o){n=t[i++];n=new THREE.Color(D[n]);q.color=n}if(b)for(c=0;c<l;c++){n=t[i++];n=new THREE.Color(D[n]);q.vertexColors.push(n)}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,i,m,l;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=[];m=d.morphTargets[c].vertices;l=a.morphTargets[c].vertices;j=0;for(i=l.length;j<i;j=j+3){var n=new THREE.Vector3;n.x=l[j]*b;n.y=l[j+1]*b;n.z=l[j+2]*b;m.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=[];i=d.morphColors[c].colors;m=a.morphColors[c].colors;b=0;for(j=m.length;b<j;b=b+3){l=new THREE.Color(16755200);l.setRGB(m[b],m[b+1],m[b+2]);i.push(l)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),e):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
-a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var g=a.materials[f],h=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},i=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},j=function(a,d,e,f,g,j){a[d]=new THREE.Texture;a[d].sourceFile=
-e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!==1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!==1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(j){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[j[0]]!==void 0)a[d].wrapS=f[j[0]];if(f[j[1]]!==void 0)a[d].wrapT=f[j[1]]}var m=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!h(a.width)||!h(a.height)){var b=i(a.width),c=i(a.height);m.image=document.createElement("canvas");m.image.width=
+a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var g=a.materials[f],h=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},j=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},i=function(a,d,e,f,g,i){a[d]=new THREE.Texture;a[d].sourceFile=
+e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!==1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!==1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(i){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[i[0]]!==void 0)a[d].wrapS=f[i[0]];if(f[i[1]]!==void 0)a[d].wrapT=f[i[1]]}var m=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!h(a.width)||!h(a.height)){var b=j(a.width),c=j(a.height);m.image=document.createElement("canvas");m.image.width=
 b;m.image.height=c;m.image.getContext("2d").drawImage(a,0,0,b,c)}else m.image=a;m.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},m=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},l="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(g.shading){var p=g.shading.toLowerCase();p==="phong"?l="MeshPhongMaterial":p==="basic"&&(l="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==
 void 0)n.blending=THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)n.transparent=g.transparent;if(g.depthTest!==void 0)n.depthTest=g.depthTest;if(g.depthWrite!==void 0)n.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")n.vertexColors=THREE.FaceColors;else if(g.vertexColors)n.vertexColors=THREE.VertexColors;if(g.colorDiffuse)n.color=m(g.colorDiffuse);else if(g.DbgColor)n.color=g.DbgColor;if(g.colorSpecular)n.specular=m(g.colorSpecular);if(g.colorAmbient)n.ambient=
-m(g.colorAmbient);if(g.transparency)n.opacity=g.transparency;if(g.specularCoef)n.shininess=g.specularCoef;if(g.visible!==void 0)n.visible=g.visible;if(g.flipSided!==void 0)n.side=THREE.BackSide;if(g.doubleSided!==void 0)n.side=THREE.DoubleSide;if(g.wireframe!==void 0)n.wireframe=g.wireframe;g.mapDiffuse&&j(n,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(n,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapBump&&j(n,"bumpMap",g.mapBump,
-g.mapBumpRepeat,g.mapBumpOffset,g.mapBumpWrap);g.mapNormal&&j(n,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(n,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){j=THREE.ShaderUtils.lib.normal;m=THREE.UniformsUtils.clone(j.uniforms);m.tNormal.texture=n.normalMap;if(g.mapNormalFactor)m.uNormalScale.value=g.mapNormalFactor;if(n.map){m.tDiffuse.texture=n.map;m.enableDiffuse.value=true}if(n.specularMap){m.tSpecular.texture=
-n.specularMap;m.enableSpecular.value=true}if(n.lightMap){m.tAO.texture=n.lightMap;m.enableAO.value=true}m.uDiffuseColor.value.setHex(n.color);m.uSpecularColor.value.setHex(n.specular);m.uAmbientColor.value.setHex(n.ambient);m.uShininess.value=n.shininess;if(n.opacity!==void 0)m.uOpacity.value=n.opacity;n=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:m,lights:true,fog:true})}else n=new THREE[l](n);if(g.DbgName!==void 0)n.name=g.DbgName;d.materials[f]=
-n}}var g=a.faces,r=a.vertices,n=a.normals,j=a.colors,m=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&m++;for(f=0;f<m;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}l=0;for(p=r.length;l<p;){var o=new THREE.Vector3;o.x=r[l++]*e;o.y=r[l++]*e;o.z=r[l++]*e;d.vertices.push(o)}l=0;for(p=g.length;l<p;){var q=g[l++],s=q&2,f=q&4,x=q&8,u=q&16,r=q&32,t=q&64,o=q&128;if(q&1){q=new THREE.Face4;q.a=g[l++];q.b=g[l++];q.c=g[l++];q.d=g[l++];var z=4}else{q=new THREE.Face3;q.a=g[l++];q.b=g[l++];q.c=g[l++];z=3}if(s){s=
-g[l++];q.materialIndex=s}var D=d.faces.length;if(f)for(f=0;f<m;f++){var G=a.uvs[f],s=g[l++],A=G[s*2],s=G[s*2+1];d.faceUvs[f][D]=new THREE.UV(A,s)}if(x)for(f=0;f<m;f++){for(var G=a.uvs[f],x=[],w=0;w<z;w++){s=g[l++];A=G[s*2];s=G[s*2+1];x[w]=new THREE.UV(A,s)}d.faceVertexUvs[f][D]=x}if(u){u=g[l++]*3;s=new THREE.Vector3;s.x=n[u++];s.y=n[u++];s.z=n[u];q.normal=s}if(r)for(f=0;f<z;f++){u=g[l++]*3;s=new THREE.Vector3;s.x=n[u++];s.y=n[u++];s.z=n[u];q.vertexNormals.push(s)}if(t){r=g[l++];q.color=new THREE.Color(j[r])}if(o)for(f=
-0;f<z;f++){r=g[l++];q.vertexColors.push(new THREE.Color(j[r]))}d.faces.push(q)}if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f=f+2){n=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],n,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=
-a.morphTargets[f].name;d.morphTargets[f].vertices=[];n=d.morphTargets[f].vertices;j=a.morphTargets[f].vertices;s=0;for(m=j.length;s<m;s=s+3){o=new THREE.Vector3;o.x=j[s]*e;o.y=j[s+1]*e;o.z=j[s+2]*e;n.push(o)}}}if(a.morphColors){f=0;for(g=a.morphColors.length;f<g;f++){d.morphColors[f]={};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;j=a.morphColors[f].colors;n=0;for(m=j.length;n<m;n=n+3){l=new THREE.Color(16755200);l.setRGB(j[n],j[n+1],j[n+2]);e.push(l)}}}d.computeCentroids();
+m(g.colorAmbient);if(g.transparency)n.opacity=g.transparency;if(g.specularCoef)n.shininess=g.specularCoef;if(g.visible!==void 0)n.visible=g.visible;if(g.flipSided!==void 0)n.side=THREE.BackSide;if(g.doubleSided!==void 0)n.side=THREE.DoubleSide;if(g.wireframe!==void 0)n.wireframe=g.wireframe;g.mapDiffuse&&i(n,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&i(n,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapBump&&i(n,"bumpMap",g.mapBump,
+g.mapBumpRepeat,g.mapBumpOffset,g.mapBumpWrap);g.mapNormal&&i(n,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&i(n,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){i=THREE.ShaderUtils.lib.normal;m=THREE.UniformsUtils.clone(i.uniforms);m.tNormal.texture=n.normalMap;if(g.mapNormalFactor)m.uNormalScale.value=g.mapNormalFactor;if(n.map){m.tDiffuse.texture=n.map;m.enableDiffuse.value=true}if(n.specularMap){m.tSpecular.texture=
+n.specularMap;m.enableSpecular.value=true}if(n.lightMap){m.tAO.texture=n.lightMap;m.enableAO.value=true}m.uDiffuseColor.value.setHex(n.color);m.uSpecularColor.value.setHex(n.specular);m.uAmbientColor.value.setHex(n.ambient);m.uShininess.value=n.shininess;if(n.opacity!==void 0)m.uOpacity.value=n.opacity;n=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:m,lights:true,fog:true})}else n=new THREE[l](n);if(g.DbgName!==void 0)n.name=g.DbgName;d.materials[f]=
+n}}var g=a.faces,r=a.vertices,n=a.normals,i=a.colors,m=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&m++;for(f=0;f<m;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}l=0;for(p=r.length;l<p;){var o=new THREE.Vector3;o.x=r[l++]*e;o.y=r[l++]*e;o.z=r[l++]*e;d.vertices.push(o)}l=0;for(p=g.length;l<p;){var q=g[l++],s=q&2,f=q&4,x=q&8,u=q&16,r=q&32,t=q&64,o=q&128;if(q&1){q=new THREE.Face4;q.a=g[l++];q.b=g[l++];q.c=g[l++];q.d=g[l++];var z=4}else{q=new THREE.Face3;q.a=g[l++];q.b=g[l++];q.c=g[l++];z=3}if(s){s=
+g[l++];q.materialIndex=s}var D=d.faces.length;if(f)for(f=0;f<m;f++){var G=a.uvs[f],s=g[l++],A=G[s*2],s=G[s*2+1];d.faceUvs[f][D]=new THREE.UV(A,s)}if(x)for(f=0;f<m;f++){for(var G=a.uvs[f],x=[],w=0;w<z;w++){s=g[l++];A=G[s*2];s=G[s*2+1];x[w]=new THREE.UV(A,s)}d.faceVertexUvs[f][D]=x}if(u){u=g[l++]*3;s=new THREE.Vector3;s.x=n[u++];s.y=n[u++];s.z=n[u];q.normal=s}if(r)for(f=0;f<z;f++){u=g[l++]*3;s=new THREE.Vector3;s.x=n[u++];s.y=n[u++];s.z=n[u];q.vertexNormals.push(s)}if(t){r=g[l++];q.color=new THREE.Color(i[r])}if(o)for(f=
+0;f<z;f++){r=g[l++];q.vertexColors.push(new THREE.Color(i[r]))}d.faces.push(q)}if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f=f+2){n=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],n,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=
+a.morphTargets[f].name;d.morphTargets[f].vertices=[];n=d.morphTargets[f].vertices;i=a.morphTargets[f].vertices;s=0;for(m=i.length;s<m;s=s+3){o=new THREE.Vector3;o.x=i[s]*e;o.y=i[s+1]*e;o.z=i[s+2]*e;n.push(o)}}}if(a.morphColors){f=0;for(g=a.morphColors.length;f<g;f++){d.morphColors[f]={};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;i=a.morphColors[f].colors;n=0;for(m=i.length;n<m;n=n+3){l=new THREE.Color(16755200);l.setRGB(i[n],i[n+1],i[n+2]);e.push(l)}}}d.computeCentroids();
 d.computeFaceNormals();return 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:j+"/"+a}function e(a,b){var c;for(n in b)if(P.objects[n]===void 0){s=b[n];if(s.geometry!==void 0){if(H=P.geometries[s.geometry]){c=false;O=P.materials[s.materials[0]];(c=O instanceof THREE.ShaderMaterial)&&H.computeTangents();z=s.position;D=s.rotation;G=s.quaternion;A=s.scale;x=s.matrix;G=0;s.materials.length==0&&(O=new THREE.MeshFaceMaterial);s.materials.length>1&&(O=new THREE.MeshFaceMaterial);c=
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:i+"/"+a}function e(a,b){var c;for(n in b)if(P.objects[n]===void 0){s=b[n];if(s.geometry!==void 0){if(H=P.geometries[s.geometry]){c=false;O=P.materials[s.materials[0]];(c=O instanceof THREE.ShaderMaterial)&&H.computeTangents();z=s.position;D=s.rotation;G=s.quaternion;A=s.scale;x=s.matrix;G=0;s.materials.length==0&&(O=new THREE.MeshFaceMaterial);s.materials.length>1&&(O=new THREE.MeshFaceMaterial);c=
 new THREE.Mesh(H,O);c.name=n;if(x){c.matrixAutoUpdate=false;c.matrix.set(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15])}else{c.position.set(z[0],z[1],z[2]);if(G){c.quaternion.set(G[0],G[1],G[2],G[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(A[0],A[1],A[2])}c.visible=s.visible;c.castShadow=s.castShadow;c.receiveShadow=s.receiveShadow;a.add(c);P.objects[n]=c}}else{z=s.position;D=s.rotation;G=s.quaternion;A=s.scale;G=0;c=new THREE.Object3D;
-c.name=n;c.position.set(z[0],z[1],z[2]);if(G){c.quaternion.set(G[0],G[1],G[2],G[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(A[0],A[1],A[2]);c.visible=s.visible!==void 0?s.visible:false;a.add(c);P.objects[n]=c;P.empties[n]=c}s.children!==void 0&&e(c,s.children)}}function f(a){return function(b){P.geometries[a]=b;e(P.scene,E.objects);Q=Q-1;i.onLoadComplete();h()}}function g(a){return function(b){P.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:V,
-loadedModels:K-Q,loadedTextures:V-L},P);i.onLoadProgress();Q===0&&L===0&&b(P)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),m,l,n,p,r,o,q,s,x,u,t,z,D,G,A,w,C,H,O,N,$,E,F,Q,L,K,V,P;E=a;c=new THREE.BinaryLoader;F=new THREE.JSONLoader;L=Q=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(E.transform){a=E.transform.position;u=E.transform.rotation;w=E.transform.scale;a&&P.scene.position.set(a[0],a[1],a[2]);u&&P.scene.rotation.set(u[0],
-u[1],u[2]);w&&P.scene.scale.set(w[0],w[1],w[2]);if(a||u||w){P.scene.updateMatrix();P.scene.updateMatrixWorld()}}a=function(a){return function(){L=L-a;h();i.onLoadComplete()}};for(r in E.cameras){w=E.cameras[r];w.type==="perspective"?N=new THREE.PerspectiveCamera(w.fov,w.aspect,w.near,w.far):w.type==="ortho"&&(N=new THREE.OrthographicCamera(w.left,w.right,w.top,w.bottom,w.near,w.far));z=w.position;u=w.target;w=w.up;N.position.set(z[0],z[1],z[2]);N.target=new THREE.Vector3(u[0],u[1],u[2]);w&&N.up.set(w[0],
-w[1],w[2]);P.cameras[r]=N}for(p in E.lights){u=E.lights[p];r=u.color!==void 0?u.color:16777215;N=u.intensity!==void 0?u.intensity:1;if(u.type==="directional"){z=u.direction;t=new THREE.DirectionalLight(r,N);t.position.set(z[0],z[1],z[2]);t.position.normalize()}else if(u.type==="point"){z=u.position;t=u.distance;t=new THREE.PointLight(r,N,t);t.position.set(z[0],z[1],z[2])}else u.type==="ambient"&&(t=new THREE.AmbientLight(r));P.scene.add(t);P.lights[p]=t}for(o in E.fogs){p=E.fogs[o];p.type==="linear"?
-$=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&($=new THREE.FogExp2(0,p.density));w=p.color;$.color.setRGB(w[0],w[1],w[2]);P.fogs[o]=$}if(P.cameras&&E.defaults.camera)P.currentCamera=P.cameras[E.defaults.camera];if(P.fogs&&E.defaults.fog)P.scene.fog=P.fogs[E.defaults.fog];w=E.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(w[0],w[1],w[2]);P.bgColorAlpha=E.defaults.bgalpha;for(m in E.geometries){o=E.geometries[m];if(o.type=="bin_mesh"||o.type=="ascii_mesh"){Q=Q+1;i.onLoadStart()}}K=Q;
-for(m in E.geometries){o=E.geometries[m];if(o.type==="cube"){H=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);P.geometries[m]=H}else if(o.type==="plane"){H=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);P.geometries[m]=H}else if(o.type==="sphere"){H=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight);P.geometries[m]=H}else if(o.type==="cylinder"){H=new THREE.CylinderGeometry(o.topRad,
-o.botRad,o.height,o.radSegs,o.heightSegs);P.geometries[m]=H}else if(o.type==="torus"){H=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);P.geometries[m]=H}else if(o.type==="icosahedron"){H=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);P.geometries[m]=H}else if(o.type==="bin_mesh")c.load(d(o.url,E.urlBaseType),f(m));else if(o.type==="ascii_mesh")F.load(d(o.url,E.urlBaseType),f(m));else if(o.type==="embedded_mesh"){o=E.embeds[o.id];o.metadata=E.metadata;o&&F.createModel(o,g(m),
-"")}}for(q in E.textures){m=E.textures[q];if(m.url instanceof Array){L=L+m.url.length;for(o=0;o<m.url.length;o++)i.onLoadStart()}else{L=L+1;i.onLoadStart()}}V=L;for(q in E.textures){m=E.textures[q];if(m.mapping!==void 0&&THREE[m.mapping]!==void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){o=m.url.length;$=[];for(c=0;c<o;c++)$[c]=d(m.url[c],E.urlBaseType);o=THREE.ImageUtils.loadTextureCube($,m.mapping,a(o))}else{o=THREE.ImageUtils.loadTexture(d(m.url,E.urlBaseType),m.mapping,a(1));if(THREE[m.minFilter]!==
-void 0)o.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!==void 0)o.magFilter=THREE[m.magFilter];if(m.repeat){o.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!==1)o.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!==1)o.wrapT=THREE.RepeatWrapping}m.offset&&o.offset.set(m.offset[0],m.offset[1]);if(m.wrap){$={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if($[m.wrap[0]]!==void 0)o.wrapS=$[m.wrap[0]];if($[m.wrap[1]]!==void 0)o.wrapT=$[m.wrap[1]]}}P.textures[q]=o}for(l in E.materials){x=
-E.materials[l];for(C in x.parameters)if(C==="envMap"||C==="map"||C==="lightMap")x.parameters[C]=P.textures[x.parameters[C]];else if(C==="shading")x.parameters[C]=x.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C==="blending")x.parameters[C]=x.parameters[C]in THREE?THREE[x.parameters[C]]:THREE.NormalBlending;else if(C==="combine")x.parameters[C]=x.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C==="vertexColors")if(x.parameters[C]=="face")x.parameters[C]=
-THREE.FaceColors;else if(x.parameters[C])x.parameters[C]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=true;if(x.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);m=x.parameters.color;o=x.parameters.specular;$=x.parameters.ambient;c=x.parameters.shininess;a.tNormal.texture=P.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)a.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map){a.tDiffuse.texture=
-x.parameters.map;a.enableDiffuse.value=true}if(x.parameters.lightMap){a.tAO.texture=x.parameters.lightMap;a.enableAO.value=true}if(x.parameters.specularMap){a.tSpecular.texture=P.textures[x.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(o);a.uAmbientColor.value.setHex($);a.uShininess.value=c;if(x.parameters.opacity)a.uOpacity.value=x.parameters.opacity;O=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
-uniforms:a,lights:true,fog:true})}else O=new THREE[x.type](x.parameters);P.materials[l]=O}e(P.scene,E.objects);i.callbackSync(P);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+c.name=n;c.position.set(z[0],z[1],z[2]);if(G){c.quaternion.set(G[0],G[1],G[2],G[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(A[0],A[1],A[2]);c.visible=s.visible!==void 0?s.visible:false;a.add(c);P.objects[n]=c;P.empties[n]=c}if(s.properties!==void 0)for(var d in s.properties)c.properties[d]=s.properties[d];s.children!==void 0&&e(c,s.children)}}function f(a){return function(b){P.geometries[a]=b;e(P.scene,E.objects);Q=Q-1;j.onLoadComplete();h()}}function g(a){return function(b){P.geometries[a]=
+b}}function h(){j.callbackProgress({totalModels:K,totalTextures:V,loadedModels:K-Q,loadedTextures:V-L},P);j.onLoadProgress();Q===0&&L===0&&b(P)}var j=this,i=THREE.Loader.prototype.extractUrlBase(c),m,l,n,p,r,o,q,s,x,u,t,z,D,G,A,w,C,H,O,N,$,E,F,Q,L,K,V,P;E=a;c=new THREE.BinaryLoader;F=new THREE.JSONLoader;L=Q=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(E.transform){a=E.transform.position;u=E.transform.rotation;w=E.transform.scale;
+a&&P.scene.position.set(a[0],a[1],a[2]);u&&P.scene.rotation.set(u[0],u[1],u[2]);w&&P.scene.scale.set(w[0],w[1],w[2]);if(a||u||w){P.scene.updateMatrix();P.scene.updateMatrixWorld()}}a=function(a){return function(){L=L-a;h();j.onLoadComplete()}};for(r in E.cameras){w=E.cameras[r];w.type==="perspective"?N=new THREE.PerspectiveCamera(w.fov,w.aspect,w.near,w.far):w.type==="ortho"&&(N=new THREE.OrthographicCamera(w.left,w.right,w.top,w.bottom,w.near,w.far));z=w.position;u=w.target;w=w.up;N.position.set(z[0],
+z[1],z[2]);N.target=new THREE.Vector3(u[0],u[1],u[2]);w&&N.up.set(w[0],w[1],w[2]);P.cameras[r]=N}for(p in E.lights){u=E.lights[p];r=u.color!==void 0?u.color:16777215;N=u.intensity!==void 0?u.intensity:1;if(u.type==="directional"){z=u.direction;t=new THREE.DirectionalLight(r,N);t.position.set(z[0],z[1],z[2]);t.position.normalize()}else if(u.type==="point"){z=u.position;t=u.distance;t=new THREE.PointLight(r,N,t);t.position.set(z[0],z[1],z[2])}else u.type==="ambient"&&(t=new THREE.AmbientLight(r));P.scene.add(t);
+P.lights[p]=t}for(o in E.fogs){p=E.fogs[o];p.type==="linear"?$=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&($=new THREE.FogExp2(0,p.density));w=p.color;$.color.setRGB(w[0],w[1],w[2]);P.fogs[o]=$}if(P.cameras&&E.defaults.camera)P.currentCamera=P.cameras[E.defaults.camera];if(P.fogs&&E.defaults.fog)P.scene.fog=P.fogs[E.defaults.fog];w=E.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(w[0],w[1],w[2]);P.bgColorAlpha=E.defaults.bgalpha;for(m in E.geometries){o=E.geometries[m];if(o.type==
+"bin_mesh"||o.type=="ascii_mesh"){Q=Q+1;j.onLoadStart()}}K=Q;for(m in E.geometries){o=E.geometries[m];if(o.type==="cube"){H=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);P.geometries[m]=H}else if(o.type==="plane"){H=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);P.geometries[m]=H}else if(o.type==="sphere"){H=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight);P.geometries[m]=H}else if(o.type===
+"cylinder"){H=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs);P.geometries[m]=H}else if(o.type==="torus"){H=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);P.geometries[m]=H}else if(o.type==="icosahedron"){H=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);P.geometries[m]=H}else if(o.type==="bin_mesh")c.load(d(o.url,E.urlBaseType),f(m));else if(o.type==="ascii_mesh")F.load(d(o.url,E.urlBaseType),f(m));else if(o.type==="embedded_mesh"){o=E.embeds[o.id];
+o.metadata=E.metadata;o&&F.createModel(o,g(m),"")}}for(q in E.textures){m=E.textures[q];if(m.url instanceof Array){L=L+m.url.length;for(o=0;o<m.url.length;o++)j.onLoadStart()}else{L=L+1;j.onLoadStart()}}V=L;for(q in E.textures){m=E.textures[q];if(m.mapping!==void 0&&THREE[m.mapping]!==void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){o=m.url.length;$=[];for(c=0;c<o;c++)$[c]=d(m.url[c],E.urlBaseType);o=THREE.ImageUtils.loadTextureCube($,m.mapping,a(o))}else{o=THREE.ImageUtils.loadTexture(d(m.url,
+E.urlBaseType),m.mapping,a(1));if(THREE[m.minFilter]!==void 0)o.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!==void 0)o.magFilter=THREE[m.magFilter];if(m.repeat){o.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!==1)o.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!==1)o.wrapT=THREE.RepeatWrapping}m.offset&&o.offset.set(m.offset[0],m.offset[1]);if(m.wrap){$={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if($[m.wrap[0]]!==void 0)o.wrapS=$[m.wrap[0]];if($[m.wrap[1]]!==void 0)o.wrapT=
+$[m.wrap[1]]}}P.textures[q]=o}for(l in E.materials){x=E.materials[l];for(C in x.parameters)if(C==="envMap"||C==="map"||C==="lightMap")x.parameters[C]=P.textures[x.parameters[C]];else if(C==="shading")x.parameters[C]=x.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C==="blending")x.parameters[C]=x.parameters[C]in THREE?THREE[x.parameters[C]]:THREE.NormalBlending;else if(C==="combine")x.parameters[C]=x.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C===
+"vertexColors")if(x.parameters[C]=="face")x.parameters[C]=THREE.FaceColors;else if(x.parameters[C])x.parameters[C]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=true;if(x.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);m=x.parameters.color;o=x.parameters.specular;$=x.parameters.ambient;c=x.parameters.shininess;a.tNormal.texture=P.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)a.uNormalScale.value=
+x.parameters.normalMapFactor;if(x.parameters.map){a.tDiffuse.texture=x.parameters.map;a.enableDiffuse.value=true}if(x.parameters.lightMap){a.tAO.texture=x.parameters.lightMap;a.enableAO.value=true}if(x.parameters.specularMap){a.tSpecular.texture=P.textures[x.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(o);a.uAmbientColor.value.setHex($);a.uShininess.value=c;if(x.parameters.opacity)a.uOpacity.value=x.parameters.opacity;O=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,
+vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else O=new THREE[x.type](x.parameters);P.materials[l]=O}e(P.scene,E.objects);j.callbackSync(P);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(){this.id=THREE.MaterialCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=false;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=true;this.polygonOffset=false;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=false;this.needsUpdate=this.visible=true};
 THREE.Material.prototype.setValues=function(a){if(a!==void 0)for(var b in a){var c=a[b];if(c===void 0)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color&&typeof c==="number"?d.setHex(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
@@ -214,9 +214,9 @@ THREE.ParticleCanvasMaterial.prototype.clone=function(){var a=new THREE.Particle
 THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.attributes=null;this.shading=THREE.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.lights=this.fog=false;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=false;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=this.uniforms;a.attributes=this.attributes;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;
 return a};
-THREE.Texture=function(a,b,c,d,e,f,g,h,i){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.anisotropy=i!==void 0?i:1;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,
+THREE.Texture=function(a,b,c,d,e,f,g,h,j){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.anisotropy=j!==void 0?j:1;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.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=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,this.anisotropy);a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;return a}};
-THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,j){THREE.Texture.call(this,null,f,g,h,i,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);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.TextureCount=0;THREE.DataTexture=function(a,b,c,d,e,f,g,h,j,i){THREE.Texture.call(this,null,f,g,h,j,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);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=Object.create(THREE.Object3D.prototype);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=Object.create(THREE.Object3D.prototype);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=Object.create(THREE.Object3D.prototype);
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
@@ -246,32 +246,32 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light){this.__lights.indexOf(a)===-1&&this.__lights.push(a);a.target&&a.target.parent===void 0&&this.add(a.target)}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.CanvasRenderer=function(a){function b(a){if(x!==a)x=o.globalAlpha=a}function c(a){if(u!==a){if(a===THREE.NormalBlending)o.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)o.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)o.globalCompositeOperation="darker";u=a}}function d(a){if(t!==a)t=o.strokeStyle=a}function e(a){if(z!==a)z=o.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,m=a.canvas!==
+THREE.CanvasRenderer=function(a){function b(a){if(x!==a)x=o.globalAlpha=a}function c(a){if(u!==a){if(a===THREE.NormalBlending)o.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)o.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)o.globalCompositeOperation="darker";u=a}}function d(a){if(t!==a)t=o.strokeStyle=a}function e(a){if(z!==a)z=o.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,j,i=new THREE.Projector,m=a.canvas!==
 void 0?a.canvas:document.createElement("canvas"),l,n,p,r,o=m.getContext("2d"),q=new THREE.Color(0),s=0,x=1,u=0,t=null,z=null,D=null,G=null,A=null,w,C,H,O,N=new THREE.RenderableVertex,$=new THREE.RenderableVertex,E,F,Q,L,K,V,P,aa,da,I,ca,ia,Y=new THREE.Color,W=new THREE.Color,R=new THREE.Color,Z=new THREE.Color,ja=new THREE.Color,Fa=[],na=[],Aa,ea,Ia,Sa,jb,ob,pb,kb,qb,db,bb=new THREE.Rectangle,Ja=new THREE.Rectangle,za=new THREE.Rectangle,lb=false,Ca=new THREE.Color,Ta=new THREE.Color,Ga=new THREE.Color,
 oa=new THREE.Vector3,rb,k,Wa,Xa,eb,cb,a=16;rb=document.createElement("canvas");rb.width=rb.height=2;k=rb.getContext("2d");k.fillStyle="rgba(0,0,0,1)";k.fillRect(0,0,2,2);Wa=k.getImageData(0,0,2,2);Xa=Wa.data;eb=document.createElement("canvas");eb.width=eb.height=a;cb=eb.getContext("2d");cb.translate(-a/2,-a/2);cb.scale(a,a);a--;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){l=a;n=b;p=Math.floor(l/2);r=Math.floor(n/
 2);m.width=l;m.height=n;bb.set(-p,-r,p,r);Ja.set(-p,-r,p,r);x=1;u=0;A=G=D=z=t=null};this.setClearColor=function(a,b){q.copy(a);s=b!==void 0?b:1;Ja.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b!==void 0?b:1;Ja.set(-p,-r,p,r)};this.clear=function(){o.setTransform(1,0,0,-1,p,r);if(Ja.isEmpty()===false){Ja.minSelf(bb);Ja.inflate(2);s<1&&o.clearRect(Math.floor(Ja.getX()),Math.floor(Ja.getY()),Math.floor(Ja.getWidth()),Math.floor(Ja.getHeight()));if(s>0){c(THREE.NormalBlending);b(1);
 e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+s+")");o.fillRect(Math.floor(Ja.getX()),Math.floor(Ja.getY()),Math.floor(Ja.getWidth()),Math.floor(Ja.getHeight()))}Ja.empty()}};this.render=function(a,m){function l(a){var b,c,d,e;Ca.setRGB(0,0,0);Ta.setRGB(0,0,0);Ga.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Ca.r=Ca.r+e.r;Ca.g=Ca.g+e.g;Ca.b=Ca.b+e.b}else if(d instanceof THREE.DirectionalLight){Ta.r=Ta.r+e.r;Ta.g=
-Ta.g+e.g;Ta.b=Ta.b+e.b}else if(d instanceof THREE.PointLight){Ga.r=Ga.r+e.r;Ga.g=Ga.g+e.g;Ga.b=Ga.b+e.b}}}function n(a,b,c,d){var e,f,g,h,k,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition().normalize();i=c.dot(k);if(!(i<=0)){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();i=c.dot(oa.sub(k,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(k)/
-g.distance,1));if(i!=0){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var h,k,i,j,m,l;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){i=f.object.scale.x;j=f.object.scale.y;i=i*f.scale.x*p;j=j*f.scale.y*r;za.set(a.x-i,a.y-j,a.x+i,a.y+j);if(bb.intersects(za)===false)return;e(g.color.getContextStyle());o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(i,j);o.fillRect(-1,-1,2,2)}else{g=g.map.image;m=g.width>>1;l=g.height>>
-1;i=f.scale.x*p;j=f.scale.y*r;h=i*m;k=j*l;za.set(a.x-h,a.y-k,a.x+h,a.y+k);if(bb.intersects(za)===false)return;o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(i,-j);o.translate(-m,-l);o.drawImage(g,0,0)}o.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=f.scale.x*p;k=f.scale.y*r;za.set(a.x-h,a.y-k,a.x+h,a.y+k);if(bb.intersects(za)!==false){d(g.color.getContextStyle());e(g.color.getContextStyle());o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(h,k);g.program(o);
-o.restore()}}}function xd(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(D!==a)D=o.lineWidth=a;a=g.linecap;if(G!==a)G=o.lineCap=a;a=g.linejoin;if(A!==a)A=o.lineJoin=a;d(g.color.getContextStyle());o.stroke();za.inflate(g.linewidth*2)}}function s(a,d,e,g,h,k,j,l){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;
-b(l.opacity);c(l.blending);E=a.positionScreen.x;F=a.positionScreen.y;Q=d.positionScreen.x;L=d.positionScreen.y;K=e.positionScreen.x;V=e.positionScreen.y;t(E,F,Q,L,K,V);if(l instanceof THREE.MeshBasicMaterial)if(l.map!==null){if(l.map.mapping instanceof THREE.UVMapping){Sa=j.uvs[0];jd(E,F,Q,L,K,V,Sa[g].u,Sa[g].v,Sa[h].u,Sa[h].v,Sa[k].u,Sa[k].v,l.map)}}else if(l.envMap!==null){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=m.matrixWorldInverse;oa.copy(j.vertexNormalsWorld[g]);jb=
-(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;ob=(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;oa.copy(j.vertexNormalsWorld[h]);pb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;kb=(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;oa.copy(j.vertexNormalsWorld[k]);qb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;db=(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;jd(E,F,Q,L,K,V,jb,
-ob,pb,kb,qb,db,l.envMap)}}else l.wireframe===true?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(l.color);else if(l instanceof THREE.MeshLambertMaterial)if(lb===true)if(l.wireframe===false&&l.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3){W.r=R.r=Z.r=Ca.r;W.g=R.g=Z.g=Ca.g;W.b=R.b=Z.b=Ca.b;n(i,j.v1.positionWorld,j.vertexNormalsWorld[0],W);n(i,j.v2.positionWorld,j.vertexNormalsWorld[1],R);n(i,j.v3.positionWorld,j.vertexNormalsWorld[2],Z);W.r=Math.max(0,Math.min(l.color.r*
-W.r,1));W.g=Math.max(0,Math.min(l.color.g*W.g,1));W.b=Math.max(0,Math.min(l.color.b*W.b,1));R.r=Math.max(0,Math.min(l.color.r*R.r,1));R.g=Math.max(0,Math.min(l.color.g*R.g,1));R.b=Math.max(0,Math.min(l.color.b*R.b,1));Z.r=Math.max(0,Math.min(l.color.r*Z.r,1));Z.g=Math.max(0,Math.min(l.color.g*Z.g,1));Z.b=Math.max(0,Math.min(l.color.b*Z.b,1));ja.r=(R.r+Z.r)*0.5;ja.g=(R.g+Z.g)*0.5;ja.b=(R.b+Z.b)*0.5;Ia=Gc(W,R,Z,ja);lc(E,F,Q,L,K,V,0,0,1,0,0,1,Ia)}else{Y.r=Ca.r;Y.g=Ca.g;Y.b=Ca.b;n(i,j.centroidWorld,j.normalWorld,
+Ta.g+e.g;Ta.b=Ta.b+e.b}else if(d instanceof THREE.PointLight){Ga.r=Ga.r+e.r;Ga.g=Ga.g+e.g;Ga.b=Ga.b+e.b}}}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition().normalize();j=c.dot(k);if(!(j<=0)){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();j=c.dot(oa.sub(k,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(k)/
+g.distance,1));if(j!=0){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var h,j,k,i,m,l;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){k=f.object.scale.x;i=f.object.scale.y;k=k*f.scale.x*p;i=i*f.scale.y*r;za.set(a.x-k,a.y-i,a.x+k,a.y+i);if(bb.intersects(za)===false)return;e(g.color.getContextStyle());o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(k,i);o.fillRect(-1,-1,2,2)}else{g=g.map.image;m=g.width>>1;l=g.height>>
+1;k=f.scale.x*p;i=f.scale.y*r;h=k*m;j=i*l;za.set(a.x-h,a.y-j,a.x+h,a.y+j);if(bb.intersects(za)===false)return;o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(k,-i);o.translate(-m,-l);o.drawImage(g,0,0)}o.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=f.scale.x*p;j=f.scale.y*r;za.set(a.x-h,a.y-j,a.x+h,a.y+j);if(bb.intersects(za)!==false){d(g.color.getContextStyle());e(g.color.getContextStyle());o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(h,j);g.program(o);
+o.restore()}}}function xd(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(D!==a)D=o.lineWidth=a;a=g.linecap;if(G!==a)G=o.lineCap=a;a=g.linejoin;if(A!==a)A=o.lineJoin=a;d(g.color.getContextStyle());o.stroke();za.inflate(g.linewidth*2)}}function s(a,d,e,g,h,k,i,l){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;
+b(l.opacity);c(l.blending);E=a.positionScreen.x;F=a.positionScreen.y;Q=d.positionScreen.x;L=d.positionScreen.y;K=e.positionScreen.x;V=e.positionScreen.y;t(E,F,Q,L,K,V);if(l instanceof THREE.MeshBasicMaterial)if(l.map!==null){if(l.map.mapping instanceof THREE.UVMapping){Sa=i.uvs[0];jd(E,F,Q,L,K,V,Sa[g].u,Sa[g].v,Sa[h].u,Sa[h].v,Sa[k].u,Sa[k].v,l.map)}}else if(l.envMap!==null){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=m.matrixWorldInverse;oa.copy(i.vertexNormalsWorld[g]);jb=
+(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;ob=(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;oa.copy(i.vertexNormalsWorld[h]);pb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;kb=(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;oa.copy(i.vertexNormalsWorld[k]);qb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;db=(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;jd(E,F,Q,L,K,V,jb,
+ob,pb,kb,qb,db,l.envMap)}}else l.wireframe===true?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(l.color);else if(l instanceof THREE.MeshLambertMaterial)if(lb===true)if(l.wireframe===false&&l.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3){W.r=R.r=Z.r=Ca.r;W.g=R.g=Z.g=Ca.g;W.b=R.b=Z.b=Ca.b;n(j,i.v1.positionWorld,i.vertexNormalsWorld[0],W);n(j,i.v2.positionWorld,i.vertexNormalsWorld[1],R);n(j,i.v3.positionWorld,i.vertexNormalsWorld[2],Z);W.r=Math.max(0,Math.min(l.color.r*
+W.r,1));W.g=Math.max(0,Math.min(l.color.g*W.g,1));W.b=Math.max(0,Math.min(l.color.b*W.b,1));R.r=Math.max(0,Math.min(l.color.r*R.r,1));R.g=Math.max(0,Math.min(l.color.g*R.g,1));R.b=Math.max(0,Math.min(l.color.b*R.b,1));Z.r=Math.max(0,Math.min(l.color.r*Z.r,1));Z.g=Math.max(0,Math.min(l.color.g*Z.g,1));Z.b=Math.max(0,Math.min(l.color.b*Z.b,1));ja.r=(R.r+Z.r)*0.5;ja.g=(R.g+Z.g)*0.5;ja.b=(R.b+Z.b)*0.5;Ia=Gc(W,R,Z,ja);lc(E,F,Q,L,K,V,0,0,1,0,0,1,Ia)}else{Y.r=Ca.r;Y.g=Ca.g;Y.b=Ca.b;n(j,i.centroidWorld,i.normalWorld,
 Y);Y.r=Math.max(0,Math.min(l.color.r*Y.r,1));Y.g=Math.max(0,Math.min(l.color.g*Y.g,1));Y.b=Math.max(0,Math.min(l.color.b*Y.b,1));l.wireframe===true?z(Y,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(Y)}else l.wireframe===true?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(l.color);else if(l instanceof THREE.MeshDepthMaterial){Aa=m.near;ea=m.far;W.r=W.g=W.b=1-fc(a.positionScreen.z,Aa,ea);R.r=R.g=R.b=1-fc(d.positionScreen.z,Aa,ea);Z.r=Z.g=Z.b=1-fc(e.positionScreen.z,
-Aa,ea);ja.r=(R.r+Z.r)*0.5;ja.g=(R.g+Z.g)*0.5;ja.b=(R.b+Z.b)*0.5;Ia=Gc(W,R,Z,ja);lc(E,F,Q,L,K,V,0,0,1,0,0,1,Ia)}else if(l instanceof THREE.MeshNormalMaterial){Y.r=mc(j.normalWorld.x);Y.g=mc(j.normalWorld.y);Y.b=mc(j.normalWorld.z);l.wireframe===true?z(Y,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(Y)}}function u(a,d,e,g,h,k,j,l,o){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(l.opacity);c(l.blending);if(l.map!==void 0&&l.map!==null||l.envMap!==void 0&&l.envMap!==
-null){s(a,d,g,0,1,3,j,l,o);s(h,e,k,1,2,3,j,l,o)}else{E=a.positionScreen.x;F=a.positionScreen.y;Q=d.positionScreen.x;L=d.positionScreen.y;K=e.positionScreen.x;V=e.positionScreen.y;P=g.positionScreen.x;aa=g.positionScreen.y;da=h.positionScreen.x;I=h.positionScreen.y;ca=k.positionScreen.x;ia=k.positionScreen.y;if(l instanceof THREE.MeshBasicMaterial){x(E,F,Q,L,K,V,P,aa);l.wireframe===true?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(l.color)}else if(l instanceof THREE.MeshLambertMaterial)if(lb===
-true)if(!l.wireframe&&l.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4){W.r=R.r=Z.r=ja.r=Ca.r;W.g=R.g=Z.g=ja.g=Ca.g;W.b=R.b=Z.b=ja.b=Ca.b;n(i,j.v1.positionWorld,j.vertexNormalsWorld[0],W);n(i,j.v2.positionWorld,j.vertexNormalsWorld[1],R);n(i,j.v4.positionWorld,j.vertexNormalsWorld[3],Z);n(i,j.v3.positionWorld,j.vertexNormalsWorld[2],ja);W.r=Math.max(0,Math.min(l.color.r*W.r,1));W.g=Math.max(0,Math.min(l.color.g*W.g,1));W.b=Math.max(0,Math.min(l.color.b*W.b,1));R.r=Math.max(0,Math.min(l.color.r*
-R.r,1));R.g=Math.max(0,Math.min(l.color.g*R.g,1));R.b=Math.max(0,Math.min(l.color.b*R.b,1));Z.r=Math.max(0,Math.min(l.color.r*Z.r,1));Z.g=Math.max(0,Math.min(l.color.g*Z.g,1));Z.b=Math.max(0,Math.min(l.color.b*Z.b,1));ja.r=Math.max(0,Math.min(l.color.r*ja.r,1));ja.g=Math.max(0,Math.min(l.color.g*ja.g,1));ja.b=Math.max(0,Math.min(l.color.b*ja.b,1));Ia=Gc(W,R,Z,ja);t(E,F,Q,L,P,aa);lc(E,F,Q,L,P,aa,0,0,1,0,0,1,Ia);t(da,I,K,V,ca,ia);lc(da,I,K,V,ca,ia,1,0,1,1,0,1,Ia)}else{Y.r=Ca.r;Y.g=Ca.g;Y.b=Ca.b;n(i,
-j.centroidWorld,j.normalWorld,Y);Y.r=Math.max(0,Math.min(l.color.r*Y.r,1));Y.g=Math.max(0,Math.min(l.color.g*Y.g,1));Y.b=Math.max(0,Math.min(l.color.b*Y.b,1));x(E,F,Q,L,K,V,P,aa);l.wireframe===true?z(Y,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(Y)}else{x(E,F,Q,L,K,V,P,aa);l.wireframe===true?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(l.color)}else if(l instanceof THREE.MeshNormalMaterial){Y.r=mc(j.normalWorld.x);Y.g=mc(j.normalWorld.y);Y.b=mc(j.normalWorld.z);
+Aa,ea);ja.r=(R.r+Z.r)*0.5;ja.g=(R.g+Z.g)*0.5;ja.b=(R.b+Z.b)*0.5;Ia=Gc(W,R,Z,ja);lc(E,F,Q,L,K,V,0,0,1,0,0,1,Ia)}else if(l instanceof THREE.MeshNormalMaterial){Y.r=mc(i.normalWorld.x);Y.g=mc(i.normalWorld.y);Y.b=mc(i.normalWorld.z);l.wireframe===true?z(Y,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(Y)}}function u(a,d,e,g,h,k,i,l,o){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(l.opacity);c(l.blending);if(l.map!==void 0&&l.map!==null||l.envMap!==void 0&&l.envMap!==
+null){s(a,d,g,0,1,3,i,l,o);s(h,e,k,1,2,3,i,l,o)}else{E=a.positionScreen.x;F=a.positionScreen.y;Q=d.positionScreen.x;L=d.positionScreen.y;K=e.positionScreen.x;V=e.positionScreen.y;P=g.positionScreen.x;aa=g.positionScreen.y;da=h.positionScreen.x;I=h.positionScreen.y;ca=k.positionScreen.x;ia=k.positionScreen.y;if(l instanceof THREE.MeshBasicMaterial){x(E,F,Q,L,K,V,P,aa);l.wireframe===true?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(l.color)}else if(l instanceof THREE.MeshLambertMaterial)if(lb===
+true)if(!l.wireframe&&l.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4){W.r=R.r=Z.r=ja.r=Ca.r;W.g=R.g=Z.g=ja.g=Ca.g;W.b=R.b=Z.b=ja.b=Ca.b;n(j,i.v1.positionWorld,i.vertexNormalsWorld[0],W);n(j,i.v2.positionWorld,i.vertexNormalsWorld[1],R);n(j,i.v4.positionWorld,i.vertexNormalsWorld[3],Z);n(j,i.v3.positionWorld,i.vertexNormalsWorld[2],ja);W.r=Math.max(0,Math.min(l.color.r*W.r,1));W.g=Math.max(0,Math.min(l.color.g*W.g,1));W.b=Math.max(0,Math.min(l.color.b*W.b,1));R.r=Math.max(0,Math.min(l.color.r*
+R.r,1));R.g=Math.max(0,Math.min(l.color.g*R.g,1));R.b=Math.max(0,Math.min(l.color.b*R.b,1));Z.r=Math.max(0,Math.min(l.color.r*Z.r,1));Z.g=Math.max(0,Math.min(l.color.g*Z.g,1));Z.b=Math.max(0,Math.min(l.color.b*Z.b,1));ja.r=Math.max(0,Math.min(l.color.r*ja.r,1));ja.g=Math.max(0,Math.min(l.color.g*ja.g,1));ja.b=Math.max(0,Math.min(l.color.b*ja.b,1));Ia=Gc(W,R,Z,ja);t(E,F,Q,L,P,aa);lc(E,F,Q,L,P,aa,0,0,1,0,0,1,Ia);t(da,I,K,V,ca,ia);lc(da,I,K,V,ca,ia,1,0,1,1,0,1,Ia)}else{Y.r=Ca.r;Y.g=Ca.g;Y.b=Ca.b;n(j,
+i.centroidWorld,i.normalWorld,Y);Y.r=Math.max(0,Math.min(l.color.r*Y.r,1));Y.g=Math.max(0,Math.min(l.color.g*Y.g,1));Y.b=Math.max(0,Math.min(l.color.b*Y.b,1));x(E,F,Q,L,K,V,P,aa);l.wireframe===true?z(Y,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(Y)}else{x(E,F,Q,L,K,V,P,aa);l.wireframe===true?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(l.color)}else if(l instanceof THREE.MeshNormalMaterial){Y.r=mc(i.normalWorld.x);Y.g=mc(i.normalWorld.y);Y.b=mc(i.normalWorld.z);
 x(E,F,Q,L,K,V,P,aa);l.wireframe===true?z(Y,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ib(Y)}else if(l instanceof THREE.MeshDepthMaterial){Aa=m.near;ea=m.far;W.r=W.g=W.b=1-fc(a.positionScreen.z,Aa,ea);R.r=R.g=R.b=1-fc(d.positionScreen.z,Aa,ea);Z.r=Z.g=Z.b=1-fc(g.positionScreen.z,Aa,ea);ja.r=ja.g=ja.b=1-fc(e.positionScreen.z,Aa,ea);Ia=Gc(W,R,Z,ja);t(E,F,Q,L,P,aa);lc(E,F,Q,L,P,aa,0,0,1,0,0,1,Ia);t(da,I,K,V,ca,ia);lc(da,I,K,V,ca,ia,1,0,1,1,0,1,Ia)}}}function t(a,b,c,d,e,f){o.beginPath();
-o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(a,b)}function x(a,b,c,d,e,f,g,h){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(g,h);o.lineTo(a,b)}function z(a,b,c,e){if(D!==b)D=o.lineWidth=b;if(G!==c)G=o.lineCap=c;if(A!==e)A=o.lineJoin=e;d(a.getContextStyle());o.stroke();za.inflate(b*2)}function Ib(a){e(a.getContextStyle());o.fill()}function jd(a,b,c,d,f,g,h,k,i,j,l,m,n){if(!(n.image===void 0||n.image.width===0)){if(n.needsUpdate===true||Fa[n.id]===void 0){var p=n.wrapS==THREE.RepeatWrapping,
-ec=n.wrapT==THREE.RepeatWrapping;Fa[n.id]=o.createPattern(n.image,p===true&&ec===true?"repeat":p===true&&ec===false?"repeat-x":p===false&&ec===true?"repeat-y":"no-repeat");n.needsUpdate=false}e(Fa[n.id]);var p=n.offset.x/n.repeat.x,ec=n.offset.y/n.repeat.y,r=n.image.width*n.repeat.x,q=n.image.height*n.repeat.y,h=(h+p)*r,k=(1-k+ec)*q,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+p)*r-h,j=(1-j+ec)*q-k,l=(l+p)*r-h,m=(1-m+ec)*q-k,p=i*m-l*j;if(p===0){if(na[n.id]===void 0){b=document.createElement("canvas");b.width=n.image.width;
-b.height=n.image.height;b=b.getContext("2d");b.drawImage(n.image,0,0);na[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data}b=na[n.id];h=(Math.floor(h)+Math.floor(k)*n.image.width)*4;Y.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Ib(Y)}else{p=1/p;n=(m*c-j*f)*p;j=(m*d-j*g)*p;c=(i*f-l*c)*p;d=(i*g-l*d)*p;a=a-n*h-c*k;h=b-j*h-d*k;o.save();o.transform(n,j,c,d,a,h);o.fill();o.restore()}}}function lc(a,b,c,d,e,f,g,h,k,i,j,l,m){var n,p;n=m.width-1;p=m.height-1;g=g*n;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;k=k*n-
-g;i=i*p-h;j=j*n-g;l=l*p-h;p=1/(k*l-j*i);n=(l*c-i*e)*p;i=(l*d-i*f)*p;c=(k*e-j*c)*p;d=(k*f-j*d)*p;a=a-n*g-c*h;b=b-i*g-d*h;o.save();o.transform(n,i,c,d,a,b);o.clip();o.drawImage(m,0,0);o.restore()}function Gc(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),l=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);Xa[0]=e<0?0:e>255?255:e;Xa[1]=f<0?0:f>255?255:f;Xa[2]=a<0?0:a>255?255:a;Xa[4]=g<0?0:g>255?255:g;Xa[5]=h<0?0:h>255?
-255:h;Xa[6]=b<0?0:b>255?255:b;Xa[8]=i<0?0:i>255?255:i;Xa[9]=j<0?0:j>255?255:j;Xa[10]=c<0?0:c>255?255:c;Xa[12]=l<0?0:l>255?255:l;Xa[13]=m<0?0:m>255?255:m;Xa[14]=d<0?0:d>255?255:d;k.putImageData(Wa,0,0);cb.drawImage(rb,0,0);return eb}function fc(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function mc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Qb(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}}if(m instanceof THREE.Camera===false)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
-else{var Hc,kd,Qa,Jb;this.autoClear===true?this.clear():o.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,m,this.sortElements);h=g.elements;i=g.lights;lb=i.length>0;lb===true&&l(i);Hc=0;for(kd=h.length;Hc<kd;Hc++){Qa=h[Hc];Jb=Qa.material;if(!(Jb===void 0||Jb.visible===false)){za.empty();if(Qa instanceof THREE.RenderableParticle){w=Qa;w.x=w.x*p;w.y=w.y*r;q(w,Qa,Jb,a)}else if(Qa instanceof THREE.RenderableLine){w=Qa.v1;C=Qa.v2;w.positionScreen.x=w.positionScreen.x*
+o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(a,b)}function x(a,b,c,d,e,f,g,h){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(g,h);o.lineTo(a,b)}function z(a,b,c,e){if(D!==b)D=o.lineWidth=b;if(G!==c)G=o.lineCap=c;if(A!==e)A=o.lineJoin=e;d(a.getContextStyle());o.stroke();za.inflate(b*2)}function Ib(a){e(a.getContextStyle());o.fill()}function jd(a,b,c,d,f,g,h,k,j,i,l,m,n){if(!(n.image===void 0||n.image.width===0)){if(n.needsUpdate===true||Fa[n.id]===void 0){var p=n.wrapS==THREE.RepeatWrapping,
+ec=n.wrapT==THREE.RepeatWrapping;Fa[n.id]=o.createPattern(n.image,p===true&&ec===true?"repeat":p===true&&ec===false?"repeat-x":p===false&&ec===true?"repeat-y":"no-repeat");n.needsUpdate=false}e(Fa[n.id]);var p=n.offset.x/n.repeat.x,ec=n.offset.y/n.repeat.y,r=n.image.width*n.repeat.x,q=n.image.height*n.repeat.y,h=(h+p)*r,k=(1-k+ec)*q,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+p)*r-h,i=(1-i+ec)*q-k,l=(l+p)*r-h,m=(1-m+ec)*q-k,p=j*m-l*i;if(p===0){if(na[n.id]===void 0){b=document.createElement("canvas");b.width=n.image.width;
+b.height=n.image.height;b=b.getContext("2d");b.drawImage(n.image,0,0);na[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data}b=na[n.id];h=(Math.floor(h)+Math.floor(k)*n.image.width)*4;Y.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Ib(Y)}else{p=1/p;n=(m*c-i*f)*p;i=(m*d-i*g)*p;c=(j*f-l*c)*p;d=(j*g-l*d)*p;a=a-n*h-c*k;h=b-i*h-d*k;o.save();o.transform(n,i,c,d,a,h);o.fill();o.restore()}}}function lc(a,b,c,d,e,f,g,h,k,j,i,l,m){var n,p;n=m.width-1;p=m.height-1;g=g*n;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;k=k*n-
+g;j=j*p-h;i=i*n-g;l=l*p-h;p=1/(k*l-i*j);n=(l*c-j*e)*p;j=(l*d-j*f)*p;c=(k*e-i*c)*p;d=(k*f-i*d)*p;a=a-n*g-c*h;b=b-j*g-d*h;o.save();o.transform(n,j,c,d,a,b);o.clip();o.drawImage(m,0,0);o.restore()}function Gc(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),l=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);Xa[0]=e<0?0:e>255?255:e;Xa[1]=f<0?0:f>255?255:f;Xa[2]=a<0?0:a>255?255:a;Xa[4]=g<0?0:g>255?255:g;Xa[5]=h<0?0:h>255?
+255:h;Xa[6]=b<0?0:b>255?255:b;Xa[8]=j<0?0:j>255?255:j;Xa[9]=i<0?0:i>255?255:i;Xa[10]=c<0?0:c>255?255:c;Xa[12]=l<0?0:l>255?255:l;Xa[13]=m<0?0:m>255?255:m;Xa[14]=d<0?0:d>255?255:d;k.putImageData(Wa,0,0);cb.drawImage(rb,0,0);return eb}function fc(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function mc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Qb(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}}if(m instanceof THREE.Camera===false)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
+else{var Hc,kd,Qa,Jb;this.autoClear===true?this.clear():o.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=i.projectScene(a,m,this.sortElements);h=g.elements;j=g.lights;lb=j.length>0;lb===true&&l(j);Hc=0;for(kd=h.length;Hc<kd;Hc++){Qa=h[Hc];Jb=Qa.material;if(!(Jb===void 0||Jb.visible===false)){za.empty();if(Qa instanceof THREE.RenderableParticle){w=Qa;w.x=w.x*p;w.y=w.y*r;q(w,Qa,Jb,a)}else if(Qa instanceof THREE.RenderableLine){w=Qa.v1;C=Qa.v2;w.positionScreen.x=w.positionScreen.x*
 p;w.positionScreen.y=w.positionScreen.y*r;C.positionScreen.x=C.positionScreen.x*p;C.positionScreen.y=C.positionScreen.y*r;za.addPoint(w.positionScreen.x,w.positionScreen.y);za.addPoint(C.positionScreen.x,C.positionScreen.y);bb.intersects(za)===true&&xd(w,C,Qa,Jb,a)}else if(Qa instanceof THREE.RenderableFace3){w=Qa.v1;C=Qa.v2;H=Qa.v3;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;C.positionScreen.x=C.positionScreen.x*p;C.positionScreen.y=C.positionScreen.y*r;H.positionScreen.x=
 H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;if(Jb.overdraw===true){Qb(w.positionScreen,C.positionScreen);Qb(C.positionScreen,H.positionScreen);Qb(H.positionScreen,w.positionScreen)}za.add3Points(w.positionScreen.x,w.positionScreen.y,C.positionScreen.x,C.positionScreen.y,H.positionScreen.x,H.positionScreen.y);bb.intersects(za)===true&&s(w,C,H,0,1,2,Qa,Jb,a)}else if(Qa instanceof THREE.RenderableFace4){w=Qa.v1;C=Qa.v2;H=Qa.v3;O=Qa.v4;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=
 w.positionScreen.y*r;C.positionScreen.x=C.positionScreen.x*p;C.positionScreen.y=C.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;O.positionScreen.x=O.positionScreen.x*p;O.positionScreen.y=O.positionScreen.y*r;N.positionScreen.copy(C.positionScreen);$.positionScreen.copy(O.positionScreen);if(Jb.overdraw===true){Qb(w.positionScreen,C.positionScreen);Qb(C.positionScreen,O.positionScreen);Qb(O.positionScreen,w.positionScreen);Qb(H.positionScreen,N.positionScreen);
@@ -320,29 +320,29 @@ THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( p
 THREE.ShaderChunk.skinning_vertex,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=k.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.bumpMap||a.specularMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,
-e,f,g,h=a.vertices;g=h.length;var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){Ca.copy(lb);Ca.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];Ta.copy(e);Ca.multiplyVector3(Ta);n[d]=[Ta.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[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=i[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;
-for(j=r.length;i<j;i++){h=r[i];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=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=n[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=n[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=n[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=n[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<j;d++){e=i[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];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+
+e,f,g,h=a.vertices;g=h.length;var j=a.colors,i=j.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){Ca.copy(lb);Ca.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];Ta.copy(e);Ca.multiplyVector3(Ta);n[d]=[Ta.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[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=j[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){j=0;
+for(i=r.length;j<i;j++){h=r[j];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=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=n[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=n[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=n[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=n[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=j[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){j=0;for(i=r.length;j<i;j++){h=r[j];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){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,
-a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,b)}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ia=aa=null;I=ca=R=W=ea=Aa=Z=-1;oa=true;a[d].render(b,c,bb,Ja);ia=aa=null;I=ca=R=W=ea=Aa=Z=-1;oa=true}}function j(a,b,c,d,f,e,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&&K.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);K.setDepthTest(i.depthTest);K.setDepthWrite(i.depthWrite);x(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}K.setMaterialFaces(i);j instanceof THREE.BufferGeometry?K.renderBufferDirect(d,f,e,i,j,k):K.renderBuffer(d,f,e,i,j,k)}}}function m(a,b,c,d,f,e,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;e&&K.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);K.setDepthTest(h.depthTest);K.setDepthWrite(h.depthWrite);x(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}K.renderImmediateObject(c,d,f,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 p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
-false}function r(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&K.deallocateMaterial(d);K.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==aa){k.useProgram(g);aa=g;e=true}if(d.id!==I){I=d.id;e=
-true}if(e||a!==ia){k.uniformMatrix4fv(h.projectionMatrix,false,a._projectionMatrixArray);a!==ia&&(ia=a)}if(e){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(oa){for(var j,l=0,m=0,n=0,o,p,r,q=rb,s=q.directional.colors,t=q.directional.positions,u=q.point.colors,x=q.point.positions,D=
-q.point.distances,G=q.spot.colors,E=q.spot.positions,C=q.spot.distances,W=q.spot.directions,H=q.spot.angles,F=q.spot.exponents,Z=0,O=0,R=0,L=r=0,c=L=0,e=b.length;c<e;c++){j=b[c];if(!j.onlyShadow&&j.visible){o=j.color;p=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(K.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(j instanceof THREE.DirectionalLight){r=Z*3;if(K.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}Ga.copy(j.matrixWorld.getPosition());Ga.subSelf(j.target.matrixWorld.getPosition());Ga.normalize();t[r]=Ga.x;t[r+1]=Ga.y;t[r+2]=Ga.z;Z=Z+1}else if(j instanceof THREE.PointLight){L=O*3;if(K.gammaInput){u[L]=o.r*o.r*p*p;u[L+1]=o.g*o.g*p*p;u[L+2]=o.b*o.b*p*p}else{u[L]=o.r*p;u[L+1]=o.g*p;u[L+2]=o.b*p}o=j.matrixWorld.getPosition();x[L]=o.x;x[L+1]=o.y;x[L+2]=o.z;D[O]=r;O=O+1}else if(j instanceof THREE.SpotLight){L=R*3;if(K.gammaInput){G[L]=o.r*o.r*p*p;G[L+1]=o.g*o.g*p*p;G[L+2]=o.b*
-o.b*p*p}else{G[L]=o.r*p;G[L+1]=o.g*p;G[L+2]=o.b*p}o=j.matrixWorld.getPosition();E[L]=o.x;E[L+1]=o.y;E[L+2]=o.z;C[R]=r;Ga.copy(o);Ga.subSelf(j.target.matrixWorld.getPosition());Ga.normalize();W[L]=Ga.x;W[L+1]=Ga.y;W[L+2]=Ga.z;H[R]=Math.cos(j.angle);F[R]=j.exponent;R=R+1}}}c=Z*3;for(e=s.length;c<e;c++)s[c]=0;c=O*3;for(e=u.length;c<e;c++)u[c]=0;c=R*3;for(e=G.length;c<e;c++)G[c]=0;q.directional.length=Z;q.point.length=O;q.spot.length=R;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=n;oa=false}c=rb;i.ambientLightColor.value=
-c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents}if(d instanceof
-THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.texture=d.map;i.lightMap.texture=d.lightMap;i.specularMap.texture=d.specularMap;if(d.bumpMap){i.bumpMap.texture=d.bumpMap;i.bumpScale.value=d.bumpScale}var N;if(d.map)N=d.map;else if(d.specularMap)N=d.specularMap;else if(d.bumpMap)N=d.bumpMap;if(N!==void 0){c=N.offset;N=N.repeat;i.offsetRepeat.value.set(c.x,
-c.y,N.x,N.y)}i.envMap.texture=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){i.diffuse.value=d.color;i.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){i.psColor.value=d.color;i.opacity.value=d.opacity;i.size.value=
-d.size;i.scale.value=w.height/2;i.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(K.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive;i.specular.value=d.specular}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(K.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);
-i.emissive.value.copyGammaToLinear(d.emissive)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){i.mNear.value=a.near;i.mFar.value=a.far;i.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=N=0;for(e=b.length;c<e;c++){j=b[c];if(j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&
-!j.shadowCascade)){i.shadowMap.texture[N]=j.shadowMap;i.shadowMapSize.value[N]=j.shadowMapSize;i.shadowMatrix.value[N]=j.shadowMatrix;i.shadowDarkness.value[N]=j.shadowDarkness;i.shadowBias.value[N]=j.shadowBias;N++}}}b=d.uniformsList;i=0;for(N=b.length;i<N;i++)if(j=g.uniforms[b[i][1]]){c=b[i][0];l=c.type;e=c.value;if(l==="i")k.uniform1i(j,e);else if(l==="f")k.uniform1f(j,e);else if(l==="v2")k.uniform2f(j,e.x,e.y);else if(l==="v3")k.uniform3f(j,e.x,e.y,e.z);else if(l==="v4")k.uniform4f(j,e.x,e.y,
-e.z,e.w);else if(l==="c")k.uniform3f(j,e.r,e.g,e.b);else if(l==="iv1")k.uniform1iv(j,e);else if(l==="iv")k.uniform3iv(j,e);else if(l==="fv1")k.uniform1fv(j,e);else if(l==="fv")k.uniform3fv(j,e);else if(l==="v2v"){if(c._array===void 0)c._array=new Float32Array(2*e.length);l=0;for(m=e.length;l<m;l++){n=l*2;c._array[n]=e[l].x;c._array[n+1]=e[l].y}k.uniform2fv(j,c._array)}else if(l==="v3v"){if(c._array===void 0)c._array=new Float32Array(3*e.length);l=0;for(m=e.length;l<m;l++){n=l*3;c._array[n]=e[l].x;
-c._array[n+1]=e[l].y;c._array[n+2]=e[l].z}k.uniform3fv(j,c._array)}else if(l==="v4v"){if(c._array===void 0)c._array=new Float32Array(4*e.length);l=0;for(m=e.length;l<m;l++){n=l*4;c._array[n]=e[l].x;c._array[n+1]=e[l].y;c._array[n+2]=e[l].z;c._array[n+3]=e[l].w}k.uniform4fv(j,c._array)}else if(l==="m4"){if(c._array===void 0)c._array=new Float32Array(16);e.flattenToArray(c._array);k.uniformMatrix4fv(j,false,c._array)}else if(l==="m4v"){if(c._array===void 0)c._array=new Float32Array(16*e.length);l=0;
-for(m=e.length;l<m;l++)e[l].flattenToArrayOffset(c._array,l*16);k.uniformMatrix4fv(j,false,c._array)}else if(l==="t"){k.uniform1i(j,e);if(j=c.texture)if(j.image instanceof Array&&j.image.length===6){c=j;if(c.image.length===6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(j=0;j<6;j++){l=e;m=j;if(K.autoScaleCubemaps){n=
-c.image[j];s=eb;if(!(n.width<=s&&n.height<=s)){t=Math.max(n.width,n.height);q=Math.floor(n.width*s/t);s=Math.floor(n.height*s/t);t=document.createElement("canvas");t.width=q;t.height=s;t.getContext("2d").drawImage(n,0,0,n.width,n.height,0,0,q,s);n=t}}else n=c.image[j];l[m]=n}j=e[0];l=(j.width&j.width-1)===0&&(j.height&j.height-1)===0;m=A(c.format);n=A(c.type);z(k.TEXTURE_CUBE_MAP,c,l);for(j=0;j<6;j++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,m,m,n,e[j]);c.generateMipmaps&&l&&k.generateMipmap(k.TEXTURE_CUBE_MAP);
-c.needsUpdate=false;if(c.onUpdate)c.onUpdate()}else{k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}}else if(j instanceof THREE.WebGLRenderTargetCube){c=j;k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)}else K.setTexture(j,e)}else if(l==="tv"){if(c._array===void 0){c._array=[];l=0;for(m=c.texture.length;l<m;l++)c._array[l]=e+l}k.uniform1iv(j,c._array);l=0;for(m=c.texture.length;l<m;l++)(j=c.texture[l])&&K.setTexture(j,c._array[l])}}if((d instanceof
+a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,b)}if(r){j=0;for(i=r.length;j<i;j++){h=r[j];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function j(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ia=aa=null;I=ca=R=W=ea=Aa=Z=-1;oa=true;a[d].render(b,c,bb,Ja);ia=aa=null;I=ca=R=W=ea=Aa=Z=-1;oa=true}}function i(a,b,c,d,f,e,g,h){var j,i,k,l;if(b){i=a.length-1;l=b=
+-1}else{i=0;b=a.length;l=1}for(var m=i;m!==b;m=m+l){j=a[m];if(j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&K.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);K.setDepthTest(j.depthTest);K.setDepthWrite(j.depthWrite);x(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setMaterialFaces(j);k instanceof THREE.BufferGeometry?K.renderBufferDirect(d,f,e,j,k,i):K.renderBuffer(d,f,e,j,k,i)}}}function m(a,b,c,d,f,e,g){for(var h,j,i=0,k=a.length;i<k;i++){h=
+a[i];j=h.object;if(j.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&K.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);K.setDepthTest(h.depthTest);K.setDepthWrite(h.depthWrite);x(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}K.renderImmediateObject(c,d,f,h,j)}}}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 p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
+false}function r(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&K.deallocateMaterial(d);K.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,j=d.uniforms;if(g!==aa){k.useProgram(g);aa=g;e=true}if(d.id!==I){I=d.id;e=
+true}if(e||a!==ia){k.uniformMatrix4fv(h.projectionMatrix,false,a._projectionMatrixArray);a!==ia&&(ia=a)}if(e){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(oa){for(var i,l=0,m=0,n=0,o,p,r,q=rb,s=q.directional.colors,t=q.directional.positions,u=q.point.colors,x=q.point.positions,D=
+q.point.distances,G=q.spot.colors,E=q.spot.positions,C=q.spot.distances,W=q.spot.directions,H=q.spot.angles,F=q.spot.exponents,Z=0,O=0,R=0,L=r=0,c=L=0,e=b.length;c<e;c++){i=b[c];if(!i.onlyShadow&&i.visible){o=i.color;p=i.intensity;r=i.distance;if(i instanceof THREE.AmbientLight)if(K.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=Z*3;if(K.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}Ga.copy(i.matrixWorld.getPosition());Ga.subSelf(i.target.matrixWorld.getPosition());Ga.normalize();t[r]=Ga.x;t[r+1]=Ga.y;t[r+2]=Ga.z;Z=Z+1}else if(i instanceof THREE.PointLight){L=O*3;if(K.gammaInput){u[L]=o.r*o.r*p*p;u[L+1]=o.g*o.g*p*p;u[L+2]=o.b*o.b*p*p}else{u[L]=o.r*p;u[L+1]=o.g*p;u[L+2]=o.b*p}o=i.matrixWorld.getPosition();x[L]=o.x;x[L+1]=o.y;x[L+2]=o.z;D[O]=r;O=O+1}else if(i instanceof THREE.SpotLight){L=R*3;if(K.gammaInput){G[L]=o.r*o.r*p*p;G[L+1]=o.g*o.g*p*p;G[L+2]=o.b*
+o.b*p*p}else{G[L]=o.r*p;G[L+1]=o.g*p;G[L+2]=o.b*p}o=i.matrixWorld.getPosition();E[L]=o.x;E[L+1]=o.y;E[L+2]=o.z;C[R]=r;Ga.copy(o);Ga.subSelf(i.target.matrixWorld.getPosition());Ga.normalize();W[L]=Ga.x;W[L+1]=Ga.y;W[L+2]=Ga.z;H[R]=Math.cos(i.angle);F[R]=i.exponent;R=R+1}}}c=Z*3;for(e=s.length;c<e;c++)s[c]=0;c=O*3;for(e=u.length;c<e;c++)u[c]=0;c=R*3;for(e=G.length;c<e;c++)G[c]=0;q.directional.length=Z;q.point.length=O;q.spot.length=R;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=n;oa=false}c=rb;j.ambientLightColor.value=
+c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances;j.spotLightColor.value=c.spot.colors;j.spotLightPosition.value=c.spot.positions;j.spotLightDistance.value=c.spot.distances;j.spotLightDirection.value=c.spot.directions;j.spotLightAngle.value=c.spot.angles;j.spotLightExponent.value=c.spot.exponents}if(d instanceof
+THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;K.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;j.map.texture=d.map;j.lightMap.texture=d.lightMap;j.specularMap.texture=d.specularMap;if(d.bumpMap){j.bumpMap.texture=d.bumpMap;j.bumpScale.value=d.bumpScale}var N;if(d.map)N=d.map;else if(d.specularMap)N=d.specularMap;else if(d.bumpMap)N=d.bumpMap;if(N!==void 0){c=N.offset;N=N.repeat;j.offsetRepeat.value.set(c.x,
+c.y,N.x,N.y)}j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=
+d.size;j.scale.value=w.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(K.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(K.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
+j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){c=N=0;for(e=b.length;c<e;c++){i=b[c];if(i.castShadow&&(i instanceof THREE.SpotLight||i instanceof THREE.DirectionalLight&&
+!i.shadowCascade)){j.shadowMap.texture[N]=i.shadowMap;j.shadowMapSize.value[N]=i.shadowMapSize;j.shadowMatrix.value[N]=i.shadowMatrix;j.shadowDarkness.value[N]=i.shadowDarkness;j.shadowBias.value[N]=i.shadowBias;N++}}}b=d.uniformsList;j=0;for(N=b.length;j<N;j++)if(i=g.uniforms[b[j][1]]){c=b[j][0];l=c.type;e=c.value;if(l==="i")k.uniform1i(i,e);else if(l==="f")k.uniform1f(i,e);else if(l==="v2")k.uniform2f(i,e.x,e.y);else if(l==="v3")k.uniform3f(i,e.x,e.y,e.z);else if(l==="v4")k.uniform4f(i,e.x,e.y,
+e.z,e.w);else if(l==="c")k.uniform3f(i,e.r,e.g,e.b);else if(l==="iv1")k.uniform1iv(i,e);else if(l==="iv")k.uniform3iv(i,e);else if(l==="fv1")k.uniform1fv(i,e);else if(l==="fv")k.uniform3fv(i,e);else if(l==="v2v"){if(c._array===void 0)c._array=new Float32Array(2*e.length);l=0;for(m=e.length;l<m;l++){n=l*2;c._array[n]=e[l].x;c._array[n+1]=e[l].y}k.uniform2fv(i,c._array)}else if(l==="v3v"){if(c._array===void 0)c._array=new Float32Array(3*e.length);l=0;for(m=e.length;l<m;l++){n=l*3;c._array[n]=e[l].x;
+c._array[n+1]=e[l].y;c._array[n+2]=e[l].z}k.uniform3fv(i,c._array)}else if(l==="v4v"){if(c._array===void 0)c._array=new Float32Array(4*e.length);l=0;for(m=e.length;l<m;l++){n=l*4;c._array[n]=e[l].x;c._array[n+1]=e[l].y;c._array[n+2]=e[l].z;c._array[n+3]=e[l].w}k.uniform4fv(i,c._array)}else if(l==="m4"){if(c._array===void 0)c._array=new Float32Array(16);e.flattenToArray(c._array);k.uniformMatrix4fv(i,false,c._array)}else if(l==="m4v"){if(c._array===void 0)c._array=new Float32Array(16*e.length);l=0;
+for(m=e.length;l<m;l++)e[l].flattenToArrayOffset(c._array,l*16);k.uniformMatrix4fv(i,false,c._array)}else if(l==="t"){k.uniform1i(i,e);if(i=c.texture)if(i.image instanceof Array&&i.image.length===6){c=i;if(c.image.length===6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(i=0;i<6;i++){l=e;m=i;if(K.autoScaleCubemaps){n=
+c.image[i];s=eb;if(!(n.width<=s&&n.height<=s)){t=Math.max(n.width,n.height);q=Math.floor(n.width*s/t);s=Math.floor(n.height*s/t);t=document.createElement("canvas");t.width=q;t.height=s;t.getContext("2d").drawImage(n,0,0,n.width,n.height,0,0,q,s);n=t}}else n=c.image[i];l[m]=n}i=e[0];l=(i.width&i.width-1)===0&&(i.height&i.height-1)===0;m=A(c.format);n=A(c.type);z(k.TEXTURE_CUBE_MAP,c,l);for(i=0;i<6;i++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,m,m,n,e[i]);c.generateMipmaps&&l&&k.generateMipmap(k.TEXTURE_CUBE_MAP);
+c.needsUpdate=false;if(c.onUpdate)c.onUpdate()}else{k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}}else if(i instanceof THREE.WebGLRenderTargetCube){c=i;k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)}else K.setTexture(i,e)}else if(l==="tv"){if(c._array===void 0){c._array=[];l=0;for(m=c.texture.length;l<m;l++)c._array[l]=e+l}k.uniform1iv(i,c._array);l=0;for(m=c.texture.length;l<m;l++)(i=c.texture[l])&&K.setTexture(i,c._array[l])}}if((d instanceof
 THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(dc&&f.useVertexTexture){if(h.boneTexture!==null){k.uniform1i(h.boneTexture,12);K.setTexture(f.boneTexture,12)}}else h.boneGlobalMatrices!==
 null&&k.uniformMatrix4fv(h.boneGlobalMatrices,false,f.boneMatrices);k.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.modelMatrix!==null&&k.uniformMatrix4fv(h.modelMatrix,false,f.matrixWorld.elements);return g}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function x(a,b,c){if(Ia!==a){a?
 k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);Ia=a}if(a&&(Sa!==b||jb!==c)){k.polygonOffset(b,c);Sa=b;jb=c}}function u(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function t(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(u(b));return null}return c}
@@ -365,39 +365,39 @@ k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.de
 THREE.Line){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);K.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);K.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;k.deleteTexture(a.__webglTexture);K.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){k.deleteTexture(a.__webglTexture);
 if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){k.deleteFramebuffer(a.__webglFramebuffer[b]);k.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{k.deleteFramebuffer(a.__webglFramebuffer);k.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=false,a=0;for(c=V.length;a<c;a++){d=V[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=V.length;a<c;a++){d=V[a];d.program!==b&&
 e.push(d)}V=e;k.deleteProgram(b);K.info.memory.programs--}}};this.updateShadowMap=function(a,b){aa=null;I=ca=ea=Aa=Z=-1;oa=true;R=W=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=k.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=k.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=k.createBuffer();
-if(a.hasPositions){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.position);k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,false,0,0)}if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,j,l,m,n,o,p=a.count*3;for(o=0;o<p;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];g=n[o+3];i=n[o+4];l=n[o+5];h=n[o+6];j=n[o+7];m=n[o+8];d=(d+
-g+h)/3;e=(e+i+j)/3;f=(f+l+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,false,0,0)}if(a.hasUvs&&c.map){k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer);k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.uv);k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,false,0,0)}if(a.hasColors&&
+if(a.hasPositions){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.position);k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,false,0,0)}if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,j,i,l,m,n,o,p=a.count*3;for(o=0;o<p;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];g=n[o+3];j=n[o+4];l=n[o+5];h=n[o+6];i=n[o+7];m=n[o+8];d=(d+
+g+h)/3;e=(e+j+i)/3;f=(f+l+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,false,0,0)}if(a.hasUvs&&c.map){k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer);k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.uv);k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,false,0,0)}if(a.hasColors&&
 c.vertexColors!==THREE.NoColors){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.color);k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,false,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ca){ca=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;
-f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){var g=f[d].index;if(b){var h=e.attributes.position,i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,i,k.FLOAT,false,0,g*i*4);h=e.attributes.normal;if(a.normal>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.normal,i,k.FLOAT,false,0,g*i*4)}h=e.attributes.uv;if(a.uv>=0&&h)if(h.buffer){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.uv,i,k.FLOAT,false,0,g*i*
-4);k.enableVertexAttribArray(a.uv)}else k.disableVertexAttribArray(a.uv);h=e.attributes.color;if(a.color>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.color,i,k.FLOAT,false,0,g*i*4)}h=e.attributes.tangent;if(a.tangent>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.tangent,i,k.FLOAT,false,0,g*i*4)}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.attributes.index.buffer)}k.drawElements(k.TRIANGLES,f[d].count,k.UNSIGNED_SHORT,f[d].start*2);
-K.info.render.calls++;K.info.render.vertices=K.info.render.vertices+f[d].count;K.info.render.faces=K.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,i,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ca){ca=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(b.position,3,k.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;
-if(f.morphTargetBase!==-1){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}else if(c.position>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var j=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;j<d.numSupportedMorphTargets&&j<i.length;){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[j]]);k.vertexAttribPointer(c["morphTarget"+
-j],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[j]]);k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[i[j]];j++}}else{i=[];g=f.morphTargetInfluences;var l,m=g.length;for(l=0;l<m;l++){j=g[l];j>0&&i.push([l,j])}if(i.length>d.numSupportedMorphTargets){i.sort(h);i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?i.sort(h):i.length===0&&i.push([0,0]);for(j=0;j<d.numSupportedMorphTargets;){if(i[j]){l=
-i[j][0];k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[l]}else{k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);d.morphNormals&&k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0);f.__webglMorphTargetInfluences[j]=0}j++}}d.program.uniforms.morphTargetInfluences!==
-null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(i=e.__webglCustomAttributesList.length;g<i;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){k.bindBuffer(k.ARRAY_BUFFER,c.buffer);k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,false,0,0)}}}if(b.color>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer);k.vertexAttribPointer(b.color,3,k.FLOAT,false,0,0)}if(b.normal>=
+f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){var g=f[d].index;if(b){var h=e.attributes.position,j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,j,k.FLOAT,false,0,g*j*4);h=e.attributes.normal;if(a.normal>=0&&h){j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.normal,j,k.FLOAT,false,0,g*j*4)}h=e.attributes.uv;if(a.uv>=0&&h)if(h.buffer){j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.uv,j,k.FLOAT,false,0,g*j*
+4);k.enableVertexAttribArray(a.uv)}else k.disableVertexAttribArray(a.uv);h=e.attributes.color;if(a.color>=0&&h){j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.color,j,k.FLOAT,false,0,g*j*4)}h=e.attributes.tangent;if(a.tangent>=0&&h){j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.tangent,j,k.FLOAT,false,0,g*j*4)}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.attributes.index.buffer)}k.drawElements(k.TRIANGLES,f[d].count,k.UNSIGNED_SHORT,f[d].start*2);
+K.info.render.calls++;K.info.render.vertices=K.info.render.vertices+f[d].count;K.info.render.faces=K.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,j,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ca){ca=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(b.position,3,k.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;
+if(f.morphTargetBase!==-1){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}else if(c.position>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var i=0;j=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<j.length;){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[i]]);k.vertexAttribPointer(c["morphTarget"+
+i],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[i]]);k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[i]=g[j[i]];i++}}else{j=[];g=f.morphTargetInfluences;var l,m=g.length;for(l=0;l<m;l++){i=g[l];i>0&&j.push([l,i])}if(j.length>d.numSupportedMorphTargets){j.sort(h);j.length=d.numSupportedMorphTargets}else j.length>d.numSupportedMorphNormals?j.sort(h):j.length===0&&j.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;){if(j[i]){l=
+j[i][0];k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[i]=g[l]}else{k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,false,0,0);d.morphNormals&&k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0);f.__webglMorphTargetInfluences[i]=0}i++}}d.program.uniforms.morphTargetInfluences!==
+null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(j=e.__webglCustomAttributesList.length;g<j;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){k.bindBuffer(k.ARRAY_BUFFER,c.buffer);k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,false,0,0)}}}if(b.color>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer);k.vertexAttribPointer(b.color,3,k.FLOAT,false,0,0)}if(b.normal>=
 0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer);k.vertexAttribPointer(b.normal,3,k.FLOAT,false,0,0)}if(b.tangent>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglTangentBuffer);k.vertexAttribPointer(b.tangent,4,k.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer);k.vertexAttribPointer(b.uv,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv)}else k.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer);
 k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2)}else k.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer);k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);k.vertexAttribPointer(b.skinIndex,
 4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==ob){k.lineWidth(d);ob=d}a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)}K.info.render.calls++;
 K.info.render.vertices=K.info.render.vertices+e.__webglFaceCount;K.info.render.faces=K.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==ob){k.lineWidth(d);ob=d}k.drawArrays(f,0,e.__webglLineCount);K.info.render.calls++}else if(f instanceof THREE.ParticleSystem){k.drawArrays(k.POINTS,0,e.__webglParticleCount);K.info.render.calls++;K.info.render.points=K.info.render.points+e.__webglParticleCount}else if(f instanceof
 THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount);K.info.render.calls++}}};this.render=function(a,b,c,d){if(b instanceof THREE.Camera===false)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,h,l,n=a.__lights,o=a.fog;I=-1;oa=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.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);lb.multiply(b.projectionMatrix,b.matrixWorldInverse);za.setFromMatrix(lb);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
+new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);lb.multiply(b.projectionMatrix,b.matrixWorldInverse);za.setFromMatrix(lb);this.autoUpdateObjects&&this.initWebGLObjects(a);j(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
 this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;d=0;for(e=l.length;d<e;d++){f=l[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||za.contains(h))){s(h,b);var p=f,r=p.object,q=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=q.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(h.renderDepth)f.z=h.renderDepth;else{Ta.copy(h.matrixWorld.getPosition());lb.multiplyVector3(Ta);f.z=Ta.z}}}this.sortObjects&&l.sort(g);l=a.__webglObjectsImmediate;d=0;for(e=l.length;d<e;d++){f=l[d];h=f.object;if(h.visible){s(h,b);h=f.object.material;if(h.transparent){f.transparent=h;f.opaque=null}else{f.opaque=h;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);x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);m(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);m(a.__webglObjectsImmediate,"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",b,n,o,true);m(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(this.renderPluginsPost,
+d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);i(a.__webglObjects,false,"",b,n,o,true,d);m(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);i(a.__webglObjects,true,"opaque",b,n,o,false);m(a.__webglObjectsImmediate,"opaque",b,n,o,false);i(a.__webglObjects,false,"transparent",b,n,o,true);m(a.__webglObjectsImmediate,"transparent",b,n,o,true)}j(this.renderPluginsPost,
 a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)}};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);
-ca=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,za):e.render(function(a){K.renderBufferImmediate(a,f,d)})};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,i=void 0,j=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){j=
-g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,s=void 0,t=void 0,w=void 0,u=void 0,x=void 0,z=void 0,A=void 0,D={},G=q.morphTargets.length,E=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){w=q.faces[s];u=w.materialIndex;z=u!==void 0?u:-1;D[z]===void 0&&(D[z]={hash:z,counter:0});A=D[z].hash+"_"+D[z].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:G,numMorphNormals:E});
+ca=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,za):e.render(function(a){K.renderBufferImmediate(a,f,d)})};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,j=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,w=void 0,u=void 0,x=void 0,z=void 0,A=void 0,D={},G=q.morphTargets.length,E=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){w=q.faces[s];u=w.materialIndex;z=u!==void 0?u:-1;D[z]===void 0&&(D[z]={hash:z,counter:0});A=D[z].hash+"_"+D[z].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:G,numMorphNormals:E});
 x=w instanceof THREE.Face3?3:4;if(q.geometryGroups[A].vertices+x>65535){D[z].counter=D[z].counter+1;A=D[z].hash+"_"+D[z].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:G,numMorphNormals:E})}w instanceof THREE.Face3?q.geometryGroups[A].faces3.push(s):q.geometryGroups[A].faces4.push(s);q.geometryGroups[A].vertices=q.geometryGroups[A].vertices+x}q.geometryGroupsList=[];var I=void 0;for(I in q.geometryGroups){q.geometryGroups[I].id=
-Y++;q.geometryGroupsList.push(q.geometryGroups[I])}}for(i in j.geometryGroups){m=j.geometryGroups[i];if(!m.__webglVertexBuffer){var C=m;C.__webglVertexBuffer=k.createBuffer();C.__webglNormalBuffer=k.createBuffer();C.__webglTangentBuffer=k.createBuffer();C.__webglColorBuffer=k.createBuffer();C.__webglUVBuffer=k.createBuffer();C.__webglUV2Buffer=k.createBuffer();C.__webglSkinVertexABuffer=k.createBuffer();C.__webglSkinVertexBBuffer=k.createBuffer();C.__webglSkinIndicesBuffer=k.createBuffer();C.__webglSkinWeightsBuffer=
+Y++;q.geometryGroupsList.push(q.geometryGroups[I])}}for(j in i.geometryGroups){m=i.geometryGroups[j];if(!m.__webglVertexBuffer){var C=m;C.__webglVertexBuffer=k.createBuffer();C.__webglNormalBuffer=k.createBuffer();C.__webglTangentBuffer=k.createBuffer();C.__webglColorBuffer=k.createBuffer();C.__webglUVBuffer=k.createBuffer();C.__webglUV2Buffer=k.createBuffer();C.__webglSkinVertexABuffer=k.createBuffer();C.__webglSkinVertexBBuffer=k.createBuffer();C.__webglSkinIndicesBuffer=k.createBuffer();C.__webglSkinWeightsBuffer=
 k.createBuffer();C.__webglFaceBuffer=k.createBuffer();C.__webglLineBuffer=k.createBuffer();var W=void 0,H=void 0;if(C.numMorphTargets){C.__webglMorphTargetsBuffers=[];W=0;for(H=C.numMorphTargets;W<H;W++)C.__webglMorphTargetsBuffers.push(k.createBuffer())}if(C.numMorphNormals){C.__webglMorphNormalsBuffers=[];W=0;for(H=C.numMorphNormals;W<H;W++)C.__webglMorphNormalsBuffers.push(k.createBuffer())}K.info.memory.geometries++;var F=m,L=g,N=L.geometry,Z=F.faces3,O=F.faces4,R=Z.length*3+O.length*4,P=Z.length*
 1+O.length*2,Q=Z.length*3+O.length*4,aa=c(L,F),V=e(aa),$=d(aa),ia=aa.vertexColors?aa.vertexColors:false;F.__vertexArray=new Float32Array(R*3);if($)F.__normalArray=new Float32Array(R*3);if(N.hasTangents)F.__tangentArray=new Float32Array(R*4);if(ia)F.__colorArray=new Float32Array(R*3);if(V){if(N.faceUvs.length>0||N.faceVertexUvs.length>0)F.__uvArray=new Float32Array(R*2);if(N.faceUvs.length>1||N.faceVertexUvs.length>1)F.__uv2Array=new Float32Array(R*2)}if(L.geometry.skinWeights.length&&L.geometry.skinIndices.length){F.__skinVertexAArray=
 new Float32Array(R*4);F.__skinVertexBArray=new Float32Array(R*4);F.__skinIndexArray=new Float32Array(R*4);F.__skinWeightArray=new Float32Array(R*4)}F.__faceArray=new Uint16Array(P*3);F.__lineArray=new Uint16Array(Q*2);var da=void 0,ca=void 0;if(F.numMorphTargets){F.__morphTargetsArrays=[];da=0;for(ca=F.numMorphTargets;da<ca;da++)F.__morphTargetsArrays.push(new Float32Array(R*3))}if(F.numMorphNormals){F.__morphNormalsArrays=[];da=0;for(ca=F.numMorphNormals;da<ca;da++)F.__morphNormalsArrays.push(new Float32Array(R*
 3))}F.__webglFaceCount=P*3;F.__webglLineCount=Q*2;if(aa.attributes){if(F.__webglCustomAttributesList===void 0)F.__webglCustomAttributesList=[];var ja=void 0;for(ja in aa.attributes){var Aa=aa.attributes[ja],ea={},na;for(na in Aa)ea[na]=Aa[na];if(!ea.__webglInitialized||ea.createUniqueBuffers){ea.__webglInitialized=true;var Fa=1;ea.type==="v2"?Fa=2:ea.type==="v3"?Fa=3:ea.type==="v4"?Fa=4:ea.type==="c"&&(Fa=3);ea.size=Fa;ea.array=new Float32Array(R*Fa);ea.buffer=k.createBuffer();ea.buffer.belongsToAttribute=
-ja;Aa.needsUpdate=true;ea.__original=Aa}F.__webglCustomAttributesList.push(ea)}}F.__inittedArrays=true;j.verticesNeedUpdate=true;j.morphTargetsNeedUpdate=true;j.elementsNeedUpdate=true;j.uvsNeedUpdate=true;j.normalsNeedUpdate=true;j.tangentsNeedUpdate=true;j.colorsNeedUpdate=true}}}else if(j instanceof THREE.BufferGeometry){var Sa=j,Ia=void 0,oa=void 0,za=void 0;for(Ia in Sa.attributes){za=Ia==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;oa=Sa.attributes[Ia];oa.buffer=k.createBuffer();k.bindBuffer(za,
-oa.buffer);k.bufferData(za,oa.array,k.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Ca=j;Ca.__webglVertexBuffer=k.createBuffer();Ca.__webglColorBuffer=k.createBuffer();K.info.memory.geometries++;var Ga=j,Ja=Ga.vertices.length;Ga.__vertexArray=new Float32Array(Ja*3);Ga.__colorArray=new Float32Array(Ja*3);Ga.__webglVertexCount=Ja;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var ob=
-j;ob.__webglVertexBuffer=k.createBuffer();ob.__webglColorBuffer=k.createBuffer();K.info.memory.geometries++;var jb=j,Xa=g,Ta=jb.vertices.length;jb.__vertexArray=new Float32Array(Ta*3);jb.__colorArray=new Float32Array(Ta*3);jb.__webglLineCount=Ta;b(jb,Xa);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var bb=j;bb.__webglVertexBuffer=k.createBuffer();bb.__webglColorBuffer=k.createBuffer();K.info.geometries++;var Wa=
-j,lb=g,pb=Wa.vertices.length;Wa.__vertexArray=new Float32Array(pb*3);Wa.__colorArray=new Float32Array(pb*3);Wa.__sortArray=[];Wa.__webglParticleCount=pb;b(Wa,lb);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(i in j.geometryGroups){m=j.geometryGroups[i];l(h.__webglObjects,m,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 fb=a.__objectsRemoved[0],kb=a;fb instanceof THREE.Mesh||fb instanceof THREE.ParticleSystem||fb instanceof THREE.Ribbon||fb instanceof
+ja;Aa.needsUpdate=true;ea.__original=Aa}F.__webglCustomAttributesList.push(ea)}}F.__inittedArrays=true;i.verticesNeedUpdate=true;i.morphTargetsNeedUpdate=true;i.elementsNeedUpdate=true;i.uvsNeedUpdate=true;i.normalsNeedUpdate=true;i.tangentsNeedUpdate=true;i.colorsNeedUpdate=true}}}else if(i instanceof THREE.BufferGeometry){var Sa=i,Ia=void 0,oa=void 0,za=void 0;for(Ia in Sa.attributes){za=Ia==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;oa=Sa.attributes[Ia];oa.buffer=k.createBuffer();k.bindBuffer(za,
+oa.buffer);k.bufferData(za,oa.array,k.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){i=g.geometry;if(!i.__webglVertexBuffer){var Ca=i;Ca.__webglVertexBuffer=k.createBuffer();Ca.__webglColorBuffer=k.createBuffer();K.info.memory.geometries++;var Ga=i,Ja=Ga.vertices.length;Ga.__vertexArray=new Float32Array(Ja*3);Ga.__colorArray=new Float32Array(Ja*3);Ga.__webglVertexCount=Ja;i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){i=g.geometry;if(!i.__webglVertexBuffer){var ob=
+i;ob.__webglVertexBuffer=k.createBuffer();ob.__webglColorBuffer=k.createBuffer();K.info.memory.geometries++;var jb=i,Xa=g,Ta=jb.vertices.length;jb.__vertexArray=new Float32Array(Ta*3);jb.__colorArray=new Float32Array(Ta*3);jb.__webglLineCount=Ta;b(jb,Xa);i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){i=g.geometry;if(!i.__webglVertexBuffer){var bb=i;bb.__webglVertexBuffer=k.createBuffer();bb.__webglColorBuffer=k.createBuffer();K.info.geometries++;var Wa=
+i,lb=g,pb=Wa.vertices.length;Wa.__vertexArray=new Float32Array(pb*3);Wa.__colorArray=new Float32Array(pb*3);Wa.__sortArray=[];Wa.__webglParticleCount=pb;b(Wa,lb);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(j in i.geometryGroups){m=i.geometryGroups[j];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,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 fb=a.__objectsRemoved[0],kb=a;fb instanceof THREE.Mesh||fb instanceof THREE.ParticleSystem||fb instanceof THREE.Ribbon||fb instanceof
 THREE.Line?r(kb.__webglObjects,fb):fb instanceof THREE.Sprite?o(kb.__webglSprites,fb):fb instanceof THREE.LensFlare?o(kb.__webglFlares,fb):(fb instanceof THREE.ImmediateRenderObject||fb.immediateRenderCallback)&&r(kb.__webglObjectsImmediate,fb);fb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var qb=0,rb=a.__webglObjects.length;qb<rb;qb++){var mb=a.__webglObjects[qb].object,fa=mb.geometry,eb=void 0,cb=void 0,Ya=void 0;if(mb instanceof THREE.Mesh)if(fa instanceof THREE.BufferGeometry){if(fa.verticesNeedUpdate||
 fa.elementsNeedUpdate||fa.uvsNeedUpdate||fa.normalsNeedUpdate||fa.colorsNeedUpdate||fa.tangentsNeedUpdate){var Kb=fa,db=k.DYNAMIC_DRAW,uc=!fa.dynamic,nc=Kb.attributes,dc=nc.index,Wc=nc.position,Xc=nc.normal,Yc=nc.uv,Zc=nc.color,$c=nc.tangent;if(Kb.elementsNeedUpdate&&dc!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,dc.buffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,dc.array,db)}if(Kb.verticesNeedUpdate&&Wc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Wc.buffer);k.bufferData(k.ARRAY_BUFFER,Wc.array,db)}if(Kb.normalsNeedUpdate&&
 Xc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Xc.buffer);k.bufferData(k.ARRAY_BUFFER,Xc.array,db)}if(Kb.uvsNeedUpdate&&Yc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Yc.buffer);k.bufferData(k.ARRAY_BUFFER,Yc.array,db)}if(Kb.colorsNeedUpdate&&Zc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Zc.buffer);k.bufferData(k.ARRAY_BUFFER,Zc.array,db)}if(Kb.tangentsNeedUpdate&&$c!==void 0){k.bindBuffer(k.ARRAY_BUFFER,$c.buffer);k.bufferData(k.ARRAY_BUFFER,$c.array,db)}if(uc){var ld=void 0;for(ld in Kb.attributes)delete Kb.attributes[ld].array}}fa.verticesNeedUpdate=
@@ -469,31 +469,31 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=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,j=f.faces,m=a.faceVertexUvs[0],l=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 o=h[p].clone();c&&c.multiplyVector3(o);g.push(o)}p=0;for(r=j.length;p<r;p++){var g=
-j[p],q,s,x=g.vertexNormals,u=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=x.length;h<o;h++){s=x[h].clone();d&&d.multiplyVector3(s);q.vertexNormals.push(s)}q.color.copy(g.color);h=0;for(o=u.length;h<o;h++){s=u[h];q.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];o=h.id;u=n[o];if(u===void 0){u=
-a.materials.length;n[o]=u;a.materials.push(h)}q.materialIndex=u}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}p=0;for(r=l.length;p<r;p++){c=l[p];d=[];h=0;for(o=c.length;h<o;h++)d.push(new THREE.UV(c[h].u,c[h].v));m.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,i=f.faces,m=a.faceVertexUvs[0],l=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 o=h[p].clone();c&&c.multiplyVector3(o);g.push(o)}p=0;for(r=i.length;p<r;p++){var g=
+i[p],q,s,x=g.vertexNormals,u=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=x.length;h<o;h++){s=x[h].clone();d&&d.multiplyVector3(s);q.vertexNormals.push(s)}q.color.copy(g.color);h=0;for(o=u.length;h<o;h++){s=u[h];q.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];o=h.id;u=n[o];if(u===void 0){u=
+a.materials.length;n[o]=u;a.materials.push(h)}q.materialIndex=u}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);j.push(q)}p=0;for(r=l.length;p<r;p++){c=l[p];d=[];h=0;for(o=c.length;h<o;h++)d.push(new THREE.UV(c[h].u,c[h].v));m.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 j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],m,l,n,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){m=g[d.a];l=g[d.b];n=g[d.c];d._area=THREE.GeometryUtils.triangleArea(m,l,n)}else if(d instanceof THREE.Face4){m=
-g[d.a];l=g[d.b];n=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(m,l,p);d._area2=THREE.GeometryUtils.triangleArea(l,n,p);d._area=d._area1+d._area2}i=i+d._area;j[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 i[e]>a?b(c,e-1):i[e]<a?b(e+1,d):e}return b(0,i.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,j=0,i=[],m,l,n,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){m=g[d.a];l=g[d.b];n=g[d.c];d._area=THREE.GeometryUtils.triangleArea(m,l,n)}else if(d instanceof THREE.Face4){m=
+g[d.a];l=g[d.b];n=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(m,l,p);d._area2=THREE.GeometryUtils.triangleArea(l,n,p);d._area=d._area1+d._area2}j=j+d._area;i[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,j=d.c,m=d.d,l=new THREE.Face3,n=new THREE.Face3;l.color.copy(d.color);n.color.copy(d.color);l.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;l.a=e;l.b=i;l.c=m;n.a=i;n.b=j;n.c=m;if(d.vertexColors.length===4){l.vertexColors[0]=d.vertexColors[0].clone();l.vertexColors[1]=d.vertexColors[1].clone();l.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(l,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){l=a.faceVertexUvs[d][b];i=l[1];j=l[2];m=l[3];l=[l[0].clone(),i.clone(),m.clone()];i=[i.clone(),j.clone(),m.clone()];h[d].push(l,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],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.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,j,m,l,n,p,r,o,q,s,x,u,t,z=[],D=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)D[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;j=a.vertices[f];m=a.vertices[g];l=a.vertices[h];p=j.distanceTo(m);r=m.distanceTo(l);n=j.distanceTo(l);if(p>
-b||r>b||n>b){i=a.vertices.length;u=e.clone();t=e.clone();if(p>=r&&p>=n){j=j.clone();j.lerpSelf(m,0.5);u.a=f;u.b=i;u.c=h;t.a=i;t.b=g;t.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);u.vertexNormals[1].copy(f);t.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);u.vertexColors[1].copy(f);t.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=n){j=m.clone();j.lerpSelf(l,0.5);u.a=f;u.b=g;u.c=
-i;t.a=i;t.b=h;t.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);u.vertexNormals[2].copy(f);t.vertexNormals[0].copy(f);t.vertexNormals[1].copy(e.vertexNormals[2]);t.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);u.vertexColors[2].copy(f);t.vertexColors[0].copy(f);t.vertexColors[1].copy(e.vertexColors[2]);t.vertexColors[2].copy(e.vertexColors[0])}e=1}else{j=j.clone();
-j.lerpSelf(l,0.5);u.a=f;u.b=g;u.c=i;t.a=i;t.b=g;t.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);u.vertexNormals[2].copy(f);t.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);u.vertexColors[2].copy(f);t.vertexColors[0].copy(f)}e=2}z.push(u,t);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];t=j[0];h=j[1];u=j[2];if(e===
-0){m=t.clone();m.lerpSelf(h,0.5);j=[t.clone(),m.clone(),u.clone()];h=[m.clone(),h.clone(),u.clone()]}else if(e===1){m=h.clone();m.lerpSelf(u,0.5);j=[t.clone(),h.clone(),m.clone()];h=[m.clone(),u.clone(),t.clone()]}else{m=t.clone();m.lerpSelf(u,0.5);j=[t.clone(),h.clone(),m.clone()];h=[m.clone(),h.clone(),u.clone()]}D[f].push(j,h)}}else{z.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;j=a.vertices[f];m=a.vertices[g];l=a.vertices[h];n=
-a.vertices[i];p=j.distanceTo(m);r=m.distanceTo(l);o=l.distanceTo(n);q=j.distanceTo(n);if(p>b||r>b||o>b||q>b){s=a.vertices.length;x=a.vertices.length+1;u=e.clone();t=e.clone();if(p>=r&&p>=o&&p>=q||o>=r&&o>=p&&o>=q){p=j.clone();p.lerpSelf(m,0.5);m=l.clone();m.lerpSelf(n,0.5);u.a=f;u.b=s;u.c=x;u.d=i;t.a=s;t.b=g;t.c=h;t.d=x;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);u.vertexNormals[1].copy(f);
-u.vertexNormals[2].copy(g);t.vertexNormals[0].copy(f);t.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);u.vertexColors[1].copy(f);u.vertexColors[2].copy(g);t.vertexColors[0].copy(f);t.vertexColors[3].copy(g)}e=0}else{p=m.clone();p.lerpSelf(l,0.5);m=n.clone();m.lerpSelf(j,0.5);u.a=f;u.b=g;u.c=s;u.d=x;t.a=x;t.b=s;t.c=h;t.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
+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,i=d.c,m=d.d,l=new THREE.Face3,n=new THREE.Face3;l.color.copy(d.color);n.color.copy(d.color);l.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;l.a=e;l.b=j;l.c=m;n.a=j;n.b=i;n.c=m;if(d.vertexColors.length===4){l.vertexColors[0]=d.vertexColors[0].clone();l.vertexColors[1]=d.vertexColors[1].clone();l.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(l,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){l=a.faceVertexUvs[d][b];j=l[1];i=l[2];m=l[3];l=[l[0].clone(),j.clone(),m.clone()];j=[j.clone(),i.clone(),m.clone()];h[d].push(l,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],i=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());b.push(i.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,i,m,l,n,p,r,o,q,s,x,u,t,z=[],D=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)D[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;i=a.vertices[f];m=a.vertices[g];l=a.vertices[h];p=i.distanceTo(m);r=m.distanceTo(l);n=i.distanceTo(l);if(p>
+b||r>b||n>b){j=a.vertices.length;u=e.clone();t=e.clone();if(p>=r&&p>=n){i=i.clone();i.lerpSelf(m,0.5);u.a=f;u.b=j;u.c=h;t.a=j;t.b=g;t.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);u.vertexNormals[1].copy(f);t.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);u.vertexColors[1].copy(f);t.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=n){i=m.clone();i.lerpSelf(l,0.5);u.a=f;u.b=g;u.c=
+j;t.a=j;t.b=h;t.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);u.vertexNormals[2].copy(f);t.vertexNormals[0].copy(f);t.vertexNormals[1].copy(e.vertexNormals[2]);t.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);u.vertexColors[2].copy(f);t.vertexColors[0].copy(f);t.vertexColors[1].copy(e.vertexColors[2]);t.vertexColors[2].copy(e.vertexColors[0])}e=1}else{i=i.clone();
+i.lerpSelf(l,0.5);u.a=f;u.b=g;u.c=j;t.a=j;t.b=g;t.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);u.vertexNormals[2].copy(f);t.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);u.vertexColors[2].copy(f);t.vertexColors[0].copy(f)}e=2}z.push(u,t);a.vertices.push(i);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){i=a.faceVertexUvs[f][c];t=i[0];h=i[1];u=i[2];if(e===
+0){m=t.clone();m.lerpSelf(h,0.5);i=[t.clone(),m.clone(),u.clone()];h=[m.clone(),h.clone(),u.clone()]}else if(e===1){m=h.clone();m.lerpSelf(u,0.5);i=[t.clone(),h.clone(),m.clone()];h=[m.clone(),u.clone(),t.clone()]}else{m=t.clone();m.lerpSelf(u,0.5);i=[t.clone(),h.clone(),m.clone()];h=[m.clone(),h.clone(),u.clone()]}D[f].push(i,h)}}else{z.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;j=e.d;i=a.vertices[f];m=a.vertices[g];l=a.vertices[h];n=
+a.vertices[j];p=i.distanceTo(m);r=m.distanceTo(l);o=l.distanceTo(n);q=i.distanceTo(n);if(p>b||r>b||o>b||q>b){s=a.vertices.length;x=a.vertices.length+1;u=e.clone();t=e.clone();if(p>=r&&p>=o&&p>=q||o>=r&&o>=p&&o>=q){p=i.clone();p.lerpSelf(m,0.5);m=l.clone();m.lerpSelf(n,0.5);u.a=f;u.b=s;u.c=x;u.d=j;t.a=s;t.b=g;t.c=h;t.d=x;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);u.vertexNormals[1].copy(f);
+u.vertexNormals[2].copy(g);t.vertexNormals[0].copy(f);t.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);u.vertexColors[1].copy(f);u.vertexColors[2].copy(g);t.vertexColors[0].copy(f);t.vertexColors[3].copy(g)}e=0}else{p=m.clone();p.lerpSelf(l,0.5);m=n.clone();m.lerpSelf(i,0.5);u.a=f;u.b=g;u.c=s;u.d=x;t.a=x;t.b=s;t.c=h;t.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);u.vertexNormals[2].copy(f);u.vertexNormals[3].copy(g);t.vertexNormals[0].copy(g);t.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);u.vertexColors[2].copy(f);u.vertexColors[3].copy(g);t.vertexColors[0].copy(g);t.vertexColors[1].copy(f)}e=1}z.push(u,t);a.vertices.push(p,m);
-f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];t=j[0];h=j[1];u=j[2];j=j[3];if(e===0){m=t.clone();m.lerpSelf(h,0.5);l=u.clone();l.lerpSelf(j,0.5);t=[t.clone(),m.clone(),l.clone(),j.clone()];h=[m.clone(),h.clone(),u.clone(),l.clone()]}else{m=h.clone();m.lerpSelf(u,0.5);l=j.clone();l.lerpSelf(t,0.5);t=[t.clone(),h.clone(),m.clone(),l.clone()];h=[l.clone(),m.clone(),u.clone(),j.clone()]}D[f].push(t,h)}}else{z.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}}a.faces=
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){i=a.faceVertexUvs[f][c];t=i[0];h=i[1];u=i[2];i=i[3];if(e===0){m=t.clone();m.lerpSelf(h,0.5);l=u.clone();l.lerpSelf(i,0.5);t=[t.clone(),m.clone(),l.clone(),i.clone()];h=[m.clone(),h.clone(),u.clone(),l.clone()]}else{m=h.clone();m.lerpSelf(u,0.5);l=i.clone();l.lerpSelf(t,0.5);t=[t.clone(),h.clone(),m.clone(),l.clone()];h=[l.clone(),m.clone(),u.clone(),i.clone()]}D[f].push(t,h)}}else{z.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}}a.faces=
 z;a.faceVertexUvs=D}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=true;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);return f},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);f.flipY=false;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()}};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),j=i.data,m=0;m<d;m++)for(var l=0;l<e;l++){var n=l-1<0?0:l-1,p=l+1>e-
+e.loadCount+1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};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,j=g.createImageData(d,e),i=j.data,m=0;m<d;m++)for(var l=0;l<e;l++){var n=l-1<0?0:l-1,p=l+1>e-
 1?e-1:l+1,r=m-1<0?0:m-1,o=m+1>d-1?d-1:m+1,q=[],s=[0,0,h[(l*d+m)*4]/255*b];q.push([-1,0,h[(l*d+r)*4]/255*b]);q.push([-1,-1,h[(n*d+r)*4]/255*b]);q.push([0,-1,h[(n*d+m)*4]/255*b]);q.push([1,-1,h[(n*d+o)*4]/255*b]);q.push([1,0,h[(l*d+o)*4]/255*b]);q.push([1,1,h[(p*d+o)*4]/255*b]);q.push([0,1,h[(p*d+m)*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 o=q[p],x=q[(p+1)%r],o=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],x=[x[0]-s[0],x[1]-s[1],x[2]-s[2]];n.push(c([o[1]*x[2]-o[2]*x[1],o[2]*
-x[0]-o[0]*x[2],o[0]*x[1]-o[1]*x[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;s=(l*d+m)*4;j[s]=(q[0]+1)/2*255|0;j[s+1]=(q[1]+1)/2*255|0;j[s+2]=q[2]*255|0;j[s+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,
+x[0]-o[0]*x[2],o[0]*x[1]-o[1]*x[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;s=(l*d+m)*4;i[s]=(q[0]+1)/2*255|0;i[s+1]=(q[1]+1)/2*255|0;i[s+2]=q[2]*255|0;i[s+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);
@@ -511,24 +511,24 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
 THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalMatrix * skinnedNormal.xyz;\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalMatrix * skinnedTangent.xyz;\n#else\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\n#endif\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinned  = boneMatX * skinVertexA * skinWeight.x;\nskinned \t  += boneMatY * skinVertexB * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinned  = boneMatX * skinVertexA * skinWeight.x;\nskinned \t  += boneMatY * skinVertexB * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 wPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = wPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * wPosition;\n}\n#endif\n}"].join("\n")},
 cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
 THREE.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,j,m,l,n,p,r,o,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
-c+d;m=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,i,m);if(g=f[f.length-1]){l=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var x=g/h;THREE.Shape.Utils.b2(x,l,p,i);THREE.Shape.Utils.b2(x,n,r,m)}}break;case "b":i=b[a++]*c+d;m=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;o=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(i,m,p,r,o,q);if(g=f[f.length-1]){l=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){x=g/h;THREE.Shape.Utils.b3(x,l,p,o,i);THREE.Shape.Utils.b3(x,n,r,q,m)}}}}}return{offset:s.ha*c,path:e}}}};
+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,i,m,l,n,p,r,o,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));i=b.length;for(a=0;a<i;){j=b[a++];switch(j){case "m":j=b[a++]*c+d;m=b[a++]*c;e.moveTo(j,m);break;case "l":j=b[a++]*c+d;m=b[a++]*c;e.lineTo(j,m);break;case "q":j=b[a++]*
+c+d;m=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,j,m);if(g=f[f.length-1]){l=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var x=g/h;THREE.Shape.Utils.b2(x,l,p,j);THREE.Shape.Utils.b2(x,n,r,m)}}break;case "b":j=b[a++]*c+d;m=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;o=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(j,m,p,r,o,q);if(g=f[f.length-1]){l=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){x=g/h;THREE.Shape.Utils.b3(x,l,p,o,j);THREE.Shape.Utils.b3(x,n,r,q,m)}}}}}return{offset:s.ha*c,path:e}}}};
 THREE.FontUtils.generateShapes=function(a,b){var b=b||{},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;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
-(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,j,m;if(b(a)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var l=2*e;for(j=e-1;e>2;){if(l--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);m=j+1;e<=m&&(m=0);var n;a:{n=a;var p=i,r=j,o=m,q=e,s=g,x=void 0,u=void 0,t=void 0,z=void 0,D=void 0,
-G=void 0,A=void 0,w=void 0,C=void 0,u=n[s[p]].x,t=n[s[p]].y,z=n[s[r]].x,D=n[s[r]].y,G=n[s[o]].x,A=n[s[o]].y;if(1.0E-10>(z-u)*(A-t)-(D-t)*(G-u))n=false;else{for(x=0;x<q;x++)if(!(x==p||x==r||x==o)){var w=n[s[x]].x,C=n[s[x]].y,H=void 0,O=void 0,N=void 0,$=void 0,E=void 0,F=void 0,Q=void 0,L=void 0,K=void 0,V=void 0,P=void 0,aa=void 0,H=N=E=void 0,H=G-z,O=A-D,N=u-G,$=t-A,E=z-u,F=D-t,Q=w-u,L=C-t,K=w-z,V=C-D,P=w-G,aa=C-A,H=H*V-O*K,E=E*L-F*Q,N=N*aa-$*P;if(H>=0&&N>=0&&E>=0){n=false;break a}}n=true}}if(n){f.push([a[g[i]],
-a[g[j]],a[g[m]]]);h.push([g[i],g[j],g[m]]);i=j;for(m=j+1;m<e;i++,m++)g[i]=g[m];e--;l=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.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.attributes={};this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.hasTangents=false;this.morphTargets=[]};
+(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,i,m;if(b(a)>0)for(i=0;i<e;i++)g[i]=i;else for(i=0;i<e;i++)g[i]=e-1-i;var l=2*e;for(i=e-1;e>2;){if(l--<=0){console.log("Warning, unable to triangulate polygon!");break}j=i;e<=j&&(j=0);i=j+1;e<=i&&(i=0);m=i+1;e<=m&&(m=0);var n;a:{n=a;var p=j,r=i,o=m,q=e,s=g,x=void 0,u=void 0,t=void 0,z=void 0,D=void 0,
+G=void 0,A=void 0,w=void 0,C=void 0,u=n[s[p]].x,t=n[s[p]].y,z=n[s[r]].x,D=n[s[r]].y,G=n[s[o]].x,A=n[s[o]].y;if(1.0E-10>(z-u)*(A-t)-(D-t)*(G-u))n=false;else{for(x=0;x<q;x++)if(!(x==p||x==r||x==o)){var w=n[s[x]].x,C=n[s[x]].y,H=void 0,O=void 0,N=void 0,$=void 0,E=void 0,F=void 0,Q=void 0,L=void 0,K=void 0,V=void 0,P=void 0,aa=void 0,H=N=E=void 0,H=G-z,O=A-D,N=u-G,$=t-A,E=z-u,F=D-t,Q=w-u,L=C-t,K=w-z,V=C-D,P=w-G,aa=C-A,H=H*V-O*K,E=E*L-F*Q,N=N*aa-$*P;if(H>=0&&N>=0&&E>=0){n=false;break a}}n=true}}if(n){f.push([a[g[j]],
+a[g[i]],a[g[m]]]);h.push([g[j],g[i],g[m]]);j=i;for(m=i+1;m<e;j++,m++)g[j]=g[m];e--;l=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.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.attributes={};this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.hasTangents=false;this.morphTargets=[]};
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;if(this.attributes.position)b=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(b!==void 0){a.multiplyVector3Array(b);this.verticesNeedUpdate=true}if(c!==void 0){b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
 Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,e,f=0,g=a.length;f<g;f=f+3){c=a[f];d=a[f+1];e=a[f+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(e<b.min.z)b.min.z=e;else if(e>b.max.z)b.max.z=e}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
 {radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f=f+3){b=a[f];d=a[f+1];e=a[f+2];b=Math.sqrt(b*b+d*d+e*e);b>c&&(c=b)}this.boundingSphere.radius=c}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
-0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,m,l,n,p,r=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,x=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var u=e[c].index;a=b;for(b=b+i;a<b;a=a+3){i=u+f[a];j=u+f[a+1];m=u+f[a+2];l=g[i*3];n=g[i*3+1];p=g[i*3+2];r.set(l,n,p);l=g[j*3];n=g[j*3+1];p=g[j*3+2];o.set(l,n,p);l=g[m*3];n=g[m*3+1];p=g[m*3+2];q.set(l,n,p);s.sub(q,o);x.sub(r,
-o);s.crossSelf(x);h[i*3]=h[i*3]+s.x;h[i*3+1]=h[i*3+1]+s.y;h[i*3+2]=h[i*3+2]+s.z;h[j*3]=h[j*3]+s.x;h[j*3+1]=h[j*3+1]+s.y;h[j*3+2]=h[j*3+2]+s.z;h[m*3]=h[m*3]+s.x;h[m*3+1]=h[m*3+1]+s.y;h[m*3+2]=h[m*3+2]+s.z}}a=0;for(b=h.length;a<b;a=a+3){l=h[a];n=h[a+1];p=h[a+2];c=1/Math.sqrt(l*l+n*n+p*p);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a,b,c){l=d[a*3];n=d[a*3+1];p=d[a*3+2];r=d[b*3];o=d[b*3+1];q=d[b*3+2];s=d[c*3];x=d[c*3+1];u=d[c*3+2];t=
-f[a*2];z=f[a*2+1];D=f[b*2];G=f[b*2+1];A=f[c*2];w=f[c*2+1];C=r-l;H=s-l;O=o-n;N=x-n;$=q-p;E=u-p;F=D-t;Q=A-t;L=G-z;K=w-z;V=1/(F*K-Q*L);P.set((K*C-L*H)*V,(K*O-L*N)*V,(K*$-L*E)*V);aa.set((F*H-Q*C)*V,(F*N-Q*O)*V,(F*E-Q*$)*V);j[a].addSelf(P);j[b].addSelf(P);j[c].addSelf(P);m[a].addSelf(aa);m[b].addSelf(aa);m[c].addSelf(aa)}function b(a){Fa.x=e[a*3];Fa.y=e[a*3+1];Fa.z=e[a*3+2];na.copy(Fa);ea=j[a];Z.copy(ea);Z.subSelf(Fa.multiplyScalar(Fa.dot(ea))).normalize();ja.cross(na,ea);Ia=ja.dot(m[a]);Aa=Ia<0?-1:1;
-i[a*4]=Z.x;i[a*4+1]=Z.y;i[a*4+2]=Z.z;i[a*4+3]=Aa}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;if(this.attributes.tangent===void 0){var h=4*g;this.attributes.tangent=
-{itemSize:4,array:new Float32Array(h),numItems:h}}for(var i=this.attributes.tangent.array,j=[],m=[],h=0;h<g;h++){j[h]=new THREE.Vector3;m[h]=new THREE.Vector3}var l,n,p,r,o,q,s,x,u,t,z,D,G,A,w,C,H,O,N,$,E,F,Q,L,K,V,P=new THREE.Vector3,aa=new THREE.Vector3,da,I,ca,ia,Y,W=this.offsets,h=0;for(I=W.length;h<I;++h){da=W[h].start;ca=W[h].count;var R=W[h].index,g=da;for(da=da+ca;g<da;g=g+3){ca=R+c[g];ia=R+c[g+1];Y=R+c[g+2];a(ca,ia,Y)}}var Z=new THREE.Vector3,ja=new THREE.Vector3,Fa=new THREE.Vector3,na=
+0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,j,i,m,l,n,p,r=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,x=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;j=e[c].count;var u=e[c].index;a=b;for(b=b+j;a<b;a=a+3){j=u+f[a];i=u+f[a+1];m=u+f[a+2];l=g[j*3];n=g[j*3+1];p=g[j*3+2];r.set(l,n,p);l=g[i*3];n=g[i*3+1];p=g[i*3+2];o.set(l,n,p);l=g[m*3];n=g[m*3+1];p=g[m*3+2];q.set(l,n,p);s.sub(q,o);x.sub(r,
+o);s.crossSelf(x);h[j*3]=h[j*3]+s.x;h[j*3+1]=h[j*3+1]+s.y;h[j*3+2]=h[j*3+2]+s.z;h[i*3]=h[i*3]+s.x;h[i*3+1]=h[i*3+1]+s.y;h[i*3+2]=h[i*3+2]+s.z;h[m*3]=h[m*3]+s.x;h[m*3+1]=h[m*3+1]+s.y;h[m*3+2]=h[m*3+2]+s.z}}a=0;for(b=h.length;a<b;a=a+3){l=h[a];n=h[a+1];p=h[a+2];c=1/Math.sqrt(l*l+n*n+p*p);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a,b,c){l=d[a*3];n=d[a*3+1];p=d[a*3+2];r=d[b*3];o=d[b*3+1];q=d[b*3+2];s=d[c*3];x=d[c*3+1];u=d[c*3+2];t=
+f[a*2];z=f[a*2+1];D=f[b*2];G=f[b*2+1];A=f[c*2];w=f[c*2+1];C=r-l;H=s-l;O=o-n;N=x-n;$=q-p;E=u-p;F=D-t;Q=A-t;L=G-z;K=w-z;V=1/(F*K-Q*L);P.set((K*C-L*H)*V,(K*O-L*N)*V,(K*$-L*E)*V);aa.set((F*H-Q*C)*V,(F*N-Q*O)*V,(F*E-Q*$)*V);i[a].addSelf(P);i[b].addSelf(P);i[c].addSelf(P);m[a].addSelf(aa);m[b].addSelf(aa);m[c].addSelf(aa)}function b(a){Fa.x=e[a*3];Fa.y=e[a*3+1];Fa.z=e[a*3+2];na.copy(Fa);ea=i[a];Z.copy(ea);Z.subSelf(Fa.multiplyScalar(Fa.dot(ea))).normalize();ja.cross(na,ea);Ia=ja.dot(m[a]);Aa=Ia<0?-1:1;
+j[a*4]=Z.x;j[a*4+1]=Z.y;j[a*4+2]=Z.z;j[a*4+3]=Aa}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;if(this.attributes.tangent===void 0){var h=4*g;this.attributes.tangent=
+{itemSize:4,array:new Float32Array(h),numItems:h}}for(var j=this.attributes.tangent.array,i=[],m=[],h=0;h<g;h++){i[h]=new THREE.Vector3;m[h]=new THREE.Vector3}var l,n,p,r,o,q,s,x,u,t,z,D,G,A,w,C,H,O,N,$,E,F,Q,L,K,V,P=new THREE.Vector3,aa=new THREE.Vector3,da,I,ca,ia,Y,W=this.offsets,h=0;for(I=W.length;h<I;++h){da=W[h].start;ca=W[h].count;var R=W[h].index,g=da;for(da=da+ca;g<da;g=g+3){ca=R+c[g];ia=R+c[g+1];Y=R+c[g+2];a(ca,ia,Y)}}var Z=new THREE.Vector3,ja=new THREE.Vector3,Fa=new THREE.Vector3,na=
 new THREE.Vector3,Aa,ea,Ia,h=0;for(I=W.length;h<I;++h){da=W[h].start;ca=W[h].count;R=W[h].index;g=da;for(da=da+ca;g<da;g=g+3){ca=R+c[g];ia=R+c[g+1];Y=R+c[g+2];b(ca);b(ia);b(Y)}}this.tangentsNeedUpdate=this.hasTangents=true}}};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.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=Object.create(THREE.Curve.prototype);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=Object.create(THREE.Curve.prototype);
 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};
@@ -546,10 +546,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=Object.create(THREE.Curve.prototype);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,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,j,m,l=a[0]instanceof THREE.Vector3;m=l?new THREE.Vector3:new THREE.Vector2;i=0;for(j=a.length;i<j;i++){h=a[i];if(h.x>b)b=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<f)f=h.y;if(l){if(h.z>d)d=h.z;else if(h.z<g)g=h.z;m.addSelf(h.x,h.y,h.z)}else m.addSelf(h.x,h.y)}a={minX:e,minY:f,maxX:b,maxY:c,centroid:m.divideScalar(j)};if(l){a.maxZ=d;a.minZ=
-g}return a};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,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,j,i,m,l=a[0]instanceof THREE.Vector3;m=l?new THREE.Vector3:new THREE.Vector2;j=0;for(i=a.length;j<i;j++){h=a[j];if(h.x>b)b=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<f)f=h.y;if(l)if(h.z>d)d=h.z;else if(h.z<g)g=h.z;m.addSelf(h)}a={minX:e,minY:f,maxX:b,maxY:c,centroid:m.divideScalar(i)};if(l){a.maxZ=d;a.minZ=g}return a};
+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,a[c].z||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.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
+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.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
 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;
 THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
@@ -557,34 +557,34 @@ THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(argum
 THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
 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=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
-THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
+THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),j=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(j);j=j.getPoint(g?1:0);h.push(j.x);h.push(j.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
 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,j,m,l,n,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];i=f[3];l=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++){o=f/a;g=THREE.Shape.Utils.b2(o,p,l,h);o=THREE.Shape.Utils.b2(o,r,n,i);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];l=f[0];n=f[1];j=f[2];m=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,l,j,h);o=THREE.Shape.Utils.b3(o,r,n,m,i);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];i=f[1];n=f[2];j=f[3];g=f[4];l=!!f[5];p=g-j;r=a*2;for(f=1;f<=r;f++){o=f/r;l||(o=1-o);o=j+o*p;g=h+n*Math.cos(o);o=i+n*Math.sin(o);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];n=f[2];m=f[3];j=f[4];g=f[5];
-l=!!f[6];p=g-j;r=a*2;for(f=1;f<=r;f++){o=f/r;l||(o=1-o);o=j+o*p;g=h+n*Math.cos(o);o=i+m*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.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,i,m,l,n,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];l=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++){o=f/a;g=THREE.Shape.Utils.b2(o,p,l,h);o=THREE.Shape.Utils.b2(o,r,n,j);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];j=f[5];l=f[0];n=f[1];i=f[2];m=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,l,i,h);o=THREE.Shape.Utils.b3(o,r,n,m,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];n=f[2];i=f[3];g=f[4];l=!!f[5];p=g-i;r=a*2;for(f=1;f<=r;f++){o=f/r;l||(o=1-o);o=i+o*p;g=h+n*Math.cos(o);o=j+n*Math.sin(o);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.ELLIPSE:h=f[0];j=f[1];n=f[2];m=f[3];i=f[4];g=f[5];
+l=!!f[6];p=g-i;r=a*2;for(f=1;f<=r;f++){o=f/r;l||(o=1-o);o=i+o*p;g=h+n*Math.cos(o);o=j+m*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.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=Object.create(THREE.Path.prototype);
 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,j,m,l,n,p,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){n=j[e];p=[];for(l=0;l<c.length;l++){m=c[l];m=n.distanceToSquared(m);p.push(m);if(m<f){f=m;g=e;h=l}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var o=[j[g],c[h],c[e]];l=THREE.FontUtils.Triangulate.area(o);var q=[j[g],j[f],c[h]];n=THREE.FontUtils.Triangulate.area(q);p=h;m=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;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;o=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(o);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(l+n>o+q){h=p;g=m;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1}l=c.slice(0,h);n=c.slice(h);p=j.slice(g);m=j.slice(0,g);f=[j[g],j[f],c[h]];r.push([j[g],c[h],c[e]]);r.push(f);c=l.concat(p).concat(m).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,j={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;j[i]!==void 0&&console.log("Duplicate point",i);j[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=j[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=j[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,i,m,l,n,p,r=[];for(j=0;j<b.length;j++){i=b[j];Array.prototype.push.apply(d,i);f=Number.POSITIVE_INFINITY;for(e=0;e<i.length;e++){n=i[e];p=[];for(l=0;l<c.length;l++){m=c[l];m=n.distanceToSquared(m);p.push(m);if(m<f){f=m;g=e;h=l}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:i.length-1;var o=[i[g],c[h],c[e]];l=THREE.FontUtils.Triangulate.area(o);var q=[i[g],i[f],c[h]];n=THREE.FontUtils.Triangulate.area(q);p=h;m=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:i.length-1;o=[i[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(o);q=[i[g],i[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(l+n>o+q){h=p;g=m;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:i.length-1}l=c.slice(0,h);n=c.slice(h);p=i.slice(g);m=i.slice(0,g);f=[i[g],i[f],c[h]];r.push([i[g],c[h],c[e]]);r.push(f);c=l.concat(p).concat(m).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,j,i={};f=0;for(g=d.length;f<g;f++){j=d[f].x+":"+d[f].y;i[j]!==void 0&&console.log("Duplicate point",j);i[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=i[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=i[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.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 j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var m=
-{};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){m[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(m[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=m}}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*
+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 i=a.hierarchy[c].keys[d].morphTargets[j];h[i]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var m=
+{};for(i in h){for(j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++)if(a.hierarchy[c].keys[d].morphTargets[j]===i){m[i]=a.hierarchy[c].keys[d].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[d].morphTargets.length&&(m[i]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=m}}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){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.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(this.isPlaying===false){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===true?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)};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,m;m=this.currentTime=this.currentTime+a*this.timeScale;j=this.currentTime=this.currentTime%this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,n=this.hierarchy.length;l<n;l++){a=this.hierarchy[l];i=a.animationCache;for(var p=0;p<3;p++){c=b[p];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(j<m)if(this.loop){g=this.data.hierarchy[l].keys[0];
-for(h=this.getNextKeyWith(c,l,1);h.time<j;){g=h;h=this.getNextKeyWith(c,l,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,l,h.index+1)}while(h.time<j)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(j-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 "+l);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+
+THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,e,f,g,h,j,i,m;m=this.currentTime=this.currentTime+a*this.timeScale;i=this.currentTime=this.currentTime%this.data.length;parseInt(Math.min(i*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,n=this.hierarchy.length;l<n;l++){a=this.hierarchy[l];j=a.animationCache;for(var p=0;p<3;p++){c=b[p];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=m){if(i<m)if(this.loop){g=this.data.hierarchy[l].keys[0];
+for(h=this.getNextKeyWith(c,l,1);h.time<i;){g=h;h=this.getNextKeyWith(c,l,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,l,h.index+1)}while(h.time<i)}j.prevKey[c]=g;j.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(i-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 "+l);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",l,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",l,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}}}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;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]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,j,i;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]];i=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],j[0],i[0],e,c,g);d[1]=this.interpolate(f[1],h[1],j[1],i[1],e,c,g);d[2]=this.interpolate(f[2],h[2],j[2],i[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=
@@ -592,14 +592,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,j=this.hierarchy.length;a<j;a++){var m=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=m.length-1;e=
-this.hierarchy[a];if(m.length){for(m=0;m<f.length;m++){g=f[m];(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(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var m=b.keys,l=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(m.length){if(this.JITCompile&&l)d instanceof THREE.Bone?d.skinMatrix=l.originalMatrix:d.matrix=l.originalMatrix;b=l.prevKey;c=l.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=m[0];for(c=m[1];c.time<g;){b=c;c=m[b.index+1]}}else if(!i)for(var n=m.length-1;c.time<g&&c.index!==n;){b=c;c=m[b.index+1]}l.prevKey=b;l.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,i=this.hierarchy.length;a<i;a++){var m=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=m.length-1;e=
+this.hierarchy[a];if(m.length){for(m=0;m<f.length;m++){g=f[m];(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(i=this.hierarchy.length;a<i;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var m=b.keys,l=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(m.length){if(this.JITCompile&&l)d instanceof THREE.Bone?d.skinMatrix=l.originalMatrix:d.matrix=l.originalMatrix;b=l.prevKey;c=l.nextKey;if(b&&c){if(c.time<=h){if(j&&this.loop){b=m[0];for(c=m[1];c.time<g;){b=c;c=m[b.index+1]}}else if(!j)for(var n=m.length-1;c.time<g&&c.index!==n;){b=c;c=m[b.index+1]}l.prevKey=b;l.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=Object.create(THREE.Object3D.prototype);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()};
+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,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,j,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);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=Object.create(THREE.Camera.prototype);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.inPerspectiveMode=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.inPerspectiveMode=false;this.inOrthographicMode=true};
 THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){if(this.inPerspectiveMode)this.toPerspective();else{this.toPerspective();this.toOrthographic()}};
@@ -633,80 +633,80 @@ 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,j=0,m=0,l=0,n=0,p=0,r=0;this.handleResize=function(){p=window.innerWidth/2;r=window.innerHeight/2};this.update=
-function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*l);this.rotateVertically(b*n)}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*m);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,i=0,m=0,l=0,n=0,p=0,r=0;this.handleResize=function(){p=window.innerWidth/2;r=window.innerHeight/2};this.update=
+function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*l);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(j>0||this.autoForward&&!(j<0)?1:j));this.object.translateX(b*i);this.object.translateY(b*m);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){l=(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: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:m=1;break;case 70:m=-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:m=0;break;case 70:m=0}},false);this.handleResize()};
+false);this.domElement.addEventListener("mousemove",function(a){l=(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: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:i=-1;break;case 40:case 83:j=-1;break;case 39:case 68:i=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:m=1;break;case 70:m=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:j=0;break;case 37:case 65:i=0;break;case 40:case 83:j=0;break;case 39:case 68:i=0;break;case 81:g=false;break;case 69:g=false;break;case 82:m=0;break;case 70:m=0}},false);this.handleResize()};
 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:0,height:0,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,j=new THREE.Vector2,m=new THREE.Vector2,l=new THREE.Vector2,n=new THREE.Vector2,p={type:"change"};this.handleResize=function(){this.screen.width=window.innerWidth;this.screen.height=window.innerHeight;this.screen.offsetLeft=0;this.screen.offsetTop=0;this.radius=(this.screen.width+this.screen.height)/4};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,
+new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector2,m=new THREE.Vector2,l=new THREE.Vector2,n=new THREE.Vector2,p={type:"change"};this.handleResize=function(){this.screen.width=window.innerWidth;this.screen.height=window.innerHeight;this.screen.offsetLeft=0;this.screen.offsetTop=0;this.radius=(this.screen.width+this.screen.height)/4};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+(m.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=m:j.y=j.y+(m.y-j.y)*
+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+(m.y-i.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?i=m:i.y=i.y+(m.y-i.y)*
 this.dynamicDampingFactor}};this.panCamera=function(){var a=n.clone().subSelf(l);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?l=n:l.addSelf(a.sub(n,l).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.distanceToSquared(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);j=m=c.getMouseOnScreen(a.clientX,a.clientY);l=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?m=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?j=m=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=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?
+this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);i=m=c.getMouseOnScreen(a.clientX,a.clientY);l=n=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?m=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=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?i=m=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=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);this.handleResize()};
-THREE.OrbitControls=function(a,b){var c,d,e;function f(){return 2*Math.PI/60/60*i.autoRotateSpeed}function g(a){a.preventDefault();if(t===c){l.set(a.clientX,a.clientY);n.sub(l,m);i.rotateLeft(2*Math.PI*n.x/j*i.userRotateSpeed);i.rotateUp(2*Math.PI*n.y/j*i.userRotateSpeed);m.copy(l)}else if(t===d){r.set(a.clientX,a.clientY);o.sub(r,p);o.y>0?i.zoomIn():i.zoomOut();p.copy(r)}}function h(){if(i.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
-t=e}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var i=this,j=1800,m=new THREE.Vector2,l=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,r=new THREE.Vector2,o=new THREE.Vector2,q=0,s=0,x=1,u=new THREE.Vector3;e=-1;c=0;d=1;var t=e,z={type:"change"};this.rotateLeft=function(a){a===void 0&&(a=f());
-s=s-a};this.rotateRight=function(a){a===void 0&&(a=f());s=s+a};this.rotateUp=function(a){a===void 0&&(a=f());q=q-a};this.rotateDown=function(a){a===void 0&&(a=f());q=q+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));x=x/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));x=x*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),c=Math.atan2(b.x,b.z),d=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&this.rotateLeft(f());
-var c=c+s,d=d+q,d=Math.max(1.0E-6,Math.min(Math.PI-1.0E-6,d)),e=b.length();b.x=e*Math.sin(d)*Math.sin(c);b.y=e*Math.cos(d);b.z=e*Math.sin(d)*Math.cos(c);b.multiplyScalar(x);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=s=0;x=1;if(u.distanceTo(this.object.position)>0){this.dispatchEvent(z);u.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(i.userRotate){a.preventDefault();
-if(a.button===0||a.button===2){t=c;m.set(a.clientX,a.clientY)}else if(a.button===1){t=d;p.set(a.clientX,a.clientY)}document.addEventListener("mousemove",g,false);document.addEventListener("mouseup",h,false)}},false);this.domElement.addEventListener("mousewheel",function(a){i.userZoom&&(a.wheelDelta>0?i.zoomOut():i.zoomIn())},false)};
+THREE.OrbitControls=function(a,b){var c,d,e;function f(){return 2*Math.PI/60/60*j.autoRotateSpeed}function g(a){a.preventDefault();if(t===c){l.set(a.clientX,a.clientY);n.sub(l,m);j.rotateLeft(2*Math.PI*n.x/i*j.userRotateSpeed);j.rotateUp(2*Math.PI*n.y/i*j.userRotateSpeed);m.copy(l)}else if(t===d){r.set(a.clientX,a.clientY);o.sub(r,p);o.y>0?j.zoomIn():j.zoomOut();p.copy(r)}}function h(){if(j.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
+t=e}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var j=this,i=1800,m=new THREE.Vector2,l=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,r=new THREE.Vector2,o=new THREE.Vector2,q=0,s=0,x=1,u=new THREE.Vector3;e=-1;c=0;d=1;var t=e,z={type:"change"};this.rotateLeft=function(a){a===void 0&&(a=f());
+s=s-a};this.rotateRight=function(a){a===void 0&&(a=f());s=s+a};this.rotateUp=function(a){a===void 0&&(a=f());q=q-a};this.rotateDown=function(a){a===void 0&&(a=f());q=q+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,j.userZoomSpeed));x=x/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,j.userZoomSpeed));x=x*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),c=Math.atan2(b.x,b.z),d=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&this.rotateLeft(f());
+var c=c+s,d=d+q,d=Math.max(1.0E-6,Math.min(Math.PI-1.0E-6,d)),e=b.length();b.x=e*Math.sin(d)*Math.sin(c);b.y=e*Math.cos(d);b.z=e*Math.sin(d)*Math.cos(c);b.multiplyScalar(x);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=s=0;x=1;if(u.distanceTo(this.object.position)>0){this.dispatchEvent(z);u.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(j.userRotate){a.preventDefault();
+if(a.button===0||a.button===2){t=c;m.set(a.clientX,a.clientY)}else if(a.button===1){t=d;p.set(a.clientX,a.clientY)}document.addEventListener("mousemove",g,false);document.addEventListener("mouseup",h,false)}},false);this.domElement.addEventListener("mousewheel",function(a){j.userZoom&&(a.wheelDelta>0?j.zoomOut():j.zoomIn())},false)};
 THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=c!==void 0?c:0,d=d!==void 0?d:Math.PI*2,b=b!==void 0?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++){this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c]));this.faceVertexUvs[0].push([f[e],
 f[e+1],g])}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,l,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=j.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 u=o+1,x=p+1,V=h/o,P=i/p,aa=new THREE.Vector3;aa[n]=l>0?1:-1;for(h=0;h<x;h++)for(i=0;i<u;i++){var da=new THREE.Vector3;da[a]=(i*V-q)*c;da[b]=(h*P-r)*g;da[n]=l;j.vertices.push(da)}for(h=0;h<p;h++)for(i=0;i<o;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(aa);a.vertexNormals.push(aa.clone(),aa.clone(),aa.clone(),aa.clone());a.materialIndex=m;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/o,1-h/p),new THREE.UV(i/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-h/p)])}}THREE.Geometry.call(this);var j=this,m=a/2,l=b/2,n=c/2,p,r,o,q,s,x;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;s=3;o=
-4;x=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var u in h)this.sides[u]!==void 0&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,m,p);this.sides.nx&&i("z","y",1,-1,c,b,-m,q);this.sides.py&&i("x","z",1,1,a,c,l,r);this.sides.ny&&i("x","z",1,-1,a,c,-l,s);this.sides.pz&&i("x","y",1,-1,a,b,n,o);this.sides.nz&&i("x","y",-1,-1,a,b,-n,x);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-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,j=[],m=[];for(i=0;i<=e;i++){var l=[],n=[],p=i/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);l.push(this.vertices.length-1);n.push(new THREE.UV(o,1-p))}j.push(l);m.push(n)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){l=this.vertices[j[0][h]].clone();n=
-this.vertices[j[0][h+1]].clone()}else{l=this.vertices[j[1][h]].clone();n=this.vertices[j[1][h+1]].clone()}l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][h],r=j[i+1][h],o=j[i+1][h+1],q=j[i][h+1],s=l.clone(),x=l.clone(),u=n.clone(),t=n.clone(),z=m[i][h].clone(),D=m[i+1][h].clone(),G=m[i+1][h+1].clone(),A=m[i][h+1].clone();this.faces.push(new THREE.Face4(p,r,o,q,[s,x,u,t]));this.faceVertexUvs[0].push([z,D,G,A])}}if(!f&&a>
-0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){p=j[0][h];r=j[0][h+1];o=this.vertices.length-1;s=new THREE.Vector3(0,1,0);x=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);z=m[0][h].clone();D=m[0][h+1].clone();G=new THREE.UV(D.u,0);this.faces.push(new THREE.Face3(p,r,o,[s,x,u]));this.faceVertexUvs[0].push([z,D,G])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=j[i][h+1];r=j[i][h];o=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);x=new THREE.Vector3(0,
--1,0);u=new THREE.Vector3(0,-1,0);z=m[i][h+1].clone();D=m[i][h].clone();G=new THREE.UV(D.u,1);this.faces.push(new THREE.Face3(p,r,o,[s,x,u]));this.faceVertexUvs[0].push([z,D,G])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
+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,q=h/2,r=j/2,s=i.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 u=o+1,x=p+1,V=h/o,P=j/p,aa=new THREE.Vector3;aa[n]=l>0?1:-1;for(h=0;h<x;h++)for(j=0;j<u;j++){var da=new THREE.Vector3;da[a]=(j*V-q)*c;da[b]=(h*P-r)*g;da[n]=l;i.vertices.push(da)}for(h=0;h<p;h++)for(j=0;j<o;j++){a=new THREE.Face4(j+
+u*h+s,j+u*(h+1)+s,j+1+u*(h+1)+s,j+1+u*h+s);a.normal.copy(aa);a.vertexNormals.push(aa.clone(),aa.clone(),aa.clone(),aa.clone());a.materialIndex=m;i.faces.push(a);i.faceVertexUvs[0].push([new THREE.UV(j/o,1-h/p),new THREE.UV(j/o,1-(h+1)/p),new THREE.UV((j+1)/o,1-(h+1)/p),new THREE.UV((j+1)/o,1-h/p)])}}THREE.Geometry.call(this);var i=this,m=a/2,l=b/2,n=c/2,p,r,o,q,s,x;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;s=3;o=
+4;x=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var u in h)this.sides[u]!==void 0&&(this.sides[u]=h[u]);this.sides.px&&j("z","y",-1,-1,c,b,m,p);this.sides.nx&&j("z","y",1,-1,c,b,-m,q);this.sides.py&&j("x","z",1,1,a,c,l,r);this.sides.ny&&j("x","z",1,-1,a,c,-l,s);this.sides.pz&&j("x","y",1,-1,a,b,n,o);this.sides.nz&&j("x","y",-1,-1,a,b,-n,x);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
+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,i=[],m=[];for(j=0;j<=e;j++){var l=[],n=[],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);l.push(this.vertices.length-1);n.push(new THREE.UV(o,1-p))}i.push(l);m.push(n)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){l=this.vertices[i[0][h]].clone();n=
+this.vertices[i[0][h+1]].clone()}else{l=this.vertices[i[1][h]].clone();n=this.vertices[i[1][h+1]].clone()}l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(j=0;j<e;j++){var p=i[j][h],r=i[j+1][h],o=i[j+1][h+1],q=i[j][h+1],s=l.clone(),x=l.clone(),u=n.clone(),t=n.clone(),z=m[j][h].clone(),D=m[j+1][h].clone(),G=m[j+1][h+1].clone(),A=m[j][h+1].clone();this.faces.push(new THREE.Face4(p,r,o,q,[s,x,u,t]));this.faceVertexUvs[0].push([z,D,G,A])}}if(!f&&a>
+0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){p=i[0][h];r=i[0][h+1];o=this.vertices.length-1;s=new THREE.Vector3(0,1,0);x=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);z=m[0][h].clone();D=m[0][h+1].clone();G=new THREE.UV(D.u,0);this.faces.push(new THREE.Face3(p,r,o,[s,x,u]));this.faceVertexUvs[0].push([z,D,G])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=i[j][h+1];r=i[j][h];o=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);x=new THREE.Vector3(0,
+-1,0);u=new THREE.Vector3(0,-1,0);z=m[j][h+1].clone();D=m[j][h].clone();G=new THREE.UV(D.u,1);this.faces.push(new THREE.Face3(p,r,o,[s,x,u]));this.faceVertexUvs[0].push([z,D,G])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
 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=Object.create(THREE.Geometry.prototype);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 e(c,d){var e,f;for(I=c.length;--I>=0;){e=I;f=I-1;f<0&&(f=
 c.length-1);for(var g=0,h=n+m*2,g=0;g<h;g++){var i=P*g,j=P*(g+1),l=d+e+i,i=d+f+i,o=d+f+j,j=d+e+j,p=c,q=g,r=h,s=e,t=f,l=l+O,i=i+O,o=o+O,j=j+O;H.faces.push(new THREE.Face4(l,i,o,j,null,null,x));l=u.generateSideWallUV(H,a,p,b,l,i,o,j,q,r,s,t);H.faceVertexUvs[0].push(l)}}}function f(a,b,c){H.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+O;d=d+O;e=e+O;H.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?u.generateBottomUV(H,a,b,c,d,e):u.generateTopUV(H,a,b,c,d,e);H.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,m=b.bevelSegments!==void 0?b.bevelSegments:3,l=b.bevelEnabled!==void 0?b.bevelEnabled:true,n=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,o,q=false,s=b.material,x=b.extrudeMaterial,u=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,z,D,G;if(r){o=r.getSpacedPoints(n);q=true;l=false;t=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
-n,false);z=new THREE.Vector3;D=new THREE.Vector3;G=new THREE.Vector3}if(!l)j=i=m=0;var A,w,C,H=this,O=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,N=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();w=0;for(C=N.length;w<C;w++){A=N[w];THREE.Shape.Utils.isClockWise(A)&&(N[w]=A.reverse())}r=false}var $=THREE.Shape.Utils.triangulateShape(p,N),E=p;w=0;for(C=N.length;w<C;w++){A=N[w];p=p.concat(A)}var F,Q,L,K,V,P=p.length,aa,da=$.length,r=[],I=0;L=E.length;F=L-1;
-for(Q=I+1;I<L;I++,F++,Q++){F===L&&(F=0);Q===L&&(Q=0);r[I]=d(E[I],E[F],E[Q])}var ca=[],ia,Y=r.concat();w=0;for(C=N.length;w<C;w++){A=N[w];ia=[];I=0;L=A.length;F=L-1;for(Q=I+1;I<L;I++,F++,Q++){F===L&&(F=0);Q===L&&(Q=0);ia[I]=d(A[I],A[F],A[Q])}ca.push(ia);Y=Y.concat(ia)}for(F=0;F<m;F++){L=F/m;K=i*(1-L);Q=j*Math.sin(L*Math.PI/2);I=0;for(L=E.length;I<L;I++){V=c(E[I],r[I],Q);f(V.x,V.y,-K)}w=0;for(C=N.length;w<C;w++){A=N[w];ia=ca[w];I=0;for(L=A.length;I<L;I++){V=c(A[I],ia[I],Q);f(V.x,V.y,-K)}}}Q=j;for(I=
-0;I<P;I++){V=l?c(p[I],Y[I],Q):p[I];if(q){D.copy(t.normals[0]).multiplyScalar(V.x);z.copy(t.binormals[0]).multiplyScalar(V.y);G.copy(o[0]).addSelf(D).addSelf(z);f(G.x,G.y,G.z)}else f(V.x,V.y,0)}for(L=1;L<=n;L++)for(I=0;I<P;I++){V=l?c(p[I],Y[I],Q):p[I];if(q){D.copy(t.normals[L]).multiplyScalar(V.x);z.copy(t.binormals[L]).multiplyScalar(V.y);G.copy(o[L]).addSelf(D).addSelf(z);f(G.x,G.y,G.z)}else f(V.x,V.y,h/n*L)}for(F=m-1;F>=0;F--){L=F/m;K=i*(1-L);Q=j*Math.sin(L*Math.PI/2);I=0;for(L=E.length;I<L;I++){V=
+var h=b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,i=b.bevelSize!==void 0?b.bevelSize:j-2,m=b.bevelSegments!==void 0?b.bevelSegments:3,l=b.bevelEnabled!==void 0?b.bevelEnabled:true,n=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,o,q=false,s=b.material,x=b.extrudeMaterial,u=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,z,D,G;if(r){o=r.getSpacedPoints(n);q=true;l=false;t=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
+n,false);z=new THREE.Vector3;D=new THREE.Vector3;G=new THREE.Vector3}if(!l)i=j=m=0;var A,w,C,H=this,O=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,N=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();w=0;for(C=N.length;w<C;w++){A=N[w];THREE.Shape.Utils.isClockWise(A)&&(N[w]=A.reverse())}r=false}var $=THREE.Shape.Utils.triangulateShape(p,N),E=p;w=0;for(C=N.length;w<C;w++){A=N[w];p=p.concat(A)}var F,Q,L,K,V,P=p.length,aa,da=$.length,r=[],I=0;L=E.length;F=L-1;
+for(Q=I+1;I<L;I++,F++,Q++){F===L&&(F=0);Q===L&&(Q=0);r[I]=d(E[I],E[F],E[Q])}var ca=[],ia,Y=r.concat();w=0;for(C=N.length;w<C;w++){A=N[w];ia=[];I=0;L=A.length;F=L-1;for(Q=I+1;I<L;I++,F++,Q++){F===L&&(F=0);Q===L&&(Q=0);ia[I]=d(A[I],A[F],A[Q])}ca.push(ia);Y=Y.concat(ia)}for(F=0;F<m;F++){L=F/m;K=j*(1-L);Q=i*Math.sin(L*Math.PI/2);I=0;for(L=E.length;I<L;I++){V=c(E[I],r[I],Q);f(V.x,V.y,-K)}w=0;for(C=N.length;w<C;w++){A=N[w];ia=ca[w];I=0;for(L=A.length;I<L;I++){V=c(A[I],ia[I],Q);f(V.x,V.y,-K)}}}Q=i;for(I=
+0;I<P;I++){V=l?c(p[I],Y[I],Q):p[I];if(q){D.copy(t.normals[0]).multiplyScalar(V.x);z.copy(t.binormals[0]).multiplyScalar(V.y);G.copy(o[0]).addSelf(D).addSelf(z);f(G.x,G.y,G.z)}else f(V.x,V.y,0)}for(L=1;L<=n;L++)for(I=0;I<P;I++){V=l?c(p[I],Y[I],Q):p[I];if(q){D.copy(t.normals[L]).multiplyScalar(V.x);z.copy(t.binormals[L]).multiplyScalar(V.y);G.copy(o[L]).addSelf(D).addSelf(z);f(G.x,G.y,G.z)}else f(V.x,V.y,h/n*L)}for(F=m-1;F>=0;F--){L=F/m;K=j*(1-L);Q=i*Math.sin(L*Math.PI/2);I=0;for(L=E.length;I<L;I++){V=
 c(E[I],r[I],Q);f(V.x,V.y,h+K)}w=0;for(C=N.length;w<C;w++){A=N[w];ia=ca[w];I=0;for(L=A.length;I<L;I++){V=c(A[I],ia[I],Q);q?f(V.x,V.y+o[n-1].y,o[n-1].x+K):f(V.x,V.y,h+K)}}}(function(){if(l){var a;a=P*0;for(I=0;I<da;I++){aa=$[I];g(aa[2]+a,aa[1]+a,aa[0]+a,true)}a=n+m*2;a=P*a;for(I=0;I<da;I++){aa=$[I];g(aa[0]+a,aa[1]+a,aa[2]+a,false)}}else{for(I=0;I<da;I++){aa=$[I];g(aa[2],aa[1],aa[0],true)}for(I=0;I<da;I++){aa=$[I];g(aa[0]+P*n,aa[1]+P*n,aa[2]+P*n,false)}}})();(function(){var a=0;e(E,a);a=a+E.length;w=
 0;for(C=N.length;w<C;w++){A=N[w];e(A,a);a=a+A.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,a.vertices[d].y),new THREE.UV(b,e),new THREE.UV(c,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,j=a.vertices[g].x,m=a.vertices[g].y,
-g=a.vertices[g].z,l=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,1-e),new THREE.UV(d,1-f),new THREE.UV(j,1-g),new THREE.UV(l,1-a)]:[new THREE.UV(c,1-e),new THREE.UV(i,1-f),new THREE.UV(m,1-g),new THREE.UV(n,1-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.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,a.vertices[d].y),new THREE.UV(b,e),new THREE.UV(c,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,i=a.vertices[g].x,m=a.vertices[g].y,
+g=a.vertices[g].z,l=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,1-e),new THREE.UV(d,1-f),new THREE.UV(i,1-g),new THREE.UV(l,1-a)]:[new THREE.UV(c,1-e),new THREE.UV(j,1-f),new THREE.UV(m,1-g),new THREE.UV(n,1-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=Object.create(THREE.Geometry.prototype);
-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,j=b/d,m=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,-(a*j-f),0));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(m);e.vertexNormals.push(m.clone(),m.clone(),m.clone(),m.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,1-a/d),new THREE.UV(b/c,1-(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,i=b/d,m=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*j-e,-(a*i-f),0));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(m);e.vertexNormals.push(m.clone(),m.clone(),m.clone(),m.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,1-a/d),new THREE.UV(b/c,1-(a+1)/d),new THREE.UV((b+
 1)/c,1-(a+1)/d),new THREE.UV((b+1)/c,1-a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
-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,j=[],m=[];for(i=0;i<=c;i++){var l=[],n=[];for(h=0;h<=b;h++){var p=h/b,r=i/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);l.push(this.vertices.length-1);n.push(new THREE.UV(p,
-1-r))}j.push(l);m.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],f=j[i+1][h],g=j[i+1][h+1],l=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),o=m[i][h+1].clone(),q=m[i][h].clone(),s=m[i+1][h].clone(),x=m[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[l,p,r]));this.faceVertexUvs[0].push([o,s,x])}else if(Math.abs(this.vertices[f].y)==
+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,i=[],m=[];for(j=0;j<=c;j++){var l=[],n=[];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);l.push(this.vertices.length-1);n.push(new THREE.UV(p,
+1-r))}i.push(l);m.push(n)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=i[j][h+1],e=i[j][h],f=i[j+1][h],g=i[j+1][h+1],l=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),o=m[j][h+1].clone(),q=m[j][h].clone(),s=m[j+1][h].clone(),x=m[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[l,p,r]));this.faceVertexUvs[0].push([o,s,x])}else if(Math.abs(this.vertices[f].y)==
 a){this.faces.push(new THREE.Face3(d,e,f,[l,n,p]));this.faceVertexUvs[0].push([o,q,s])}else{this.faces.push(new THREE.Face4(d,e,f,g,[l,n,p,r]));this.faceVertexUvs[0].push([o,q,s,x])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);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=Object.create(THREE.ExtrudeGeometry.prototype);
 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,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.faceVertexUvs[0].push([a[e].clone(),
+this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,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=Object.create(THREE.Geometry.prototype);
 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),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,j,m])}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),i=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,j,i,m])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
-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,j,m,l=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);m=a.getPointAt(d);d=n[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
-m,c,255));this.debug.add(new THREE.ArrowHelper(g,m,c,16711680));this.debug.add(new THREE.ArrowHelper(h,m,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);l.copy(m);l.x=l.x+(j*g.x+i*h.x);l.y=l.y+(j*g.y+i*h.y);l.z=l.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(l.x,l.y,l.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;l=(d+1)%this.segmentsRadius;
+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,i,m,l=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);m=a.getPointAt(d);d=n[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+m,c,255));this.debug.add(new THREE.ArrowHelper(g,m,c,16711680));this.debug.add(new THREE.ArrowHelper(h,m,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;i=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);l.copy(m);l.x=l.x+(i*g.x+j*h.x);l.y=l.y+(i*g.y+j*h.y);l.z=l.z+(i*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(l.x,l.y,l.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;l=(d+1)%this.segmentsRadius;
 a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][l];l=this.grid[b][l];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,l));this.faceVertexUvs[0].push([n,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-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,j,m,l;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++){m=j/(b-1);e[j]=a.getTangentAt(m);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);m=Math.abs(e[0].y);l=Math.abs(e[0].z);if(j<=a){a=j;d.set(1,0,0)}if(m<=a){a=m;d.set(0,1,0)}l<=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(j=1;j<b;j++){f[j]=f[j-1].clone();g[j]=g[j-1].clone();h.cross(e[j-1],e[j]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[j-1].dot(e[j]));i.makeRotationAxis(h,d).multiplyVector3(f[j])}g[j].cross(e[j],f[j])}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(j=1;j<b;j++){i.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
-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,1-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){l[a.index]||(l[a.index]=[]);l[b.index]||(l[b.index]=[]);var c=l[a.index][b.index];c===void 0&&(l[a.index][b.index]=l[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,j=0,m=a.length;j<m;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var l=[],a=this.vertices,j=0,m=b.length;j<m;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(m=this.vertices.length;j<m;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
+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,i,m,l;this.tangents=e;this.normals=f;this.binormals=g;for(i=0;i<b;i++){m=i/(b-1);e[i]=a.getTangentAt(m);e[i].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;i=Math.abs(e[0].x);m=Math.abs(e[0].y);l=Math.abs(e[0].z);if(i<=a){a=i;d.set(1,0,0)}if(m<=a){a=m;d.set(0,1,0)}l<=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(i=1;i<b;i++){f[i]=f[i-1].clone();g[i]=g[i-1].clone();h.cross(e[i-1],e[i]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[i-1].dot(e[i]));j.makeRotationAxis(h,d).multiplyVector3(f[i])}g[i].cross(e[i],f[i])}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(i=1;i<b;i++){j.makeRotationAxis(e[i],d*i).multiplyVector3(f[i]);g[i].cross(e[i],f[i])}}};
+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,1-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){l[a.index]||(l[a.index]=[]);l[b.index]||(l[b.index]=[]);var c=l[a.index][b.index];c===void 0&&(l[a.index][b.index]=l[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,i=0,m=a.length;i<m;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var l=[],a=this.vertices,i=0,m=b.length;i<m;i++)f(a[b[i][0]],a[b[i][1]],a[b[i][2]],d);this.mergeVertices();i=0;for(m=this.vertices.length;i<m;i++)this.vertices[i].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 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=Object.create(THREE.Geometry.prototype);
 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=Object.create(THREE.Geometry.prototype);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=Object.create(THREE.Geometry.prototype);
-THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,j,m,l=b+1;for(h=0;h<=c;h++){m=h/c;for(i=0;i<=b;i++){j=i/b;j=a(j,m);e.push(j)}}var n,p,r,o;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*l+i;e=h*l+i+1;m=(h+1)*l+i;j=(h+1)*l+i+1;n=new THREE.UV(i/b,h/c);p=new THREE.UV((i+1)/b,h/c);r=new THREE.UV(i/b,(h+1)/c);o=new THREE.UV((i+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,m));f.push(new THREE.Face3(e,j,m));g.push([n,
-p,r]);g.push([p,o,r])}else{f.push(new THREE.Face4(a,e,j,m));g.push([n,p,o,r])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,j,i,m,l=b+1;for(h=0;h<=c;h++){m=h/c;for(j=0;j<=b;j++){i=j/b;i=a(i,m);e.push(i)}}var n,p,r,o;for(h=0;h<c;h++)for(j=0;j<b;j++){a=h*l+j;e=h*l+j+1;m=(h+1)*l+j;i=(h+1)*l+j+1;n=new THREE.UV(j/b,h/c);p=new THREE.UV((j+1)/b,h/c);r=new THREE.UV(j/b,(h+1)/c);o=new THREE.UV((j+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,m));f.push(new THREE.Face3(e,i,m));g.push([n,
+p,r]);g.push([p,o,r])}else{f.push(new THREE.Face4(a,e,i,m));g.push([n,p,o,r])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.ConvexGeometry=function(a){function b(b){var d=a[b].clone(),f=d.length();d.x=d.x+f*c();d.y=d.y+f*c();d.z=d.z+f*c();for(var f=[],g=0;g<e.length;){var h=e[g],i=d,j=a[h[0]],s;s=j;var x=a[h[1]],u=a[h[2]],t=new THREE.Vector3,z=new THREE.Vector3;t.sub(u,x);z.sub(s,x);t.crossSelf(z);t.isZero()||t.normalize();s=t;j=s.dot(j);if(s.dot(i)>=j){for(i=0;i<3;i++){j=[h[i],h[(i+1)%3]];s=true;for(x=0;x<f.length;x++)if(f[x][0]===j[1]&&f[x][1]===j[0]){f[x]=f[f.length-1];f.pop();s=false;break}s&&f.push(j)}e[g]=
-e[e.length-1];e.pop()}else g++}for(x=0;x<f.length;x++)e.push([f[x][0],f[x][1],b])}function c(){return(Math.random()-0.5)*2.0E-6}function d(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var e=[[0,1,2],[0,2,1]],f=3;f<a.length;f++)b(f);for(var g=0,h=Array(a.length),f=0;f<e.length;f++)for(var i=e[f],j=0;j<3;j++){if(h[i[j]]===void 0){h[i[j]]=g++;this.vertices.push(a[i[j]])}i[j]=h[i[j]]}for(f=0;f<e.length;f++)this.faces.push(new THREE.Face3(e[f][0],e[f][1],e[f][2]));
-for(f=0;f<this.faces.length;f++){i=this.faces[f];this.faceVertexUvs[0].push([d(this.vertices[i.a]),d(this.vertices[i.b]),d(this.vertices[i.c])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);
+e[e.length-1];e.pop()}else g++}for(x=0;x<f.length;x++)e.push([f[x][0],f[x][1],b])}function c(){return(Math.random()-0.5)*2.0E-6}function d(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var e=[[0,1,2],[0,2,1]],f=3;f<a.length;f++)b(f);for(var g=0,h=Array(a.length),f=0;f<e.length;f++)for(var j=e[f],i=0;i<3;i++){if(h[j[i]]===void 0){h[j[i]]=g++;this.vertices.push(a[j[i]])}j[i]=h[j[i]]}for(f=0;f<e.length;f++)this.faces.push(new THREE.Face3(e[f][0],e[f][1],e[f][2]));
+for(f=0;f<this.faces.length;f++){j=this.faces[f];this.faceVertexUvs[0].push([d(this.vertices[j.a]),d(this.vertices[j.b]),d(this.vertices[j.c])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);
 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=Object.create(THREE.Object3D.prototype);
 THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);if(b instanceof THREE.Vector3)this.position=
@@ -720,56 +720,56 @@ THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraH
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};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,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.materialIndex);if(n.useOldVertexColors){j.vertexColors=[];for(var o,p,q,r=0;r<4;r++){q=h[r];o=new THREE.Color;o.setRGB(0,0,0);for(var s=0;s<q.length;s++){p=g.vertexColors[q[s]-1];o.r=o.r+p.r;o.g=o.g+p.g;o.b=o.b+p.b}o.r=o.r/q.length;o.g=o.g/q.length;o.b=o.b/
 q.length;j.vertexColors[r]=o}}m.push(j);if(n.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?l.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=x[e];if(!f){a>=u&&a<u+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 x?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,x[e]):x[e]=d}function h(a,
-b){N[a]===void 0&&(N[a]=[]);N[a].push(b)}function i(a,b,c){$[a]===void 0&&($[a]={});$[a][b]=c}var j=[],m=[],l=[],n=this,p=a.vertices,r=a.faces,j=p.concat(),o=[],q={},s={},x={},u=p.length,t,z,D,G,A,w=a.faceVertexUvs[0],C;b("originalFaces, uvs, originalVerticesLength",r.length,w.length,u);if(n.supportUVs){t=0;for(z=w.length;t<z;t++){D=0;for(G=w[t].length;D<G;D++){C=r[t]["abcd".charAt(D)];g(C,t,w[t][D])}}}if(w.length==0)n.supportUVs=false;t=0;for(A in x)t++;if(!t){n.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-x,"vs",w.length);t=0;for(z=r.length;t<z;t++){A=r[t];o.push(A.centroid);j.push(A.centroid);if(n.supportUVs){w=new THREE.UV;if(A instanceof THREE.Face3){w.u=f(A.a,t).u+f(A.b,t).u+f(A.c,t).u;w.v=f(A.a,t).v+f(A.b,t).v+f(A.c,t).v;w.u=w.u/3;w.v=w.v/3}else if(A instanceof THREE.Face4){w.u=f(A.a,t).u+f(A.b,t).u+f(A.c,t).u+f(A.d,t).u;w.v=f(A.a,t).v+f(A.b,t).v+f(A.c,t).v+f(A.d,t).v;w.u=w.u/4;w.v=w.v/4}g(u+t,"",w)}}b("-- added UVs for new Faces",x);z=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);C=0;var H,O,N={},$={};for(t in z){w=z[t];H=t.split("_");O=H[0];H=H[1];h(O,[O,H]);h(H,[O,H]);D=0;for(G=w.length;D<G;D++){A=w[D];i(O,A,t);i(H,A,t)}w.length<2&&(s[t]=true)}b("vertexEdgeMap",N,"vertexFaceMap",$);for(t in z){w=
-z[t];A=w[0];G=w[1];H=t.split("_");O=H[0];H=H[1];w=new THREE.Vector3;if(s[t]){w.addSelf(p[O]);w.addSelf(p[H]);w.multiplyScalar(0.5)}else{w.addSelf(o[A]);w.addSelf(o[G]);w.addSelf(p[O]);w.addSelf(p[H]);w.multiplyScalar(0.25)}q[t]=u+r.length+C;j.push(w);C++;if(n.supportUVs){w=new THREE.UV;w.u=f(O,A).u+f(H,A).u;w.v=f(O,A).v+f(H,A).v;w.u=w.u/2;w.v=w.v/2;g(q[t],A,w);if(!s[t]){w=new THREE.UV;w.u=f(O,G).u+f(H,G).u;w.v=f(O,G).v+f(H,G).v;w.u=w.u/2;w.v=w.v/2;g(q[t],G,w)}}}b("-- Step 2 done");var E,F;G=["123",
+b){N[a]===void 0&&(N[a]=[]);N[a].push(b)}function j(a,b,c){$[a]===void 0&&($[a]={});$[a][b]=c}var i=[],m=[],l=[],n=this,p=a.vertices,r=a.faces,i=p.concat(),o=[],q={},s={},x={},u=p.length,t,z,D,G,A,w=a.faceVertexUvs[0],C;b("originalFaces, uvs, originalVerticesLength",r.length,w.length,u);if(n.supportUVs){t=0;for(z=w.length;t<z;t++){D=0;for(G=w[t].length;D<G;D++){C=r[t]["abcd".charAt(D)];g(C,t,w[t][D])}}}if(w.length==0)n.supportUVs=false;t=0;for(A in x)t++;if(!t){n.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
+x,"vs",w.length);t=0;for(z=r.length;t<z;t++){A=r[t];o.push(A.centroid);i.push(A.centroid);if(n.supportUVs){w=new THREE.UV;if(A instanceof THREE.Face3){w.u=f(A.a,t).u+f(A.b,t).u+f(A.c,t).u;w.v=f(A.a,t).v+f(A.b,t).v+f(A.c,t).v;w.u=w.u/3;w.v=w.v/3}else if(A instanceof THREE.Face4){w.u=f(A.a,t).u+f(A.b,t).u+f(A.c,t).u+f(A.d,t).u;w.v=f(A.a,t).v+f(A.b,t).v+f(A.c,t).v+f(A.d,t).v;w.u=w.u/4;w.v=w.v/4}g(u+t,"",w)}}b("-- added UVs for new Faces",x);z=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);C=0;var H,O,N={},$={};for(t in z){w=z[t];H=t.split("_");O=H[0];H=H[1];h(O,[O,H]);h(H,[O,H]);D=0;for(G=w.length;D<G;D++){A=w[D];j(O,A,t);j(H,A,t)}w.length<2&&(s[t]=true)}b("vertexEdgeMap",N,"vertexFaceMap",$);for(t in z){w=
+z[t];A=w[0];G=w[1];H=t.split("_");O=H[0];H=H[1];w=new THREE.Vector3;if(s[t]){w.addSelf(p[O]);w.addSelf(p[H]);w.multiplyScalar(0.5)}else{w.addSelf(o[A]);w.addSelf(o[G]);w.addSelf(p[O]);w.addSelf(p[H]);w.multiplyScalar(0.25)}q[t]=u+r.length+C;i.push(w);C++;if(n.supportUVs){w=new THREE.UV;w.u=f(O,A).u+f(H,A).u;w.v=f(O,A).v+f(H,A).v;w.u=w.u/2;w.v=w.v/2;g(q[t],A,w);if(!s[t]){w=new THREE.UV;w.u=f(O,G).u+f(H,G).u;w.v=f(O,G).v+f(H,G).v;w.u=w.u/2;w.v=w.v/2;g(q[t],G,w)}}}b("-- Step 2 done");var E,F;G=["123",
 "12","2","23"];H=["123","23","3","31"];var Q=["123","31","1","12"],L=["1234","12","2","23"],K=["1234","23","3","34"],V=["1234","34","4","41"],P=["1234","41","1","12"];t=0;for(z=o.length;t<z;t++){A=r[t];w=u+t;if(A instanceof THREE.Face3){C=e(A.a,A.b);O=e(A.b,A.c);E=e(A.c,A.a);d(w,q[C],A.b,q[O],A,G,t);d(w,q[O],A.c,q[E],A,H,t);d(w,q[E],A.a,q[C],A,Q,t)}else if(A instanceof THREE.Face4){C=e(A.a,A.b);O=e(A.b,A.c);E=e(A.c,A.d);F=e(A.d,A.a);d(w,q[C],A.b,q[O],A,L,t);d(w,q[O],A.c,q[E],A,K,t);d(w,q[E],A.d,q[F],
 A,V,t);d(w,q[F],A.a,q[C],A,P,t)}else b("face should be a face!",A)}q=new THREE.Vector3;A=new THREE.Vector3;t=0;for(z=p.length;t<z;t++)if(N[t]!==void 0){q.set(0,0,0);A.set(0,0,0);O=new THREE.Vector3(0,0,0);w=0;for(D in $[t]){q.addSelf(o[D]);w++}G=0;C=N[t].length;for(D=0;D<C;D++)s[e(N[t][D][0],N[t][D][1])]&&G++;if(G!=2){q.divideScalar(w);for(D=0;D<C;D++){w=N[t][D];w=p[w[0]].clone().addSelf(p[w[1]]).divideScalar(2);A.addSelf(w)}A.divideScalar(C);O.addSelf(p[t]);O.multiplyScalar(C-3);O.addSelf(q);O.addSelf(A.multiplyScalar(2));
-O.divideScalar(C);j[t]=O}}a.vertices=j;a.faces=m;a.faceVertexUvs[0]=l;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
+O.divideScalar(C);i[t]=O}}a.vertices=i;a.faces=m;a.faceVertexUvs[0]=l;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
 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=Object.create(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=Object.create(THREE.Mesh.prototype);
 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,j,m,l,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){j=false;m=a(THREE.ShaderFlares.lensFlare)}else{j=true;m=a(THREE.ShaderFlares.lensFlareVertexTexture)}l={};n={};l.vertex=b.getAttribLocation(m,"position");l.uv=b.getAttribLocation(m,"uv");n.renderType=b.getUniformLocation(m,"renderType");n.map=b.getUniformLocation(m,"map");n.occlusionMap=b.getUniformLocation(m,"occlusionMap");n.opacity=b.getUniformLocation(m,"opacity");n.color=b.getUniformLocation(m,
+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,i,m,l,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();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){i=false;m=a(THREE.ShaderFlares.lensFlare)}else{i=true;m=a(THREE.ShaderFlares.lensFlareVertexTexture)}l={};n={};l.vertex=b.getAttribLocation(m,"position");l.uv=b.getAttribLocation(m,"uv");n.renderType=b.getUniformLocation(m,"renderType");n.map=b.getUniformLocation(m,"map");n.occlusionMap=b.getUniformLocation(m,"occlusionMap");n.opacity=b.getUniformLocation(m,"opacity");n.color=b.getUniformLocation(m,
 "color");n.scale=b.getUniformLocation(m,"scale");n.rotation=b.getUniformLocation(m,"rotation");n.screenPosition=b.getUniformLocation(m,"screenPosition");p=false};this.render=function(a,d,e,s){var a=a.__webglFlares,x=a.length;if(x){var u=new THREE.Vector3,t=s/e,z=e*0.5,D=s*0.5,G=16/s,A=new THREE.Vector2(G*t,G),w=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),H=n,G=l;b.useProgram(m);if(!p){b.enableVertexAttribArray(l.vertex);b.enableVertexAttribArray(l.uv);p=true}b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(G.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(G.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var O,N,$,E,F;for(O=0;O<x;O++){G=16/s;A.set(G*t,G);E=a[O];u.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(u);d.projectionMatrix.multiplyVector3(u);w.copy(u);C.x=w.x*z+z;C.y=w.y*D+D;if(j||C.x>0&&C.x<e&&C.y>0&&
-C.y<s){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(H.renderType,0);b.uniform2f(H.scale,A.x,A.y);b.uniform3f(H.screenPosition,w.x,w.y,w.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(H.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(G.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(G.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var O,N,$,E,F;for(O=0;O<x;O++){G=16/s;A.set(G*t,G);E=a[O];u.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(u);d.projectionMatrix.multiplyVector3(u);w.copy(u);C.x=w.x*z+z;C.y=w.y*D+D;if(i||C.x>0&&C.x<e&&C.y>0&&
+C.y<s){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(H.renderType,0);b.uniform2f(H.scale,A.x,A.y);b.uniform3f(H.screenPosition,w.x,w.y,w.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,C.x-8,C.y-8,16,16,0);b.uniform1i(H.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);E.positionScreen.copy(w);E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares();b.uniform1i(H.renderType,2);b.enable(b.BLEND);N=0;for($=E.lensFlares.length;N<$;N++){F=E.lensFlares[N];if(F.opacity>0.001&&F.scale>0.001){w.x=F.x;w.y=F.y;w.z=F.z;G=F.size*F.scale/s;A.x=G*t;A.y=G;b.uniform3f(H.screenPosition,w.x,w.y,w.z);b.uniform2f(H.scale,A.x,A.y);b.uniform1f(H.rotation,F.rotation);b.uniform1f(H.opacity,F.opacity);
 b.uniform3f(H.color,F.color.r,F.color.g,F.color.b);c.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst);c.setTexture(F.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,f=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,i=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
-vertexShader:f.vertexShader,uniforms:g,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,m){var l,n,p,r,o,q,s,x,u,t=[];r=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);l=0;for(n=j.__lights.length;l<n;l++){p=j.__lights[l];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&
+THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,j=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
+vertexShader:f.vertexShader,uniforms:g,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,m){var l,n,p,r,o,q,s,x,u,t=[];r=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);l=0;for(n=i.__lights.length;l<n;l++){p=i.__lights[l];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&
 p.shadowCascade)for(o=0;o<p.shadowCascadeCount;o++){var z;if(p.shadowCascadeArray[o])z=p.shadowCascadeArray[o];else{u=p;s=o;z=new THREE.DirectionalLight;z.isVirtual=true;z.onlyShadow=true;z.castShadow=true;z.shadowCameraNear=u.shadowCameraNear;z.shadowCameraFar=u.shadowCameraFar;z.shadowCameraLeft=u.shadowCameraLeft;z.shadowCameraRight=u.shadowCameraRight;z.shadowCameraBottom=u.shadowCameraBottom;z.shadowCameraTop=u.shadowCameraTop;z.shadowCameraVisible=u.shadowCameraVisible;z.shadowDarkness=u.shadowDarkness;
 z.shadowBias=u.shadowCascadeBias[s];z.shadowMapWidth=u.shadowCascadeWidth[s];z.shadowMapHeight=u.shadowCascadeHeight[s];z.pointsWorld=[];z.pointsFrustum=[];x=z.pointsWorld;q=z.pointsFrustum;for(var D=0;D<8;D++){x[D]=new THREE.Vector3;q[D]=new THREE.Vector3}x=u.shadowCascadeNearZ[s];u=u.shadowCascadeFarZ[s];q[0].set(-1,-1,x);q[1].set(1,-1,x);q[2].set(-1,1,x);q[3].set(1,1,x);q[4].set(-1,-1,u);q[5].set(1,-1,u);q[6].set(-1,1,u);q[7].set(1,1,u);z.originalCamera=m;q=new THREE.Gyroscope;q.position=p.shadowCascadeOffset;
 q.add(z);q.add(z.target);m.add(q);p.shadowCascadeArray[o]=z;console.log("Created virtualLight",z)}s=p;x=o;u=s.shadowCascadeArray[x];u.position.copy(s.position);u.target.position.copy(s.target.position);u.lookAt(u.target);u.shadowCameraVisible=s.shadowCameraVisible;u.shadowDarkness=s.shadowDarkness;u.shadowBias=s.shadowCascadeBias[x];q=s.shadowCascadeNearZ[x];s=s.shadowCascadeFarZ[x];u=u.pointsFrustum;u[0].z=q;u[1].z=q;u[2].z=q;u[3].z=q;u[4].z=s;u[5].z=s;u[6].z=s;u[7].z=s;t[r]=z;r++}else{t[r]=p;r++}}l=
 0;for(n=t.length;l<n;l++){p=t[l];if(!p.shadowMap){p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight);p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof
-THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(p.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(p.shadowCameraVisible&&!p.cameraHelper){p.cameraHelper=new THREE.CameraHelper(p.shadowCamera);p.shadowCamera.add(p.cameraHelper)}if(p.isVirtual&&z.originalCamera==m){o=m;r=p.shadowCamera;
-q=p.pointsFrustum;u=p.pointsWorld;h.set(Infinity,Infinity,Infinity);i.set(-Infinity,-Infinity,-Infinity);for(s=0;s<8;s++){x=u[s];x.copy(q[s]);THREE.ShadowMapPlugin.__projector.unprojectVector(x,o);r.matrixWorldInverse.multiplyVector3(x);if(x.x<h.x)h.x=x.x;if(x.x>i.x)i.x=x.x;if(x.y<h.y)h.y=x.y;if(x.y>i.y)i.y=x.y;if(x.z<h.z)h.z=x.z;if(x.z>i.z)i.z=x.z}r.left=h.x;r.right=i.x;r.top=i.y;r.bottom=h.y;r.updateProjectionMatrix()}r=p.shadowMap;q=p.shadowMatrix;o=p.shadowCamera;o.position.copy(p.matrixWorld.getPosition());
+THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(p.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(p.shadowCameraVisible&&!p.cameraHelper){p.cameraHelper=new THREE.CameraHelper(p.shadowCamera);p.shadowCamera.add(p.cameraHelper)}if(p.isVirtual&&z.originalCamera==m){o=m;r=p.shadowCamera;
+q=p.pointsFrustum;u=p.pointsWorld;h.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(s=0;s<8;s++){x=u[s];x.copy(q[s]);THREE.ShadowMapPlugin.__projector.unprojectVector(x,o);r.matrixWorldInverse.multiplyVector3(x);if(x.x<h.x)h.x=x.x;if(x.x>j.x)j.x=x.x;if(x.y<h.y)h.y=x.y;if(x.y>j.y)j.y=x.y;if(x.z<h.z)h.z=x.z;if(x.z>j.z)j.z=x.z}r.left=h.x;r.right=j.x;r.top=j.y;r.bottom=h.y;r.updateProjectionMatrix()}r=p.shadowMap;q=p.shadowMatrix;o=p.shadowCamera;o.position.copy(p.matrixWorld.getPosition());
 o.lookAt(p.target.matrixWorld.getPosition());o.updateMatrixWorld();o.matrixWorldInverse.getInverse(o.matrixWorld);if(p.cameraHelper)p.cameraHelper.lines.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update();q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(o.projectionMatrix);q.multiplySelf(o.matrixWorldInverse);if(!o._viewMatrixArray)o._viewMatrixArray=new Float32Array(16);if(!o._projectionMatrixArray)o._projectionMatrixArray=new Float32Array(16);o.matrixWorldInverse.flattenToArray(o._viewMatrixArray);
-o.projectionMatrix.flattenToArray(o._projectionMatrixArray);g.multiply(o.projectionMatrix,o.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(r);b.clear();u=j.__webglObjects;p=0;for(r=u.length;p<r;p++){s=u[p];q=s.object;s.render=false;if(q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q))){q._modelViewMatrix.multiply(o.matrixWorldInverse,q.matrixWorld);s.render=true}}p=0;for(r=u.length;p<r;p++){s=u[p];if(s.render){q=s.object;s=s.buffer;x=q.customDepthMaterial?
-q.customDepthMaterial:q.geometry.morphTargets.length?d:q instanceof THREE.SkinnedMesh?e:c;s instanceof THREE.BufferGeometry?b.renderBufferDirect(o,j.__lights,null,x,s,q):b.renderBuffer(o,j.__lights,null,x,s,q)}}u=j.__webglObjectsImmediate;p=0;for(r=u.length;p<r;p++){s=u[p];q=s.object;if(q.visible&&q.castShadow){q._modelViewMatrix.multiply(o.matrixWorldInverse,q.matrixWorld);b.renderImmediateObject(o,j.__lights,null,c,q)}}}l=b.getClearColor();n=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,n);a.enable(a.BLEND);
+o.projectionMatrix.flattenToArray(o._projectionMatrixArray);g.multiply(o.projectionMatrix,o.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(r);b.clear();u=i.__webglObjects;p=0;for(r=u.length;p<r;p++){s=u[p];q=s.object;s.render=false;if(q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q))){q._modelViewMatrix.multiply(o.matrixWorldInverse,q.matrixWorld);s.render=true}}p=0;for(r=u.length;p<r;p++){s=u[p];if(s.render){q=s.object;s=s.buffer;x=q.customDepthMaterial?
+q.customDepthMaterial:q.geometry.morphTargets.length?d:q instanceof THREE.SkinnedMesh?e:c;s instanceof THREE.BufferGeometry?b.renderBufferDirect(o,i.__lights,null,x,s,q):b.renderBuffer(o,i.__lights,null,x,s,q)}}u=i.__webglObjectsImmediate;p=0;for(r=u.length;p<r;p++){s=u[p];q=s.object;if(q.visible&&q.castShadow){q._modelViewMatrix.multiply(o.matrixWorldInverse,q.matrixWorld);b.renderImmediateObject(o,i.__lights,null,c,q)}}}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,i,j,m;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++]=0;d[a++]=1;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++]=0;d[a++]=1;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={};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");m=false};this.render=function(d,e,p,r){var d=d.__webglSprites,o=d.length;if(o){var q=i,s=j,x=r/p,p=p*0.5,u=r*0.5,t=true;b.useProgram(h);if(!m){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);m=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,
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,j,i,m;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++]=0;d[a++]=1;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++]=0;d[a++]=1;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;j={};i={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,"uv");i.uvOffset=b.getUniformLocation(h,"uvOffset");i.uvScale=b.getUniformLocation(h,
+"uvScale");i.rotation=b.getUniformLocation(h,"rotation");i.scale=b.getUniformLocation(h,"scale");i.alignment=b.getUniformLocation(h,"alignment");i.color=b.getUniformLocation(h,"color");i.map=b.getUniformLocation(h,"map");i.opacity=b.getUniformLocation(h,"opacity");i.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");i.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");i.screenPosition=b.getUniformLocation(h,"screenPosition");i.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
+i.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");m=false};this.render=function(d,e,p,r){var d=d.__webglSprites,o=d.length;if(o){var q=j,s=i,x=r/p,p=p*0.5,u=r*0.5,t=true;b.useProgram(h);if(!m){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);m=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(s.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var z,D=[],q=0;q<o;q++){z=d[q];if(z.visible&&z.opacity!==0)if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiply(e.matrixWorldInverse,z.matrixWorld);z.z=-z._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<o;q++){z=d[q];if(z.visible&&z.opacity!==0&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){b.uniform1i(s.useScreenCoordinates,1);
 b.uniform3f(s.screenPosition,(z.position.x-p)/p,(u-z.position.y)/u,Math.max(0,Math.min(1,z.position.z)))}else{b.uniform1i(s.useScreenCoordinates,0);b.uniform1i(s.affectedByDistance,z.affectedByDistance?1:0);b.uniformMatrix4fv(s.modelViewMatrix,false,z._modelViewMatrix.elements)}e=z.map.image.width/(z.scaleByViewport?r:1);D[0]=e*x*z.scale.x;D[1]=e*z.scale.y;b.uniform2f(s.uvScale,z.uvScale.x,z.uvScale.y);b.uniform2f(s.uvOffset,z.uvOffset.x,z.uvOffset.y);b.uniform2f(s.alignment,z.alignment.x,z.alignment.y);
 b.uniform1f(s.opacity,z.opacity);b.uniform3f(s.color,z.color.r,z.color.g,z.color.b);b.uniform1f(s.rotation,z.rotation);b.uniform2fv(s.scale,D);if(z.mergeWith3D&&!t){b.enable(b.DEPTH_TEST);t=true}else if(!z.mergeWith3D&&t){b.disable(b.DEPTH_TEST);t=false}c.setBlending(z.blending,z.blendEquation,z.blendSrc,z.blendDst);c.setTexture(z.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,j,m,l,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(j=p.length;i<j;i++){m=p[i];n=m.object;m.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);m.render=true}}i=0;for(j=p.length;i<j;i++){m=p[i];if(m.render){n=m.object;m=m.buffer;n.material&&b.setMaterialFaces(n.material);l=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?
-d:c;m instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,l,m,n):b.renderBuffer(h,g.__lights,null,l,m,n)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){m=p[i];n=m.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,i,m,l,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;j=0;for(i=p.length;j<i;j++){m=p[j];n=m.object;m.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);m.render=true}}j=0;for(i=p.length;j<i;j++){m=p[j];if(m.render){n=m.object;m=m.buffer;n.material&&b.setMaterialFaces(n.material);l=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?
+d:c;m instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,l,m,n):b.renderBuffer(h,g.__lights,null,l,m,n)}}p=g.__webglObjectsImmediate;j=0;for(i=p.length;j<i;j++){m=p[j];n=m.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}j=b.getClearColor();i=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,i);a.enable(a.BLEND)}};
 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}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\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 sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 109 - 109
build/custom/ThreeCanvas.js

@@ -16,8 +16,8 @@ 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},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],j=d[1],m=d[5],l=d[9],h=d[2],n=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-l,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(j,m);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(l));if(Math.abs(l)<
-0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(j,m)}else{this.y=Math.atan2(-h,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(n));if(Math.abs(n)<0.99999){this.y=Math.atan2(-h,d);this.z=Math.atan2(-e,m)}else{this.y=0;this.z=Math.atan2(g,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(j,f)}else{this.x=0;this.z=Math.atan2(-e,m)}}else if(b==="YZX"){this.z=Math.asin(c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(-l,m);this.y=Math.atan2(-h,
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],j=d[1],m=d[5],k=d[9],h=d[2],n=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-k,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(j,m);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(k));if(Math.abs(k)<
+0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(j,m)}else{this.y=Math.atan2(-h,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(n));if(Math.abs(n)<0.99999){this.y=Math.atan2(-h,d);this.z=Math.atan2(-e,m)}else{this.y=0;this.z=Math.atan2(g,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(j,f)}else{this.x=0;this.z=Math.atan2(-e,m)}}else if(b==="YZX"){this.z=Math.asin(c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(-k,m);this.y=Math.atan2(-h,
 f)}else{this.x=0;this.y=Math.atan2(h,d)}}else if(b==="XZY"){this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(n,m);this.y=Math.atan2(g,f)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-f+e);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-f-e)}else if(b===
 "YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-f+e);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+f-e)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-f+e);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+f-e)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-f+e);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-f-e)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 a.y),g-d+f-e);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-f-e);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+f-e);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-f-e);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}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=
@@ -25,74 +25,74 @@ b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===t
 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)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
-a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],j=a[5],m=a[9];c=a[2];b=a[6];var l=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(m-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(m+b)<0.1&&Math.abs(f+j+l-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;j=(j+1)/2;l=(l+1)/2;d=(d+g)/4;e=(e+c)/4;m=(m+b)/4;if(f>j&&f>l)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(j>
-l)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=m/c}else if(l<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(l);b=e/d;c=m/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-m)*(b-m)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-m)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+j+l-1)/2);return this}};
+a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],j=a[5],m=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(m-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(m+b)<0.1&&Math.abs(f+j+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;j=(j+1)/2;k=(k+1)/2;d=(d+g)/4;e=(e+c)/4;m=(m+b)/4;if(f>j&&f>k)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(j>
+k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=m/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=e/d;c=m/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-m)*(b-m)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-m)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+j+k-1)/2);return this}};
 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.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=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],j=c[5],m=c[6],l=c[7],h=c[8],n=c[9],k=c[10],o=c[11],q=c[12],i=c[13],p=c[14],c=c[15];b[0].set(e-a,l-g,o-h,c-q);b[1].set(e+a,l+g,o+h,c+q);b[2].set(e+d,l+j,o+n,c+i);b[3].set(e-d,l-j,o-n,c-i);b[4].set(e-f,l-m,o-k,c-p);b[5].set(e+f,l+m,o+k,c+p);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
+THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],j=c[5],m=c[6],k=c[7],h=c[8],n=c[9],l=c[10],o=c[11],q=c[12],i=c[13],p=c[14],c=c[15];b[0].set(e-a,k-g,o-h,c-q);b[1].set(e+a,k+g,o+h,c+q);b[2].set(e+d,k+j,o+n,c+i);b[3].set(e-d,k-j,o-n,c-i);b[4].set(e-f,k-m,o-l,c-p);b[5].set(e+f,k+m,o+l,c+p);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),f=0;f<6;f++){b=c[f].x*d[12]+c[f].y*d[13]+c[f].z*d[14]+c[f].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3,k=new THREE.Vector3,o=function(a,b){return a.distance-b.distance},q=new THREE.Vector3,i=new THREE.Vector3,p=new THREE.Vector3,r,u,v,B=function(a,b,c){q.sub(c,a);r=q.dot(b);u=i.add(a,p.copy(b).multiplyScalar(r));
+THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3,o=function(a,b){return a.distance-b.distance},q=new THREE.Vector3,i=new THREE.Vector3,p=new THREE.Vector3,r,u,v,B=function(a,b,c){q.sub(c,a);r=q.dot(b);u=i.add(a,p.copy(b).multiplyScalar(r));
 return v=c.distanceTo(u)},x,A,y,E,s,w,C,K,M=function(a,b,c,d){q.sub(d,b);i.sub(c,b);p.sub(a,b);x=q.dot(q);A=q.dot(i);y=q.dot(p);E=i.dot(i);s=i.dot(p);w=1/(x*E-A*A);C=(E*y-A*s)*w;K=(x*s-A*y)*w;return C>=0&&K>=0&&C+K<1},N=1.0E-4;this.setPrecision=function(a){N=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var i=0,q=a.children.length;i<q;i++)Array.prototype.push.apply(d,this.intersectObject(a.children[i],b));if(a instanceof THREE.Particle){v=B(this.origin,this.direction,a.matrixWorld.getPosition());
 if(v>a.scale.x)return[];c={distance:v,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){i=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());i=a.geometry.boundingSphere.radius*Math.max(i.x,Math.max(i.y,i.z));v=B(this.origin,this.direction,a.matrixWorld.getPosition());if(v>i)return d;var z,p,r=a.geometry,J=r.vertices,s;a.matrixRotationWorld.extractRotation(a.matrixWorld);i=0;for(q=r.faces.length;i<
-q;i++){c=r.faces[i];m.copy(this.origin);l.copy(this.direction);s=a.matrixWorld;h=s.multiplyVector3(h.copy(c.centroid)).subSelf(m);n=a.matrixRotationWorld.multiplyVector3(n.copy(c.normal));z=l.dot(n);if(!(Math.abs(z)<N)){p=n.dot(h)/z;if(!(p<0)&&(a.doubleSided||(a.flipSided?z>0:z<0))){k.add(m,l.multiplyScalar(p));v=m.distanceTo(k);if(!(v<this.near)&&!(v>this.far))if(c instanceof THREE.Face3){f=s.multiplyVector3(f.copy(J[c.a]));e=s.multiplyVector3(e.copy(J[c.b]));g=s.multiplyVector3(g.copy(J[c.c]));
-if(M(k,f,e,g)){c={distance:v,point:k.clone(),face:c,faceIndex:i,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=s.multiplyVector3(f.copy(J[c.a]));e=s.multiplyVector3(e.copy(J[c.b]));g=s.multiplyVector3(g.copy(J[c.c]));j=s.multiplyVector3(j.copy(J[c.d]));if(M(k,f,e,j)||M(k,e,g,j)){c={distance:v,point:k.clone(),face:c,faceIndex:i,object:a};d.push(c)}}}}}}d.sort(o);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],
+q;i++){c=r.faces[i];m.copy(this.origin);k.copy(this.direction);s=a.matrixWorld;h=s.multiplyVector3(h.copy(c.centroid)).subSelf(m);n=a.matrixRotationWorld.multiplyVector3(n.copy(c.normal));z=k.dot(n);if(!(Math.abs(z)<N)){p=n.dot(h)/z;if(!(p<0)&&(a.doubleSided||(a.flipSided?z>0:z<0))){l.add(m,k.multiplyScalar(p));v=m.distanceTo(l);if(!(v<this.near)&&!(v>this.far))if(c instanceof THREE.Face3){f=s.multiplyVector3(f.copy(J[c.a]));e=s.multiplyVector3(e.copy(J[c.b]));g=s.multiplyVector3(g.copy(J[c.c]));
+if(M(l,f,e,g)){c={distance:v,point:l.clone(),face:c,faceIndex:i,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=s.multiplyVector3(f.copy(J[c.a]));e=s.multiplyVector3(e.copy(J[c.b]));g=s.multiplyVector3(g.copy(J[c.c]));j=s.multiplyVector3(j.copy(J[c.d]));if(M(l,f,e,j)||M(l,e,g,j)){c={distance:v,point:l.clone(),face:c,faceIndex:i,object:a};d.push(c)}}}}}}d.sort(o);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],
 b));c.sort(o);return c}};
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b=0,c=0,d=0,f=0,e=0,g=0,j=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,h,n){j=false;b=e;c=g;d=h;f=n;a()};this.addPoint=function(e,g){if(j===true){j=false;b=e;c=g;d=e;f=g}else{b=b<e?b:e;c=c<g?c:
-g;d=d>e?d:e;f=f>g?f:g}a()};this.add3Points=function(e,g,h,n,k,o){if(j===true){j=false;b=e<h?e<k?e:k:h<k?h:k;c=g<n?g<o?g:o:n<o?n:o;d=e>h?e>k?e:k:h>k?h:k;f=g>n?g>o?g:o:n>o?n:o}else{b=e<h?e<k?e<b?e:b:k<b?k:b:h<k?h<b?h:b:k<b?k:b;c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;d=e>h?e>k?e>d?e:d:k>d?k:d:h>k?h>d?h:d:k>d?k:d;f=g>n?g>o?g>f?g:f:o>f?o:f:n>o?n>f?n:f:o>f?o:f}a()};this.addRectangle=function(e){if(j===true){j=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();
+g;d=d>e?d:e;f=f>g?f:g}a()};this.add3Points=function(e,g,h,n,l,o){if(j===true){j=false;b=e<h?e<l?e:l:h<l?h:l;c=g<n?g<o?g:o:n<o?n:o;d=e>h?e>l?e:l:h>l?h:l;f=g>n?g>o?g:o:n>o?n:o}else{b=e<h?e<l?e<b?e:b:l<b?l:b:h<l?h<b?h:b:l<b?l:b;c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;d=e>h?e>l?e>d?e:d:l>d?l:d:h>l?h>d?h:d:l>d?l:d;f=g>n?g>o?g>f?g:f:o>f?o:f:n>o?n>f?n:f:o>f?o:f}a()};this.addRectangle=function(e){if(j===true){j=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();
 c=c<e.getTop()?c:e.getTop();d=d>e.getRight()?d:e.getRight();f=f>e.getBottom()?f:e.getBottom()}a()};this.inflate=function(e){b=b-e;c=c-e;d=d+e;f=f+e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){j=true;f=d=c=b=0;a()};this.isEmpty=function(){return j}};
 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,f){return d+(a-b)*(f-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],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*j;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*f;h[4]=b*e;h[5]=b*g;h[6]=b*j;h[7]=b*m;h[8]=b*l;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,f,e,g,j,m,l,h,n,k,o,q,i){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,j||0,m||0,l||0,h!==void 0?h:1,n||0,k||0,o||0,q||0,i!==void 0?i:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,j,m,l,h,n,k,o,q,i){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=f;p[5]=e;p[9]=g;p[13]=j;p[2]=m;p[6]=l;p[10]=h;p[14]=n;p[3]=k;p[7]=o;p[11]=q;p[15]=i;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,
-f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1.0E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],j=c[8],m=c[12],l=c[1],h=c[5],n=c[9],k=c[13],o=c[2],q=c[6],i=c[10],p=c[14],r=c[3],u=c[7],v=c[11],c=c[15],B=d[0],x=d[4],
-A=d[8],y=d[12],E=d[1],s=d[5],w=d[9],C=d[13],K=d[2],M=d[6],N=d[10],t=d[14],G=d[3],I=d[7],O=d[11],d=d[15];f[0]=e*B+g*E+j*K+m*G;f[4]=e*x+g*s+j*M+m*I;f[8]=e*A+g*w+j*N+m*O;f[12]=e*y+g*C+j*t+m*d;f[1]=l*B+h*E+n*K+k*G;f[5]=l*x+h*s+n*M+k*I;f[9]=l*A+h*w+n*N+k*O;f[13]=l*y+h*C+n*t+k*d;f[2]=o*B+q*E+i*K+p*G;f[6]=o*x+q*s+i*M+p*I;f[10]=o*A+q*w+i*N+p*O;f[14]=o*y+q*C+i*t+p*d;f[3]=r*B+u*E+v*K+c*G;f[7]=r*x+u*s+v*M+c*I;f[11]=r*A+u*w+v*N+c*O;f[15]=r*y+u*C+v*t+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],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*j;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*f;h[4]=b*e;h[5]=b*g;h[6]=b*j;h[7]=b*m;h[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,f,e,g,j,m,k,h,n,l,o,q,i){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,j||0,m||0,k||0,h!==void 0?h:1,n||0,l||0,o||0,q||0,i!==void 0?i:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,j,m,k,h,n,l,o,q,i){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=f;p[5]=e;p[9]=g;p[13]=j;p[2]=m;p[6]=k;p[10]=h;p[14]=n;p[3]=l;p[7]=o;p[11]=q;p[15]=i;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,
+f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1.0E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],j=c[8],m=c[12],k=c[1],h=c[5],n=c[9],l=c[13],o=c[2],q=c[6],i=c[10],p=c[14],r=c[3],u=c[7],v=c[11],c=c[15],B=d[0],x=d[4],
+A=d[8],y=d[12],E=d[1],s=d[5],w=d[9],C=d[13],K=d[2],M=d[6],N=d[10],t=d[14],G=d[3],I=d[7],O=d[11],d=d[15];f[0]=e*B+g*E+j*K+m*G;f[4]=e*x+g*s+j*M+m*I;f[8]=e*A+g*w+j*N+m*O;f[12]=e*y+g*C+j*t+m*d;f[1]=k*B+h*E+n*K+l*G;f[5]=k*x+h*s+n*M+l*I;f[9]=k*A+h*w+n*N+l*O;f[13]=k*y+h*C+n*t+l*d;f[2]=o*B+q*E+i*K+p*G;f[6]=o*x+q*s+i*M+p*I;f[10]=o*A+q*w+i*N+p*O;f[14]=o*y+q*C+i*t+p*d;f[3]=r*B+u*E+v*K+c*G;f[7]=r*x+u*s+v*M+c*I;f[11]=r*A+u*w+v*N+c*O;f[15]=r*y+u*C+v*t+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,f=a.z,e=1/(b[3]*c+b[7]*d+b[11]*f+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*f+b[12])*e;a.y=(b[1]*c+b[5]*d+b[9]*f+b[13])*e;a.z=(b[2]*c+b[6]*d+b[10]*f+b[14])*e;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w;a.x=b[0]*c+b[4]*d+b[8]*f+b[12]*e;a.y=b[1]*c+b[5]*d+b[9]*f+b[13]*e;a.z=b[2]*c+b[6]*d+b[10]*f+b[14]*e;a.w=b[3]*c+b[7]*d+b[11]*f+b[15]*e;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
 c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z;a.x=c*b[0]+d*b[4]+f*b[8];a.y=c*b[1]+d*b[5]+f*b[9];a.z=c*b[2]+d*b[6]+f*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],f=a[12],e=a[1],g=a[5],j=a[9],m=a[13],l=a[2],h=a[6],n=a[10],k=a[14],o=a[3],q=a[7],i=a[11],a=a[15];return f*j*h*o-d*m*h*o-f*g*n*o+c*m*n*o+d*g*k*o-c*j*k*o-f*j*l*q+d*m*l*q+f*e*n*q-b*m*n*q-d*e*k*q+b*j*k*q+f*g*l*i-c*m*l*i-f*e*h*i+b*m*h*i+c*e*k*i-b*g*k*i-d*g*l*a+c*j*l*a+d*e*h*a-b*j*h*a-c*e*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;
+a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],g=a[5],j=a[9],m=a[13],k=a[2],h=a[6],n=a[10],l=a[14],o=a[3],q=a[7],i=a[11],a=a[15];return f*j*h*o-d*m*h*o-f*g*n*o+c*m*n*o+d*g*l*o-c*j*l*o-f*j*k*q+d*m*k*q+f*e*n*q-b*m*n*q-d*e*l*q+b*j*l*q+f*g*k*i-c*m*k*i-f*e*h*i+b*m*h*i+c*e*l*i-b*g*l*i-d*g*k*a+c*j*k*a+d*e*h*a-b*j*h*a-c*e*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],f=c[4],e=c[8],g=c[12],j=c[1],m=c[5],l=c[9],h=c[13],n=c[2],k=c[6],o=c[10],q=c[14],i=c[3],p=c[7],r=c[11],c=c[15];b[0]=l*q*p-h*o*p+h*k*r-m*q*r-l*k*c+m*o*c;b[4]=g*o*p-e*q*p-g*k*r+f*q*r+e*k*c-f*o*c;b[8]=e*h*p-g*l*p+g*m*r-f*h*r-e*m*c+f*l*c;b[12]=g*l*k-e*h*k-g*m*o+f*h*o+e*m*q-f*l*q;b[1]=h*o*i-l*q*i-h*n*r+j*q*r+l*n*c-j*o*c;b[5]=e*q*i-g*o*i+g*n*r-d*q*r-e*n*c+d*o*c;b[9]=g*l*i-e*h*i-g*j*r+d*h*r+e*j*c-d*l*c;b[13]=e*h*n-g*l*n+g*j*o-d*
-h*o-e*j*q+d*l*q;b[2]=m*q*i-h*k*i+h*n*p-j*q*p-m*n*c+j*k*c;b[6]=g*k*i-f*q*i-g*n*p+d*q*p+f*n*c-d*k*c;b[10]=f*h*i-g*m*i+g*j*p-d*h*p-f*j*c+d*m*c;b[14]=g*m*n-f*h*n-g*j*k+d*h*k+f*j*q-d*m*q;b[3]=l*k*i-m*o*i-l*n*p+j*o*p+m*n*r-j*k*r;b[7]=f*o*i-e*k*i+e*n*p-d*o*p-f*n*r+d*k*r;b[11]=e*m*i-f*l*i-e*j*p+d*l*p+f*j*r-d*m*r;b[15]=f*l*n-e*m*n+e*j*k-d*l*k-f*j*o+d*m*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),
-j=Math.cos(f),f=Math.sin(f),m=Math.cos(e),e=Math.sin(e);if(b===void 0||b==="XYZ"){var l=g*m,h=g*e,n=d*m,k=d*e;c[0]=j*m;c[4]=-j*e;c[8]=f;c[1]=h+n*f;c[5]=l-k*f;c[9]=-d*j;c[2]=k-l*f;c[6]=n+h*f;c[10]=g*j}else if(b==="YXZ"){l=j*m;h=j*e;n=f*m;k=f*e;c[0]=l+k*d;c[4]=n*d-h;c[8]=g*f;c[1]=g*e;c[5]=g*m;c[9]=-d;c[2]=h*d-n;c[6]=k+l*d;c[10]=g*j}else if(b==="ZXY"){l=j*m;h=j*e;n=f*m;k=f*e;c[0]=l-k*d;c[4]=-g*e;c[8]=n+h*d;c[1]=h+n*d;c[5]=g*m;c[9]=k-l*d;c[2]=-g*f;c[6]=d;c[10]=g*j}else if(b==="ZYX"){l=g*m;h=g*e;n=d*m;
-k=d*e;c[0]=j*m;c[4]=n*f-h;c[8]=l*f+k;c[1]=j*e;c[5]=k*f+l;c[9]=h*f-n;c[2]=-f;c[6]=d*j;c[10]=g*j}else if(b==="YZX"){l=g*j;h=g*f;n=d*j;k=d*f;c[0]=j*m;c[4]=k-l*e;c[8]=n*e+h;c[1]=e;c[5]=g*m;c[9]=-d*m;c[2]=-f*m;c[6]=h*e+n;c[10]=l-k*e}else if(b==="XZY"){l=g*j;h=g*f;n=d*j;k=d*f;c[0]=j*m;c[4]=-e;c[8]=f*m;c[1]=l*e+k;c[5]=g*m;c[9]=h*e-n;c[2]=n*e-h;c[6]=d*m;c[10]=k*e+l}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,j=d+d,m=f+f,a=c*g,l=c*j,c=c*m,h=d*j,d=d*
-m,f=f*m,g=e*g,j=e*j,e=e*m;b[0]=1-(h+f);b[4]=l-e;b[8]=c+j;b[1]=l+e;b[5]=1-(a+f);b[9]=d-g;b[2]=c-j;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(b);e.makeScale(c.x,c.y,c.z);this.multiply(f,e);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;f.set(d[0],d[1],d[2]);e.set(d[4],d[5],d[6]);
+a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],j=c[1],m=c[5],k=c[9],h=c[13],n=c[2],l=c[6],o=c[10],q=c[14],i=c[3],p=c[7],r=c[11],c=c[15];b[0]=k*q*p-h*o*p+h*l*r-m*q*r-k*l*c+m*o*c;b[4]=g*o*p-e*q*p-g*l*r+f*q*r+e*l*c-f*o*c;b[8]=e*h*p-g*k*p+g*m*r-f*h*r-e*m*c+f*k*c;b[12]=g*k*l-e*h*l-g*m*o+f*h*o+e*m*q-f*k*q;b[1]=h*o*i-k*q*i-h*n*r+j*q*r+k*n*c-j*o*c;b[5]=e*q*i-g*o*i+g*n*r-d*q*r-e*n*c+d*o*c;b[9]=g*k*i-e*h*i-g*j*r+d*h*r+e*j*c-d*k*c;b[13]=e*h*n-g*k*n+g*j*o-d*
+h*o-e*j*q+d*k*q;b[2]=m*q*i-h*l*i+h*n*p-j*q*p-m*n*c+j*l*c;b[6]=g*l*i-f*q*i-g*n*p+d*q*p+f*n*c-d*l*c;b[10]=f*h*i-g*m*i+g*j*p-d*h*p-f*j*c+d*m*c;b[14]=g*m*n-f*h*n-g*j*l+d*h*l+f*j*q-d*m*q;b[3]=k*l*i-m*o*i-k*n*p+j*o*p+m*n*r-j*l*r;b[7]=f*o*i-e*l*i+e*n*p-d*o*p-f*n*r+d*l*r;b[11]=e*m*i-f*k*i-e*j*p+d*k*p+f*j*r-d*m*r;b[15]=f*k*n-e*m*n+e*j*l-d*k*l-f*j*o+d*m*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),
+j=Math.cos(f),f=Math.sin(f),m=Math.cos(e),e=Math.sin(e);if(b===void 0||b==="XYZ"){var k=g*m,h=g*e,n=d*m,l=d*e;c[0]=j*m;c[4]=-j*e;c[8]=f;c[1]=h+n*f;c[5]=k-l*f;c[9]=-d*j;c[2]=l-k*f;c[6]=n+h*f;c[10]=g*j}else if(b==="YXZ"){k=j*m;h=j*e;n=f*m;l=f*e;c[0]=k+l*d;c[4]=n*d-h;c[8]=g*f;c[1]=g*e;c[5]=g*m;c[9]=-d;c[2]=h*d-n;c[6]=l+k*d;c[10]=g*j}else if(b==="ZXY"){k=j*m;h=j*e;n=f*m;l=f*e;c[0]=k-l*d;c[4]=-g*e;c[8]=n+h*d;c[1]=h+n*d;c[5]=g*m;c[9]=l-k*d;c[2]=-g*f;c[6]=d;c[10]=g*j}else if(b==="ZYX"){k=g*m;h=g*e;n=d*m;
+l=d*e;c[0]=j*m;c[4]=n*f-h;c[8]=k*f+l;c[1]=j*e;c[5]=l*f+k;c[9]=h*f-n;c[2]=-f;c[6]=d*j;c[10]=g*j}else if(b==="YZX"){k=g*j;h=g*f;n=d*j;l=d*f;c[0]=j*m;c[4]=l-k*e;c[8]=n*e+h;c[1]=e;c[5]=g*m;c[9]=-d*m;c[2]=-f*m;c[6]=h*e+n;c[10]=k-l*e}else if(b==="XZY"){k=g*j;h=g*f;n=d*j;l=d*f;c[0]=j*m;c[4]=-e;c[8]=f*m;c[1]=k*e+l;c[5]=g*m;c[9]=h*e-n;c[2]=n*e-h;c[6]=d*m;c[10]=l*e+k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,j=d+d,m=f+f,a=c*g,k=c*j,c=c*m,h=d*j,d=d*
+m,f=f*m,g=e*g,j=e*j,e=e*m;b[0]=1-(h+f);b[4]=k-e;b[8]=c+j;b[1]=k+e;b[5]=1-(a+f);b[9]=d-g;b[2]=c-j;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(b);e.makeScale(c.x,c.y,c.z);this.multiply(f,e);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;f.set(d[0],d[1],d[2]);e.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=f.length();c.y=e.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(),f=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]*f;b[5]=a[5]*f;b[6]=a[6]*f;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],f=b[6],e=b[7],g=b[8],j=b[9],m=b[10],l=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*j;b[6]=h*f+a*m;b[7]=h*e+a*l;b[8]=h*g-a*c;b[9]=h*j-a*d;b[10]=h*m-a*f;b[11]=h*l-a*e;return this},rotateY:function(a){var b=
-this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[8],j=b[9],m=b[10],l=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*j;b[2]=h*f-a*m;b[3]=h*e-a*l;b[8]=h*g+a*c;b[9]=h*j+a*d;b[10]=h*m+a*f;b[11]=h*l+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[4],j=b[5],m=b[6],l=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*j;b[2]=h*f+a*m;b[3]=h*e+a*l;b[4]=h*g-a*c;b[5]=h*j-a*d;b[6]=h*m-a*f;b[7]=h*l-a*e;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,f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,j=f*f,m=e*e,l=Math.cos(b),h=Math.sin(b),n=1-l,k=d*f*n,o=d*e*n,n=f*e*n,d=d*h,q=f*h,h=e*h,e=g+(1-g)*l,g=k+h,f=o-q,k=k-h,j=j+(1-j)*l,h=n+d,o=o+q,n=n-d,m=m+(1-m)*l,l=c[0],d=c[1],q=c[2],i=c[3],p=c[4],r=c[5],u=c[6],v=c[7],B=c[8],x=c[9],A=c[10],y=c[11];c[0]=e*l+g*p+f*B;c[1]=e*d+g*
-r+f*x;c[2]=e*q+g*u+f*A;c[3]=e*i+g*v+f*y;c[4]=k*l+j*p+h*B;c[5]=k*d+j*r+h*x;c[6]=k*q+j*u+h*A;c[7]=k*i+j*v+h*y;c[8]=o*l+n*p+m*B;c[9]=o*d+n*r+m*x;c[10]=o*q+n*u+m*A;c[11]=o*i+n*v+m*y;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]+
+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],f=b[6],e=b[7],g=b[8],j=b[9],m=b[10],k=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*j;b[6]=h*f+a*m;b[7]=h*e+a*k;b[8]=h*g-a*c;b[9]=h*j-a*d;b[10]=h*m-a*f;b[11]=h*k-a*e;return this},rotateY:function(a){var b=
+this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[8],j=b[9],m=b[10],k=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*j;b[2]=h*f-a*m;b[3]=h*e-a*k;b[8]=h*g+a*c;b[9]=h*j+a*d;b[10]=h*m+a*f;b[11]=h*k+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[4],j=b[5],m=b[6],k=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*j;b[2]=h*f+a*m;b[3]=h*e+a*k;b[4]=h*g-a*c;b[5]=h*j-a*d;b[6]=h*m-a*f;b[7]=h*k-a*e;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,f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,j=f*f,m=e*e,k=Math.cos(b),h=Math.sin(b),n=1-k,l=d*f*n,o=d*e*n,n=f*e*n,d=d*h,q=f*h,h=e*h,e=g+(1-g)*k,g=l+h,f=o-q,l=l-h,j=j+(1-j)*k,h=n+d,o=o+q,n=n-d,m=m+(1-m)*k,k=c[0],d=c[1],q=c[2],i=c[3],p=c[4],r=c[5],u=c[6],v=c[7],B=c[8],x=c[9],A=c[10],y=c[11];c[0]=e*k+g*p+f*B;c[1]=e*d+g*
+r+f*x;c[2]=e*q+g*u+f*A;c[3]=e*i+g*v+f*y;c[4]=l*k+j*p+h*B;c[5]=l*d+j*r+h*x;c[6]=l*q+j*u+h*A;c[7]=l*i+j*v+h*y;c[8]=o*k+n*p+m*B;c[9]=o*d+n*r+m*x;c[10]=o*q+n*u+m*A;c[11]=o*i+n*v+m*y;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),f=1-c,e=a.x,g=a.y,j=a.z,m=f*e,l=f*g;this.set(m*e+c,m*g-d*j,m*j+d*g,0,m*g+d*j,l*g+c,l*j-d*e,0,m*j-d*g,l*j+d*e,f*j*j+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,f,e){var g=this.elements;g[0]=2*f/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*f/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(e+f)/(e-f);g[14]=-2*e*f/(e-f);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),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,e){var g=this.elements,j=b-a,m=c-d,l=e-f;g[0]=2/j;g[4]=0;g[8]=0;g[12]=-((b+a)/j);g[1]=0;g[5]=2/m;g[9]=0;g[13]=-((c+d)/m);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((e+f)/l);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],
+return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,j=a.z,m=f*e,k=f*g;this.set(m*e+c,m*g-d*j,m*j+d*g,0,m*g+d*j,k*g+c,k*j-d*e,0,m*j-d*g,k*j+d*e,f*j*j+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,f,e){var g=this.elements;g[0]=2*f/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*f/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(e+f)/(e-f);g[14]=-2*e*f/(e-f);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),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,e){var g=this.elements,j=b-a,m=c-d,k=e-f;g[0]=2/j;g[4]=0;g[8]=0;g[12]=-((b+a)/j);g[1]=0;g[5]=2/m;g[9]=0;g[13]=-((c+d)/m);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((e+f)/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.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};
+THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.properties={};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.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};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.setEulerFromRotationMatrix((new THREE.Matrix4).extractRotation(this.matrix),this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=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,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b){f=f.getChildByName(a,b);if(f!==void 0)return f}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion===true?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===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?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)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)},clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(a,c){g=0;A.objects.length=0;A.sprites.length=0;A.lights.length=0;var f=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||C.contains(a)===true)){y.copy(a.matrixWorld.getPosition());s.multiplyVector3(y);e=b();e.object=a;e.z=y.z;A.objects.push(e)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){y.copy(a.matrixWorld.getPosition());s.multiplyVector3(y);e=b();e.object=a;e.z=y.z;A.sprites.push(e)}else a instanceof
-THREE.Light&&A.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)f(a.children[c])}};f(a);c===true&&A.objects.sort(d);return A}function b(){var a;if(g===j.length){a=new THREE.RenderableObject;j.push(a)}else a=j[g];g++;return a}function c(){var a;if(l===h.length){a=new THREE.RenderableVertex;h.push(a)}else a=h[l];l++;return a}function d(a,b){return b.z-a.z}function f(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(e>=0&&g>=0&&f>=0&&h>=0)return true;if(e<0&&g<0||f<0&&h<0)return false;
-e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g)));f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,g,j=[],m,l,h=[],n,k,o=[],q,i=[],p,r,u=[],v,B,x=[],A={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,E=new THREE.Vector4,s=new THREE.Matrix4,w=new THREE.Matrix4,C=new THREE.Frustum,K=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);s.multiply(b.projectionMatrix,
+THREE.Light&&A.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)f(a.children[c])}};f(a);c===true&&A.objects.sort(d);return A}function b(){var a;if(g===j.length){a=new THREE.RenderableObject;j.push(a)}else a=j[g];g++;return a}function c(){var a;if(k===h.length){a=new THREE.RenderableVertex;h.push(a)}else a=h[k];k++;return a}function d(a,b){return b.z-a.z}function f(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(e>=0&&g>=0&&f>=0&&h>=0)return true;if(e<0&&g<0||f<0&&h<0)return false;
+e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g)));f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,g,j=[],m,k,h=[],n,l,o=[],q,i=[],p,r,u=[],v,B,x=[],A={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,E=new THREE.Vector4,s=new THREE.Matrix4,w=new THREE.Matrix4,C=new THREE.Frustum,K=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);s.multiply(b.projectionMatrix,
 b.matrixWorldInverse);s.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);s.multiply(b.matrixWorld,b.projectionMatrixInverse);s.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.projectScene=function(b,e,g){var j=e.near,y=e.far,P=false,R,z,$,aa,J,S,W,D,F,H,L,Q,la,T,ca,
-U,da;B=r=q=k=0;A.elements.length=0;b.updateMatrixWorld();e.parent===void 0&&e.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);s.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(s);A=a(b,false);b=0;for(R=A.objects.length;b<R;b++){F=A.objects[b].object;H=F.matrixWorld;l=0;if(F instanceof THREE.Mesh){L=F.geometry;Q=F.geometry.materials;aa=L.vertices;la=L.faces;ca=L.faceVertexUvs;L=F.matrixRotationWorld.extractRotation(H);da=F.material instanceof THREE.MeshFaceMaterial;
+U,da;B=r=q=l=0;A.elements.length=0;b.updateMatrixWorld();e.parent===void 0&&e.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);s.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(s);A=a(b,false);b=0;for(R=A.objects.length;b<R;b++){F=A.objects[b].object;H=F.matrixWorld;k=0;if(F instanceof THREE.Mesh){L=F.geometry;Q=F.geometry.materials;aa=L.vertices;la=L.faces;ca=L.faceVertexUvs;L=F.matrixRotationWorld.extractRotation(H);da=F.material instanceof THREE.MeshFaceMaterial;
 z=0;for($=aa.length;z<$;z++){m=c();m.positionWorld.copy(aa[z]);H.multiplyVector3(m.positionWorld);m.positionScreen.copy(m.positionWorld);s.multiplyVector4(m.positionScreen);m.positionScreen.x=m.positionScreen.x/m.positionScreen.w;m.positionScreen.y=m.positionScreen.y/m.positionScreen.w;m.visible=m.positionScreen.z>j&&m.positionScreen.z<y}aa=0;for(z=la.length;aa<z;aa++){D=la[aa];$=da===true?Q[D.materialIndex]:F.material;if($!==void 0){W=$.side;if(D instanceof THREE.Face3){J=h[D.a];S=h[D.b];T=h[D.c];
-if(J.visible===true&&S.visible===true&&T.visible===true){P=(T.positionScreen.x-J.positionScreen.x)*(S.positionScreen.y-J.positionScreen.y)-(T.positionScreen.y-J.positionScreen.y)*(S.positionScreen.x-J.positionScreen.x)<0;if(W===THREE.DoubleSide||P===(W===THREE.FrontSide)){U=void 0;if(k===o.length){U=new THREE.RenderableFace3;o.push(U)}else U=o[k];k++;n=U;n.v1.copy(J);n.v2.copy(S);n.v3.copy(T)}else continue}else continue}else if(D instanceof THREE.Face4){J=h[D.a];S=h[D.b];T=h[D.c];U=h[D.d];if(J.visible===
+if(J.visible===true&&S.visible===true&&T.visible===true){P=(T.positionScreen.x-J.positionScreen.x)*(S.positionScreen.y-J.positionScreen.y)-(T.positionScreen.y-J.positionScreen.y)*(S.positionScreen.x-J.positionScreen.x)<0;if(W===THREE.DoubleSide||P===(W===THREE.FrontSide)){U=void 0;if(l===o.length){U=new THREE.RenderableFace3;o.push(U)}else U=o[l];l++;n=U;n.v1.copy(J);n.v2.copy(S);n.v3.copy(T)}else continue}else continue}else if(D instanceof THREE.Face4){J=h[D.a];S=h[D.b];T=h[D.c];U=h[D.d];if(J.visible===
 true&&S.visible===true&&T.visible===true&&U.visible===true){P=(U.positionScreen.x-J.positionScreen.x)*(S.positionScreen.y-J.positionScreen.y)-(U.positionScreen.y-J.positionScreen.y)*(S.positionScreen.x-J.positionScreen.x)<0||(S.positionScreen.x-T.positionScreen.x)*(U.positionScreen.y-T.positionScreen.y)-(S.positionScreen.y-T.positionScreen.y)*(U.positionScreen.x-T.positionScreen.x)<0;if(W===THREE.DoubleSide||P===(W===THREE.FrontSide)){var fa=void 0;if(q===i.length){fa=new THREE.RenderableFace4;i.push(fa)}else fa=
 i[q];q++;n=fa;n.v1.copy(J);n.v2.copy(S);n.v3.copy(T);n.v4.copy(U)}else continue}else continue}n.normalWorld.copy(D.normal);P===false&&(W===THREE.BackSide||W===THREE.DoubleSide)&&n.normalWorld.negate();L.multiplyVector3(n.normalWorld);n.centroidWorld.copy(D.centroid);H.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);s.multiplyVector3(n.centroidScreen);D=D.vertexNormals;J=0;for(S=D.length;J<S;J++){T=n.vertexNormalsWorld[J];T.copy(D[J]);P===false&&(W===THREE.BackSide||W===THREE.DoubleSide)&&
-T.negate();L.multiplyVector3(T)}J=0;for(S=ca.length;J<S;J++){T=ca[J][aa];if(T!==void 0){W=0;for(D=T.length;W<D;W++)n.uvs[J][W]=T[W]}}n.material=$;n.z=n.centroidScreen.z;A.elements.push(n)}}}else if(F instanceof THREE.Line){w.multiply(s,H);aa=F.geometry.vertices;J=c();J.positionScreen.copy(aa[0]);w.multiplyVector4(J.positionScreen);H=F.type===THREE.LinePieces?2:1;z=1;for($=aa.length;z<$;z++){J=c();J.positionScreen.copy(aa[z]);w.multiplyVector4(J.positionScreen);if(!((z+1)%H>0)){S=h[l-2];K.copy(J.positionScreen);
+T.negate();L.multiplyVector3(T)}J=0;for(S=ca.length;J<S;J++){T=ca[J][aa];if(T!==void 0){W=0;for(D=T.length;W<D;W++)n.uvs[J][W]=T[W]}}n.material=$;n.z=n.centroidScreen.z;A.elements.push(n)}}}else if(F instanceof THREE.Line){w.multiply(s,H);aa=F.geometry.vertices;J=c();J.positionScreen.copy(aa[0]);w.multiplyVector4(J.positionScreen);H=F.type===THREE.LinePieces?2:1;z=1;for($=aa.length;z<$;z++){J=c();J.positionScreen.copy(aa[z]);w.multiplyVector4(J.positionScreen);if(!((z+1)%H>0)){S=h[k-2];K.copy(J.positionScreen);
 M.copy(S.positionScreen);if(f(K,M)===true){K.multiplyScalar(1/K.w);M.multiplyScalar(1/M.w);Q=void 0;if(r===u.length){Q=new THREE.RenderableLine;u.push(Q)}else Q=u[r];r++;p=Q;p.v1.positionScreen.copy(K);p.v2.positionScreen.copy(M);p.z=Math.max(K.z,M.z);p.material=F.material;A.elements.push(p)}}}}}b=0;for(R=A.sprites.length;b<R;b++){F=A.sprites[b].object;H=F.matrixWorld;if(F instanceof THREE.Particle){E.set(H.elements[12],H.elements[13],H.elements[14],1);s.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<
 1){j=void 0;if(B===x.length){j=new THREE.RenderableParticle;x.push(j)}else j=x[B];B++;v=j;v.object=F;v.x=E.x/E.w;v.y=E.y/E.w;v.z=E.z;v.rotation=F.rotation.z;v.scale.x=F.scale.x*Math.abs(v.x-(E.x+e.projectionMatrix.elements[0])/(E.w+e.projectionMatrix.elements[12]));v.scale.y=F.scale.y*Math.abs(v.y-(E.y+e.projectionMatrix.elements[5])/(E.w+e.projectionMatrix.elements[13]));v.material=F.material;A.elements.push(v)}}}g&&A.elements.sort(d);return A}};
 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,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),f=Math.cos(a.z/2),e=Math.sin(a.x/2),g=Math.sin(a.y/2),j=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=e*d*f+c*g*j;this.y=c*g*f-e*d*j;this.z=c*d*j+e*g*f;this.w=c*d*f-e*g*j}else if(b==="YXZ"){this.x=e*d*f+c*g*j;this.y=c*g*f-e*d*j;this.z=
 c*d*j-e*g*f;this.w=c*d*f+e*g*j}else if(b==="ZXY"){this.x=e*d*f-c*g*j;this.y=c*g*f+e*d*j;this.z=c*d*j+e*g*f;this.w=c*d*f-e*g*j}else if(b==="ZYX"){this.x=e*d*f-c*g*j;this.y=c*g*f+e*d*j;this.z=c*d*j-e*g*f;this.w=c*d*f+e*g*j}else if(b==="YZX"){this.x=e*d*f+c*g*j;this.y=c*g*f+e*d*j;this.z=c*d*j-e*g*f;this.w=c*d*f-e*g*j}else if(b==="XZY"){this.x=e*d*f-c*g*j;this.y=c*g*f-e*d*j;this.z=c*d*j+e*g*f;this.w=c*d*f+e*g*j}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=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],j=b[2],m=b[6],b=b[10],l=c+e+b;if(l>0){c=0.5/Math.sqrt(l+1);this.w=0.25/c;this.x=(m-g)*c;this.y=(d-j)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(m-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+j)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-j)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+m)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
+d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],j=b[2],m=b[6],b=b[10],k=c+e+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(m-g)*c;this.y=(d-j)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(m-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+j)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-j)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+m)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
 (d+j)/c;this.y=(g+m)/c;this.z=0.25*c}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,f=this.w,e=a.x,g=a.y,j=a.z,a=a.w;this.x=b*a+f*e+c*j-d*g;this.y=c*a+f*g+d*e-b*j;this.z=d*a+f*j+b*g-c*e;this.w=f*a-b*e-c*g-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,
-e=this.x,g=this.y,j=this.z,m=this.w,l=m*c+g*f-j*d,h=m*d+j*c-e*f,n=m*f+e*d-g*c,c=-e*c-g*d-j*f;b.x=l*m+c*-e+h*-j-n*-g;b.y=h*m+c*-g+n*-e-l*-j;b.z=n*m+c*-j+l*-g-h*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var j=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);
-this.y=0.5*(d+this.y);this.z=0.5*(f+this.z);return this}g=Math.sin((1-b)*j)/m;j=Math.sin(b*j)/m;this.w=e*g+this.w*j;this.x=c*g+this.x*j;this.y=d*g+this.y*j;this.z=f*g+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){var c=a.x,d=a.y,f=a.z,e=a.w,g=b.x,j=b.y,m=b.z,k=b.w;this.x=c*k+d*m-f*j+e*g;this.y=-c*m+d*k+f*g+e*j;this.z=c*j-d*g+f*k+e*m;this.w=-c*g-d*j-f*m+e*k;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,j=a.z,a=a.w;this.x=b*a+f*e+c*j-d*g;this.y=c*a+f*g+d*e-b*j;this.z=d*a+f*j+b*g-c*e;this.w=f*a-b*e-c*g-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=
+this.y,j=this.z,m=this.w,k=m*c+g*f-j*d,h=m*d+j*c-e*f,n=m*f+e*d-g*c,c=-e*c-g*d-j*f;b.x=k*m+c*-e+h*-j-n*-g;b.y=h*m+c*-g+n*-e-k*-j;b.z=n*m+c*-j+k*-g-h*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var j=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);this.y=0.5*
+(d+this.y);this.z=0.5*(f+this.z);return this}g=Math.sin((1-b)*j)/m;j=Math.sin(b*j)/m;this.w=e*g+this.w*j;this.x=c*g+this.x*j;this.y=d*g+this.y*j;this.z=f*g+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face3.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();
@@ -106,9 +106,9 @@ b;a++){c=this.faces[a];d=this.vertices[c.a];f=this.vertices[c.b];e=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,f;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.__originalFaceNormal?
 f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];a=0;for(b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var e=new THREE.Geometry;e.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,j=this.morphNormals[a].vertexNormals,m,l;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];m=new THREE.Vector3;l=f 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(m);j.push(l)}}g=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
-m=g.faceNormals[c];l=g.vertexNormals[c];m.copy(f.normal);if(f instanceof THREE.Face3){l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2])}else{l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2]);l.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,t){j=a.vertices[b];m=a.vertices[c];
-l=a.vertices[d];h=g[e];n=g[f];k=g[t];o=m.x-j.x;q=l.x-j.x;i=m.y-j.y;p=l.y-j.y;r=m.z-j.z;u=l.z-j.z;v=n.u-h.u;B=k.u-h.u;x=n.v-h.v;A=k.v-h.v;y=1/(v*A-B*x);C.set((A*o-x*q)*y,(A*i-x*p)*y,(A*r-x*u)*y);K.set((v*q-B*o)*y,(v*p-B*i)*y,(v*u-B*r)*y);s[b].addSelf(C);s[c].addSelf(C);s[d].addSelf(C);w[b].addSelf(K);w[c].addSelf(K);w[d].addSelf(K)}var b,c,d,f,e,g,j,m,l,h,n,k,o,q,i,p,r,u,v,B,x,A,y,E,s=[],w=[],C=new THREE.Vector3,K=new THREE.Vector3,M=new THREE.Vector3,N=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
+[];var g=this.morphNormals[a].faceNormals,j=this.morphNormals[a].vertexNormals,m,k;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];m=new THREE.Vector3;k=f 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(m);j.push(k)}}g=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
+m=g.faceNormals[c];k=g.vertexNormals[c];m.copy(f.normal);if(f instanceof THREE.Face3){k.a.copy(f.vertexNormals[0]);k.b.copy(f.vertexNormals[1]);k.c.copy(f.vertexNormals[2])}else{k.a.copy(f.vertexNormals[0]);k.b.copy(f.vertexNormals[1]);k.c.copy(f.vertexNormals[2]);k.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,t){j=a.vertices[b];m=a.vertices[c];
+k=a.vertices[d];h=g[e];n=g[f];l=g[t];o=m.x-j.x;q=k.x-j.x;i=m.y-j.y;p=k.y-j.y;r=m.z-j.z;u=k.z-j.z;v=n.u-h.u;B=l.u-h.u;x=n.v-h.v;A=l.v-h.v;y=1/(v*A-B*x);C.set((A*o-x*q)*y,(A*i-x*p)*y,(A*r-x*u)*y);K.set((v*q-B*o)*y,(v*p-B*i)*y,(v*u-B*r)*y);s[b].addSelf(C);s[c].addSelf(C);s[d].addSelf(C);w[b].addSelf(K);w[c].addSelf(K);w[d].addSelf(K)}var b,c,d,f,e,g,j,m,k,h,n,l,o,q,i,p,r,u,v,B,x,A,y,E,s=[],w=[],C=new THREE.Vector3,K=new THREE.Vector3,M=new THREE.Vector3,N=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
 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++){e=this.faces[b];g=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var G=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){t.copy(e.vertexNormals[d]);f=e[G[d]];E=s[f];M.copy(E);M.subSelf(t.multiplyScalar(t.dot(E))).normalize();
 N.cross(e.vertexNormals[d],E);f=N.dot(w[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(M.x,M.y,M.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),e,g,j,m;e=0;for(g=this.vertices.length;e<g;e++){d=this.vertices[e];d=
@@ -125,62 +125,62 @@ THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THRE
 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=j.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
-d;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!==1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!==1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,m="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};
-if(a.shading){var h=a.shading.toLowerCase();h==="phong"?m="MeshPhongMaterial":h==="basic"&&(m="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)l.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)l.transparent=a.transparent;if(a.depthTest!==void 0)l.depthTest=a.depthTest;if(a.depthWrite!==void 0)l.depthWrite=a.depthWrite;if(a.visible!==void 0)l.visible=a.visible;if(a.flipSided!==void 0)l.side=THREE.BackSide;if(a.doubleSided!==void 0)l.side=THREE.DoubleSide;if(a.wireframe!==
-void 0)l.wireframe=a.wireframe;if(a.vertexColors!==void 0)if(a.vertexColors=="face")l.vertexColors=THREE.FaceColors;else if(a.vertexColors)l.vertexColors=THREE.VertexColors;if(a.colorDiffuse)l.color=g(a.colorDiffuse);else if(a.DbgColor)l.color=a.DbgColor;if(a.colorSpecular)l.specular=g(a.colorSpecular);if(a.colorAmbient)l.ambient=g(a.colorAmbient);if(a.transparency)l.opacity=a.transparency;if(a.specularCoef)l.shininess=a.specularCoef;a.mapDiffuse&&b&&e(l,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,
-a.mapDiffuseWrap);a.mapLight&&b&&e(l,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapBump&&b&&e(l,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap);a.mapNormal&&b&&e(l,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(l,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){m=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(m.uniforms);h.tNormal.texture=
-l.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(l.map){h.tDiffuse.texture=l.map;h.enableDiffuse.value=true}if(l.specularMap){h.tSpecular.texture=l.specularMap;h.enableSpecular.value=true}if(l.lightMap){h.tAO.texture=l.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(l.color);h.uSpecularColor.value.setHex(l.specular);h.uAmbientColor.value.setHex(l.ambient);h.uShininess.value=l.shininess;if(l.opacity!==void 0)h.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,
-vertexShader:m.vertexShader,uniforms:h,lights:true,fog:true})}else l=new THREE[m](l);if(a.DbgName!==void 0)l.name=a.DbgName;return l}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(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),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
+d;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!==1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!==1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,m="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};
+if(a.shading){var h=a.shading.toLowerCase();h==="phong"?m="MeshPhongMaterial":h==="basic"&&(m="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.visible!==void 0)k.visible=a.visible;if(a.flipSided!==void 0)k.side=THREE.BackSide;if(a.doubleSided!==void 0)k.side=THREE.DoubleSide;if(a.wireframe!==
+void 0)k.wireframe=a.wireframe;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&&e(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,
+a.mapDiffuseWrap);a.mapLight&&b&&e(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapBump&&b&&e(k,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap);a.mapNormal&&b&&e(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){m=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(m.uniforms);h.tNormal.texture=
+k.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(k.map){h.tDiffuse.texture=k.map;h.enableDiffuse.value=true}if(k.specularMap){h.tSpecular.texture=k.specularMap;h.enableSpecular.value=true}if(k.lightMap){h.tAO.texture=k.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(k.color);h.uSpecularColor.value.setHex(k.specular);h.uAmbientColor.value.setHex(k.ambient);h.uShininess.value=k.shininess;if(k.opacity!==void 0)h.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,
+vertexShader:m.vertexShader,uniforms:h,lights:true,fog:true})}else k=new THREE[m](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(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),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
 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 j=JSON.parse(g.responseText);a.loadAjaxBuffers(j,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,j=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0){var c=e.response;if(c===void 0)c=(new Uint8Array(e.responseBody)).buffer;THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){j==0&&(j=e.getResponseHeader("Content-Length"));f({total:j,loaded:e.responseText.length})}}else e.readyState==
 2&&(j=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,m,l,h,n,k,o,q,i,p,r,u,v,B;function x(a){return a%4?4-a%4:0}function A(a,b){return(new Uint8Array(a,b,1))[0]}function y(a,b){return(new Uint32Array(a,b,1))[0]}function E(b,c){var d,e,g,f,h,j,l,i,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];g=m[d*3+1];f=m[d*3+2];h=I[e*2];e=I[e*2+1];j=I[g*2];l=I[g*2+1];g=I[f*2];i=I[f*2+1];f=N.faceVertexUvs[0];var k=[];k.push(new THREE.UV(h,e));k.push(new THREE.UV(j,l));k.push(new THREE.UV(g,
-i));f.push(k)}}function s(b,c){var d,e,g,f,h,j,l,m,i,k,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];g=n[d*4+1];f=n[d*4+2];h=n[d*4+3];j=I[e*2];e=I[e*2+1];l=I[g*2];i=I[g*2+1];m=I[f*2];k=I[f*2+1];f=I[h*2];g=I[h*2+1];h=N.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(l,i));o.push(new THREE.UV(m,k));o.push(new THREE.UV(f,g));h.push(o)}}function w(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];g=c[d*3+1];f=c[d*3+2];h=j[d];
-N.faces.push(new THREE.Face3(e,g,f,null,null,h))}}function C(b,c,d){for(var e,g,f,h,j,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];g=c[d*4+1];f=c[d*4+2];h=c[d*4+3];j=l[d];N.faces.push(new THREE.Face4(e,g,f,h,null,null,j))}}function K(b,c,d,e){for(var g,f,h,j,l,m,i,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),k=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*3];f=c[e*3+1];h=c[e*3+2];l=d[e*3];m=d[e*3+1];i=d[e*3+2];j=k[e];var n=G[m*3],o=G[m*3+1];m=G[m*3+2];var p=G[i*3],
-q=G[i*3+1];i=G[i*3+2];N.faces.push(new THREE.Face3(g,f,h,[new THREE.Vector3(G[l*3],G[l*3+1],G[l*3+2]),new THREE.Vector3(n,o,m),new THREE.Vector3(p,q,i)],null,j))}}function M(b,c,d,e){for(var g,f,h,j,l,m,i,k,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++){g=c[e*4];f=c[e*4+1];h=c[e*4+2];j=c[e*4+3];m=d[e*4];i=d[e*4+1];k=d[e*4+2];n=d[e*4+3];l=o[e];var p=G[i*3],q=G[i*3+1];i=G[i*3+2];var r=G[k*3],s=G[k*3+1];k=G[k*3+2];var t=G[n*3],w=G[n*3+1];n=G[n*3+2];N.faces.push(new THREE.Face4(g,
-f,h,j,[new THREE.Vector3(G[m*3],G[m*3+1],G[m*3+2]),new THREE.Vector3(p,q,i),new THREE.Vector3(r,s,k),new THREE.Vector3(t,w,n)],null,l))}}var N=this,t=0,G=[],I=[],O,P,R;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(N,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,t,12);c=A(a,t+12);A(a,t+13);A(a,t+14);A(a,t+15);f=A(a,t+16);m=A(a,t+17);l=A(a,t+18);h=A(a,t+19);n=y(a,t+20);k=y(a,t+20+4);o=y(a,t+20+8);b=y(a,t+20+12);q=
-y(a,t+20+16);i=y(a,t+20+20);p=y(a,t+20+24);r=y(a,t+20+28);u=y(a,t+20+32);v=y(a,t+20+36);B=y(a,t+20+40);t=t+c;c=f*3+h;R=f*4+h;O=b*c;P=q*(c+m*3);f=i*(c+l*3);h=p*(c+m*3+l*3);c=r*R;m=u*(R+m*4);l=v*(R+l*4);t=t+function(b){var b=new Float32Array(a,b,n*3),c,d,e,g;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];N.vertices.push(new THREE.Vector3(d,e,g))}return n*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(k){var b=new Int8Array(a,b,k*3),c,d,e,g;for(c=0;c<k;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];G.push(d/
-127,e/127,g/127)}}return k*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+x(k*3);t=t+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];I.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(t);O=t+O+x(b*2);P=O+P+x(q*2);f=P+f+x(i*2);h=f+h+x(p*2);c=h+c+x(r*2);m=c+m+x(u*2);l=m+l+x(v*2);(function(a){if(i){var b=a+i*Uint32Array.BYTES_PER_ELEMENT*3;w(i,a,b+i*Uint32Array.BYTES_PER_ELEMENT*3);E(i,b)}})(P);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-p*Uint32Array.BYTES_PER_ELEMENT*3;K(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);E(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;C(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);s(v,b)}})(m);(function(a){if(B){var b=a+B*Uint32Array.BYTES_PER_ELEMENT*4,c=b+B*Uint32Array.BYTES_PER_ELEMENT*4;M(B,a,b,c+B*Uint32Array.BYTES_PER_ELEMENT*4);s(B,c)}})(l);b&&w(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;K(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,m,k,h,n,l,o,q,i,p,r,u,v,B;function x(a){return a%4?4-a%4:0}function A(a,b){return(new Uint8Array(a,b,1))[0]}function y(a,b){return(new Uint32Array(a,b,1))[0]}function E(b,c){var d,e,g,f,h,j,k,m,i=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=i[d*3];g=i[d*3+1];f=i[d*3+2];h=I[e*2];e=I[e*2+1];j=I[g*2];k=I[g*2+1];g=I[f*2];m=I[f*2+1];f=N.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(j,k));l.push(new THREE.UV(g,
+m));f.push(l)}}function s(b,c){var d,e,g,f,h,j,k,m,i,l,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];g=n[d*4+1];f=n[d*4+2];h=n[d*4+3];j=I[e*2];e=I[e*2+1];k=I[g*2];i=I[g*2+1];m=I[f*2];l=I[f*2+1];f=I[h*2];g=I[h*2+1];h=N.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(k,i));o.push(new THREE.UV(m,l));o.push(new THREE.UV(f,g));h.push(o)}}function w(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];g=c[d*3+1];f=c[d*3+2];h=j[d];
+N.faces.push(new THREE.Face3(e,g,f,null,null,h))}}function C(b,c,d){for(var e,g,f,h,j,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];g=c[d*4+1];f=c[d*4+2];h=c[d*4+3];j=k[d];N.faces.push(new THREE.Face4(e,g,f,h,null,null,j))}}function K(b,c,d,e){for(var g,f,h,j,k,m,i,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*3];f=c[e*3+1];h=c[e*3+2];k=d[e*3];m=d[e*3+1];i=d[e*3+2];j=l[e];var n=G[m*3],o=G[m*3+1];m=G[m*3+2];var p=G[i*3],
+q=G[i*3+1];i=G[i*3+2];N.faces.push(new THREE.Face3(g,f,h,[new THREE.Vector3(G[k*3],G[k*3+1],G[k*3+2]),new THREE.Vector3(n,o,m),new THREE.Vector3(p,q,i)],null,j))}}function M(b,c,d,e){for(var g,f,h,j,k,m,i,l,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++){g=c[e*4];f=c[e*4+1];h=c[e*4+2];j=c[e*4+3];m=d[e*4];i=d[e*4+1];l=d[e*4+2];n=d[e*4+3];k=o[e];var p=G[i*3],q=G[i*3+1];i=G[i*3+2];var r=G[l*3],s=G[l*3+1];l=G[l*3+2];var t=G[n*3],w=G[n*3+1];n=G[n*3+2];N.faces.push(new THREE.Face4(g,
+f,h,j,[new THREE.Vector3(G[m*3],G[m*3+1],G[m*3+2]),new THREE.Vector3(p,q,i),new THREE.Vector3(r,s,l),new THREE.Vector3(t,w,n)],null,k))}}var N=this,t=0,G=[],I=[],O,P,R;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(N,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,t,12);c=A(a,t+12);A(a,t+13);A(a,t+14);A(a,t+15);f=A(a,t+16);m=A(a,t+17);k=A(a,t+18);h=A(a,t+19);n=y(a,t+20);l=y(a,t+20+4);o=y(a,t+20+8);b=y(a,t+20+12);q=
+y(a,t+20+16);i=y(a,t+20+20);p=y(a,t+20+24);r=y(a,t+20+28);u=y(a,t+20+32);v=y(a,t+20+36);B=y(a,t+20+40);t=t+c;c=f*3+h;R=f*4+h;O=b*c;P=q*(c+m*3);f=i*(c+k*3);h=p*(c+m*3+k*3);c=r*R;m=u*(R+m*4);k=v*(R+k*4);t=t+function(b){var b=new Float32Array(a,b,n*3),c,d,e,g;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];N.vertices.push(new THREE.Vector3(d,e,g))}return n*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(l){var b=new Int8Array(a,b,l*3),c,d,e,g;for(c=0;c<l;c++){d=b[c*3];e=b[c*3+1];g=b[c*3+2];G.push(d/
+127,e/127,g/127)}}return l*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+x(l*3);t=t+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];I.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(t);O=t+O+x(b*2);P=O+P+x(q*2);f=P+f+x(i*2);h=f+h+x(p*2);c=h+c+x(r*2);m=c+m+x(u*2);k=m+k+x(v*2);(function(a){if(i){var b=a+i*Uint32Array.BYTES_PER_ELEMENT*3;w(i,a,b+i*Uint32Array.BYTES_PER_ELEMENT*3);E(i,b)}})(P);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+p*Uint32Array.BYTES_PER_ELEMENT*3;K(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);E(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;C(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);s(v,b)}})(m);(function(a){if(B){var b=a+B*Uint32Array.BYTES_PER_ELEMENT*4,c=b+B*Uint32Array.BYTES_PER_ELEMENT*4;M(B,a,b,c+B*Uint32Array.BYTES_PER_ELEMENT*4);s(B,c)}})(k);b&&w(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;K(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(O);r&&C(r,h,h+r*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;M(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=Object.create(THREE.Geometry.prototype);b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;b===void 0&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},false);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(c.crossOrigin)b.crossOrigin=c.crossOrigin;b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(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 j=JSON.parse(e.responseText);a.createModel(j,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,m,l,h,n,k,o,q,i,p,r,u,v,B=a.faces;n=a.vertices;var x=a.normals,A=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}l=0;for(h=n.length;l<h;){k=new THREE.Vector3;k.x=n[l++]*b;k.y=n[l++]*b;k.z=n[l++]*b;d.vertices.push(k)}l=0;for(h=B.length;l<h;){b=B[l++];n=b&1;m=b&2;c=b&
-4;f=b&8;o=b&16;k=b&32;i=b&64;b=b&128;if(n){p=new THREE.Face4;p.a=B[l++];p.b=B[l++];p.c=B[l++];p.d=B[l++];n=4}else{p=new THREE.Face3;p.a=B[l++];p.b=B[l++];p.c=B[l++];n=3}if(m){m=B[l++];p.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<y;c++){r=a.uvs[c];q=B[l++];v=r[q*2];q=r[q*2+1];d.faceUvs[c][m]=new THREE.UV(v,q)}if(f)for(c=0;c<y;c++){r=a.uvs[c];u=[];for(f=0;f<n;f++){q=B[l++];v=r[q*2];q=r[q*2+1];u[f]=new THREE.UV(v,q)}d.faceVertexUvs[c][m]=u}if(o){o=B[l++]*3;f=new THREE.Vector3;f.x=x[o++];f.y=x[o++];
-f.z=x[o];p.normal=f}if(k)for(c=0;c<n;c++){o=B[l++]*3;f=new THREE.Vector3;f.x=x[o++];f.y=x[o++];f.z=x[o];p.vertexNormals.push(f)}if(i){k=B[l++];k=new THREE.Color(A[k]);p.color=k}if(b)for(c=0;c<n;c++){k=B[l++];k=new THREE.Color(A[k]);p.vertexColors.push(k)}d.faces.push(p)}})(f);(function(){var b,c,f,m;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];m=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,m,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){f=a.skinIndices[b];m=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,m,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,m,l,h,n;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=[];h=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;m=0;for(l=n.length;m<l;m=m+3){var k=new THREE.Vector3;k.x=n[m]*b;k.y=n[m+1]*b;k.z=n[m+2]*b;h.push(k)}}}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=[];l=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(m=h.length;b<m;b=b+3){n=new THREE.Color(16755200);n.setRGB(h[b],h[b+1],h[b+2]);l.push(n)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=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,m,k,h,n,l,o,q,i,p,r,u,v,B=a.faces;n=a.vertices;var x=a.normals,A=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(h=n.length;k<h;){l=new THREE.Vector3;l.x=n[k++]*b;l.y=n[k++]*b;l.z=n[k++]*b;d.vertices.push(l)}k=0;for(h=B.length;k<h;){b=B[k++];n=b&1;m=b&2;c=b&
+4;f=b&8;o=b&16;l=b&32;i=b&64;b=b&128;if(n){p=new THREE.Face4;p.a=B[k++];p.b=B[k++];p.c=B[k++];p.d=B[k++];n=4}else{p=new THREE.Face3;p.a=B[k++];p.b=B[k++];p.c=B[k++];n=3}if(m){m=B[k++];p.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<y;c++){r=a.uvs[c];q=B[k++];v=r[q*2];q=r[q*2+1];d.faceUvs[c][m]=new THREE.UV(v,q)}if(f)for(c=0;c<y;c++){r=a.uvs[c];u=[];for(f=0;f<n;f++){q=B[k++];v=r[q*2];q=r[q*2+1];u[f]=new THREE.UV(v,q)}d.faceVertexUvs[c][m]=u}if(o){o=B[k++]*3;f=new THREE.Vector3;f.x=x[o++];f.y=x[o++];
+f.z=x[o];p.normal=f}if(l)for(c=0;c<n;c++){o=B[k++]*3;f=new THREE.Vector3;f.x=x[o++];f.y=x[o++];f.z=x[o];p.vertexNormals.push(f)}if(i){l=B[k++];l=new THREE.Color(A[l]);p.color=l}if(b)for(c=0;c<n;c++){l=B[k++];l=new THREE.Color(A[l]);p.vertexColors.push(l)}d.faces.push(p)}})(f);(function(){var b,c,f,m;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];m=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,m,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){f=a.skinIndices[b];m=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,m,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,m,k,h,n;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=[];h=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;m=0;for(k=n.length;m<k;m=m+3){var l=new THREE.Vector3;l.x=n[m]*b;l.y=n[m+1]*b;l.z=n[m+2]*b;h.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=[];k=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(m=h.length;b<m;b=b+3){n=new THREE.Color(16755200);n.setRGB(h[b],h[b+1],h[b+2]);k.push(n)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),f):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
-a,true);d.send(null);var f=new THREE.LoadingMonitor;f.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});f.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var e=0;e<a.materials.length;++e){var g=a.materials[e],j=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},m=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},l=function(a,d,e,f,g,h){a[d]=new THREE.Texture;a[d].sourceFile=
-e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!==1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!==1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[d].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[d].wrapT=f[h[1]]}var l=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!j(a.width)||!j(a.height)){var b=m(a.width),c=m(a.height);l.image=document.createElement("canvas");l.image.width=
-b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},h=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},n="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(g.shading){var o=g.shading.toLowerCase();o==="phong"?n="MeshPhongMaterial":o==="basic"&&(n="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==
-void 0)k.blending=THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)k.transparent=g.transparent;if(g.depthTest!==void 0)k.depthTest=g.depthTest;if(g.depthWrite!==void 0)k.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(g.vertexColors)k.vertexColors=THREE.VertexColors;if(g.colorDiffuse)k.color=h(g.colorDiffuse);else if(g.DbgColor)k.color=g.DbgColor;if(g.colorSpecular)k.specular=h(g.colorSpecular);if(g.colorAmbient)k.ambient=
-h(g.colorAmbient);if(g.transparency)k.opacity=g.transparency;if(g.specularCoef)k.shininess=g.specularCoef;if(g.visible!==void 0)k.visible=g.visible;if(g.flipSided!==void 0)k.side=THREE.BackSide;if(g.doubleSided!==void 0)k.side=THREE.DoubleSide;if(g.wireframe!==void 0)k.wireframe=g.wireframe;g.mapDiffuse&&l(k,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&l(k,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapBump&&l(k,"bumpMap",g.mapBump,
-g.mapBumpRepeat,g.mapBumpOffset,g.mapBumpWrap);g.mapNormal&&l(k,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&l(k,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){l=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(l.uniforms);h.tNormal.texture=k.normalMap;if(g.mapNormalFactor)h.uNormalScale.value=g.mapNormalFactor;if(k.map){h.tDiffuse.texture=k.map;h.enableDiffuse.value=true}if(k.specularMap){h.tSpecular.texture=
-k.specularMap;h.enableSpecular.value=true}if(k.lightMap){h.tAO.texture=k.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(k.color);h.uSpecularColor.value.setHex(k.specular);h.uAmbientColor.value.setHex(k.ambient);h.uShininess.value=k.shininess;if(k.opacity!==void 0)h.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:h,lights:true,fog:true})}else k=new THREE[n](k);if(g.DbgName!==void 0)k.name=g.DbgName;d.materials[e]=
-k}}var g=a.faces,q=a.vertices,k=a.normals,l=a.colors,h=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&h++;for(e=0;e<h;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(o=q.length;n<o;){var i=new THREE.Vector3;i.x=q[n++]*f;i.y=q[n++]*f;i.z=q[n++]*f;d.vertices.push(i)}n=0;for(o=g.length;n<o;){var p=g[n++],r=p&2,e=p&4,u=p&8,v=p&16,q=p&32,B=p&64,i=p&128;if(p&1){p=new THREE.Face4;p.a=g[n++];p.b=g[n++];p.c=g[n++];p.d=g[n++];var x=4}else{p=new THREE.Face3;p.a=g[n++];p.b=g[n++];p.c=g[n++];x=3}if(r){r=
-g[n++];p.materialIndex=r}var A=d.faces.length;if(e)for(e=0;e<h;e++){var y=a.uvs[e],r=g[n++],E=y[r*2],r=y[r*2+1];d.faceUvs[e][A]=new THREE.UV(E,r)}if(u)for(e=0;e<h;e++){for(var y=a.uvs[e],u=[],s=0;s<x;s++){r=g[n++];E=y[r*2];r=y[r*2+1];u[s]=new THREE.UV(E,r)}d.faceVertexUvs[e][A]=u}if(v){v=g[n++]*3;r=new THREE.Vector3;r.x=k[v++];r.y=k[v++];r.z=k[v];p.normal=r}if(q)for(e=0;e<x;e++){v=g[n++]*3;r=new THREE.Vector3;r.x=k[v++];r.y=k[v++];r.z=k[v];p.vertexNormals.push(r)}if(B){q=g[n++];p.color=new THREE.Color(l[q])}if(i)for(e=
-0;e<x;e++){q=g[n++];p.vertexColors.push(new THREE.Color(l[q]))}d.faces.push(p)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+2){k=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],k,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<g;e++){d.morphTargets[e]={};d.morphTargets[e].name=
-a.morphTargets[e].name;d.morphTargets[e].vertices=[];k=d.morphTargets[e].vertices;l=a.morphTargets[e].vertices;r=0;for(h=l.length;r<h;r=r+3){i=new THREE.Vector3;i.x=l[r]*f;i.y=l[r+1]*f;i.z=l[r+2]*f;k.push(i)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]={};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;l=a.morphColors[e].colors;k=0;for(h=l.length;k<h;k=k+3){n=new THREE.Color(16755200);n.setRGB(l[k],l[k+1],l[k+2]);f.push(n)}}}d.computeCentroids();
+a,true);d.send(null);var f=new THREE.LoadingMonitor;f.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});f.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var e=0;e<a.materials.length;++e){var g=a.materials[e],j=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},m=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},k=function(a,d,e,f,g,h){a[d]=new THREE.Texture;a[d].sourceFile=
+e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!==1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!==1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[d].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[d].wrapT=f[h[1]]}var k=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!j(a.width)||!j(a.height)){var b=m(a.width),c=m(a.height);k.image=document.createElement("canvas");k.image.width=
+b;k.image.height=c;k.image.getContext("2d").drawImage(a,0,0,b,c)}else k.image=a;k.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},h=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},n="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(g.shading){var o=g.shading.toLowerCase();o==="phong"?n="MeshPhongMaterial":o==="basic"&&(n="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==
+void 0)l.blending=THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)l.transparent=g.transparent;if(g.depthTest!==void 0)l.depthTest=g.depthTest;if(g.depthWrite!==void 0)l.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")l.vertexColors=THREE.FaceColors;else if(g.vertexColors)l.vertexColors=THREE.VertexColors;if(g.colorDiffuse)l.color=h(g.colorDiffuse);else if(g.DbgColor)l.color=g.DbgColor;if(g.colorSpecular)l.specular=h(g.colorSpecular);if(g.colorAmbient)l.ambient=
+h(g.colorAmbient);if(g.transparency)l.opacity=g.transparency;if(g.specularCoef)l.shininess=g.specularCoef;if(g.visible!==void 0)l.visible=g.visible;if(g.flipSided!==void 0)l.side=THREE.BackSide;if(g.doubleSided!==void 0)l.side=THREE.DoubleSide;if(g.wireframe!==void 0)l.wireframe=g.wireframe;g.mapDiffuse&&k(l,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&k(l,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapBump&&k(l,"bumpMap",g.mapBump,
+g.mapBumpRepeat,g.mapBumpOffset,g.mapBumpWrap);g.mapNormal&&k(l,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&k(l,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){k=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(k.uniforms);h.tNormal.texture=l.normalMap;if(g.mapNormalFactor)h.uNormalScale.value=g.mapNormalFactor;if(l.map){h.tDiffuse.texture=l.map;h.enableDiffuse.value=true}if(l.specularMap){h.tSpecular.texture=
+l.specularMap;h.enableSpecular.value=true}if(l.lightMap){h.tAO.texture=l.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(l.color);h.uSpecularColor.value.setHex(l.specular);h.uAmbientColor.value.setHex(l.ambient);h.uShininess.value=l.shininess;if(l.opacity!==void 0)h.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:h,lights:true,fog:true})}else l=new THREE[n](l);if(g.DbgName!==void 0)l.name=g.DbgName;d.materials[e]=
+l}}var g=a.faces,q=a.vertices,l=a.normals,k=a.colors,h=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&h++;for(e=0;e<h;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(o=q.length;n<o;){var i=new THREE.Vector3;i.x=q[n++]*f;i.y=q[n++]*f;i.z=q[n++]*f;d.vertices.push(i)}n=0;for(o=g.length;n<o;){var p=g[n++],r=p&2,e=p&4,u=p&8,v=p&16,q=p&32,B=p&64,i=p&128;if(p&1){p=new THREE.Face4;p.a=g[n++];p.b=g[n++];p.c=g[n++];p.d=g[n++];var x=4}else{p=new THREE.Face3;p.a=g[n++];p.b=g[n++];p.c=g[n++];x=3}if(r){r=
+g[n++];p.materialIndex=r}var A=d.faces.length;if(e)for(e=0;e<h;e++){var y=a.uvs[e],r=g[n++],E=y[r*2],r=y[r*2+1];d.faceUvs[e][A]=new THREE.UV(E,r)}if(u)for(e=0;e<h;e++){for(var y=a.uvs[e],u=[],s=0;s<x;s++){r=g[n++];E=y[r*2];r=y[r*2+1];u[s]=new THREE.UV(E,r)}d.faceVertexUvs[e][A]=u}if(v){v=g[n++]*3;r=new THREE.Vector3;r.x=l[v++];r.y=l[v++];r.z=l[v];p.normal=r}if(q)for(e=0;e<x;e++){v=g[n++]*3;r=new THREE.Vector3;r.x=l[v++];r.y=l[v++];r.z=l[v];p.vertexNormals.push(r)}if(B){q=g[n++];p.color=new THREE.Color(k[q])}if(i)for(e=
+0;e<x;e++){q=g[n++];p.vertexColors.push(new THREE.Color(k[q]))}d.faces.push(p)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+2){l=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],l,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<g;e++){d.morphTargets[e]={};d.morphTargets[e].name=
+a.morphTargets[e].name;d.morphTargets[e].vertices=[];l=d.morphTargets[e].vertices;k=a.morphTargets[e].vertices;r=0;for(h=k.length;r<h;r=r+3){i=new THREE.Vector3;i.x=k[r]*f;i.y=k[r+1]*f;i.z=k[r+2]*f;l.push(i)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]={};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;k=a.morphColors[e].colors;l=0;for(h=k.length;l<h;l=l+3){n=new THREE.Color(16755200);n.setRGB(k[l],k[l+1],k[l+2]);f.push(n)}}}d.computeCentroids();
 d.computeFaceNormals();return 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 f=JSON.parse(d.responseText);c.createScene(f,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:l+"/"+a}function f(a,b){var c;for(k in b)if(z.objects[k]===void 0){r=b[k];if(r.geometry!==void 0){if(C=z.geometries[r.geometry]){c=false;K=z.materials[r.materials[0]];(c=K instanceof THREE.ShaderMaterial)&&C.computeTangents();x=r.position;A=r.rotation;y=r.quaternion;E=r.scale;u=r.matrix;y=0;r.materials.length==0&&(K=new THREE.MeshFaceMaterial);r.materials.length>1&&(K=new THREE.MeshFaceMaterial);c=
-new THREE.Mesh(C,K);c.name=k;if(u){c.matrixAutoUpdate=false;c.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{c.position.set(x[0],x[1],x[2]);if(y){c.quaternion.set(y[0],y[1],y[2],y[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(E[0],E[1],E[2])}c.visible=r.visible;c.castShadow=r.castShadow;c.receiveShadow=r.receiveShadow;a.add(c);z.objects[k]=c}}else{x=r.position;A=r.rotation;y=r.quaternion;E=r.scale;y=0;c=new THREE.Object3D;
-c.name=k;c.position.set(x[0],x[1],x[2]);if(y){c.quaternion.set(y[0],y[1],y[2],y[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(E[0],E[1],E[2]);c.visible=r.visible!==void 0?r.visible:false;a.add(c);z.objects[k]=c;z.empties[k]=c}r.children!==void 0&&f(c,r.children)}}function e(a){return function(b){z.geometries[a]=b;f(z.scene,t.objects);I=I-1;m.onLoadComplete();j()}}function g(a){return function(b){z.geometries[a]=b}}function j(){m.callbackProgress({totalModels:P,totalTextures:R,
-loadedModels:P-I,loadedTextures:R-O},z);m.onLoadProgress();I===0&&O===0&&b(z)}var m=this,l=THREE.Loader.prototype.extractUrlBase(c),h,n,k,o,q,i,p,r,u,v,B,x,A,y,E,s,w,C,K,M,N,t,G,I,O,P,R,z;t=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;O=I=0;z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(t.transform){a=t.transform.position;v=t.transform.rotation;s=t.transform.scale;a&&z.scene.position.set(a[0],a[1],a[2]);v&&z.scene.rotation.set(v[0],
-v[1],v[2]);s&&z.scene.scale.set(s[0],s[1],s[2]);if(a||v||s){z.scene.updateMatrix();z.scene.updateMatrixWorld()}}a=function(a){return function(){O=O-a;j();m.onLoadComplete()}};for(q in t.cameras){s=t.cameras[q];s.type==="perspective"?M=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):s.type==="ortho"&&(M=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far));x=s.position;v=s.target;s=s.up;M.position.set(x[0],x[1],x[2]);M.target=new THREE.Vector3(v[0],v[1],v[2]);s&&M.up.set(s[0],
-s[1],s[2]);z.cameras[q]=M}for(o in t.lights){v=t.lights[o];q=v.color!==void 0?v.color:16777215;M=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){x=v.direction;B=new THREE.DirectionalLight(q,M);B.position.set(x[0],x[1],x[2]);B.position.normalize()}else if(v.type==="point"){x=v.position;B=v.distance;B=new THREE.PointLight(q,M,B);B.position.set(x[0],x[1],x[2])}else v.type==="ambient"&&(B=new THREE.AmbientLight(q));z.scene.add(B);z.lights[o]=B}for(i in t.fogs){o=t.fogs[i];o.type==="linear"?
-N=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&(N=new THREE.FogExp2(0,o.density));s=o.color;N.color.setRGB(s[0],s[1],s[2]);z.fogs[i]=N}if(z.cameras&&t.defaults.camera)z.currentCamera=z.cameras[t.defaults.camera];if(z.fogs&&t.defaults.fog)z.scene.fog=z.fogs[t.defaults.fog];s=t.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(s[0],s[1],s[2]);z.bgColorAlpha=t.defaults.bgalpha;for(h in t.geometries){i=t.geometries[h];if(i.type=="bin_mesh"||i.type=="ascii_mesh"){I=I+1;m.onLoadStart()}}P=I;
-for(h in t.geometries){i=t.geometries[h];if(i.type==="cube"){C=new THREE.CubeGeometry(i.width,i.height,i.depth,i.segmentsWidth,i.segmentsHeight,i.segmentsDepth,null,i.flipped,i.sides);z.geometries[h]=C}else if(i.type==="plane"){C=new THREE.PlaneGeometry(i.width,i.height,i.segmentsWidth,i.segmentsHeight);z.geometries[h]=C}else if(i.type==="sphere"){C=new THREE.SphereGeometry(i.radius,i.segmentsWidth,i.segmentsHeight);z.geometries[h]=C}else if(i.type==="cylinder"){C=new THREE.CylinderGeometry(i.topRad,
-i.botRad,i.height,i.radSegs,i.heightSegs);z.geometries[h]=C}else if(i.type==="torus"){C=new THREE.TorusGeometry(i.radius,i.tube,i.segmentsR,i.segmentsT);z.geometries[h]=C}else if(i.type==="icosahedron"){C=new THREE.IcosahedronGeometry(i.radius,i.subdivisions);z.geometries[h]=C}else if(i.type==="bin_mesh")c.load(d(i.url,t.urlBaseType),e(h));else if(i.type==="ascii_mesh")G.load(d(i.url,t.urlBaseType),e(h));else if(i.type==="embedded_mesh"){i=t.embeds[i.id];i.metadata=t.metadata;i&&G.createModel(i,g(h),
-"")}}for(p in t.textures){h=t.textures[p];if(h.url instanceof Array){O=O+h.url.length;for(i=0;i<h.url.length;i++)m.onLoadStart()}else{O=O+1;m.onLoadStart()}}R=O;for(p in t.textures){h=t.textures[p];if(h.mapping!==void 0&&THREE[h.mapping]!==void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){i=h.url.length;N=[];for(c=0;c<i;c++)N[c]=d(h.url[c],t.urlBaseType);i=THREE.ImageUtils.loadTextureCube(N,h.mapping,a(i))}else{i=THREE.ImageUtils.loadTexture(d(h.url,t.urlBaseType),h.mapping,a(1));if(THREE[h.minFilter]!==
-void 0)i.minFilter=THREE[h.minFilter];if(THREE[h.magFilter]!==void 0)i.magFilter=THREE[h.magFilter];if(h.repeat){i.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!==1)i.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!==1)i.wrapT=THREE.RepeatWrapping}h.offset&&i.offset.set(h.offset[0],h.offset[1]);if(h.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(N[h.wrap[0]]!==void 0)i.wrapS=N[h.wrap[0]];if(N[h.wrap[1]]!==void 0)i.wrapT=N[h.wrap[1]]}}z.textures[p]=i}for(n in t.materials){u=
-t.materials[n];for(w in u.parameters)if(w==="envMap"||w==="map"||w==="lightMap")u.parameters[w]=z.textures[u.parameters[w]];else if(w==="shading")u.parameters[w]=u.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w==="blending")u.parameters[w]=u.parameters[w]in THREE?THREE[u.parameters[w]]:THREE.NormalBlending;else if(w==="combine")u.parameters[w]=u.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w==="vertexColors")if(u.parameters[w]=="face")u.parameters[w]=
-THREE.FaceColors;else if(u.parameters[w])u.parameters[w]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);h=u.parameters.color;i=u.parameters.specular;N=u.parameters.ambient;c=u.parameters.shininess;a.tNormal.texture=z.textures[u.parameters.normalMap];if(u.parameters.normalMapFactor)a.uNormalScale.value=u.parameters.normalMapFactor;if(u.parameters.map){a.tDiffuse.texture=
-u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.lightMap){a.tAO.texture=u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.texture=z.textures[u.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(i);a.uAmbientColor.value.setHex(N);a.uShininess.value=c;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,
-uniforms:a,lights:true,fog:true})}else K=new THREE[u.type](u.parameters);z.materials[n]=K}f(z.scene,t.objects);m.callbackSync(z);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function f(a,b){var c;for(l in b)if(z.objects[l]===void 0){r=b[l];if(r.geometry!==void 0){if(C=z.geometries[r.geometry]){c=false;K=z.materials[r.materials[0]];(c=K instanceof THREE.ShaderMaterial)&&C.computeTangents();x=r.position;A=r.rotation;y=r.quaternion;E=r.scale;u=r.matrix;y=0;r.materials.length==0&&(K=new THREE.MeshFaceMaterial);r.materials.length>1&&(K=new THREE.MeshFaceMaterial);c=
+new THREE.Mesh(C,K);c.name=l;if(u){c.matrixAutoUpdate=false;c.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{c.position.set(x[0],x[1],x[2]);if(y){c.quaternion.set(y[0],y[1],y[2],y[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(E[0],E[1],E[2])}c.visible=r.visible;c.castShadow=r.castShadow;c.receiveShadow=r.receiveShadow;a.add(c);z.objects[l]=c}}else{x=r.position;A=r.rotation;y=r.quaternion;E=r.scale;y=0;c=new THREE.Object3D;
+c.name=l;c.position.set(x[0],x[1],x[2]);if(y){c.quaternion.set(y[0],y[1],y[2],y[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(E[0],E[1],E[2]);c.visible=r.visible!==void 0?r.visible:false;a.add(c);z.objects[l]=c;z.empties[l]=c}if(r.properties!==void 0)for(var d in r.properties)c.properties[d]=r.properties[d];r.children!==void 0&&f(c,r.children)}}function e(a){return function(b){z.geometries[a]=b;f(z.scene,t.objects);I=I-1;m.onLoadComplete();j()}}function g(a){return function(b){z.geometries[a]=
+b}}function j(){m.callbackProgress({totalModels:P,totalTextures:R,loadedModels:P-I,loadedTextures:R-O},z);m.onLoadProgress();I===0&&O===0&&b(z)}var m=this,k=THREE.Loader.prototype.extractUrlBase(c),h,n,l,o,q,i,p,r,u,v,B,x,A,y,E,s,w,C,K,M,N,t,G,I,O,P,R,z;t=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;O=I=0;z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(t.transform){a=t.transform.position;v=t.transform.rotation;s=t.transform.scale;
+a&&z.scene.position.set(a[0],a[1],a[2]);v&&z.scene.rotation.set(v[0],v[1],v[2]);s&&z.scene.scale.set(s[0],s[1],s[2]);if(a||v||s){z.scene.updateMatrix();z.scene.updateMatrixWorld()}}a=function(a){return function(){O=O-a;j();m.onLoadComplete()}};for(q in t.cameras){s=t.cameras[q];s.type==="perspective"?M=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):s.type==="ortho"&&(M=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far));x=s.position;v=s.target;s=s.up;M.position.set(x[0],
+x[1],x[2]);M.target=new THREE.Vector3(v[0],v[1],v[2]);s&&M.up.set(s[0],s[1],s[2]);z.cameras[q]=M}for(o in t.lights){v=t.lights[o];q=v.color!==void 0?v.color:16777215;M=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){x=v.direction;B=new THREE.DirectionalLight(q,M);B.position.set(x[0],x[1],x[2]);B.position.normalize()}else if(v.type==="point"){x=v.position;B=v.distance;B=new THREE.PointLight(q,M,B);B.position.set(x[0],x[1],x[2])}else v.type==="ambient"&&(B=new THREE.AmbientLight(q));z.scene.add(B);
+z.lights[o]=B}for(i in t.fogs){o=t.fogs[i];o.type==="linear"?N=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&(N=new THREE.FogExp2(0,o.density));s=o.color;N.color.setRGB(s[0],s[1],s[2]);z.fogs[i]=N}if(z.cameras&&t.defaults.camera)z.currentCamera=z.cameras[t.defaults.camera];if(z.fogs&&t.defaults.fog)z.scene.fog=z.fogs[t.defaults.fog];s=t.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(s[0],s[1],s[2]);z.bgColorAlpha=t.defaults.bgalpha;for(h in t.geometries){i=t.geometries[h];if(i.type==
+"bin_mesh"||i.type=="ascii_mesh"){I=I+1;m.onLoadStart()}}P=I;for(h in t.geometries){i=t.geometries[h];if(i.type==="cube"){C=new THREE.CubeGeometry(i.width,i.height,i.depth,i.segmentsWidth,i.segmentsHeight,i.segmentsDepth,null,i.flipped,i.sides);z.geometries[h]=C}else if(i.type==="plane"){C=new THREE.PlaneGeometry(i.width,i.height,i.segmentsWidth,i.segmentsHeight);z.geometries[h]=C}else if(i.type==="sphere"){C=new THREE.SphereGeometry(i.radius,i.segmentsWidth,i.segmentsHeight);z.geometries[h]=C}else if(i.type===
+"cylinder"){C=new THREE.CylinderGeometry(i.topRad,i.botRad,i.height,i.radSegs,i.heightSegs);z.geometries[h]=C}else if(i.type==="torus"){C=new THREE.TorusGeometry(i.radius,i.tube,i.segmentsR,i.segmentsT);z.geometries[h]=C}else if(i.type==="icosahedron"){C=new THREE.IcosahedronGeometry(i.radius,i.subdivisions);z.geometries[h]=C}else if(i.type==="bin_mesh")c.load(d(i.url,t.urlBaseType),e(h));else if(i.type==="ascii_mesh")G.load(d(i.url,t.urlBaseType),e(h));else if(i.type==="embedded_mesh"){i=t.embeds[i.id];
+i.metadata=t.metadata;i&&G.createModel(i,g(h),"")}}for(p in t.textures){h=t.textures[p];if(h.url instanceof Array){O=O+h.url.length;for(i=0;i<h.url.length;i++)m.onLoadStart()}else{O=O+1;m.onLoadStart()}}R=O;for(p in t.textures){h=t.textures[p];if(h.mapping!==void 0&&THREE[h.mapping]!==void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){i=h.url.length;N=[];for(c=0;c<i;c++)N[c]=d(h.url[c],t.urlBaseType);i=THREE.ImageUtils.loadTextureCube(N,h.mapping,a(i))}else{i=THREE.ImageUtils.loadTexture(d(h.url,
+t.urlBaseType),h.mapping,a(1));if(THREE[h.minFilter]!==void 0)i.minFilter=THREE[h.minFilter];if(THREE[h.magFilter]!==void 0)i.magFilter=THREE[h.magFilter];if(h.repeat){i.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!==1)i.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!==1)i.wrapT=THREE.RepeatWrapping}h.offset&&i.offset.set(h.offset[0],h.offset[1]);if(h.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(N[h.wrap[0]]!==void 0)i.wrapS=N[h.wrap[0]];if(N[h.wrap[1]]!==void 0)i.wrapT=
+N[h.wrap[1]]}}z.textures[p]=i}for(n in t.materials){u=t.materials[n];for(w in u.parameters)if(w==="envMap"||w==="map"||w==="lightMap")u.parameters[w]=z.textures[u.parameters[w]];else if(w==="shading")u.parameters[w]=u.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w==="blending")u.parameters[w]=u.parameters[w]in THREE?THREE[u.parameters[w]]:THREE.NormalBlending;else if(w==="combine")u.parameters[w]=u.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w===
+"vertexColors")if(u.parameters[w]=="face")u.parameters[w]=THREE.FaceColors;else if(u.parameters[w])u.parameters[w]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);h=u.parameters.color;i=u.parameters.specular;N=u.parameters.ambient;c=u.parameters.shininess;a.tNormal.texture=z.textures[u.parameters.normalMap];if(u.parameters.normalMapFactor)a.uNormalScale.value=
+u.parameters.normalMapFactor;if(u.parameters.map){a.tDiffuse.texture=u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.lightMap){a.tAO.texture=u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.texture=z.textures[u.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(i);a.uAmbientColor.value.setHex(N);a.uShininess.value=c;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,
+vertexShader:p.vertexShader,uniforms:a,lights:true,fog:true})}else K=new THREE[u.type](u.parameters);z.materials[n]=K}f(z.scene,t.objects);m.callbackSync(z);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(){this.id=THREE.MaterialCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=false;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=true;this.polygonOffset=false;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=false;this.needsUpdate=this.visible=true};
 THREE.Material.prototype.setValues=function(a){if(a!==void 0)for(var b in a){var c=a[b];if(c===void 0)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color&&typeof c==="number"?d.setHex(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
@@ -206,7 +206,7 @@ THREE.ParticleBasicMaterial.prototype.clone=function(){var a=new THREE.ParticleB
 THREE.ParticleCanvasMaterial.prototype.clone=function(){var a=new THREE.ParticleCanvasMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.program=this.program;return a};
 THREE.Texture=function(a,b,c,d,f,e,g,j,m){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=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e:THREE.LinearMipMapLinearFilter;this.anisotropy=m!==void 0?m:1;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=j!==void 0?j:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=
 new THREE.Vector2(1,1);this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=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,this.anisotropy);a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;return a}};
-THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,f,e,g,j,m,l){THREE.Texture.call(this,null,e,g,j,m,l,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);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.TextureCount=0;THREE.DataTexture=function(a,b,c,d,f,e,g,j,m,k){THREE.Texture.call(this,null,e,g,j,m,k,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);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=Object.create(THREE.Object3D.prototype);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=Object.create(THREE.Object3D.prototype);
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);
@@ -218,32 +218,32 @@ THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.to
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=false;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light){this.__lights.indexOf(a)===-1&&this.__lights.push(a);a.target&&a.target.parent===void 0&&this.add(a.target)}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.CanvasRenderer=function(a){function b(a){if(u!==a)u=i.globalAlpha=a}function c(a){if(v!==a){if(a===THREE.NormalBlending)i.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)i.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)i.globalCompositeOperation="darker";v=a}}function d(a){if(B!==a)B=i.strokeStyle=a}function f(a){if(x!==a)x=i.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,j,m,l=new THREE.Projector,h=a.canvas!==
-void 0?a.canvas:document.createElement("canvas"),n,k,o,q,i=h.getContext("2d"),p=new THREE.Color(0),r=0,u=1,v=0,B=null,x=null,A=null,y=null,E=null,s,w,C,K,M=new THREE.RenderableVertex,N=new THREE.RenderableVertex,t,G,I,O,P,R,z,$,aa,J,S,W,D=new THREE.Color,F=new THREE.Color,H=new THREE.Color,L=new THREE.Color,Q=new THREE.Color,la=[],T=[],ca,U,da,fa,za,Aa,Ba,Ca,Da,Ea,ia=new THREE.Rectangle,ba=new THREE.Rectangle,X=new THREE.Rectangle,ua=false,Z=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,V=
-new THREE.Vector3,ra,sa,ya,ea,ta,va,a=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);ya=sa.getImageData(0,0,2,2);ea=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;va=ta.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;k=b;o=Math.floor(n/2);q=Math.floor(k/
-2);h.width=n;h.height=k;ia.set(-o,-q,o,q);ba.set(-o,-q,o,q);u=1;v=0;E=y=A=x=B=null};this.setClearColor=function(a,b){p.copy(a);r=b!==void 0?b:1;ba.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){p.setHex(a);r=b!==void 0?b:1;ba.set(-o,-q,o,q)};this.clear=function(){i.setTransform(1,0,0,-1,o,q);if(ba.isEmpty()===false){ba.minSelf(ia);ba.inflate(2);r<1&&i.clearRect(Math.floor(ba.getX()),Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight()));if(r>0){c(THREE.NormalBlending);b(1);
-f("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")");i.fillRect(Math.floor(ba.getX()),Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight()))}ba.empty()}};this.render=function(a,h){function k(a){var b,c,d,e;Z.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Z.r=Z.r+e.r;Z.g=Z.g+e.g;Z.b=Z.b+e.b}else if(d instanceof THREE.DirectionalLight){ma.r=ma.r+e.r;ma.g=ma.g+e.g;
-ma.b=ma.b+e.b}else if(d instanceof THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function n(a,b,c,d){var e,f,g,h,l,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){l=g.matrixWorld.getPosition().normalize();j=c.dot(l);if(!(j<=0)){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}else if(g instanceof THREE.PointLight){l=g.matrixWorld.getPosition();j=c.dot(V.sub(l,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(l)/
-g.distance,1));if(j!=0){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}}}}function p(a,e,g){b(g.opacity);c(g.blending);var h,l,j,m,k,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){j=e.object.scale.x;m=e.object.scale.y;j=j*e.scale.x*o;m=m*e.scale.y*q;X.set(a.x-j,a.y-m,a.x+j,a.y+m);if(ia.intersects(X)===false)return;f(g.color.getContextStyle());i.save();i.translate(a.x,a.y);i.rotate(-e.rotation);i.scale(j,m);i.fillRect(-1,-1,2,2)}else{g=g.map.image;k=g.width>>1;n=g.height>>
-1;j=e.scale.x*o;m=e.scale.y*q;h=j*k;l=m*n;X.set(a.x-h,a.y-l,a.x+h,a.y+l);if(ia.intersects(X)===false)return;i.save();i.translate(a.x,a.y);i.rotate(-e.rotation);i.scale(j,-m);i.translate(-k,-n);i.drawImage(g,0,0)}i.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=e.scale.x*o;l=e.scale.y*q;X.set(a.x-h,a.y-l,a.x+h,a.y+l);if(ia.intersects(X)!==false){d(g.color.getContextStyle());f(g.color.getContextStyle());i.save();i.translate(a.x,a.y);i.rotate(-e.rotation);i.scale(h,l);g.program(i);i.restore()}}}
-function r(a,e,f,g){b(g.opacity);c(g.blending);i.beginPath();i.moveTo(a.positionScreen.x,a.positionScreen.y);i.lineTo(e.positionScreen.x,e.positionScreen.y);i.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!==a)A=i.lineWidth=a;a=g.linecap;if(y!==a)y=i.lineCap=a;a=g.linejoin;if(E!==a)E=i.lineJoin=a;d(g.color.getContextStyle());i.stroke();X.inflate(g.linewidth*2)}}function u(a,d,f,g,l,j,i,k){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(k.opacity);c(k.blending);
-t=a.positionScreen.x;G=a.positionScreen.y;I=d.positionScreen.x;O=d.positionScreen.y;P=f.positionScreen.x;R=f.positionScreen.y;x(t,G,I,O,P,R);if(k instanceof THREE.MeshBasicMaterial)if(k.map!==null){if(k.map.mapping instanceof THREE.UVMapping){fa=i.uvs[0];Fa(t,G,I,O,P,R,fa[g].u,fa[g].v,fa[l].u,fa[l].v,fa[j].u,fa[j].v,k.map)}}else if(k.envMap!==null){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=h.matrixWorldInverse;V.copy(i.vertexNormalsWorld[g]);za=(V.x*a.elements[0]+V.y*a.elements[4]+
-V.z*a.elements[8])*0.5+0.5;Aa=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(i.vertexNormalsWorld[l]);Ba=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ca=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(i.vertexNormalsWorld[j]);Da=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ea=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;Fa(t,G,I,O,P,R,za,Aa,Ba,Ca,Da,Ea,k.envMap)}}else k.wireframe===true?ja(k.color,
-k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(k.color);else if(k instanceof THREE.MeshLambertMaterial)if(ua===true)if(k.wireframe===false&&k.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3){F.r=H.r=L.r=Z.r;F.g=H.g=L.g=Z.g;F.b=H.b=L.b=Z.b;n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],F);n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],H);n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],L);F.r=Math.max(0,Math.min(k.color.r*F.r,1));F.g=Math.max(0,Math.min(k.color.g*F.g,1));
-F.b=Math.max(0,Math.min(k.color.b*F.b,1));H.r=Math.max(0,Math.min(k.color.r*H.r,1));H.g=Math.max(0,Math.min(k.color.g*H.g,1));H.b=Math.max(0,Math.min(k.color.b*H.b,1));L.r=Math.max(0,Math.min(k.color.r*L.r,1));L.g=Math.max(0,Math.min(k.color.g*L.g,1));L.b=Math.max(0,Math.min(k.color.b*L.b,1));Q.r=(H.r+L.r)*0.5;Q.g=(H.g+L.g)*0.5;Q.b=(H.b+L.b)*0.5;da=wa(F,H,L,Q);pa(t,G,I,O,P,R,0,0,1,0,0,1,da)}else{D.r=Z.r;D.g=Z.g;D.b=Z.b;n(m,i.centroidWorld,i.normalWorld,D);D.r=Math.max(0,Math.min(k.color.r*D.r,1));
-D.g=Math.max(0,Math.min(k.color.g*D.g,1));D.b=Math.max(0,Math.min(k.color.b*D.b,1));k.wireframe===true?ja(D,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(D)}else k.wireframe===true?ja(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(k.color);else if(k instanceof THREE.MeshDepthMaterial){ca=h.near;U=h.far;F.r=F.g=F.b=1-oa(a.positionScreen.z,ca,U);H.r=H.g=H.b=1-oa(d.positionScreen.z,ca,U);L.r=L.g=L.b=1-oa(f.positionScreen.z,ca,U);Q.r=(H.r+L.r)*0.5;Q.g=(H.g+L.g)*
-0.5;Q.b=(H.b+L.b)*0.5;da=wa(F,H,L,Q);pa(t,G,I,O,P,R,0,0,1,0,0,1,da)}else if(k instanceof THREE.MeshNormalMaterial){D.r=qa(i.normalWorld.x);D.g=qa(i.normalWorld.y);D.b=qa(i.normalWorld.z);k.wireframe===true?ja(D,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(D)}}function v(a,d,f,g,l,j,k,i,o){e.info.render.vertices=e.info.render.vertices+4;e.info.render.faces++;b(i.opacity);c(i.blending);if(i.map!==void 0&&i.map!==null||i.envMap!==void 0&&i.envMap!==null){u(a,d,g,0,1,3,k,i,o);u(l,f,
-j,1,2,3,k,i,o)}else{t=a.positionScreen.x;G=a.positionScreen.y;I=d.positionScreen.x;O=d.positionScreen.y;P=f.positionScreen.x;R=f.positionScreen.y;z=g.positionScreen.x;$=g.positionScreen.y;aa=l.positionScreen.x;J=l.positionScreen.y;S=j.positionScreen.x;W=j.positionScreen.y;if(i instanceof THREE.MeshBasicMaterial){B(t,G,I,O,P,R,z,$);i.wireframe===true?ja(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color)}else if(i instanceof THREE.MeshLambertMaterial)if(ua===true)if(!i.wireframe&&
-i.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4){F.r=H.r=L.r=Q.r=Z.r;F.g=H.g=L.g=Q.g=Z.g;F.b=H.b=L.b=Q.b=Z.b;n(m,k.v1.positionWorld,k.vertexNormalsWorld[0],F);n(m,k.v2.positionWorld,k.vertexNormalsWorld[1],H);n(m,k.v4.positionWorld,k.vertexNormalsWorld[3],L);n(m,k.v3.positionWorld,k.vertexNormalsWorld[2],Q);F.r=Math.max(0,Math.min(i.color.r*F.r,1));F.g=Math.max(0,Math.min(i.color.g*F.g,1));F.b=Math.max(0,Math.min(i.color.b*F.b,1));H.r=Math.max(0,Math.min(i.color.r*H.r,1));H.g=Math.max(0,
-Math.min(i.color.g*H.g,1));H.b=Math.max(0,Math.min(i.color.b*H.b,1));L.r=Math.max(0,Math.min(i.color.r*L.r,1));L.g=Math.max(0,Math.min(i.color.g*L.g,1));L.b=Math.max(0,Math.min(i.color.b*L.b,1));Q.r=Math.max(0,Math.min(i.color.r*Q.r,1));Q.g=Math.max(0,Math.min(i.color.g*Q.g,1));Q.b=Math.max(0,Math.min(i.color.b*Q.b,1));da=wa(F,H,L,Q);x(t,G,I,O,z,$);pa(t,G,I,O,z,$,0,0,1,0,0,1,da);x(aa,J,P,R,S,W);pa(aa,J,P,R,S,W,1,0,1,1,0,1,da)}else{D.r=Z.r;D.g=Z.g;D.b=Z.b;n(m,k.centroidWorld,k.normalWorld,D);D.r=Math.max(0,
-Math.min(i.color.r*D.r,1));D.g=Math.max(0,Math.min(i.color.g*D.g,1));D.b=Math.max(0,Math.min(i.color.b*D.b,1));B(t,G,I,O,P,R,z,$);i.wireframe===true?ja(D,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(D)}else{B(t,G,I,O,P,R,z,$);i.wireframe===true?ja(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color)}else if(i instanceof THREE.MeshNormalMaterial){D.r=qa(k.normalWorld.x);D.g=qa(k.normalWorld.y);D.b=qa(k.normalWorld.z);B(t,G,I,O,P,R,z,$);i.wireframe===true?
+THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=i.globalAlpha=a}function c(a){if(v!==a){if(a===THREE.NormalBlending)i.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)i.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)i.globalCompositeOperation="darker";v=a}}function d(a){if(B!==a)B=i.strokeStyle=a}function f(a){if(x!==a)x=i.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,j,m,k=new THREE.Projector,h=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),n,l,o,q,i=h.getContext("2d"),p=new THREE.Color(0),r=0,u=1,v=0,B=null,x=null,A=null,y=null,E=null,s,w,C,K,M=new THREE.RenderableVertex,N=new THREE.RenderableVertex,t,G,I,O,P,R,z,$,aa,J,S,W,D=new THREE.Color,F=new THREE.Color,H=new THREE.Color,L=new THREE.Color,Q=new THREE.Color,la=[],T=[],ca,U,da,fa,za,Aa,Ba,Ca,Da,Ea,ia=new THREE.Rectangle,ba=new THREE.Rectangle,X=new THREE.Rectangle,ua=false,Z=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,V=
+new THREE.Vector3,ra,sa,ya,ea,ta,va,a=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);ya=sa.getImageData(0,0,2,2);ea=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;va=ta.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;l=b;o=Math.floor(n/2);q=Math.floor(l/
+2);h.width=n;h.height=l;ia.set(-o,-q,o,q);ba.set(-o,-q,o,q);u=1;v=0;E=y=A=x=B=null};this.setClearColor=function(a,b){p.copy(a);r=b!==void 0?b:1;ba.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){p.setHex(a);r=b!==void 0?b:1;ba.set(-o,-q,o,q)};this.clear=function(){i.setTransform(1,0,0,-1,o,q);if(ba.isEmpty()===false){ba.minSelf(ia);ba.inflate(2);r<1&&i.clearRect(Math.floor(ba.getX()),Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight()));if(r>0){c(THREE.NormalBlending);b(1);
+f("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")");i.fillRect(Math.floor(ba.getX()),Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight()))}ba.empty()}};this.render=function(a,h){function l(a){var b,c,d,e;Z.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Z.r=Z.r+e.r;Z.g=Z.g+e.g;Z.b=Z.b+e.b}else if(d instanceof THREE.DirectionalLight){ma.r=ma.r+e.r;ma.g=ma.g+e.g;
+ma.b=ma.b+e.b}else if(d instanceof THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition().normalize();j=c.dot(k);if(!(j<=0)){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();j=c.dot(V.sub(k,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(k)/
+g.distance,1));if(j!=0){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}}}}function p(a,e,g){b(g.opacity);c(g.blending);var h,k,j,m,l,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map===null){j=e.object.scale.x;m=e.object.scale.y;j=j*e.scale.x*o;m=m*e.scale.y*q;X.set(a.x-j,a.y-m,a.x+j,a.y+m);if(ia.intersects(X)===false)return;f(g.color.getContextStyle());i.save();i.translate(a.x,a.y);i.rotate(-e.rotation);i.scale(j,m);i.fillRect(-1,-1,2,2)}else{g=g.map.image;l=g.width>>1;n=g.height>>
+1;j=e.scale.x*o;m=e.scale.y*q;h=j*l;k=m*n;X.set(a.x-h,a.y-k,a.x+h,a.y+k);if(ia.intersects(X)===false)return;i.save();i.translate(a.x,a.y);i.rotate(-e.rotation);i.scale(j,-m);i.translate(-l,-n);i.drawImage(g,0,0)}i.restore()}else if(g instanceof THREE.ParticleCanvasMaterial){h=e.scale.x*o;k=e.scale.y*q;X.set(a.x-h,a.y-k,a.x+h,a.y+k);if(ia.intersects(X)!==false){d(g.color.getContextStyle());f(g.color.getContextStyle());i.save();i.translate(a.x,a.y);i.rotate(-e.rotation);i.scale(h,k);g.program(i);i.restore()}}}
+function r(a,e,f,g){b(g.opacity);c(g.blending);i.beginPath();i.moveTo(a.positionScreen.x,a.positionScreen.y);i.lineTo(e.positionScreen.x,e.positionScreen.y);i.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!==a)A=i.lineWidth=a;a=g.linecap;if(y!==a)y=i.lineCap=a;a=g.linejoin;if(E!==a)E=i.lineJoin=a;d(g.color.getContextStyle());i.stroke();X.inflate(g.linewidth*2)}}function u(a,d,f,g,k,j,i,l){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(l.opacity);c(l.blending);
+t=a.positionScreen.x;G=a.positionScreen.y;I=d.positionScreen.x;O=d.positionScreen.y;P=f.positionScreen.x;R=f.positionScreen.y;x(t,G,I,O,P,R);if(l instanceof THREE.MeshBasicMaterial)if(l.map!==null){if(l.map.mapping instanceof THREE.UVMapping){fa=i.uvs[0];Fa(t,G,I,O,P,R,fa[g].u,fa[g].v,fa[k].u,fa[k].v,fa[j].u,fa[j].v,l.map)}}else if(l.envMap!==null){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=h.matrixWorldInverse;V.copy(i.vertexNormalsWorld[g]);za=(V.x*a.elements[0]+V.y*a.elements[4]+
+V.z*a.elements[8])*0.5+0.5;Aa=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(i.vertexNormalsWorld[k]);Ba=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ca=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(i.vertexNormalsWorld[j]);Da=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ea=(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;Fa(t,G,I,O,P,R,za,Aa,Ba,Ca,Da,Ea,l.envMap)}}else l.wireframe===true?ja(l.color,
+l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ga(l.color);else if(l instanceof THREE.MeshLambertMaterial)if(ua===true)if(l.wireframe===false&&l.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3){F.r=H.r=L.r=Z.r;F.g=H.g=L.g=Z.g;F.b=H.b=L.b=Z.b;n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],F);n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],H);n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],L);F.r=Math.max(0,Math.min(l.color.r*F.r,1));F.g=Math.max(0,Math.min(l.color.g*F.g,1));
+F.b=Math.max(0,Math.min(l.color.b*F.b,1));H.r=Math.max(0,Math.min(l.color.r*H.r,1));H.g=Math.max(0,Math.min(l.color.g*H.g,1));H.b=Math.max(0,Math.min(l.color.b*H.b,1));L.r=Math.max(0,Math.min(l.color.r*L.r,1));L.g=Math.max(0,Math.min(l.color.g*L.g,1));L.b=Math.max(0,Math.min(l.color.b*L.b,1));Q.r=(H.r+L.r)*0.5;Q.g=(H.g+L.g)*0.5;Q.b=(H.b+L.b)*0.5;da=wa(F,H,L,Q);pa(t,G,I,O,P,R,0,0,1,0,0,1,da)}else{D.r=Z.r;D.g=Z.g;D.b=Z.b;n(m,i.centroidWorld,i.normalWorld,D);D.r=Math.max(0,Math.min(l.color.r*D.r,1));
+D.g=Math.max(0,Math.min(l.color.g*D.g,1));D.b=Math.max(0,Math.min(l.color.b*D.b,1));l.wireframe===true?ja(D,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ga(D)}else l.wireframe===true?ja(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ga(l.color);else if(l instanceof THREE.MeshDepthMaterial){ca=h.near;U=h.far;F.r=F.g=F.b=1-oa(a.positionScreen.z,ca,U);H.r=H.g=H.b=1-oa(d.positionScreen.z,ca,U);L.r=L.g=L.b=1-oa(f.positionScreen.z,ca,U);Q.r=(H.r+L.r)*0.5;Q.g=(H.g+L.g)*
+0.5;Q.b=(H.b+L.b)*0.5;da=wa(F,H,L,Q);pa(t,G,I,O,P,R,0,0,1,0,0,1,da)}else if(l instanceof THREE.MeshNormalMaterial){D.r=qa(i.normalWorld.x);D.g=qa(i.normalWorld.y);D.b=qa(i.normalWorld.z);l.wireframe===true?ja(D,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ga(D)}}function v(a,d,f,g,k,j,l,i,o){e.info.render.vertices=e.info.render.vertices+4;e.info.render.faces++;b(i.opacity);c(i.blending);if(i.map!==void 0&&i.map!==null||i.envMap!==void 0&&i.envMap!==null){u(a,d,g,0,1,3,l,i,o);u(k,f,
+j,1,2,3,l,i,o)}else{t=a.positionScreen.x;G=a.positionScreen.y;I=d.positionScreen.x;O=d.positionScreen.y;P=f.positionScreen.x;R=f.positionScreen.y;z=g.positionScreen.x;$=g.positionScreen.y;aa=k.positionScreen.x;J=k.positionScreen.y;S=j.positionScreen.x;W=j.positionScreen.y;if(i instanceof THREE.MeshBasicMaterial){B(t,G,I,O,P,R,z,$);i.wireframe===true?ja(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color)}else if(i instanceof THREE.MeshLambertMaterial)if(ua===true)if(!i.wireframe&&
+i.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==4){F.r=H.r=L.r=Q.r=Z.r;F.g=H.g=L.g=Q.g=Z.g;F.b=H.b=L.b=Q.b=Z.b;n(m,l.v1.positionWorld,l.vertexNormalsWorld[0],F);n(m,l.v2.positionWorld,l.vertexNormalsWorld[1],H);n(m,l.v4.positionWorld,l.vertexNormalsWorld[3],L);n(m,l.v3.positionWorld,l.vertexNormalsWorld[2],Q);F.r=Math.max(0,Math.min(i.color.r*F.r,1));F.g=Math.max(0,Math.min(i.color.g*F.g,1));F.b=Math.max(0,Math.min(i.color.b*F.b,1));H.r=Math.max(0,Math.min(i.color.r*H.r,1));H.g=Math.max(0,
+Math.min(i.color.g*H.g,1));H.b=Math.max(0,Math.min(i.color.b*H.b,1));L.r=Math.max(0,Math.min(i.color.r*L.r,1));L.g=Math.max(0,Math.min(i.color.g*L.g,1));L.b=Math.max(0,Math.min(i.color.b*L.b,1));Q.r=Math.max(0,Math.min(i.color.r*Q.r,1));Q.g=Math.max(0,Math.min(i.color.g*Q.g,1));Q.b=Math.max(0,Math.min(i.color.b*Q.b,1));da=wa(F,H,L,Q);x(t,G,I,O,z,$);pa(t,G,I,O,z,$,0,0,1,0,0,1,da);x(aa,J,P,R,S,W);pa(aa,J,P,R,S,W,1,0,1,1,0,1,da)}else{D.r=Z.r;D.g=Z.g;D.b=Z.b;n(m,l.centroidWorld,l.normalWorld,D);D.r=Math.max(0,
+Math.min(i.color.r*D.r,1));D.g=Math.max(0,Math.min(i.color.g*D.g,1));D.b=Math.max(0,Math.min(i.color.b*D.b,1));B(t,G,I,O,P,R,z,$);i.wireframe===true?ja(D,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(D)}else{B(t,G,I,O,P,R,z,$);i.wireframe===true?ja(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color)}else if(i instanceof THREE.MeshNormalMaterial){D.r=qa(l.normalWorld.x);D.g=qa(l.normalWorld.y);D.b=qa(l.normalWorld.z);B(t,G,I,O,P,R,z,$);i.wireframe===true?
 ja(D,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(D)}else if(i instanceof THREE.MeshDepthMaterial){ca=h.near;U=h.far;F.r=F.g=F.b=1-oa(a.positionScreen.z,ca,U);H.r=H.g=H.b=1-oa(d.positionScreen.z,ca,U);L.r=L.g=L.b=1-oa(g.positionScreen.z,ca,U);Q.r=Q.g=Q.b=1-oa(f.positionScreen.z,ca,U);da=wa(F,H,L,Q);x(t,G,I,O,z,$);pa(t,G,I,O,z,$,0,0,1,0,0,1,da);x(aa,J,P,R,S,W);pa(aa,J,P,R,S,W,1,0,1,1,0,1,da)}}}function x(a,b,c,d,e,f){i.beginPath();i.moveTo(a,b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(a,
-b)}function B(a,b,c,d,e,f,g,h){i.beginPath();i.moveTo(a,b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(g,h);i.lineTo(a,b)}function ja(a,b,c,e){if(A!==b)A=i.lineWidth=b;if(y!==c)y=i.lineCap=c;if(E!==e)E=i.lineJoin=e;d(a.getContextStyle());i.stroke();X.inflate(b*2)}function ga(a){f(a.getContextStyle());i.fill()}function Fa(a,b,c,d,e,g,h,k,l,j,m,n,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||la[o.id]===void 0){var p=o.wrapS==THREE.RepeatWrapping,q=o.wrapT==THREE.RepeatWrapping;la[o.id]=
-i.createPattern(o.image,p===true&&q===true?"repeat":p===true&&q===false?"repeat-x":p===false&&q===true?"repeat-y":"no-repeat");o.needsUpdate=false}f(la[o.id]);var p=o.offset.x/o.repeat.x,q=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,s=o.image.height*o.repeat.y,h=(h+p)*r,k=(1-k+q)*s,c=c-a,d=d-b,e=e-a,g=g-b,l=(l+p)*r-h,j=(1-j+q)*s-k,m=(m+p)*r-h,n=(1-n+q)*s-k,p=l*n-m*j;if(p===0){if(T[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");
-b.drawImage(o.image,0,0);T[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=T[o.id];h=(Math.floor(h)+Math.floor(k)*o.image.width)*4;D.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ga(D)}else{p=1/p;o=(n*c-j*e)*p;j=(n*d-j*g)*p;c=(l*e-m*c)*p;d=(l*g-m*d)*p;a=a-o*h-c*k;h=b-j*h-d*k;i.save();i.transform(o,j,c,d,a,h);i.fill();i.restore()}}}function pa(a,b,c,d,e,f,g,h,k,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;k=k*o-g;j=j*p-h;l=l*o-g;m=m*p-h;p=1/(k*m-l*j);o=(m*c-
+b)}function B(a,b,c,d,e,f,g,h){i.beginPath();i.moveTo(a,b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(g,h);i.lineTo(a,b)}function ja(a,b,c,e){if(A!==b)A=i.lineWidth=b;if(y!==c)y=i.lineCap=c;if(E!==e)E=i.lineJoin=e;d(a.getContextStyle());i.stroke();X.inflate(b*2)}function ga(a){f(a.getContextStyle());i.fill()}function Fa(a,b,c,d,e,g,h,k,j,l,m,n,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||la[o.id]===void 0){var p=o.wrapS==THREE.RepeatWrapping,q=o.wrapT==THREE.RepeatWrapping;la[o.id]=
+i.createPattern(o.image,p===true&&q===true?"repeat":p===true&&q===false?"repeat-x":p===false&&q===true?"repeat-y":"no-repeat");o.needsUpdate=false}f(la[o.id]);var p=o.offset.x/o.repeat.x,q=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,s=o.image.height*o.repeat.y,h=(h+p)*r,k=(1-k+q)*s,c=c-a,d=d-b,e=e-a,g=g-b,j=(j+p)*r-h,l=(1-l+q)*s-k,m=(m+p)*r-h,n=(1-n+q)*s-k,p=j*n-m*l;if(p===0){if(T[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");
+b.drawImage(o.image,0,0);T[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=T[o.id];h=(Math.floor(h)+Math.floor(k)*o.image.width)*4;D.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ga(D)}else{p=1/p;o=(n*c-l*e)*p;l=(n*d-l*g)*p;c=(j*e-m*c)*p;d=(j*g-m*d)*p;a=a-o*h-c*k;h=b-l*h-d*k;i.save();i.transform(o,l,c,d,a,h);i.fill();i.restore()}}}function pa(a,b,c,d,e,f,g,h,k,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;k=k*o-g;j=j*p-h;l=l*o-g;m=m*p-h;p=1/(k*m-l*j);o=(m*c-
 j*e)*p;j=(m*d-j*f)*p;c=(k*e-l*c)*p;d=(k*f-l*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;i.save();i.transform(o,j,c,d,a,b);i.clip();i.drawImage(n,0,0);i.restore()}function wa(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);ea[0]=e<0?0:e>255?255:e;ea[1]=f<0?0:f>255?255:f;ea[2]=a<0?0:a>255?255:a;ea[4]=g<0?0:g>255?255:g;ea[5]=h<0?0:h>255?255:h;ea[6]=b<0?0:b>255?255:b;ea[8]=i<0?0:i>255?
 255:i;ea[9]=j<0?0:j>255?255:j;ea[10]=c<0?0:c>255?255:c;ea[12]=k<0?0:k>255?255:k;ea[13]=l<0?0:l>255?255:l;ea[14]=d<0?0:d>255?255:d;sa.putImageData(ya,0,0);va.drawImage(ra,0,0);return ta}function oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function qa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ka(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}}if(h instanceof THREE.Camera===false)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
-else{var xa,Ga,Y,ha;this.autoClear===true?this.clear():i.setTransform(1,0,0,-1,o,q);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,h,this.sortElements);j=g.elements;m=g.lights;ua=m.length>0;ua===true&&k(m);xa=0;for(Ga=j.length;xa<Ga;xa++){Y=j[xa];ha=Y.material;if(!(ha===void 0||ha.visible===false)){X.empty();if(Y instanceof THREE.RenderableParticle){s=Y;s.x=s.x*o;s.y=s.y*q;p(s,Y,ha,a)}else if(Y instanceof THREE.RenderableLine){s=Y.v1;w=Y.v2;s.positionScreen.x=s.positionScreen.x*
+else{var xa,Ga,Y,ha;this.autoClear===true?this.clear():i.setTransform(1,0,0,-1,o,q);e.info.render.vertices=0;e.info.render.faces=0;g=k.projectScene(a,h,this.sortElements);j=g.elements;m=g.lights;ua=m.length>0;ua===true&&l(m);xa=0;for(Ga=j.length;xa<Ga;xa++){Y=j[xa];ha=Y.material;if(!(ha===void 0||ha.visible===false)){X.empty();if(Y instanceof THREE.RenderableParticle){s=Y;s.x=s.x*o;s.y=s.y*q;p(s,Y,ha,a)}else if(Y instanceof THREE.RenderableLine){s=Y.v1;w=Y.v2;s.positionScreen.x=s.positionScreen.x*
 o;s.positionScreen.y=s.positionScreen.y*q;w.positionScreen.x=w.positionScreen.x*o;w.positionScreen.y=w.positionScreen.y*q;X.addPoint(s.positionScreen.x,s.positionScreen.y);X.addPoint(w.positionScreen.x,w.positionScreen.y);ia.intersects(X)===true&&r(s,w,Y,ha,a)}else if(Y instanceof THREE.RenderableFace3){s=Y.v1;w=Y.v2;C=Y.v3;s.positionScreen.x=s.positionScreen.x*o;s.positionScreen.y=s.positionScreen.y*q;w.positionScreen.x=w.positionScreen.x*o;w.positionScreen.y=w.positionScreen.y*q;C.positionScreen.x=
 C.positionScreen.x*o;C.positionScreen.y=C.positionScreen.y*q;if(ha.overdraw===true){ka(s.positionScreen,w.positionScreen);ka(w.positionScreen,C.positionScreen);ka(C.positionScreen,s.positionScreen)}X.add3Points(s.positionScreen.x,s.positionScreen.y,w.positionScreen.x,w.positionScreen.y,C.positionScreen.x,C.positionScreen.y);ia.intersects(X)===true&&u(s,w,C,0,1,2,Y,ha,a)}else if(Y instanceof THREE.RenderableFace4){s=Y.v1;w=Y.v2;C=Y.v3;K=Y.v4;s.positionScreen.x=s.positionScreen.x*o;s.positionScreen.y=
 s.positionScreen.y*q;w.positionScreen.x=w.positionScreen.x*o;w.positionScreen.y=w.positionScreen.y*q;C.positionScreen.x=C.positionScreen.x*o;C.positionScreen.y=C.positionScreen.y*q;K.positionScreen.x=K.positionScreen.x*o;K.positionScreen.y=K.positionScreen.y*q;M.positionScreen.copy(w.positionScreen);N.positionScreen.copy(K.positionScreen);if(ha.overdraw===true){ka(s.positionScreen,w.positionScreen);ka(w.positionScreen,K.positionScreen);ka(K.positionScreen,s.positionScreen);ka(C.positionScreen,M.positionScreen);

+ 2 - 2
build/custom/ThreeExtras.js

@@ -77,8 +77,8 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(b){this.points=b==void 0?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return a});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(b){this.curves.push(b)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var b=this.curves[0].getPoint(0),a=this.curves[this.curves.length-1].getPoint(1);b.equals(a)||this.curves.push(new THREE.LineCurve(a,b))};
 THREE.CurvePath.prototype.getPoint=function(b){for(var a=b*this.getLength(),c=this.getCurveLengths(),b=0;b<c.length;){if(c[b]>=a){a=c[b]-a;b=this.curves[b];a=1-a/b.getLength();return b.getPointAt(a)}b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],a=0,c,d=this.curves.length;for(c=0;c<d;c++){a=a+this.curves[c].getLength();b.push(a)}return this.cacheLengths=b};
-THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),a,c,d,e,f,g;a=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,j,l,m=b[0]instanceof THREE.Vector3;l=m?new THREE.Vector3:new THREE.Vector2;i=0;for(j=b.length;i<j;i++){h=b[i];if(h.x>a)a=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<f)f=h.y;if(m){if(h.z>d)d=h.z;else if(h.z<g)g=h.z;l.addSelf(h.x,h.y,h.z)}else l.addSelf(h.x,h.y)}b={minX:e,minY:f,maxX:a,maxY:c,centroid:l.divideScalar(j)};if(m){b.maxZ=d;b.minZ=
-g}return b};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,true))};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,true))};THREE.CurvePath.prototype.createGeometry=function(b){for(var a=new THREE.Geometry,c=0;c<b.length;c++)a.vertices.push(new THREE.Vector3(b[c].x,b[c].y,b[c].z||0));return a};THREE.CurvePath.prototype.addWrapPath=function(b){this.bends.push(b)};
+THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),a,c,d,e,f,g;a=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,j,l,m=b[0]instanceof THREE.Vector3;l=m?new THREE.Vector3:new THREE.Vector2;i=0;for(j=b.length;i<j;i++){h=b[i];if(h.x>a)a=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<f)f=h.y;if(m)if(h.z>d)d=h.z;else if(h.z<g)g=h.z;l.addSelf(h)}b={minX:e,minY:f,maxX:a,maxY:c,centroid:l.divideScalar(j)};if(m){b.maxZ=d;b.minZ=g}return b};
+THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,true))};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,true))};THREE.CurvePath.prototype.createGeometry=function(b){for(var a=new THREE.Geometry,c=0;c<b.length;c++)a.vertices.push(new THREE.Vector3(b[c].x,b[c].y,b[c].z||0));return a};THREE.CurvePath.prototype.addWrapPath=function(b){this.bends.push(b)};
 THREE.CurvePath.prototype.getTransformedPoints=function(b,a){var c=this.getPoints(b),d,e;if(!a)a=this.bends;d=0;for(e=a.length;d<e;d++)c=this.getWrapPoints(c,a[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(b,a){var c=this.getSpacedPoints(b),d,e;if(!a)a=this.bends;d=0;for(e=a.length;d<e;d++)c=this.getWrapPoints(c,a[d]);return c};
 THREE.CurvePath.prototype.getWrapPoints=function(b,a){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=b.length;d<e;d++){f=b[d];g=f.x;h=f.y;i=g/c.maxX;i=a.getUtoTmapping(i,g);g=a.getPoint(i);h=a.getNormalVector(i).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return b};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Gyroscope.prototype.updateMatrixWorld=function(b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){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);

+ 204 - 204
build/custom/ThreeWebGL.js

@@ -16,83 +16,83 @@ 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},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],h=d[8],j=d[1],n=d[5],k=d[9],i=d[2],l=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-k,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(j,n);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(k));if(Math.abs(k)<
-0.99999){this.y=Math.atan2(h,d);this.z=Math.atan2(j,n)}else{this.y=Math.atan2(-i,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(l));if(Math.abs(l)<0.99999){this.y=Math.atan2(-i,d);this.z=Math.atan2(-f,n)}else{this.y=0;this.z=Math.atan2(h,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(i));if(Math.abs(i)<0.99999){this.x=Math.atan2(l,d);this.z=Math.atan2(j,e)}else{this.x=0;this.z=Math.atan2(-f,n)}}else if(b==="YZX"){this.z=Math.asin(c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(-k,n);this.y=Math.atan2(-i,
-e)}else{this.x=0;this.y=Math.atan2(i,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(l,n);this.y=Math.atan2(h,e)}else{this.x=Math.atan2(-h,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,h=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),h-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),h+d-e-f)}else if(b===
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],h=d[8],i=d[1],l=d[5],k=d[9],j=d[2],o=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-k,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(i,l);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(k));if(Math.abs(k)<
+0.99999){this.y=Math.atan2(h,d);this.z=Math.atan2(i,l)}else{this.y=Math.atan2(-j,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(o));if(Math.abs(o)<0.99999){this.y=Math.atan2(-j,d);this.z=Math.atan2(-f,l)}else{this.y=0;this.z=Math.atan2(h,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(i,e)}else{this.x=0;this.z=Math.atan2(-f,l)}}else if(b==="YZX"){this.z=Math.asin(c(i));if(Math.abs(i)<0.99999){this.x=Math.atan2(-k,l);this.y=Math.atan2(-j,
+e)}else{this.x=0;this.y=Math.atan2(j,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(o,l);this.y=Math.atan2(h,e)}else{this.x=Math.atan2(-h,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,h=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),h-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),h+d-e-f)}else if(b===
 "YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),h-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-d+e-f)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),h-d-e+f);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-d+e-f)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),h-d-e+f);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),h+d-e-f)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 a.y),h-d+e-f);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+d-e-f);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),h-d+e-f);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+d-e-f);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}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;return this},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)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
-a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],h=a[1],j=a[5],n=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-h)<0.01&&Math.abs(f-c)<0.01&&Math.abs(n-b)<0.01){if(Math.abs(d+h)<0.1&&Math.abs(f+c)<0.1&&Math.abs(n+b)<0.1&&Math.abs(e+j+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;j=(j+1)/2;k=(k+1)/2;d=(d+h)/4;f=(f+c)/4;n=(n+b)/4;if(e>j&&e>k)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(j>
-k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=n/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=n/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-n)*(b-n)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.001&&(a=1);this.x=(b-n)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+j+k-1)/2);return this}};
+a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],h=a[1],i=a[5],l=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-h)<0.01&&Math.abs(f-c)<0.01&&Math.abs(l-b)<0.01){if(Math.abs(d+h)<0.1&&Math.abs(f+c)<0.1&&Math.abs(l+b)<0.1&&Math.abs(e+i+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;i=(i+1)/2;k=(k+1)/2;d=(d+h)/4;f=(f+c)/4;l=(l+b)/4;if(e>i&&e>k)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(i>
+k)if(i<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(i);b=d/c;d=l/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=l/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.001&&(a=1);this.x=(b-l)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+i+k-1)/2);return this}};
 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.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=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],j=c[5],n=c[6],k=c[7],i=c[8],l=c[9],m=c[10],p=c[11],u=c[12],o=c[13],q=c[14],c=c[15];b[0].set(f-a,k-h,p-i,c-u);b[1].set(f+a,k+h,p+i,c+u);b[2].set(f+d,k+j,p+l,c+o);b[3].set(f-d,k-j,p-l,c-o);b[4].set(f-e,k-n,p-m,c-q);b[5].set(f+e,k+n,p+m,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
+THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],i=c[5],l=c[6],k=c[7],j=c[8],o=c[9],m=c[10],p=c[11],u=c[12],n=c[13],q=c[14],c=c[15];b[0].set(f-a,k-h,p-j,c-u);b[1].set(f+a,k+h,p+j,c+u);b[2].set(f+d,k+i,p+o,c+n);b[3].set(f-d,k-i,p-o,c-n);b[4].set(f-e,k-l,p-m,c-q);b[5].set(f+e,k+l,p+m,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,k=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},u=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,s,w,v,H=function(a,b,c){u.sub(c,a);s=u.dot(b);w=o.add(a,q.copy(b).multiplyScalar(s));
-return v=c.distanceTo(w)},x,D,E,O,B,Q,F,W,V=function(a,b,c,d){u.sub(d,b);o.sub(c,b);q.sub(a,b);x=u.dot(u);D=u.dot(o);E=u.dot(q);O=o.dot(o);B=o.dot(q);Q=1/(x*O-D*D);F=(O*E-D*B)*Q;W=(x*B-D*E)*Q;return F>=0&&W>=0&&F+W<1},T=1.0E-4;this.setPrecision=function(a){T=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var o=0,q=a.children.length;o<q;o++)Array.prototype.push.apply(d,this.intersectObject(a.children[o],b));if(a instanceof THREE.Particle){v=H(this.origin,this.direction,a.matrixWorld.getPosition());
-if(v>a.scale.x)return[];c={distance:v,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){o=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());o=a.geometry.boundingSphere.radius*Math.max(o.x,Math.max(o.y,o.z));v=H(this.origin,this.direction,a.matrixWorld.getPosition());if(v>o)return d;var u,s,x=a.geometry,w=x.vertices,B;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(q=x.faces.length;o<
-q;o++){c=x.faces[o];n.copy(this.origin);k.copy(this.direction);B=a.matrixWorld;i=B.multiplyVector3(i.copy(c.centroid)).subSelf(n);l=a.matrixRotationWorld.multiplyVector3(l.copy(c.normal));u=k.dot(l);if(!(Math.abs(u)<T)){s=l.dot(i)/u;if(!(s<0)&&(a.doubleSided||(a.flipSided?u>0:u<0))){m.add(n,k.multiplyScalar(s));v=n.distanceTo(m);if(!(v<this.near)&&!(v>this.far))if(c instanceof THREE.Face3){e=B.multiplyVector3(e.copy(w[c.a]));f=B.multiplyVector3(f.copy(w[c.b]));h=B.multiplyVector3(h.copy(w[c.c]));
-if(V(m,e,f,h)){c={distance:v,point:m.clone(),face:c,faceIndex:o,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=B.multiplyVector3(e.copy(w[c.a]));f=B.multiplyVector3(f.copy(w[c.b]));h=B.multiplyVector3(h.copy(w[c.c]));j=B.multiplyVector3(j.copy(w[c.d]));if(V(m,e,f,j)||V(m,f,h,j)){c={distance:v,point:m.clone(),face:c,faceIndex:o,object:a};d.push(c)}}}}}}d.sort(p);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],
+THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},u=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,r,w,v,H=function(a,b,c){u.sub(c,a);r=u.dot(b);w=n.add(a,q.copy(b).multiplyScalar(r));
+return v=c.distanceTo(w)},x,D,E,O,B,Q,F,W,V=function(a,b,c,d){u.sub(d,b);n.sub(c,b);q.sub(a,b);x=u.dot(u);D=u.dot(n);E=u.dot(q);O=n.dot(n);B=n.dot(q);Q=1/(x*O-D*D);F=(O*E-D*B)*Q;W=(x*B-D*E)*Q;return F>=0&&W>=0&&F+W<1},T=1.0E-4;this.setPrecision=function(a){T=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var n=0,q=a.children.length;n<q;n++)Array.prototype.push.apply(d,this.intersectObject(a.children[n],b));if(a instanceof THREE.Particle){v=H(this.origin,this.direction,a.matrixWorld.getPosition());
+if(v>a.scale.x)return[];c={distance:v,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){n=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());n=a.geometry.boundingSphere.radius*Math.max(n.x,Math.max(n.y,n.z));v=H(this.origin,this.direction,a.matrixWorld.getPosition());if(v>n)return d;var u,r,x=a.geometry,w=x.vertices,B;a.matrixRotationWorld.extractRotation(a.matrixWorld);n=0;for(q=x.faces.length;n<
+q;n++){c=x.faces[n];l.copy(this.origin);k.copy(this.direction);B=a.matrixWorld;j=B.multiplyVector3(j.copy(c.centroid)).subSelf(l);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));u=k.dot(o);if(!(Math.abs(u)<T)){r=o.dot(j)/u;if(!(r<0)&&(a.doubleSided||(a.flipSided?u>0:u<0))){m.add(l,k.multiplyScalar(r));v=l.distanceTo(m);if(!(v<this.near)&&!(v>this.far))if(c instanceof THREE.Face3){e=B.multiplyVector3(e.copy(w[c.a]));f=B.multiplyVector3(f.copy(w[c.b]));h=B.multiplyVector3(h.copy(w[c.c]));
+if(V(m,e,f,h)){c={distance:v,point:m.clone(),face:c,faceIndex:n,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=B.multiplyVector3(e.copy(w[c.a]));f=B.multiplyVector3(f.copy(w[c.b]));h=B.multiplyVector3(h.copy(w[c.c]));i=B.multiplyVector3(i.copy(w[c.d]));if(V(m,e,f,i)||V(m,f,h,i)){c={distance:v,point:m.clone(),face:c,faceIndex:n,object:a};d.push(c)}}}}}}d.sort(p);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],
 b));c.sort(p);return c}};
-THREE.Rectangle=function(){function a(){f=d-b;h=e-c}var b=0,c=0,d=0,e=0,f=0,h=0,j=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,h,i,l){j=false;b=f;c=h;d=i;e=l;a()};this.addPoint=function(f,h){if(j===true){j=false;b=f;c=h;d=f;e=h}else{b=b<f?b:f;c=c<h?c:
-h;d=d>f?d:f;e=e>h?e:h}a()};this.add3Points=function(f,h,i,l,m,p){if(j===true){j=false;b=f<i?f<m?f:m:i<m?i:m;c=h<l?h<p?h:p:l<p?l:p;d=f>i?f>m?f:m:i>m?i:m;e=h>l?h>p?h:p:l>p?l:p}else{b=f<i?f<m?f<b?f:b:m<b?m:b:i<m?i<b?i:b:m<b?m:b;c=h<l?h<p?h<c?h:c:p<c?p:c:l<p?l<c?l:c:p<c?p:c;d=f>i?f>m?f>d?f:d:m>d?m:d:i>m?i>d?i:d:m>d?m:d;e=h>l?h>p?h>e?h:e:p>e?p:e:l>p?l>e?l:e:p>e?p:e}a()};this.addRectangle=function(f){if(j===true){j=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(){j=true;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
+THREE.Rectangle=function(){function a(){f=d-b;h=e-c}var b=0,c=0,d=0,e=0,f=0,h=0,i=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,h,j,o){i=false;b=f;c=h;d=j;e=o;a()};this.addPoint=function(f,h){if(i===true){i=false;b=f;c=h;d=f;e=h}else{b=b<f?b:f;c=c<h?c:
+h;d=d>f?d:f;e=e>h?e:h}a()};this.add3Points=function(f,h,j,o,m,p){if(i===true){i=false;b=f<j?f<m?f:m:j<m?j:m;c=h<o?h<p?h:p:o<p?o:p;d=f>j?f>m?f:m:j>m?j:m;e=h>o?h>p?h:p:o>p?o:p}else{b=f<j?f<m?f<b?f:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b;c=h<o?h<p?h<c?h:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>j?f>m?f>d?f:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d;e=h>o?h>p?h>e?h:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(i===true){i=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(){i=true;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,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],h=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],n=-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]*j;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,i=this.elements;i[0]=b*a;i[1]=b*c;i[2]=b*d;i[3]=b*e;i[4]=b*f;i[5]=b*h;i[6]=b*j;i[7]=b*n;i[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,h,j,n,k,i,l,m,p,u,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,h||0,j||0,n||0,k||0,i!==void 0?i:1,l||0,m||0,p||0,u||0,o!==void 0?o:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,j,n,k,i,l,m,p,u,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]=h;q[13]=j;q[2]=n;q[6]=k;q[10]=i;q[14]=l;q[3]=m;q[7]=p;q[11]=u;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,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();if(e.length()===0){h.x=h.x+1.0E-4;e.cross(c,h).normalize()}f.cross(h,e);d[0]=e.x;d[4]=f.x;d[8]=h.x;d[1]=e.y;d[5]=f.y;d[9]=h.y;d[2]=e.z;d[6]=f.z;d[10]=h.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],j=c[8],n=c[12],k=c[1],i=c[5],l=c[9],m=c[13],p=c[2],u=c[6],o=c[10],q=c[14],s=c[3],w=c[7],v=c[11],c=c[15],H=d[0],x=d[4],
-D=d[8],E=d[12],O=d[1],B=d[5],Q=d[9],F=d[13],W=d[2],V=d[6],T=d[10],A=d[14],M=d[3],G=d[7],ea=d[11],d=d[15];e[0]=f*H+h*O+j*W+n*M;e[4]=f*x+h*B+j*V+n*G;e[8]=f*D+h*Q+j*T+n*ea;e[12]=f*E+h*F+j*A+n*d;e[1]=k*H+i*O+l*W+m*M;e[5]=k*x+i*B+l*V+m*G;e[9]=k*D+i*Q+l*T+m*ea;e[13]=k*E+i*F+l*A+m*d;e[2]=p*H+u*O+o*W+q*M;e[6]=p*x+u*B+o*V+q*G;e[10]=p*D+u*Q+o*T+q*ea;e[14]=p*E+u*F+o*A+q*d;e[3]=s*H+w*O+v*W+c*M;e[7]=s*x+w*B+v*V+c*G;e[11]=s*D+w*Q+v*T+c*ea;e[15]=s*E+w*F+v*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],h=-b[6]*b[0]+b[2]*b[4],i=b[9]*b[4]-b[5]*b[8],l=-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]*i;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,j=this.elements;j[0]=b*a;j[1]=b*c;j[2]=b*d;j[3]=b*e;j[4]=b*f;j[5]=b*h;j[6]=b*i;j[7]=b*l;j[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,h,i,l,k,j,o,m,p,u,n){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,h||0,i||0,l||0,k||0,j!==void 0?j:1,o||0,m||0,p||0,u||0,n!==void 0?n:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,i,l,k,j,o,m,p,u,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=h;q[13]=i;q[2]=l;q[6]=k;q[10]=j;q[14]=o;q[3]=m;q[7]=p;q[11]=u;q[15]=n;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,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();if(e.length()===0){h.x=h.x+1.0E-4;e.cross(c,h).normalize()}f.cross(h,e);d[0]=e.x;d[4]=f.x;d[8]=h.x;d[1]=e.y;d[5]=f.y;d[9]=h.y;d[2]=e.z;d[6]=f.z;d[10]=h.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],i=c[8],l=c[12],k=c[1],j=c[5],o=c[9],m=c[13],p=c[2],u=c[6],n=c[10],q=c[14],r=c[3],w=c[7],v=c[11],c=c[15],H=d[0],x=d[4],
+D=d[8],E=d[12],O=d[1],B=d[5],Q=d[9],F=d[13],W=d[2],V=d[6],T=d[10],A=d[14],M=d[3],G=d[7],ea=d[11],d=d[15];e[0]=f*H+h*O+i*W+l*M;e[4]=f*x+h*B+i*V+l*G;e[8]=f*D+h*Q+i*T+l*ea;e[12]=f*E+h*F+i*A+l*d;e[1]=k*H+j*O+o*W+m*M;e[5]=k*x+j*B+o*V+m*G;e[9]=k*D+j*Q+o*T+m*ea;e[13]=k*E+j*F+o*A+m*d;e[2]=p*H+u*O+n*W+q*M;e[6]=p*x+u*B+n*V+q*G;e[10]=p*D+u*Q+n*T+q*ea;e[14]=p*E+u*F+n*A+q*d;e[3]=r*H+w*O+v*W+c*M;e[7]=r*x+w*B+v*V+c*G;e[11]=r*D+w*Q+v*T+c*ea;e[15]=r*E+w*F+v*A+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},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
 c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}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],h=a[5],j=a[9],n=a[13],k=a[2],i=a[6],l=a[10],m=a[14],p=a[3],u=a[7],o=a[11],a=a[15];return e*j*i*p-d*n*i*p-e*h*l*p+c*n*l*p+d*h*m*p-c*j*m*p-e*j*k*u+d*n*k*u+e*f*l*u-b*n*l*u-d*f*m*u+b*j*m*u+e*h*k*o-c*n*k*o-e*f*i*o+b*n*i*o+c*f*m*o-b*h*m*o-d*h*k*a+c*j*k*a+d*f*i*a-b*j*i*a-c*f*l*a+b*h*l*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;
+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],h=a[5],i=a[9],l=a[13],k=a[2],j=a[6],o=a[10],m=a[14],p=a[3],u=a[7],n=a[11],a=a[15];return e*i*j*p-d*l*j*p-e*h*o*p+c*l*o*p+d*h*m*p-c*i*m*p-e*i*k*u+d*l*k*u+e*f*o*u-b*l*o*u-d*f*m*u+b*i*m*u+e*h*k*n-c*l*k*n-e*f*j*n+b*l*j*n+c*f*m*n-b*h*m*n-d*h*k*a+c*i*k*a+d*f*j*a-b*i*j*a-c*f*o*a+b*h*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];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],h=c[12],j=c[1],n=c[5],k=c[9],i=c[13],l=c[2],m=c[6],p=c[10],u=c[14],o=c[3],q=c[7],s=c[11],c=c[15];b[0]=k*u*q-i*p*q+i*m*s-n*u*s-k*m*c+n*p*c;b[4]=h*p*q-f*u*q-h*m*s+e*u*s+f*m*c-e*p*c;b[8]=f*i*q-h*k*q+h*n*s-e*i*s-f*n*c+e*k*c;b[12]=h*k*m-f*i*m-h*n*p+e*i*p+f*n*u-e*k*u;b[1]=i*p*o-k*u*o-i*l*s+j*u*s+k*l*c-j*p*c;b[5]=f*u*o-h*p*o+h*l*s-d*u*s-f*l*c+d*p*c;b[9]=h*k*o-f*i*o-h*j*s+d*i*s+f*j*c-d*k*c;b[13]=f*i*l-h*k*l+h*j*p-d*
-i*p-f*j*u+d*k*u;b[2]=n*u*o-i*m*o+i*l*q-j*u*q-n*l*c+j*m*c;b[6]=h*m*o-e*u*o-h*l*q+d*u*q+e*l*c-d*m*c;b[10]=e*i*o-h*n*o+h*j*q-d*i*q-e*j*c+d*n*c;b[14]=h*n*l-e*i*l-h*j*m+d*i*m+e*j*u-d*n*u;b[3]=k*m*o-n*p*o-k*l*q+j*p*q+n*l*s-j*m*s;b[7]=e*p*o-f*m*o+f*l*q-d*p*q-e*l*s+d*m*s;b[11]=f*n*o-e*k*o-f*j*q+d*k*q+e*j*s-d*n*s;b[15]=e*k*l-f*n*l+f*j*m-d*k*m-e*j*p+d*n*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,h=Math.cos(d),d=Math.sin(d),
-j=Math.cos(e),e=Math.sin(e),n=Math.cos(f),f=Math.sin(f);if(b===void 0||b==="XYZ"){var k=h*n,i=h*f,l=d*n,m=d*f;c[0]=j*n;c[4]=-j*f;c[8]=e;c[1]=i+l*e;c[5]=k-m*e;c[9]=-d*j;c[2]=m-k*e;c[6]=l+i*e;c[10]=h*j}else if(b==="YXZ"){k=j*n;i=j*f;l=e*n;m=e*f;c[0]=k+m*d;c[4]=l*d-i;c[8]=h*e;c[1]=h*f;c[5]=h*n;c[9]=-d;c[2]=i*d-l;c[6]=m+k*d;c[10]=h*j}else if(b==="ZXY"){k=j*n;i=j*f;l=e*n;m=e*f;c[0]=k-m*d;c[4]=-h*f;c[8]=l+i*d;c[1]=i+l*d;c[5]=h*n;c[9]=m-k*d;c[2]=-h*e;c[6]=d;c[10]=h*j}else if(b==="ZYX"){k=h*n;i=h*f;l=d*n;
-m=d*f;c[0]=j*n;c[4]=l*e-i;c[8]=k*e+m;c[1]=j*f;c[5]=m*e+k;c[9]=i*e-l;c[2]=-e;c[6]=d*j;c[10]=h*j}else if(b==="YZX"){k=h*j;i=h*e;l=d*j;m=d*e;c[0]=j*n;c[4]=m-k*f;c[8]=l*f+i;c[1]=f;c[5]=h*n;c[9]=-d*n;c[2]=-e*n;c[6]=i*f+l;c[10]=k-m*f}else if(b==="XZY"){k=h*j;i=h*e;l=d*j;m=d*e;c[0]=j*n;c[4]=-f;c[8]=e*n;c[1]=k*f+m;c[5]=h*n;c[9]=i*f-l;c[2]=l*f-i;c[6]=d*n;c[10]=m*f+k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,j=d+d,n=e+e,a=c*h,k=c*j,c=c*n,i=d*j,d=d*
-n,e=e*n,h=f*h,j=f*j,f=f*n;b[0]=1-(i+e);b[4]=k-f;b[8]=c+j;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-j;b[6]=d+h;b[10]=1-(a+i);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,h=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);
+a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],h=c[12],i=c[1],l=c[5],k=c[9],j=c[13],o=c[2],m=c[6],p=c[10],u=c[14],n=c[3],q=c[7],r=c[11],c=c[15];b[0]=k*u*q-j*p*q+j*m*r-l*u*r-k*m*c+l*p*c;b[4]=h*p*q-f*u*q-h*m*r+e*u*r+f*m*c-e*p*c;b[8]=f*j*q-h*k*q+h*l*r-e*j*r-f*l*c+e*k*c;b[12]=h*k*m-f*j*m-h*l*p+e*j*p+f*l*u-e*k*u;b[1]=j*p*n-k*u*n-j*o*r+i*u*r+k*o*c-i*p*c;b[5]=f*u*n-h*p*n+h*o*r-d*u*r-f*o*c+d*p*c;b[9]=h*k*n-f*j*n-h*i*r+d*j*r+f*i*c-d*k*c;b[13]=f*j*o-h*k*o+h*i*p-d*
+j*p-f*i*u+d*k*u;b[2]=l*u*n-j*m*n+j*o*q-i*u*q-l*o*c+i*m*c;b[6]=h*m*n-e*u*n-h*o*q+d*u*q+e*o*c-d*m*c;b[10]=e*j*n-h*l*n+h*i*q-d*j*q-e*i*c+d*l*c;b[14]=h*l*o-e*j*o-h*i*m+d*j*m+e*i*u-d*l*u;b[3]=k*m*n-l*p*n-k*o*q+i*p*q+l*o*r-i*m*r;b[7]=e*p*n-f*m*n+f*o*q-d*p*q-e*o*r+d*m*r;b[11]=f*l*n-e*k*n-f*i*q+d*k*q+e*i*r-d*l*r;b[15]=e*k*o-f*l*o+f*i*m-d*k*m-e*i*p+d*l*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,h=Math.cos(d),d=Math.sin(d),
+i=Math.cos(e),e=Math.sin(e),l=Math.cos(f),f=Math.sin(f);if(b===void 0||b==="XYZ"){var k=h*l,j=h*f,o=d*l,m=d*f;c[0]=i*l;c[4]=-i*f;c[8]=e;c[1]=j+o*e;c[5]=k-m*e;c[9]=-d*i;c[2]=m-k*e;c[6]=o+j*e;c[10]=h*i}else if(b==="YXZ"){k=i*l;j=i*f;o=e*l;m=e*f;c[0]=k+m*d;c[4]=o*d-j;c[8]=h*e;c[1]=h*f;c[5]=h*l;c[9]=-d;c[2]=j*d-o;c[6]=m+k*d;c[10]=h*i}else if(b==="ZXY"){k=i*l;j=i*f;o=e*l;m=e*f;c[0]=k-m*d;c[4]=-h*f;c[8]=o+j*d;c[1]=j+o*d;c[5]=h*l;c[9]=m-k*d;c[2]=-h*e;c[6]=d;c[10]=h*i}else if(b==="ZYX"){k=h*l;j=h*f;o=d*l;
+m=d*f;c[0]=i*l;c[4]=o*e-j;c[8]=k*e+m;c[1]=i*f;c[5]=m*e+k;c[9]=j*e-o;c[2]=-e;c[6]=d*i;c[10]=h*i}else if(b==="YZX"){k=h*i;j=h*e;o=d*i;m=d*e;c[0]=i*l;c[4]=m-k*f;c[8]=o*f+j;c[1]=f;c[5]=h*l;c[9]=-d*l;c[2]=-e*l;c[6]=j*f+o;c[10]=k-m*f}else if(b==="XZY"){k=h*i;j=h*e;o=d*i;m=d*e;c[0]=i*l;c[4]=-f;c[8]=e*l;c[1]=k*f+m;c[5]=h*l;c[9]=j*f-o;c[2]=o*f-j;c[6]=d*l;c[10]=m*f+k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,i=d+d,l=e+e,a=c*h,k=c*i,c=c*l,j=d*i,d=d*
+l,e=e*l,h=f*h,i=f*i,f=f*l;b[0]=1-(j+e);b[4]=k-f;b[8]=c+i;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-i;b[6]=d+h;b[10]=1-(a+j);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,h=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);
 h.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=h.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],h=b[8],j=b[9],n=b[10],k=b[11],i=Math.cos(a),a=Math.sin(a);b[4]=i*c+a*h;b[5]=i*d+a*j;b[6]=i*e+a*n;b[7]=i*f+a*k;b[8]=i*h-a*c;b[9]=i*j-a*d;b[10]=i*n-a*e;b[11]=i*k-a*f;return this},rotateY:function(a){var b=
-this.elements,c=b[0],d=b[1],e=b[2],f=b[3],h=b[8],j=b[9],n=b[10],k=b[11],i=Math.cos(a),a=Math.sin(a);b[0]=i*c-a*h;b[1]=i*d-a*j;b[2]=i*e-a*n;b[3]=i*f-a*k;b[8]=i*h+a*c;b[9]=i*j+a*d;b[10]=i*n+a*e;b[11]=i*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],h=b[4],j=b[5],n=b[6],k=b[7],i=Math.cos(a),a=Math.sin(a);b[0]=i*c+a*h;b[1]=i*d+a*j;b[2]=i*e+a*n;b[3]=i*f+a*k;b[4]=i*h-a*c;b[5]=i*j-a*d;b[6]=i*n-a*e;b[7]=i*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,h=Math.sqrt(d*d+e*e+f*f),d=d/h,e=e/h,f=f/h,h=d*d,j=e*e,n=f*f,k=Math.cos(b),i=Math.sin(b),l=1-k,m=d*e*l,p=d*f*l,l=e*f*l,d=d*i,u=e*i,i=f*i,f=h+(1-h)*k,h=m+i,e=p-u,m=m-i,j=j+(1-j)*k,i=l+d,p=p+u,l=l-d,n=n+(1-n)*k,k=c[0],d=c[1],u=c[2],o=c[3],q=c[4],s=c[5],w=c[6],v=c[7],H=c[8],x=c[9],D=c[10],E=c[11];c[0]=f*k+h*q+e*H;c[1]=f*d+h*
-s+e*x;c[2]=f*u+h*w+e*D;c[3]=f*o+h*v+e*E;c[4]=m*k+j*q+i*H;c[5]=m*d+j*s+i*x;c[6]=m*u+j*w+i*D;c[7]=m*o+j*v+i*E;c[8]=p*k+l*q+n*H;c[9]=p*d+l*s+n*x;c[10]=p*u+l*w+n*D;c[11]=p*o+l*v+n*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]+
+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],h=b[8],i=b[9],l=b[10],k=b[11],j=Math.cos(a),a=Math.sin(a);b[4]=j*c+a*h;b[5]=j*d+a*i;b[6]=j*e+a*l;b[7]=j*f+a*k;b[8]=j*h-a*c;b[9]=j*i-a*d;b[10]=j*l-a*e;b[11]=j*k-a*f;return this},rotateY:function(a){var b=
+this.elements,c=b[0],d=b[1],e=b[2],f=b[3],h=b[8],i=b[9],l=b[10],k=b[11],j=Math.cos(a),a=Math.sin(a);b[0]=j*c-a*h;b[1]=j*d-a*i;b[2]=j*e-a*l;b[3]=j*f-a*k;b[8]=j*h+a*c;b[9]=j*i+a*d;b[10]=j*l+a*e;b[11]=j*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],h=b[4],i=b[5],l=b[6],k=b[7],j=Math.cos(a),a=Math.sin(a);b[0]=j*c+a*h;b[1]=j*d+a*i;b[2]=j*e+a*l;b[3]=j*f+a*k;b[4]=j*h-a*c;b[5]=j*i-a*d;b[6]=j*l-a*e;b[7]=j*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,h=Math.sqrt(d*d+e*e+f*f),d=d/h,e=e/h,f=f/h,h=d*d,i=e*e,l=f*f,k=Math.cos(b),j=Math.sin(b),o=1-k,m=d*e*o,p=d*f*o,o=e*f*o,d=d*j,u=e*j,j=f*j,f=h+(1-h)*k,h=m+j,e=p-u,m=m-j,i=i+(1-i)*k,j=o+d,p=p+u,o=o-d,l=l+(1-l)*k,k=c[0],d=c[1],u=c[2],n=c[3],q=c[4],r=c[5],w=c[6],v=c[7],H=c[8],x=c[9],D=c[10],E=c[11];c[0]=f*k+h*q+e*H;c[1]=f*d+h*
+r+e*x;c[2]=f*u+h*w+e*D;c[3]=f*n+h*v+e*E;c[4]=m*k+i*q+j*H;c[5]=m*d+i*r+j*x;c[6]=m*u+i*w+j*D;c[7]=m*n+i*v+j*E;c[8]=p*k+o*q+l*H;c[9]=p*d+o*r+l*x;c[10]=p*u+o*w+l*D;c[11]=p*n+o*v+l*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,h=a.y,j=a.z,n=e*f,k=e*h;this.set(n*f+c,n*h-d*j,n*j+d*h,0,n*h+d*j,k*h+c,k*j-d*f,0,n*j-d*h,k*j+d*f,e*j*j+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 h=this.elements;h[0]=2*e/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*e/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(f+e)/(f-e);h[14]=-2*f*e/(f-e);h[3]=
-0;h[7]=0;h[11]=-1;h[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 h=this.elements,j=b-a,n=c-d,k=f-e;h[0]=2/j;h[4]=0;h[8]=0;h[12]=-((b+a)/j);h[1]=0;h[5]=2/n;h[9]=0;h[13]=-((c+d)/n);h[2]=0;h[6]=0;h[10]=-2/k;h[14]=-((f+e)/k);h[3]=0;h[7]=0;h[11]=0;h[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],
+return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,i=a.z,l=e*f,k=e*h;this.set(l*f+c,l*h-d*i,l*i+d*h,0,l*h+d*i,k*h+c,k*i-d*f,0,l*i-d*h,k*i+d*f,e*i*i+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 h=this.elements;h[0]=2*e/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*e/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(f+e)/(f-e);h[14]=-2*f*e/(f-e);h[3]=
+0;h[7]=0;h[11]=-1;h[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 h=this.elements,i=b-a,l=c-d,k=f-e;h[0]=2/i;h[4]=0;h[8]=0;h[12]=-((b+a)/i);h[1]=0;h[5]=2/l;h[9]=0;h[13]=-((c+d)/l);h[2]=0;h[6]=0;h[10]=-2/k;h[14]=-((f+e)/k);h[3]=0;h[7]=0;h[11]=0;h[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.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};
+THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.properties={};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.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};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.setEulerFromRotationMatrix((new THREE.Matrix4).extractRotation(this.matrix),this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=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===true?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===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?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)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)},clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(a,c){h=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var e=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||F.contains(a)===true)){E.copy(a.matrixWorld.getPosition());B.multiplyVector3(E);f=b();f.object=a;f.z=E.z;D.objects.push(f)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){E.copy(a.matrixWorld.getPosition());B.multiplyVector3(E);f=b();f.object=a;f.z=E.z;D.sprites.push(f)}else a instanceof
-THREE.Light&&D.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&D.objects.sort(d);return D}function b(){var a;if(h===j.length){a=new THREE.RenderableObject;j.push(a)}else a=j[h];h++;return a}function c(){var a;if(k===i.length){a=new THREE.RenderableVertex;i.push(a)}else a=i[k];k++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,h=b.z+b.w,e=-a.z+a.w,j=-b.z+b.w;if(f>=0&&h>=0&&e>=0&&j>=0)return true;if(f<0&&h<0||e<0&&j<0)return false;
-f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));e<0?c=Math.max(c,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,h,j=[],n,k,i=[],l,m,p=[],u,o=[],q,s,w=[],v,H,x=[],D={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,O=new THREE.Vector4,B=new THREE.Matrix4,Q=new THREE.Matrix4,F=new THREE.Frustum,W=new THREE.Vector4,V=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.projectScene=function(b,f,h){var j=f.near,E=f.far,I=false,aa,P,Aa,sa,U,S,ta,wa,ba,ia,fa,Ja,
-Ga,la,Pa,ua,Xa;H=s=u=m=0;D.elements.length=0;b.updateMatrixWorld();f.parent===void 0&&f.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);B.multiply(f.projectionMatrix,f.matrixWorldInverse);F.setFromMatrix(B);D=a(b,false);b=0;for(aa=D.objects.length;b<aa;b++){ba=D.objects[b].object;ia=ba.matrixWorld;k=0;if(ba instanceof THREE.Mesh){fa=ba.geometry;Ja=ba.geometry.materials;sa=fa.vertices;Ga=fa.faces;Pa=fa.faceVertexUvs;fa=ba.matrixRotationWorld.extractRotation(ia);Xa=ba.material instanceof
-THREE.MeshFaceMaterial;P=0;for(Aa=sa.length;P<Aa;P++){n=c();n.positionWorld.copy(sa[P]);ia.multiplyVector3(n.positionWorld);n.positionScreen.copy(n.positionWorld);B.multiplyVector4(n.positionScreen);n.positionScreen.x=n.positionScreen.x/n.positionScreen.w;n.positionScreen.y=n.positionScreen.y/n.positionScreen.w;n.visible=n.positionScreen.z>j&&n.positionScreen.z<E}sa=0;for(P=Ga.length;sa<P;sa++){wa=Ga[sa];Aa=Xa===true?Ja[wa.materialIndex]:ba.material;if(Aa!==void 0){ta=Aa.side;if(wa instanceof THREE.Face3){U=
-i[wa.a];S=i[wa.b];la=i[wa.c];if(U.visible===true&&S.visible===true&&la.visible===true){I=(la.positionScreen.x-U.positionScreen.x)*(S.positionScreen.y-U.positionScreen.y)-(la.positionScreen.y-U.positionScreen.y)*(S.positionScreen.x-U.positionScreen.x)<0;if(ta===THREE.DoubleSide||I===(ta===THREE.FrontSide)){ua=void 0;if(m===p.length){ua=new THREE.RenderableFace3;p.push(ua)}else ua=p[m];m++;l=ua;l.v1.copy(U);l.v2.copy(S);l.v3.copy(la)}else continue}else continue}else if(wa instanceof THREE.Face4){U=
-i[wa.a];S=i[wa.b];la=i[wa.c];ua=i[wa.d];if(U.visible===true&&S.visible===true&&la.visible===true&&ua.visible===true){I=(ua.positionScreen.x-U.positionScreen.x)*(S.positionScreen.y-U.positionScreen.y)-(ua.positionScreen.y-U.positionScreen.y)*(S.positionScreen.x-U.positionScreen.x)<0||(S.positionScreen.x-la.positionScreen.x)*(ua.positionScreen.y-la.positionScreen.y)-(S.positionScreen.y-la.positionScreen.y)*(ua.positionScreen.x-la.positionScreen.x)<0;if(ta===THREE.DoubleSide||I===(ta===THREE.FrontSide)){var Va=
-void 0;if(u===o.length){Va=new THREE.RenderableFace4;o.push(Va)}else Va=o[u];u++;l=Va;l.v1.copy(U);l.v2.copy(S);l.v3.copy(la);l.v4.copy(ua)}else continue}else continue}l.normalWorld.copy(wa.normal);I===false&&(ta===THREE.BackSide||ta===THREE.DoubleSide)&&l.normalWorld.negate();fa.multiplyVector3(l.normalWorld);l.centroidWorld.copy(wa.centroid);ia.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);B.multiplyVector3(l.centroidScreen);wa=wa.vertexNormals;U=0;for(S=wa.length;U<S;U++){la=
-l.vertexNormalsWorld[U];la.copy(wa[U]);I===false&&(ta===THREE.BackSide||ta===THREE.DoubleSide)&&la.negate();fa.multiplyVector3(la)}U=0;for(S=Pa.length;U<S;U++){la=Pa[U][sa];if(la!==void 0){ta=0;for(wa=la.length;ta<wa;ta++)l.uvs[U][ta]=la[ta]}}l.material=Aa;l.z=l.centroidScreen.z;D.elements.push(l)}}}else if(ba instanceof THREE.Line){Q.multiply(B,ia);sa=ba.geometry.vertices;U=c();U.positionScreen.copy(sa[0]);Q.multiplyVector4(U.positionScreen);ia=ba.type===THREE.LinePieces?2:1;P=1;for(Aa=sa.length;P<
-Aa;P++){U=c();U.positionScreen.copy(sa[P]);Q.multiplyVector4(U.positionScreen);if(!((P+1)%ia>0)){S=i[k-2];W.copy(U.positionScreen);V.copy(S.positionScreen);if(e(W,V)===true){W.multiplyScalar(1/W.w);V.multiplyScalar(1/V.w);Ja=void 0;if(s===w.length){Ja=new THREE.RenderableLine;w.push(Ja)}else Ja=w[s];s++;q=Ja;q.v1.positionScreen.copy(W);q.v2.positionScreen.copy(V);q.z=Math.max(W.z,V.z);q.material=ba.material;D.elements.push(q)}}}}}b=0;for(aa=D.sprites.length;b<aa;b++){ba=D.sprites[b].object;ia=ba.matrixWorld;
-if(ba instanceof THREE.Particle){O.set(ia.elements[12],ia.elements[13],ia.elements[14],1);B.multiplyVector4(O);O.z=O.z/O.w;if(O.z>0&&O.z<1){j=void 0;if(H===x.length){j=new THREE.RenderableParticle;x.push(j)}else j=x[H];H++;v=j;v.object=ba;v.x=O.x/O.w;v.y=O.y/O.w;v.z=O.z;v.rotation=ba.rotation.z;v.scale.x=ba.scale.x*Math.abs(v.x-(O.x+f.projectionMatrix.elements[0])/(O.w+f.projectionMatrix.elements[12]));v.scale.y=ba.scale.y*Math.abs(v.y-(O.y+f.projectionMatrix.elements[5])/(O.w+f.projectionMatrix.elements[13]));
+THREE.Light&&D.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&D.objects.sort(d);return D}function b(){var a;if(h===i.length){a=new THREE.RenderableObject;i.push(a)}else a=i[h];h++;return a}function c(){var a;if(k===j.length){a=new THREE.RenderableVertex;j.push(a)}else a=j[k];k++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,h=b.z+b.w,e=-a.z+a.w,i=-b.z+b.w;if(f>=0&&h>=0&&e>=0&&i>=0)return true;if(f<0&&h<0||e<0&&i<0)return false;
+f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));e<0?c=Math.max(c,e/(e-i)):i<0&&(d=Math.min(d,e/(e-i)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,h,i=[],l,k,j=[],o,m,p=[],u,n=[],q,r,w=[],v,H,x=[],D={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,O=new THREE.Vector4,B=new THREE.Matrix4,Q=new THREE.Matrix4,F=new THREE.Frustum,W=new THREE.Vector4,V=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.projectScene=function(b,f,h){var i=f.near,E=f.far,I=false,aa,P,Aa,sa,U,S,ta,wa,ba,ia,fa,Ja,
+Ga,la,Pa,ua,Xa;H=r=u=m=0;D.elements.length=0;b.updateMatrixWorld();f.parent===void 0&&f.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);B.multiply(f.projectionMatrix,f.matrixWorldInverse);F.setFromMatrix(B);D=a(b,false);b=0;for(aa=D.objects.length;b<aa;b++){ba=D.objects[b].object;ia=ba.matrixWorld;k=0;if(ba instanceof THREE.Mesh){fa=ba.geometry;Ja=ba.geometry.materials;sa=fa.vertices;Ga=fa.faces;Pa=fa.faceVertexUvs;fa=ba.matrixRotationWorld.extractRotation(ia);Xa=ba.material instanceof
+THREE.MeshFaceMaterial;P=0;for(Aa=sa.length;P<Aa;P++){l=c();l.positionWorld.copy(sa[P]);ia.multiplyVector3(l.positionWorld);l.positionScreen.copy(l.positionWorld);B.multiplyVector4(l.positionScreen);l.positionScreen.x=l.positionScreen.x/l.positionScreen.w;l.positionScreen.y=l.positionScreen.y/l.positionScreen.w;l.visible=l.positionScreen.z>i&&l.positionScreen.z<E}sa=0;for(P=Ga.length;sa<P;sa++){wa=Ga[sa];Aa=Xa===true?Ja[wa.materialIndex]:ba.material;if(Aa!==void 0){ta=Aa.side;if(wa instanceof THREE.Face3){U=
+j[wa.a];S=j[wa.b];la=j[wa.c];if(U.visible===true&&S.visible===true&&la.visible===true){I=(la.positionScreen.x-U.positionScreen.x)*(S.positionScreen.y-U.positionScreen.y)-(la.positionScreen.y-U.positionScreen.y)*(S.positionScreen.x-U.positionScreen.x)<0;if(ta===THREE.DoubleSide||I===(ta===THREE.FrontSide)){ua=void 0;if(m===p.length){ua=new THREE.RenderableFace3;p.push(ua)}else ua=p[m];m++;o=ua;o.v1.copy(U);o.v2.copy(S);o.v3.copy(la)}else continue}else continue}else if(wa instanceof THREE.Face4){U=
+j[wa.a];S=j[wa.b];la=j[wa.c];ua=j[wa.d];if(U.visible===true&&S.visible===true&&la.visible===true&&ua.visible===true){I=(ua.positionScreen.x-U.positionScreen.x)*(S.positionScreen.y-U.positionScreen.y)-(ua.positionScreen.y-U.positionScreen.y)*(S.positionScreen.x-U.positionScreen.x)<0||(S.positionScreen.x-la.positionScreen.x)*(ua.positionScreen.y-la.positionScreen.y)-(S.positionScreen.y-la.positionScreen.y)*(ua.positionScreen.x-la.positionScreen.x)<0;if(ta===THREE.DoubleSide||I===(ta===THREE.FrontSide)){var Va=
+void 0;if(u===n.length){Va=new THREE.RenderableFace4;n.push(Va)}else Va=n[u];u++;o=Va;o.v1.copy(U);o.v2.copy(S);o.v3.copy(la);o.v4.copy(ua)}else continue}else continue}o.normalWorld.copy(wa.normal);I===false&&(ta===THREE.BackSide||ta===THREE.DoubleSide)&&o.normalWorld.negate();fa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(wa.centroid);ia.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);B.multiplyVector3(o.centroidScreen);wa=wa.vertexNormals;U=0;for(S=wa.length;U<S;U++){la=
+o.vertexNormalsWorld[U];la.copy(wa[U]);I===false&&(ta===THREE.BackSide||ta===THREE.DoubleSide)&&la.negate();fa.multiplyVector3(la)}U=0;for(S=Pa.length;U<S;U++){la=Pa[U][sa];if(la!==void 0){ta=0;for(wa=la.length;ta<wa;ta++)o.uvs[U][ta]=la[ta]}}o.material=Aa;o.z=o.centroidScreen.z;D.elements.push(o)}}}else if(ba instanceof THREE.Line){Q.multiply(B,ia);sa=ba.geometry.vertices;U=c();U.positionScreen.copy(sa[0]);Q.multiplyVector4(U.positionScreen);ia=ba.type===THREE.LinePieces?2:1;P=1;for(Aa=sa.length;P<
+Aa;P++){U=c();U.positionScreen.copy(sa[P]);Q.multiplyVector4(U.positionScreen);if(!((P+1)%ia>0)){S=j[k-2];W.copy(U.positionScreen);V.copy(S.positionScreen);if(e(W,V)===true){W.multiplyScalar(1/W.w);V.multiplyScalar(1/V.w);Ja=void 0;if(r===w.length){Ja=new THREE.RenderableLine;w.push(Ja)}else Ja=w[r];r++;q=Ja;q.v1.positionScreen.copy(W);q.v2.positionScreen.copy(V);q.z=Math.max(W.z,V.z);q.material=ba.material;D.elements.push(q)}}}}}b=0;for(aa=D.sprites.length;b<aa;b++){ba=D.sprites[b].object;ia=ba.matrixWorld;
+if(ba instanceof THREE.Particle){O.set(ia.elements[12],ia.elements[13],ia.elements[14],1);B.multiplyVector4(O);O.z=O.z/O.w;if(O.z>0&&O.z<1){i=void 0;if(H===x.length){i=new THREE.RenderableParticle;x.push(i)}else i=x[H];H++;v=i;v.object=ba;v.x=O.x/O.w;v.y=O.y/O.w;v.z=O.z;v.rotation=ba.rotation.z;v.scale.x=ba.scale.x*Math.abs(v.x-(O.x+f.projectionMatrix.elements[0])/(O.w+f.projectionMatrix.elements[12]));v.scale.y=ba.scale.y*Math.abs(v.y-(O.y+f.projectionMatrix.elements[5])/(O.w+f.projectionMatrix.elements[13]));
 v.material=ba.material;D.elements.push(v)}}}h&&D.elements.sort(d);return D}};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,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),h=Math.sin(a.y/2),j=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*h*j;this.y=c*h*e-f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e-f*h*j}else if(b==="YXZ"){this.x=f*d*e+c*h*j;this.y=c*h*e-f*d*j;this.z=
-c*d*j-f*h*e;this.w=c*d*e+f*h*j}else if(b==="ZXY"){this.x=f*d*e-c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e-f*h*j}else if(b==="ZYX"){this.x=f*d*e-c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j-f*h*e;this.w=c*d*e+f*h*j}else if(b==="YZX"){this.x=f*d*e+c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j-f*h*e;this.w=c*d*e-f*h*j}else if(b==="XZY"){this.x=f*d*e-c*h*j;this.y=c*h*e-f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e+f*h*j}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=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],j=b[2],n=b[6],b=b[10],k=c+f+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(n-h)*c;this.y=(d-j)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(n-h)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+j)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-j)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(h+n)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
-(d+j)/c;this.y=(h+n)/c;this.z=0.25*c}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,h=a.y,j=a.z,a=a.w;this.x=b*a+e*f+c*j-d*h;this.y=c*a+e*h+d*f-b*j;this.z=d*a+e*j+b*h-c*f;this.w=e*a-b*f-c*h-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
-f=this.x,h=this.y,j=this.z,n=this.w,k=n*c+h*e-j*d,i=n*d+j*c-f*e,l=n*e+f*d-h*c,c=-f*c-h*d-j*e;b.x=k*n+c*-f+i*-j-l*-h;b.y=i*n+c*-h+l*-f-k*-j;b.z=l*n+c*-j+k*-h-i*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;if(h<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;h=-h}else this.copy(a);if(h>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var j=Math.acos(h),n=Math.sqrt(1-h*h);if(Math.abs(n)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
-this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}h=Math.sin((1-b)*j)/n;j=Math.sin(b*j)/n;this.w=f*h+this.w*j;this.x=c*h+this.x*j;this.y=d*h+this.y*j;this.z=e*h+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+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,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),h=Math.sin(a.y/2),i=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*h*i;this.y=c*h*e-f*d*i;this.z=c*d*i+f*h*e;this.w=c*d*e-f*h*i}else if(b==="YXZ"){this.x=f*d*e+c*h*i;this.y=c*h*e-f*d*i;this.z=
+c*d*i-f*h*e;this.w=c*d*e+f*h*i}else if(b==="ZXY"){this.x=f*d*e-c*h*i;this.y=c*h*e+f*d*i;this.z=c*d*i+f*h*e;this.w=c*d*e-f*h*i}else if(b==="ZYX"){this.x=f*d*e-c*h*i;this.y=c*h*e+f*d*i;this.z=c*d*i-f*h*e;this.w=c*d*e+f*h*i}else if(b==="YZX"){this.x=f*d*e+c*h*i;this.y=c*h*e+f*d*i;this.z=c*d*i-f*h*e;this.w=c*d*e-f*h*i}else if(b==="XZY"){this.x=f*d*e-c*h*i;this.y=c*h*e-f*d*i;this.z=c*d*i+f*h*e;this.w=c*d*e+f*h*i}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=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],i=b[2],l=b[6],b=b[10],k=c+f+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(l-h)*c;this.y=(d-i)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(l-h)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+i)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-i)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(h+l)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
+(d+i)/c;this.y=(h+l)/c;this.z=0.25*c}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){var c=a.x,d=a.y,e=a.z,f=a.w,h=b.x,i=b.y,l=b.z,k=b.w;this.x=c*k+d*l-e*i+f*h;this.y=-c*l+d*k+e*h+f*i;this.z=c*i-d*h+e*k+f*l;this.w=-c*h-d*i-e*l+f*k;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*h;this.y=c*a+e*h+d*f-b*i;this.z=d*a+e*i+b*h-c*f;this.w=e*a-b*f-c*h-d*i;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,h=
+this.y,i=this.z,l=this.w,k=l*c+h*e-i*d,j=l*d+i*c-f*e,o=l*e+f*d-h*c,c=-f*c-h*d-i*e;b.x=k*l+c*-f+j*-i-o*-h;b.y=j*l+c*-h+o*-f-k*-i;b.z=o*l+c*-i+k*-h-j*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;if(h<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;h=-h}else this.copy(a);if(h>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var i=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);this.y=0.5*
+(d+this.y);this.z=0.5*(e+this.z);return this}h=Math.sin((1-b)*i)/l;i=Math.sin(b*i)/l;this.w=f*h+this.w*i;this.x=c*h+this.x*i;this.y=d*h+this.y*i;this.z=e*h+this.z*i;return this},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 b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};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();
@@ -101,23 +101,23 @@ THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.
 return a}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.name="";this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=false;this.dynamic=true};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,h=e.vertexNormals.length;f<h;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
-0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,h=new THREE.Vector3,j=new THREE.Vector3;a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];h.sub(f,e);j.sub(d,e);h.crossSelf(j);h.isZero()||h.normalize();c.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
+0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<
+b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];h.sub(f,e);i.sub(d,e);h.crossSelf(i);h.isZero()||h.normalize();c.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
 else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];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 h=this.morphNormals[a].faceNormals,j=this.morphNormals[a].vertexNormals,n,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];n=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};h.push(n);j.push(k)}}h=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];
-n=h.faceNormals[c];k=h.vertexNormals[c];n.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,f,e,A){j=a.vertices[b];n=a.vertices[c];
-k=a.vertices[d];i=h[f];l=h[e];m=h[A];p=n.x-j.x;u=k.x-j.x;o=n.y-j.y;q=k.y-j.y;s=n.z-j.z;w=k.z-j.z;v=l.u-i.u;H=m.u-i.u;x=l.v-i.v;D=m.v-i.v;E=1/(v*D-H*x);F.set((D*p-x*u)*E,(D*o-x*q)*E,(D*s-x*w)*E);W.set((v*u-H*p)*E,(v*q-H*o)*E,(v*w-H*s)*E);B[b].addSelf(F);B[c].addSelf(F);B[d].addSelf(F);Q[b].addSelf(W);Q[c].addSelf(W);Q[d].addSelf(W)}var b,c,d,e,f,h,j,n,k,i,l,m,p,u,o,q,s,w,v,H,x,D,E,O,B=[],Q=[],F=new THREE.Vector3,W=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=
+[];var h=this.morphNormals[a].faceNormals,i=this.morphNormals[a].vertexNormals,l,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];l=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};h.push(l);i.push(k)}}h=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];
+l=h.faceNormals[c];k=h.vertexNormals[c];l.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,f,e,A){i=a.vertices[b];l=a.vertices[c];
+k=a.vertices[d];j=h[f];o=h[e];m=h[A];p=l.x-i.x;u=k.x-i.x;n=l.y-i.y;q=k.y-i.y;r=l.z-i.z;w=k.z-i.z;v=o.u-j.u;H=m.u-j.u;x=o.v-j.v;D=m.v-j.v;E=1/(v*D-H*x);F.set((D*p-x*u)*E,(D*n-x*q)*E,(D*r-x*w)*E);W.set((v*u-H*p)*E,(v*q-H*n)*E,(v*w-H*r)*E);B[b].addSelf(F);B[c].addSelf(F);B[d].addSelf(F);Q[b].addSelf(W);Q[c].addSelf(W);Q[d].addSelf(W)}var b,c,d,e,f,h,i,l,k,j,o,m,p,u,n,q,r,w,v,H,x,D,E,O,B=[],Q=[],F=new THREE.Vector3,W=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=
 this.vertices.length;b<c;b++){B[b]=new THREE.Vector3;Q[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];h=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]];O=B[e];V.copy(O);V.subSelf(A.multiplyScalar(A.dot(O))).normalize();
 T.cross(f.vertexNormals[d],O);e=T.dot(Q[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(V.x,V.y,V.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,h,j,n;f=0;for(h=this.vertices.length;f<h;f++){d=this.vertices[f];d=
+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,h,i,l;f=0;for(h=this.vertices.length;f<h;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(h=this.faces.length;f<h;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];d=[a.a,a.b,a.c,a.d];for(e=3;e>0;e--)if(d.indexOf(a["abcd"[e]])!==e){d.splice(e,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);
-d=0;for(j=this.faceVertexUvs.length;d<j;d++)(n=this.faceVertexUvs[d][f])&&n.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,f,h,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*h+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,j,n,k,i,l,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);h=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]];i=this.points[c[1]];l=this.points[c[2]];m=this.points[c[3]];j=h*h;n=h*j;d.x=b(k.x,i.x,l.x,m.x,h,j,n);d.y=b(k.y,i.y,l.y,m.y,h,j,n);d.z=b(k.z,i.z,l.z,m.z,h,j,n);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,h=new THREE.Vector3,e=new THREE.Vector3,j=[],i=0;j[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++){b=
-a/c;d=this.getPoint(b);e.copy(d);i=i+e.distanceTo(h);h.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){j[b]=i;f=b}}j[j.length]=i;return{chunks:j,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,h,e,j=[],i=new THREE.Vector3,k=this.getLength();j.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];e=Math.ceil(a*c/k.total);f=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<e-1;c++){d=f+c*(1/e)*(h-f);d=this.getPoint(d);
-j.push(i.copy(d).clone())}j.push(i.copy(this.points[b]).clone())}this.points=j}};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=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
+d=0;for(i=this.faceVertexUvs.length;d<i;d++)(l=this.faceVertexUvs[d][f])&&l.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,d,f,h,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*h+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,i,l,k,j,o,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);h=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]];j=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];i=h*h;l=h*i;d.x=b(k.x,j.x,o.x,m.x,h,i,l);d.y=b(k.y,j.y,o.y,m.y,h,i,l);d.z=b(k.z,j.z,o.z,m.z,h,i,l);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,h=new THREE.Vector3,e=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++){b=
+a/c;d=this.getPoint(b);e.copy(d);j=j+e.distanceTo(h);h.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){i[b]=j;f=b}}i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,f,h,e,i=[],j=new THREE.Vector3,k=this.getLength();i.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];e=Math.ceil(a*c/k.total);f=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<e-1;c++){d=f+c*(1/e)*(h-f);d=this.getPoint(d);
+i.push(j.copy(d).clone())}i.push(j.copy(this.points[b]).clone())}this.points=i}};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=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
 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=Object.create(THREE.Camera.prototype);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=Object.create(THREE.Camera.prototype);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()};
@@ -130,63 +130,63 @@ THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new T
 this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);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 f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=j.crossOrigin;f.src=b}function f(a,c,d,f,h,j){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}h&&a[c].offset.set(h[0],h[1]);if(j){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[j[0]]!==void 0)a[c].wrapS=f[j[0]];if(f[j[1]]!==void 0)a[c].wrapT=f[j[1]]}e(a[c],b+"/"+d)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,n="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};
-if(a.shading){var i=a.shading.toLowerCase();i==="phong"?n="MeshPhongMaterial":i==="basic"&&(n="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.visible!==void 0)k.visible=a.visible;if(a.flipSided!==void 0)k.side=THREE.BackSide;if(a.doubleSided!==void 0)k.side=THREE.DoubleSide;if(a.wireframe!==
+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 f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=i.crossOrigin;f.src=b}function f(a,c,d,f,h,i){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}h&&a[c].offset.set(h[0],h[1]);if(i){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[i[0]]!==void 0)a[c].wrapS=f[i[0]];if(f[i[1]]!==void 0)a[c].wrapT=f[i[1]]}e(a[c],b+"/"+d)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var i=this,l="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};
+if(a.shading){var j=a.shading.toLowerCase();j==="phong"?l="MeshPhongMaterial":j==="basic"&&(l="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.visible!==void 0)k.visible=a.visible;if(a.flipSided!==void 0)k.side=THREE.BackSide;if(a.doubleSided!==void 0)k.side=THREE.DoubleSide;if(a.wireframe!==
 void 0)k.wireframe=a.wireframe;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=h(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=h(a.colorSpecular);if(a.colorAmbient)k.ambient=h(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.mapBump&&b&&f(k,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap);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){n=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(n.uniforms);i.tNormal.texture=
-k.normalMap;if(a.mapNormalFactor)i.uNormalScale.value=a.mapNormalFactor;if(k.map){i.tDiffuse.texture=k.map;i.enableDiffuse.value=true}if(k.specularMap){i.tSpecular.texture=k.specularMap;i.enableSpecular.value=true}if(k.lightMap){i.tAO.texture=k.lightMap;i.enableAO.value=true}i.uDiffuseColor.value.setHex(k.color);i.uSpecularColor.value.setHex(k.specular);i.uAmbientColor.value.setHex(k.ambient);i.uShininess.value=k.shininess;if(k.opacity!==void 0)i.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:n.fragmentShader,
-vertexShader:n.vertexShader,uniforms:i,lights:true,fog:true})}else k=new THREE[n](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(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 h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState==4)if(h.status==200||h.status==0){var j=JSON.parse(h.responseText);a.loadAjaxBuffers(j,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+h.status+"]")};h.open("GET",b,true);h.overrideMimeType&&h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,h=c+"/"+a.buffers,j=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0){var c=f.response;if(c===void 0)c=(new Uint8Array(f.responseBody)).buffer;THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+f.status+"]");else if(f.readyState==3){if(e){j==0&&(j=f.getResponseHeader("Content-Length"));e({total:j,loaded:f.responseText.length})}}else f.readyState==
-2&&(j=f.getResponseHeader("Content-Length"))};f.open("GET",h,true);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,n,k,i,l,m,p,u,o,q,s,w,v,H;function x(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function O(b,c){var d,f,e,h,j,i,k,l,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=n[d*3];e=n[d*3+1];h=n[d*3+2];j=G[f*2];f=G[f*2+1];i=G[e*2];k=G[e*2+1];e=G[h*2];l=G[h*2+1];h=T.faceVertexUvs[0];var m=[];m.push(new THREE.UV(j,f));m.push(new THREE.UV(i,k));m.push(new THREE.UV(e,
-l));h.push(m)}}function B(b,c){var d,f,e,h,j,i,k,l,n,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];h=o[d*4+2];j=o[d*4+3];i=G[f*2];f=G[f*2+1];k=G[e*2];n=G[e*2+1];l=G[h*2];m=G[h*2+1];h=G[j*2];e=G[j*2+1];j=T.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(k,n));p.push(new THREE.UV(l,m));p.push(new THREE.UV(h,e));j.push(p)}}function Q(b,c,d){for(var f,e,h,j,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];h=c[d*3+2];j=i[d];
-T.faces.push(new THREE.Face3(f,e,h,null,null,j))}}function F(b,c,d){for(var f,e,h,j,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];h=c[d*4+2];j=c[d*4+3];i=k[d];T.faces.push(new THREE.Face4(f,e,h,j,null,null,i))}}function W(b,c,d,f){for(var e,h,j,i,k,l,n,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];h=c[f*3+1];j=c[f*3+2];k=d[f*3];l=d[f*3+1];n=d[f*3+2];i=m[f];var o=M[l*3],p=M[l*3+1];l=M[l*3+2];var q=M[n*3],
-s=M[n*3+1];n=M[n*3+2];T.faces.push(new THREE.Face3(e,h,j,[new THREE.Vector3(M[k*3],M[k*3+1],M[k*3+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(q,s,n)],null,i))}}function V(b,c,d,f){for(var e,h,j,i,k,l,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];h=c[f*4+1];j=c[f*4+2];i=c[f*4+3];l=d[f*4];n=d[f*4+1];m=d[f*4+2];o=d[f*4+3];k=p[f];var q=M[n*3],s=M[n*3+1];n=M[n*3+2];var u=M[m*3],x=M[m*3+1];m=M[m*3+2];var v=M[o*3],w=M[o*3+1];o=M[o*3+2];T.faces.push(new THREE.Face4(e,
-h,j,i,[new THREE.Vector3(M[l*3],M[l*3+1],M[l*3+2]),new THREE.Vector3(q,s,n),new THREE.Vector3(u,x,m),new THREE.Vector3(v,w,o)],null,k))}}var T=this,A=0,M=[],G=[],ea,I,aa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(T,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,A,12);c=D(a,A+12);D(a,A+13);D(a,A+14);D(a,A+15);e=D(a,A+16);n=D(a,A+17);k=D(a,A+18);i=D(a,A+19);l=E(a,A+20);m=E(a,A+20+4);p=E(a,A+20+8);b=E(a,A+20+12);
-u=E(a,A+20+16);o=E(a,A+20+20);q=E(a,A+20+24);s=E(a,A+20+28);w=E(a,A+20+32);v=E(a,A+20+36);H=E(a,A+20+40);A=A+c;c=e*3+i;aa=e*4+i;ea=b*c;I=u*(c+n*3);e=o*(c+k*3);i=q*(c+n*3+k*3);c=s*aa;n=w*(aa+n*4);k=v*(aa+k*4);A=A+function(b){var b=new Float32Array(a,b,l*3),c,d,f,e;for(c=0;c<l;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];T.vertices.push(new THREE.Vector3(d,f,e))}return l*3*Float32Array.BYTES_PER_ELEMENT}(A);A=A+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,f,e;for(c=0;c<m;c++){d=b[c*3];f=b[c*3+1];e=b[c*
-3+2];M.push(d/127,f/127,e/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(A);A=A+x(m*3);A=A+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,f;for(c=0;c<p;c++){d=b[c*2];f=b[c*2+1];G.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(A);ea=A+ea+x(b*2);I=ea+I+x(u*2);e=I+e+x(o*2);i=e+i+x(q*2);c=i+c+x(s*2);n=c+n+x(w*2);k=n+k+x(v*2);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*3;Q(o,a,b+o*Uint32Array.BYTES_PER_ELEMENT*3);O(o,b)}})(I);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*
-3,c=b+q*Uint32Array.BYTES_PER_ELEMENT*3;W(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);O(q,c)}})(e);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;F(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);B(v,b)}})(n);(function(a){if(H){var b=a+H*Uint32Array.BYTES_PER_ELEMENT*4,c=b+H*Uint32Array.BYTES_PER_ELEMENT*4;V(H,a,b,c+H*Uint32Array.BYTES_PER_ELEMENT*4);B(H,c)}})(k);b&&Q(b,A,A+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*3;W(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(ea);s&&F(s,i,i+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;V(w,a,b,b+w*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapBump&&b&&f(k,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap);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){l=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(l.uniforms);j.tNormal.texture=
+k.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(k.map){j.tDiffuse.texture=k.map;j.enableDiffuse.value=true}if(k.specularMap){j.tSpecular.texture=k.specularMap;j.enableSpecular.value=true}if(k.lightMap){j.tAO.texture=k.lightMap;j.enableAO.value=true}j.uDiffuseColor.value.setHex(k.color);j.uSpecularColor.value.setHex(k.specular);j.uAmbientColor.value.setHex(k.ambient);j.uShininess.value=k.shininess;if(k.opacity!==void 0)j.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,
+vertexShader:l.vertexShader,uniforms:j,lights:true,fog:true})}else k=new THREE[l](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(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 h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState==4)if(h.status==200||h.status==0){var i=JSON.parse(h.responseText);a.loadAjaxBuffers(i,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+h.status+"]")};h.open("GET",b,true);h.overrideMimeType&&h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,h=c+"/"+a.buffers,i=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0){var c=f.response;if(c===void 0)c=(new Uint8Array(f.responseBody)).buffer;THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+f.status+"]");else if(f.readyState==3){if(e){i==0&&(i=f.getResponseHeader("Content-Length"));e({total:i,loaded:f.responseText.length})}}else f.readyState==
+2&&(i=f.getResponseHeader("Content-Length"))};f.open("GET",h,true);f.responseType="arraybuffer";f.send(null)};
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,l,k,j,o,m,p,u,n,q,r,w,v,H;function x(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function O(b,c){var d,f,e,h,i,j,k,o,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=l[d*3];e=l[d*3+1];h=l[d*3+2];i=G[f*2];f=G[f*2+1];j=G[e*2];k=G[e*2+1];e=G[h*2];o=G[h*2+1];h=T.faceVertexUvs[0];var m=[];m.push(new THREE.UV(i,f));m.push(new THREE.UV(j,k));m.push(new THREE.UV(e,
+o));h.push(m)}}function B(b,c){var d,f,e,h,i,j,k,o,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=n[d*4];e=n[d*4+1];h=n[d*4+2];i=n[d*4+3];j=G[f*2];f=G[f*2+1];k=G[e*2];l=G[e*2+1];o=G[h*2];m=G[h*2+1];h=G[i*2];e=G[i*2+1];i=T.faceVertexUvs[0];var p=[];p.push(new THREE.UV(j,f));p.push(new THREE.UV(k,l));p.push(new THREE.UV(o,m));p.push(new THREE.UV(h,e));i.push(p)}}function Q(b,c,d){for(var f,e,h,i,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];h=c[d*3+2];i=j[d];
+T.faces.push(new THREE.Face3(f,e,h,null,null,i))}}function F(b,c,d){for(var f,e,h,i,j,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];h=c[d*4+2];i=c[d*4+3];j=k[d];T.faces.push(new THREE.Face4(f,e,h,i,null,null,j))}}function W(b,c,d,f){for(var e,h,i,j,k,o,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];h=c[f*3+1];i=c[f*3+2];k=d[f*3];o=d[f*3+1];l=d[f*3+2];j=m[f];var n=M[o*3],p=M[o*3+1];o=M[o*3+2];var q=M[l*3],
+r=M[l*3+1];l=M[l*3+2];T.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(M[k*3],M[k*3+1],M[k*3+2]),new THREE.Vector3(n,p,o),new THREE.Vector3(q,r,l)],null,j))}}function V(b,c,d,f){for(var e,h,i,j,k,o,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];h=c[f*4+1];i=c[f*4+2];j=c[f*4+3];o=d[f*4];l=d[f*4+1];m=d[f*4+2];n=d[f*4+3];k=p[f];var q=M[l*3],r=M[l*3+1];l=M[l*3+2];var u=M[m*3],x=M[m*3+1];m=M[m*3+2];var v=M[n*3],w=M[n*3+1];n=M[n*3+2];T.faces.push(new THREE.Face4(e,
+h,i,j,[new THREE.Vector3(M[o*3],M[o*3+1],M[o*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(u,x,m),new THREE.Vector3(v,w,n)],null,k))}}var T=this,A=0,M=[],G=[],ea,I,aa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(T,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,A,12);c=D(a,A+12);D(a,A+13);D(a,A+14);D(a,A+15);e=D(a,A+16);l=D(a,A+17);k=D(a,A+18);j=D(a,A+19);o=E(a,A+20);m=E(a,A+20+4);p=E(a,A+20+8);b=E(a,A+20+12);
+u=E(a,A+20+16);n=E(a,A+20+20);q=E(a,A+20+24);r=E(a,A+20+28);w=E(a,A+20+32);v=E(a,A+20+36);H=E(a,A+20+40);A=A+c;c=e*3+j;aa=e*4+j;ea=b*c;I=u*(c+l*3);e=n*(c+k*3);j=q*(c+l*3+k*3);c=r*aa;l=w*(aa+l*4);k=v*(aa+k*4);A=A+function(b){var b=new Float32Array(a,b,o*3),c,d,f,e;for(c=0;c<o;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];T.vertices.push(new THREE.Vector3(d,f,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(A);A=A+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,f,e;for(c=0;c<m;c++){d=b[c*3];f=b[c*3+1];e=b[c*
+3+2];M.push(d/127,f/127,e/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(A);A=A+x(m*3);A=A+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,f;for(c=0;c<p;c++){d=b[c*2];f=b[c*2+1];G.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(A);ea=A+ea+x(b*2);I=ea+I+x(u*2);e=I+e+x(n*2);j=e+j+x(q*2);c=j+c+x(r*2);l=c+l+x(w*2);k=l+k+x(v*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;Q(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);O(n,b)}})(I);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*
+3,c=b+q*Uint32Array.BYTES_PER_ELEMENT*3;W(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);O(q,c)}})(e);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;F(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);B(v,b)}})(l);(function(a){if(H){var b=a+H*Uint32Array.BYTES_PER_ELEMENT*4,c=b+H*Uint32Array.BYTES_PER_ELEMENT*4;V(H,a,b,c+H*Uint32Array.BYTES_PER_ELEMENT*4);B(H,c)}})(k);b&&Q(b,A,A+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*3;W(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*
+3)}})(ea);r&&F(r,j,j+r*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;V(w,a,b,b+w*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;b===void 0&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},false);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(c.crossOrigin)b.crossOrigin=c.crossOrigin;b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(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,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var j=JSON.parse(f.responseText);a.createModel(j,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){h===0&&(h=f.getResponseHeader("Content-Length"));
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var i=JSON.parse(f.responseText);a.createModel(i,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){h===0&&(h=f.getResponseHeader("Content-Length"));
 e({total:h,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(h=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,n,k,i,l,m,p,u,o,q,s,w,v,H=a.faces;l=a.vertices;var x=a.normals,D=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(i=l.length;k<i;){m=new THREE.Vector3;m.x=l[k++]*b;m.y=l[k++]*b;m.z=l[k++]*b;d.vertices.push(m)}k=0;for(i=H.length;k<i;){b=H[k++];l=b&1;n=b&2;c=b&
-4;e=b&8;p=b&16;m=b&32;o=b&64;b=b&128;if(l){q=new THREE.Face4;q.a=H[k++];q.b=H[k++];q.c=H[k++];q.d=H[k++];l=4}else{q=new THREE.Face3;q.a=H[k++];q.b=H[k++];q.c=H[k++];l=3}if(n){n=H[k++];q.materialIndex=n}n=d.faces.length;if(c)for(c=0;c<E;c++){s=a.uvs[c];u=H[k++];v=s[u*2];u=s[u*2+1];d.faceUvs[c][n]=new THREE.UV(v,u)}if(e)for(c=0;c<E;c++){s=a.uvs[c];w=[];for(e=0;e<l;e++){u=H[k++];v=s[u*2];u=s[u*2+1];w[e]=new THREE.UV(v,u)}d.faceVertexUvs[c][n]=w}if(p){p=H[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
-e.z=x[p];q.normal=e}if(m)for(c=0;c<l;c++){p=H[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(o){m=H[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<l;c++){m=H[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,n;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];n=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,n,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){e=a.skinIndices[b];n=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,n,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,n,k,i,l;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=[];i=d.morphTargets[c].vertices;l=a.morphTargets[c].vertices;n=0;for(k=l.length;n<k;n=n+3){var m=new THREE.Vector3;m.x=l[n]*b;m.y=l[n+1]*b;m.z=l[n+2]*b;i.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;i=a.morphColors[c].colors;b=0;for(n=i.length;b<n;b=b+3){l=new THREE.Color(16755200);l.setRGB(i[b],i[b+1],i[b+2]);k.push(l)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=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,l,k,j,o,m,p,u,n,q,r,w,v,H=a.faces;o=a.vertices;var x=a.normals,D=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(j=o.length;k<j;){m=new THREE.Vector3;m.x=o[k++]*b;m.y=o[k++]*b;m.z=o[k++]*b;d.vertices.push(m)}k=0;for(j=H.length;k<j;){b=H[k++];o=b&1;l=b&2;c=b&
+4;e=b&8;p=b&16;m=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=H[k++];q.b=H[k++];q.c=H[k++];q.d=H[k++];o=4}else{q=new THREE.Face3;q.a=H[k++];q.b=H[k++];q.c=H[k++];o=3}if(l){l=H[k++];q.materialIndex=l}l=d.faces.length;if(c)for(c=0;c<E;c++){r=a.uvs[c];u=H[k++];v=r[u*2];u=r[u*2+1];d.faceUvs[c][l]=new THREE.UV(v,u)}if(e)for(c=0;c<E;c++){r=a.uvs[c];w=[];for(e=0;e<o;e++){u=H[k++];v=r[u*2];u=r[u*2+1];w[e]=new THREE.UV(v,u)}d.faceVertexUvs[c][l]=w}if(p){p=H[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
+e.z=x[p];q.normal=e}if(m)for(c=0;c<o;c++){p=H[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(n){m=H[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<o;c++){m=H[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];l=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,l,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){e=a.skinIndices[b];l=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,l,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,l,k,j,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=[];j=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;l=0;for(k=o.length;l<k;l=l+3){var m=new THREE.Vector3;m.x=o[l]*b;m.y=o[l+1]*b;m.z=o[l+2]*b;j.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;j=a.morphColors[c].colors;b=0;for(l=j.length;b<l;b=b+3){o=new THREE.Color(16755200);o.setRGB(j[b],j[b+1],j[b+2]);k.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),e):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
-a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var h=a.materials[f],j=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},n=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},k=function(a,d,f,e,h,i){a[d]=new THREE.Texture;a[d].sourceFile=
-f;if(e){a[d].repeat.set(e[0],e[1]);if(e[0]!==1)a[d].wrapS=THREE.RepeatWrapping;if(e[1]!==1)a[d].wrapT=THREE.RepeatWrapping}h&&a[d].offset.set(h[0],h[1]);if(i){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[i[0]]!==void 0)a[d].wrapS=e[i[0]];if(e[i[1]]!==void 0)a[d].wrapT=e[i[1]]}var k=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!j(a.width)||!j(a.height)){var b=n(a.width),c=n(a.height);k.image=document.createElement("canvas");k.image.width=
-b;k.image.height=c;k.image.getContext("2d").drawImage(a,0,0,b,c)}else k.image=a;k.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+f);b&&b.add(a)},i=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},l="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(h.shading){var p=h.shading.toLowerCase();p==="phong"?l="MeshPhongMaterial":p==="basic"&&(l="MeshBasicMaterial")}if(h.blending!==void 0&&THREE[h.blending]!==
-void 0)m.blending=THREE[h.blending];if(h.transparent!==void 0||h.opacity<1)m.transparent=h.transparent;if(h.depthTest!==void 0)m.depthTest=h.depthTest;if(h.depthWrite!==void 0)m.depthWrite=h.depthWrite;if(h.vertexColors!==void 0)if(h.vertexColors=="face")m.vertexColors=THREE.FaceColors;else if(h.vertexColors)m.vertexColors=THREE.VertexColors;if(h.colorDiffuse)m.color=i(h.colorDiffuse);else if(h.DbgColor)m.color=h.DbgColor;if(h.colorSpecular)m.specular=i(h.colorSpecular);if(h.colorAmbient)m.ambient=
-i(h.colorAmbient);if(h.transparency)m.opacity=h.transparency;if(h.specularCoef)m.shininess=h.specularCoef;if(h.visible!==void 0)m.visible=h.visible;if(h.flipSided!==void 0)m.side=THREE.BackSide;if(h.doubleSided!==void 0)m.side=THREE.DoubleSide;if(h.wireframe!==void 0)m.wireframe=h.wireframe;h.mapDiffuse&&k(m,"map",h.mapDiffuse,h.mapDiffuseRepeat,h.mapDiffuseOffset,h.mapDiffuseWrap);h.mapLight&&k(m,"lightMap",h.mapLight,h.mapLightRepeat,h.mapLightOffset,h.mapLightWrap);h.mapBump&&k(m,"bumpMap",h.mapBump,
-h.mapBumpRepeat,h.mapBumpOffset,h.mapBumpWrap);h.mapNormal&&k(m,"normalMap",h.mapNormal,h.mapNormalRepeat,h.mapNormalOffset,h.mapNormalWrap);h.mapSpecular&&k(m,"specularMap",h.mapSpecular,h.mapSpecularRepeat,h.mapSpecularOffset,h.mapSpecularWrap);if(h.mapNormal){k=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(k.uniforms);i.tNormal.texture=m.normalMap;if(h.mapNormalFactor)i.uNormalScale.value=h.mapNormalFactor;if(m.map){i.tDiffuse.texture=m.map;i.enableDiffuse.value=true}if(m.specularMap){i.tSpecular.texture=
-m.specularMap;i.enableSpecular.value=true}if(m.lightMap){i.tAO.texture=m.lightMap;i.enableAO.value=true}i.uDiffuseColor.value.setHex(m.color);i.uSpecularColor.value.setHex(m.specular);i.uAmbientColor.value.setHex(m.ambient);i.uShininess.value=m.shininess;if(m.opacity!==void 0)i.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:i,lights:true,fog:true})}else m=new THREE[l](m);if(h.DbgName!==void 0)m.name=h.DbgName;d.materials[f]=
-m}}var h=a.faces,u=a.vertices,m=a.normals,k=a.colors,i=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&i++;for(f=0;f<i;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}l=0;for(p=u.length;l<p;){var o=new THREE.Vector3;o.x=u[l++]*e;o.y=u[l++]*e;o.z=u[l++]*e;d.vertices.push(o)}l=0;for(p=h.length;l<p;){var q=h[l++],s=q&2,f=q&4,w=q&8,v=q&16,u=q&32,H=q&64,o=q&128;if(q&1){q=new THREE.Face4;q.a=h[l++];q.b=h[l++];q.c=h[l++];q.d=h[l++];var x=4}else{q=new THREE.Face3;q.a=h[l++];q.b=h[l++];q.c=h[l++];x=3}if(s){s=
-h[l++];q.materialIndex=s}var D=d.faces.length;if(f)for(f=0;f<i;f++){var E=a.uvs[f],s=h[l++],O=E[s*2],s=E[s*2+1];d.faceUvs[f][D]=new THREE.UV(O,s)}if(w)for(f=0;f<i;f++){for(var E=a.uvs[f],w=[],B=0;B<x;B++){s=h[l++];O=E[s*2];s=E[s*2+1];w[B]=new THREE.UV(O,s)}d.faceVertexUvs[f][D]=w}if(v){v=h[l++]*3;s=new THREE.Vector3;s.x=m[v++];s.y=m[v++];s.z=m[v];q.normal=s}if(u)for(f=0;f<x;f++){v=h[l++]*3;s=new THREE.Vector3;s.x=m[v++];s.y=m[v++];s.z=m[v];q.vertexNormals.push(s)}if(H){u=h[l++];q.color=new THREE.Color(k[u])}if(o)for(f=
-0;f<x;f++){u=h[l++];q.vertexColors.push(new THREE.Color(k[u]))}d.faces.push(q)}if(a.skinWeights){f=0;for(h=a.skinWeights.length;f<h;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(h=a.skinIndices.length;f<h;f=f+2){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],m,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(h=a.morphTargets.length;f<h;f++){d.morphTargets[f]={};d.morphTargets[f].name=
-a.morphTargets[f].name;d.morphTargets[f].vertices=[];m=d.morphTargets[f].vertices;k=a.morphTargets[f].vertices;s=0;for(i=k.length;s<i;s=s+3){o=new THREE.Vector3;o.x=k[s]*e;o.y=k[s+1]*e;o.z=k[s+2]*e;m.push(o)}}}if(a.morphColors){f=0;for(h=a.morphColors.length;f<h;f++){d.morphColors[f]={};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;k=a.morphColors[f].colors;m=0;for(i=k.length;m<i;m=m+3){l=new THREE.Color(16755200);l.setRGB(k[m],k[m+1],k[m+2]);e.push(l)}}}d.computeCentroids();
+a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var h=a.materials[f],i=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},l=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},k=function(a,d,f,e,h,j){a[d]=new THREE.Texture;a[d].sourceFile=
+f;if(e){a[d].repeat.set(e[0],e[1]);if(e[0]!==1)a[d].wrapS=THREE.RepeatWrapping;if(e[1]!==1)a[d].wrapT=THREE.RepeatWrapping}h&&a[d].offset.set(h[0],h[1]);if(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[d].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[d].wrapT=e[j[1]]}var k=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!i(a.width)||!i(a.height)){var b=l(a.width),c=l(a.height);k.image=document.createElement("canvas");k.image.width=
+b;k.image.height=c;k.image.getContext("2d").drawImage(a,0,0,b,c)}else k.image=a;k.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+f);b&&b.add(a)},j=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},o="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(h.shading){var p=h.shading.toLowerCase();p==="phong"?o="MeshPhongMaterial":p==="basic"&&(o="MeshBasicMaterial")}if(h.blending!==void 0&&THREE[h.blending]!==
+void 0)m.blending=THREE[h.blending];if(h.transparent!==void 0||h.opacity<1)m.transparent=h.transparent;if(h.depthTest!==void 0)m.depthTest=h.depthTest;if(h.depthWrite!==void 0)m.depthWrite=h.depthWrite;if(h.vertexColors!==void 0)if(h.vertexColors=="face")m.vertexColors=THREE.FaceColors;else if(h.vertexColors)m.vertexColors=THREE.VertexColors;if(h.colorDiffuse)m.color=j(h.colorDiffuse);else if(h.DbgColor)m.color=h.DbgColor;if(h.colorSpecular)m.specular=j(h.colorSpecular);if(h.colorAmbient)m.ambient=
+j(h.colorAmbient);if(h.transparency)m.opacity=h.transparency;if(h.specularCoef)m.shininess=h.specularCoef;if(h.visible!==void 0)m.visible=h.visible;if(h.flipSided!==void 0)m.side=THREE.BackSide;if(h.doubleSided!==void 0)m.side=THREE.DoubleSide;if(h.wireframe!==void 0)m.wireframe=h.wireframe;h.mapDiffuse&&k(m,"map",h.mapDiffuse,h.mapDiffuseRepeat,h.mapDiffuseOffset,h.mapDiffuseWrap);h.mapLight&&k(m,"lightMap",h.mapLight,h.mapLightRepeat,h.mapLightOffset,h.mapLightWrap);h.mapBump&&k(m,"bumpMap",h.mapBump,
+h.mapBumpRepeat,h.mapBumpOffset,h.mapBumpWrap);h.mapNormal&&k(m,"normalMap",h.mapNormal,h.mapNormalRepeat,h.mapNormalOffset,h.mapNormalWrap);h.mapSpecular&&k(m,"specularMap",h.mapSpecular,h.mapSpecularRepeat,h.mapSpecularOffset,h.mapSpecularWrap);if(h.mapNormal){k=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(k.uniforms);j.tNormal.texture=m.normalMap;if(h.mapNormalFactor)j.uNormalScale.value=h.mapNormalFactor;if(m.map){j.tDiffuse.texture=m.map;j.enableDiffuse.value=true}if(m.specularMap){j.tSpecular.texture=
+m.specularMap;j.enableSpecular.value=true}if(m.lightMap){j.tAO.texture=m.lightMap;j.enableAO.value=true}j.uDiffuseColor.value.setHex(m.color);j.uSpecularColor.value.setHex(m.specular);j.uAmbientColor.value.setHex(m.ambient);j.uShininess.value=m.shininess;if(m.opacity!==void 0)j.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:true,fog:true})}else m=new THREE[o](m);if(h.DbgName!==void 0)m.name=h.DbgName;d.materials[f]=
+m}}var h=a.faces,u=a.vertices,m=a.normals,k=a.colors,j=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&j++;for(f=0;f<j;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}o=0;for(p=u.length;o<p;){var n=new THREE.Vector3;n.x=u[o++]*e;n.y=u[o++]*e;n.z=u[o++]*e;d.vertices.push(n)}o=0;for(p=h.length;o<p;){var q=h[o++],r=q&2,f=q&4,w=q&8,v=q&16,u=q&32,H=q&64,n=q&128;if(q&1){q=new THREE.Face4;q.a=h[o++];q.b=h[o++];q.c=h[o++];q.d=h[o++];var x=4}else{q=new THREE.Face3;q.a=h[o++];q.b=h[o++];q.c=h[o++];x=3}if(r){r=
+h[o++];q.materialIndex=r}var D=d.faces.length;if(f)for(f=0;f<j;f++){var E=a.uvs[f],r=h[o++],O=E[r*2],r=E[r*2+1];d.faceUvs[f][D]=new THREE.UV(O,r)}if(w)for(f=0;f<j;f++){for(var E=a.uvs[f],w=[],B=0;B<x;B++){r=h[o++];O=E[r*2];r=E[r*2+1];w[B]=new THREE.UV(O,r)}d.faceVertexUvs[f][D]=w}if(v){v=h[o++]*3;r=new THREE.Vector3;r.x=m[v++];r.y=m[v++];r.z=m[v];q.normal=r}if(u)for(f=0;f<x;f++){v=h[o++]*3;r=new THREE.Vector3;r.x=m[v++];r.y=m[v++];r.z=m[v];q.vertexNormals.push(r)}if(H){u=h[o++];q.color=new THREE.Color(k[u])}if(n)for(f=
+0;f<x;f++){u=h[o++];q.vertexColors.push(new THREE.Color(k[u]))}d.faces.push(q)}if(a.skinWeights){f=0;for(h=a.skinWeights.length;f<h;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(h=a.skinIndices.length;f<h;f=f+2){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],m,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(h=a.morphTargets.length;f<h;f++){d.morphTargets[f]={};d.morphTargets[f].name=
+a.morphTargets[f].name;d.morphTargets[f].vertices=[];m=d.morphTargets[f].vertices;k=a.morphTargets[f].vertices;r=0;for(j=k.length;r<j;r=r+3){n=new THREE.Vector3;n.x=k[r]*e;n.y=k[r+1]*e;n.z=k[r+2]*e;m.push(n)}}}if(a.morphColors){f=0;for(h=a.morphColors.length;f<h;f++){d.morphColors[f]={};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;k=a.morphColors[f].colors;m=0;for(j=k.length;m<j;m=m+3){o=new THREE.Color(16755200);o.setRGB(k[m],k[m+1],k[m+2]);e.push(o)}}}d.computeCentroids();
 d.computeFaceNormals();return 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(a,b){var c;for(m in b)if(P.objects[m]===void 0){s=b[m];if(s.geometry!==void 0){if(F=P.geometries[s.geometry]){c=false;W=P.materials[s.materials[0]];(c=W instanceof THREE.ShaderMaterial)&&F.computeTangents();x=s.position;D=s.rotation;E=s.quaternion;O=s.scale;w=s.matrix;E=0;s.materials.length==0&&(W=new THREE.MeshFaceMaterial);s.materials.length>1&&(W=new THREE.MeshFaceMaterial);c=
-new THREE.Mesh(F,W);c.name=m;if(w){c.matrixAutoUpdate=false;c.matrix.set(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],w[8],w[9],w[10],w[11],w[12],w[13],w[14],w[15])}else{c.position.set(x[0],x[1],x[2]);if(E){c.quaternion.set(E[0],E[1],E[2],E[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(O[0],O[1],O[2])}c.visible=s.visible;c.castShadow=s.castShadow;c.receiveShadow=s.receiveShadow;a.add(c);P.objects[m]=c}}else{x=s.position;D=s.rotation;E=s.quaternion;O=s.scale;E=0;c=new THREE.Object3D;
-c.name=m;c.position.set(x[0],x[1],x[2]);if(E){c.quaternion.set(E[0],E[1],E[2],E[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(O[0],O[1],O[2]);c.visible=s.visible!==void 0?s.visible:false;a.add(c);P.objects[m]=c;P.empties[m]=c}s.children!==void 0&&e(c,s.children)}}function f(a){return function(b){P.geometries[a]=b;e(P.scene,A.objects);G=G-1;n.onLoadComplete();j()}}function h(a){return function(b){P.geometries[a]=b}}function j(){n.callbackProgress({totalModels:I,totalTextures:aa,
-loadedModels:I-G,loadedTextures:aa-ea},P);n.onLoadProgress();G===0&&ea===0&&b(P)}var n=this,k=THREE.Loader.prototype.extractUrlBase(c),i,l,m,p,u,o,q,s,w,v,H,x,D,E,O,B,Q,F,W,V,T,A,M,G,ea,I,aa,P;A=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;ea=G=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(A.transform){a=A.transform.position;v=A.transform.rotation;B=A.transform.scale;a&&P.scene.position.set(a[0],a[1],a[2]);v&&P.scene.rotation.set(v[0],
-v[1],v[2]);B&&P.scene.scale.set(B[0],B[1],B[2]);if(a||v||B){P.scene.updateMatrix();P.scene.updateMatrixWorld()}}a=function(a){return function(){ea=ea-a;j();n.onLoadComplete()}};for(u in A.cameras){B=A.cameras[u];B.type==="perspective"?V=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):B.type==="ortho"&&(V=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far));x=B.position;v=B.target;B=B.up;V.position.set(x[0],x[1],x[2]);V.target=new THREE.Vector3(v[0],v[1],v[2]);B&&V.up.set(B[0],
-B[1],B[2]);P.cameras[u]=V}for(p in A.lights){v=A.lights[p];u=v.color!==void 0?v.color:16777215;V=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){x=v.direction;H=new THREE.DirectionalLight(u,V);H.position.set(x[0],x[1],x[2]);H.position.normalize()}else if(v.type==="point"){x=v.position;H=v.distance;H=new THREE.PointLight(u,V,H);H.position.set(x[0],x[1],x[2])}else v.type==="ambient"&&(H=new THREE.AmbientLight(u));P.scene.add(H);P.lights[p]=H}for(o in A.fogs){p=A.fogs[o];p.type==="linear"?
-T=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(T=new THREE.FogExp2(0,p.density));B=p.color;T.color.setRGB(B[0],B[1],B[2]);P.fogs[o]=T}if(P.cameras&&A.defaults.camera)P.currentCamera=P.cameras[A.defaults.camera];if(P.fogs&&A.defaults.fog)P.scene.fog=P.fogs[A.defaults.fog];B=A.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(B[0],B[1],B[2]);P.bgColorAlpha=A.defaults.bgalpha;for(i in A.geometries){o=A.geometries[i];if(o.type=="bin_mesh"||o.type=="ascii_mesh"){G=G+1;n.onLoadStart()}}I=G;
-for(i in A.geometries){o=A.geometries[i];if(o.type==="cube"){F=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);P.geometries[i]=F}else if(o.type==="plane"){F=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);P.geometries[i]=F}else if(o.type==="sphere"){F=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight);P.geometries[i]=F}else if(o.type==="cylinder"){F=new THREE.CylinderGeometry(o.topRad,
-o.botRad,o.height,o.radSegs,o.heightSegs);P.geometries[i]=F}else if(o.type==="torus"){F=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);P.geometries[i]=F}else if(o.type==="icosahedron"){F=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);P.geometries[i]=F}else if(o.type==="bin_mesh")c.load(d(o.url,A.urlBaseType),f(i));else if(o.type==="ascii_mesh")M.load(d(o.url,A.urlBaseType),f(i));else if(o.type==="embedded_mesh"){o=A.embeds[o.id];o.metadata=A.metadata;o&&M.createModel(o,h(i),
-"")}}for(q in A.textures){i=A.textures[q];if(i.url instanceof Array){ea=ea+i.url.length;for(o=0;o<i.url.length;o++)n.onLoadStart()}else{ea=ea+1;n.onLoadStart()}}aa=ea;for(q in A.textures){i=A.textures[q];if(i.mapping!==void 0&&THREE[i.mapping]!==void 0)i.mapping=new THREE[i.mapping];if(i.url instanceof Array){o=i.url.length;T=[];for(c=0;c<o;c++)T[c]=d(i.url[c],A.urlBaseType);o=THREE.ImageUtils.loadTextureCube(T,i.mapping,a(o))}else{o=THREE.ImageUtils.loadTexture(d(i.url,A.urlBaseType),i.mapping,a(1));
-if(THREE[i.minFilter]!==void 0)o.minFilter=THREE[i.minFilter];if(THREE[i.magFilter]!==void 0)o.magFilter=THREE[i.magFilter];if(i.repeat){o.repeat.set(i.repeat[0],i.repeat[1]);if(i.repeat[0]!==1)o.wrapS=THREE.RepeatWrapping;if(i.repeat[1]!==1)o.wrapT=THREE.RepeatWrapping}i.offset&&o.offset.set(i.offset[0],i.offset[1]);if(i.wrap){T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(T[i.wrap[0]]!==void 0)o.wrapS=T[i.wrap[0]];if(T[i.wrap[1]]!==void 0)o.wrapT=T[i.wrap[1]]}}P.textures[q]=
-o}for(l in A.materials){w=A.materials[l];for(Q in w.parameters)if(Q==="envMap"||Q==="map"||Q==="lightMap")w.parameters[Q]=P.textures[w.parameters[Q]];else if(Q==="shading")w.parameters[Q]=w.parameters[Q]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(Q==="blending")w.parameters[Q]=w.parameters[Q]in THREE?THREE[w.parameters[Q]]:THREE.NormalBlending;else if(Q==="combine")w.parameters[Q]=w.parameters[Q]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(Q==="vertexColors")if(w.parameters[Q]==
-"face")w.parameters[Q]=THREE.FaceColors;else if(w.parameters[Q])w.parameters[Q]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=true;if(w.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);i=w.parameters.color;o=w.parameters.specular;T=w.parameters.ambient;c=w.parameters.shininess;a.tNormal.texture=P.textures[w.parameters.normalMap];if(w.parameters.normalMapFactor)a.uNormalScale.value=w.parameters.normalMapFactor;
-if(w.parameters.map){a.tDiffuse.texture=w.parameters.map;a.enableDiffuse.value=true}if(w.parameters.lightMap){a.tAO.texture=w.parameters.lightMap;a.enableAO.value=true}if(w.parameters.specularMap){a.tSpecular.texture=P.textures[w.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(o);a.uAmbientColor.value.setHex(T);a.uShininess.value=c;if(w.parameters.opacity)a.uOpacity.value=w.parameters.opacity;W=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,
-vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else W=new THREE[w.type](w.parameters);P.materials[l]=W}e(P.scene,A.objects);n.callbackSync(P);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(a,b){var c;for(m in b)if(P.objects[m]===void 0){r=b[m];if(r.geometry!==void 0){if(F=P.geometries[r.geometry]){c=false;W=P.materials[r.materials[0]];(c=W instanceof THREE.ShaderMaterial)&&F.computeTangents();x=r.position;D=r.rotation;E=r.quaternion;O=r.scale;w=r.matrix;E=0;r.materials.length==0&&(W=new THREE.MeshFaceMaterial);r.materials.length>1&&(W=new THREE.MeshFaceMaterial);c=
+new THREE.Mesh(F,W);c.name=m;if(w){c.matrixAutoUpdate=false;c.matrix.set(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],w[8],w[9],w[10],w[11],w[12],w[13],w[14],w[15])}else{c.position.set(x[0],x[1],x[2]);if(E){c.quaternion.set(E[0],E[1],E[2],E[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(O[0],O[1],O[2])}c.visible=r.visible;c.castShadow=r.castShadow;c.receiveShadow=r.receiveShadow;a.add(c);P.objects[m]=c}}else{x=r.position;D=r.rotation;E=r.quaternion;O=r.scale;E=0;c=new THREE.Object3D;
+c.name=m;c.position.set(x[0],x[1],x[2]);if(E){c.quaternion.set(E[0],E[1],E[2],E[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(O[0],O[1],O[2]);c.visible=r.visible!==void 0?r.visible:false;a.add(c);P.objects[m]=c;P.empties[m]=c}if(r.properties!==void 0)for(var d in r.properties)c.properties[d]=r.properties[d];r.children!==void 0&&e(c,r.children)}}function f(a){return function(b){P.geometries[a]=b;e(P.scene,A.objects);G=G-1;l.onLoadComplete();i()}}function h(a){return function(b){P.geometries[a]=
+b}}function i(){l.callbackProgress({totalModels:I,totalTextures:aa,loadedModels:I-G,loadedTextures:aa-ea},P);l.onLoadProgress();G===0&&ea===0&&b(P)}var l=this,k=THREE.Loader.prototype.extractUrlBase(c),j,o,m,p,u,n,q,r,w,v,H,x,D,E,O,B,Q,F,W,V,T,A,M,G,ea,I,aa,P;A=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;ea=G=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(A.transform){a=A.transform.position;v=A.transform.rotation;B=A.transform.scale;
+a&&P.scene.position.set(a[0],a[1],a[2]);v&&P.scene.rotation.set(v[0],v[1],v[2]);B&&P.scene.scale.set(B[0],B[1],B[2]);if(a||v||B){P.scene.updateMatrix();P.scene.updateMatrixWorld()}}a=function(a){return function(){ea=ea-a;i();l.onLoadComplete()}};for(u in A.cameras){B=A.cameras[u];B.type==="perspective"?V=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):B.type==="ortho"&&(V=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far));x=B.position;v=B.target;B=B.up;V.position.set(x[0],
+x[1],x[2]);V.target=new THREE.Vector3(v[0],v[1],v[2]);B&&V.up.set(B[0],B[1],B[2]);P.cameras[u]=V}for(p in A.lights){v=A.lights[p];u=v.color!==void 0?v.color:16777215;V=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){x=v.direction;H=new THREE.DirectionalLight(u,V);H.position.set(x[0],x[1],x[2]);H.position.normalize()}else if(v.type==="point"){x=v.position;H=v.distance;H=new THREE.PointLight(u,V,H);H.position.set(x[0],x[1],x[2])}else v.type==="ambient"&&(H=new THREE.AmbientLight(u));P.scene.add(H);
+P.lights[p]=H}for(n in A.fogs){p=A.fogs[n];p.type==="linear"?T=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(T=new THREE.FogExp2(0,p.density));B=p.color;T.color.setRGB(B[0],B[1],B[2]);P.fogs[n]=T}if(P.cameras&&A.defaults.camera)P.currentCamera=P.cameras[A.defaults.camera];if(P.fogs&&A.defaults.fog)P.scene.fog=P.fogs[A.defaults.fog];B=A.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(B[0],B[1],B[2]);P.bgColorAlpha=A.defaults.bgalpha;for(j in A.geometries){n=A.geometries[j];if(n.type==
+"bin_mesh"||n.type=="ascii_mesh"){G=G+1;l.onLoadStart()}}I=G;for(j in A.geometries){n=A.geometries[j];if(n.type==="cube"){F=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);P.geometries[j]=F}else if(n.type==="plane"){F=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);P.geometries[j]=F}else if(n.type==="sphere"){F=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);P.geometries[j]=F}else if(n.type===
+"cylinder"){F=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs);P.geometries[j]=F}else if(n.type==="torus"){F=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);P.geometries[j]=F}else if(n.type==="icosahedron"){F=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);P.geometries[j]=F}else if(n.type==="bin_mesh")c.load(d(n.url,A.urlBaseType),f(j));else if(n.type==="ascii_mesh")M.load(d(n.url,A.urlBaseType),f(j));else if(n.type==="embedded_mesh"){n=A.embeds[n.id];
+n.metadata=A.metadata;n&&M.createModel(n,h(j),"")}}for(q in A.textures){j=A.textures[q];if(j.url instanceof Array){ea=ea+j.url.length;for(n=0;n<j.url.length;n++)l.onLoadStart()}else{ea=ea+1;l.onLoadStart()}}aa=ea;for(q in A.textures){j=A.textures[q];if(j.mapping!==void 0&&THREE[j.mapping]!==void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=j.url.length;T=[];for(c=0;c<n;c++)T[c]=d(j.url[c],A.urlBaseType);n=THREE.ImageUtils.loadTextureCube(T,j.mapping,a(n))}else{n=THREE.ImageUtils.loadTexture(d(j.url,
+A.urlBaseType),j.mapping,a(1));if(THREE[j.minFilter]!==void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!==void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!==1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!==1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(T[j.wrap[0]]!==void 0)n.wrapS=T[j.wrap[0]];if(T[j.wrap[1]]!==void 0)n.wrapT=
+T[j.wrap[1]]}}P.textures[q]=n}for(o in A.materials){w=A.materials[o];for(Q in w.parameters)if(Q==="envMap"||Q==="map"||Q==="lightMap")w.parameters[Q]=P.textures[w.parameters[Q]];else if(Q==="shading")w.parameters[Q]=w.parameters[Q]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(Q==="blending")w.parameters[Q]=w.parameters[Q]in THREE?THREE[w.parameters[Q]]:THREE.NormalBlending;else if(Q==="combine")w.parameters[Q]=w.parameters[Q]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(Q===
+"vertexColors")if(w.parameters[Q]=="face")w.parameters[Q]=THREE.FaceColors;else if(w.parameters[Q])w.parameters[Q]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=true;if(w.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);j=w.parameters.color;n=w.parameters.specular;T=w.parameters.ambient;c=w.parameters.shininess;a.tNormal.texture=P.textures[w.parameters.normalMap];if(w.parameters.normalMapFactor)a.uNormalScale.value=
+w.parameters.normalMapFactor;if(w.parameters.map){a.tDiffuse.texture=w.parameters.map;a.enableDiffuse.value=true}if(w.parameters.lightMap){a.tAO.texture=w.parameters.lightMap;a.enableAO.value=true}if(w.parameters.specularMap){a.tSpecular.texture=P.textures[w.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(j);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(T);a.uShininess.value=c;if(w.parameters.opacity)a.uOpacity.value=w.parameters.opacity;W=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,
+vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else W=new THREE[w.type](w.parameters);P.materials[o]=W}e(P.scene,A.objects);l.callbackSync(P);i()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(){this.id=THREE.MaterialCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=false;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=true;this.polygonOffset=false;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=false;this.needsUpdate=this.visible=true};
 THREE.Material.prototype.setValues=function(a){if(a!==void 0)for(var b in a){var c=a[b];if(c===void 0)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color&&typeof c==="number"?d.setHex(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
@@ -212,9 +212,9 @@ THREE.ParticleBasicMaterial.prototype.clone=function(){var a=new THREE.ParticleB
 THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.attributes=null;this.shading=THREE.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.lights=this.fog=false;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=false;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=this.uniforms;a.attributes=this.attributes;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;
 return a};
-THREE.Texture=function(a,b,c,d,e,f,h,j,n){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.anisotropy=n!==void 0?n:1;this.format=h!==void 0?h:THREE.RGBAFormat;this.type=j!==void 0?j:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,
+THREE.Texture=function(a,b,c,d,e,f,h,i,l){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.anisotropy=l!==void 0?l:1;this.format=h!==void 0?h:THREE.RGBAFormat;this.type=i!==void 0?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,
 1);this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=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,this.anisotropy);a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;return a}};
-THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,e,f,h,j,n,k){THREE.Texture.call(this,null,f,h,j,n,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);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.TextureCount=0;THREE.DataTexture=function(a,b,c,d,e,f,h,i,l,k){THREE.Texture.call(this,null,f,h,i,l,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);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=Object.create(THREE.Object3D.prototype);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=Object.create(THREE.Object3D.prototype);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=Object.create(THREE.Object3D.prototype);
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
@@ -282,31 +282,31 @@ THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( p
 THREE.ShaderChunk.skinning_vertex,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 f in d.attributes){var e=d.attributes[f];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=true;var h=1;e.type==="v2"?h=2:e.type==="v3"?h=3:e.type==="v4"?h=4:e.type==="c"&&(h=3);e.size=h;e.array=new Float32Array(c*h);e.buffer=g.createBuffer();e.buffer.belongsToAttribute=f;e.needsUpdate=true}a.__webglCustomAttributesList.push(e)}}}
 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.bumpMap||a.specularMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,
-f,e,h,i=a.vertices;h=i.length;var j=a.colors,k=j.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){Wb.copy(Xb);Wb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){f=i[d];Ya.copy(f);Wb.multiplyVector3(Ya);m[d]=[Ya.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){f=i[m[d][1]];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}for(d=0;d<k;d++){e=d*3;f=j[m[d][1]];n[e]=f.r;n[e+1]=f.g;n[e+2]=f.b}if(q){j=0;
+f,e,h,i=a.vertices;h=i.length;var j=a.colors,k=j.length,l=a.__vertexArray,o=a.__colorArray,m=a.__sortArray,n=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){Wb.copy(Xb);Wb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){f=i[d];Ya.copy(f);Wb.multiplyVector3(Ya);m[d]=[Ya.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){f=i[m[d][1]];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}for(d=0;d<k;d++){e=d*3;f=j[m[d][1]];o[e]=f.r;o[e+1]=f.g;o[e+2]=f.b}if(q){j=0;
 for(k=q.length;j<k;j++){i=q[j];if(i.boundTo===void 0||i.boundTo==="vertices"){e=0;f=i.value.length;if(i.size===1)for(d=0;d<f;d++){h=m[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[e]=h.x;i.array[e+1]=h.y;e=e+2}else if(i.size===3)if(i.type==="c")for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[e]=h.r;i.array[e+1]=h.g;i.array[e+2]=h.b;e=e+3}else for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;e=e+3}else if(i.size===
-4)for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;i.array[e+3]=h.w;e=e+4}}}}}else{if(o)for(d=0;d<h;d++){f=i[d];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}if(p)for(d=0;d<k;d++){f=j[d];e=d*3;n[e]=f.r;n[e+1]=f.g;n[e+2]=f.b}if(q){j=0;for(k=q.length;j<k;j++){i=q[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){f=i.value.length;e=0;if(i.size===1)for(d=0;d<f;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+
-1]=h.y;e=e+2}else if(i.size===3)if(i.type==="c")for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.r;i.array[e+1]=h.g;i.array[e+2]=h.b;e=e+3}else for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;e=e+3}else if(i.size===4)for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;i.array[e+3]=h.w;e=e+4}}}}}if(o||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,
-a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,n,b)}if(q){j=0;for(k=q.length;j<k;j++){i=q[j];if(i.needsUpdate||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.bufferData(g.ARRAY_BUFFER,i.array,b)}}}}function h(a,b){return b.z-a.z}function j(a,b){return b[1]-a[1]}function n(a,b,c){if(a.length)for(var d=0,g=a.length;d<g;d++){ta=Aa=null;U=S=ia=ba=ua=Pa=fa=-1;ab=true;a[d].render(b,c,hc,yc);ta=Aa=null;U=S=ia=ba=ua=Pa=fa=-1;ab=true}}function k(a,b,c,d,g,f,e,h){var i,j,k,l;if(b){j=a.length-1;
-l=b=-1}else{j=0;b=a.length;l=1}for(var n=j;n!==b;n=n+l){i=a[n];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&I.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);I.setDepthTest(i.depthTest);I.setDepthWrite(i.depthWrite);w(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}I.setMaterialFaces(i);k instanceof THREE.BufferGeometry?I.renderBufferDirect(d,g,f,i,k,j):I.renderBuffer(d,g,f,i,k,j)}}}function i(a,b,c,d,g,f,e){for(var h,i,j=0,k=a.length;j<k;j++){h=
-a[j];i=h.object;if(i.visible){if(e)h=e;else{h=h[b];if(!h)continue;f&&I.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);I.setDepthTest(h.depthTest);I.setDepthWrite(h.depthWrite);w(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}I.renderImmediateObject(c,d,g,h,i)}}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
-false}function u(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&I.deallocateMaterial(d);I.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets);var e=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==Aa){g.useProgram(h);Aa=h;e=true}if(d.id!==U){U=d.id;e=
-true}if(e||a!==ta){g.uniformMatrix4fv(i.projectionMatrix,false,a._projectionMatrixArray);a!==ta&&(ta=a)}if(e){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ab){for(var k,l=0,n=0,m=0,o,p,q,s=zc,u=s.directional.colors,v=s.directional.positions,w=s.point.colors,A=s.point.positions,E=
-s.point.distances,D=s.spot.colors,H=s.spot.positions,M=s.spot.distances,P=s.spot.directions,Q=s.spot.angles,F=s.spot.exponents,V=0,W=0,T=0,G=q=0,c=G=0,e=b.length;c<e;c++){k=b[c];if(!k.onlyShadow&&k.visible){o=k.color;p=k.intensity;q=k.distance;if(k instanceof THREE.AmbientLight)if(I.gammaInput){l=l+o.r*o.r;n=n+o.g*o.g;m=m+o.b*o.b}else{l=l+o.r;n=n+o.g;m=m+o.b}else if(k instanceof THREE.DirectionalLight){q=V*3;if(I.gammaInput){u[q]=o.r*o.r*p*p;u[q+1]=o.g*o.g*p*p;u[q+2]=o.b*o.b*p*p}else{u[q]=o.r*p;u[q+
-1]=o.g*p;u[q+2]=o.b*p}Ma.copy(k.matrixWorld.getPosition());Ma.subSelf(k.target.matrixWorld.getPosition());Ma.normalize();v[q]=Ma.x;v[q+1]=Ma.y;v[q+2]=Ma.z;V=V+1}else if(k instanceof THREE.PointLight){G=W*3;if(I.gammaInput){w[G]=o.r*o.r*p*p;w[G+1]=o.g*o.g*p*p;w[G+2]=o.b*o.b*p*p}else{w[G]=o.r*p;w[G+1]=o.g*p;w[G+2]=o.b*p}o=k.matrixWorld.getPosition();A[G]=o.x;A[G+1]=o.y;A[G+2]=o.z;E[W]=q;W=W+1}else if(k instanceof THREE.SpotLight){G=T*3;if(I.gammaInput){D[G]=o.r*o.r*p*p;D[G+1]=o.g*o.g*p*p;D[G+2]=o.b*
-o.b*p*p}else{D[G]=o.r*p;D[G+1]=o.g*p;D[G+2]=o.b*p}o=k.matrixWorld.getPosition();H[G]=o.x;H[G+1]=o.y;H[G+2]=o.z;M[T]=q;Ma.copy(o);Ma.subSelf(k.target.matrixWorld.getPosition());Ma.normalize();P[G]=Ma.x;P[G+1]=Ma.y;P[G+2]=Ma.z;Q[T]=Math.cos(k.angle);F[T]=k.exponent;T=T+1}}}c=V*3;for(e=u.length;c<e;c++)u[c]=0;c=W*3;for(e=w.length;c<e;c++)w[c]=0;c=T*3;for(e=D.length;c<e;c++)D[c]=0;s.directional.length=V;s.point.length=W;s.spot.length=T;s.ambient[0]=l;s.ambient[1]=n;s.ambient[2]=m;ab=false}c=zc;j.ambientLightColor.value=
+4)for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;i.array[e+3]=h.w;e=e+4}}}}}else{if(n)for(d=0;d<h;d++){f=i[d];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}if(p)for(d=0;d<k;d++){f=j[d];e=d*3;o[e]=f.r;o[e+1]=f.g;o[e+2]=f.b}if(q){j=0;for(k=q.length;j<k;j++){i=q[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){f=i.value.length;e=0;if(i.size===1)for(d=0;d<f;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+
+1]=h.y;e=e+2}else if(i.size===3)if(i.type==="c")for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.r;i.array[e+1]=h.g;i.array[e+2]=h.b;e=e+3}else for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;e=e+3}else if(i.size===4)for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;i.array[e+3]=h.w;e=e+4}}}}}if(n||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,
+a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,o,b)}if(q){j=0;for(k=q.length;j<k;j++){i=q[j];if(i.needsUpdate||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.bufferData(g.ARRAY_BUFFER,i.array,b)}}}}function h(a,b){return b.z-a.z}function i(a,b){return b[1]-a[1]}function l(a,b,c){if(a.length)for(var d=0,g=a.length;d<g;d++){ta=Aa=null;U=S=ia=ba=ua=Pa=fa=-1;ab=true;a[d].render(b,c,hc,yc);ta=Aa=null;U=S=ia=ba=ua=Pa=fa=-1;ab=true}}function k(a,b,c,d,g,f,e,h){var i,j,k,l;if(b){j=a.length-1;
+l=b=-1}else{j=0;b=a.length;l=1}for(var o=j;o!==b;o=o+l){i=a[o];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&I.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);I.setDepthTest(i.depthTest);I.setDepthWrite(i.depthWrite);w(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}I.setMaterialFaces(i);k instanceof THREE.BufferGeometry?I.renderBufferDirect(d,g,f,i,k,j):I.renderBuffer(d,g,f,i,k,j)}}}function j(a,b,c,d,g,f,e){for(var h,i,j=0,k=a.length;j<k;j++){h=
+a[j];i=h.object;if(i.visible){if(e)h=e;else{h=h[b];if(!h)continue;f&&I.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);I.setDepthTest(h.depthTest);I.setDepthWrite(h.depthWrite);w(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}I.renderImmediateObject(c,d,g,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
+false}function u(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&I.deallocateMaterial(d);I.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets);var e=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==Aa){g.useProgram(h);Aa=h;e=true}if(d.id!==U){U=d.id;e=
+true}if(e||a!==ta){g.uniformMatrix4fv(i.projectionMatrix,false,a._projectionMatrixArray);a!==ta&&(ta=a)}if(e){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ab){for(var k,l=0,o=0,m=0,n,p,q,r=zc,u=r.directional.colors,v=r.directional.positions,w=r.point.colors,A=r.point.positions,E=
+r.point.distances,D=r.spot.colors,H=r.spot.positions,M=r.spot.distances,P=r.spot.directions,Q=r.spot.angles,F=r.spot.exponents,V=0,W=0,T=0,G=q=0,c=G=0,e=b.length;c<e;c++){k=b[c];if(!k.onlyShadow&&k.visible){n=k.color;p=k.intensity;q=k.distance;if(k instanceof THREE.AmbientLight)if(I.gammaInput){l=l+n.r*n.r;o=o+n.g*n.g;m=m+n.b*n.b}else{l=l+n.r;o=o+n.g;m=m+n.b}else if(k instanceof THREE.DirectionalLight){q=V*3;if(I.gammaInput){u[q]=n.r*n.r*p*p;u[q+1]=n.g*n.g*p*p;u[q+2]=n.b*n.b*p*p}else{u[q]=n.r*p;u[q+
+1]=n.g*p;u[q+2]=n.b*p}Ma.copy(k.matrixWorld.getPosition());Ma.subSelf(k.target.matrixWorld.getPosition());Ma.normalize();v[q]=Ma.x;v[q+1]=Ma.y;v[q+2]=Ma.z;V=V+1}else if(k instanceof THREE.PointLight){G=W*3;if(I.gammaInput){w[G]=n.r*n.r*p*p;w[G+1]=n.g*n.g*p*p;w[G+2]=n.b*n.b*p*p}else{w[G]=n.r*p;w[G+1]=n.g*p;w[G+2]=n.b*p}n=k.matrixWorld.getPosition();A[G]=n.x;A[G+1]=n.y;A[G+2]=n.z;E[W]=q;W=W+1}else if(k instanceof THREE.SpotLight){G=T*3;if(I.gammaInput){D[G]=n.r*n.r*p*p;D[G+1]=n.g*n.g*p*p;D[G+2]=n.b*
+n.b*p*p}else{D[G]=n.r*p;D[G+1]=n.g*p;D[G+2]=n.b*p}n=k.matrixWorld.getPosition();H[G]=n.x;H[G+1]=n.y;H[G+2]=n.z;M[T]=q;Ma.copy(n);Ma.subSelf(k.target.matrixWorld.getPosition());Ma.normalize();P[G]=Ma.x;P[G+1]=Ma.y;P[G+2]=Ma.z;Q[T]=Math.cos(k.angle);F[T]=k.exponent;T=T+1}}}c=V*3;for(e=u.length;c<e;c++)u[c]=0;c=W*3;for(e=w.length;c<e;c++)w[c]=0;c=T*3;for(e=D.length;c<e;c++)D[c]=0;r.directional.length=V;r.point.length=W;r.spot.length=T;r.ambient[0]=l;r.ambient[1]=o;r.ambient[2]=m;ab=false}c=zc;j.ambientLightColor.value=
 c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances;j.spotLightColor.value=c.spot.colors;j.spotLightPosition.value=c.spot.positions;j.spotLightDistance.value=c.spot.distances;j.spotLightDirection.value=c.spot.directions;j.spotLightAngle.value=c.spot.angles;j.spotLightExponent.value=c.spot.exponents}if(d instanceof
 THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;I.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;j.map.texture=d.map;j.lightMap.texture=d.lightMap;j.specularMap.texture=d.specularMap;if(d.bumpMap){j.bumpMap.texture=d.bumpMap;j.bumpScale.value=d.bumpScale}var S;if(d.map)S=d.map;else if(d.specularMap)S=d.specularMap;else if(d.bumpMap)S=d.bumpMap;if(S!==void 0){c=S.offset;S=S.repeat;j.offsetRepeat.value.set(c.x,
 c.y,S.x,S.y)}j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=
 d.size;j.scale.value=B.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(I.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(I.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
 j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){c=S=0;for(e=b.length;c<e;c++){k=b[c];if(k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&
 !k.shadowCascade)){j.shadowMap.texture[S]=k.shadowMap;j.shadowMapSize.value[S]=k.shadowMapSize;j.shadowMatrix.value[S]=k.shadowMatrix;j.shadowDarkness.value[S]=k.shadowDarkness;j.shadowBias.value[S]=k.shadowBias;S++}}}b=d.uniformsList;j=0;for(S=b.length;j<S;j++)if(k=h.uniforms[b[j][1]]){c=b[j][0];l=c.type;e=c.value;if(l==="i")g.uniform1i(k,e);else if(l==="f")g.uniform1f(k,e);else if(l==="v2")g.uniform2f(k,e.x,e.y);else if(l==="v3")g.uniform3f(k,e.x,e.y,e.z);else if(l==="v4")g.uniform4f(k,e.x,e.y,
-e.z,e.w);else if(l==="c")g.uniform3f(k,e.r,e.g,e.b);else if(l==="iv1")g.uniform1iv(k,e);else if(l==="iv")g.uniform3iv(k,e);else if(l==="fv1")g.uniform1fv(k,e);else if(l==="fv")g.uniform3fv(k,e);else if(l==="v2v"){if(c._array===void 0)c._array=new Float32Array(2*e.length);l=0;for(n=e.length;l<n;l++){m=l*2;c._array[m]=e[l].x;c._array[m+1]=e[l].y}g.uniform2fv(k,c._array)}else if(l==="v3v"){if(c._array===void 0)c._array=new Float32Array(3*e.length);l=0;for(n=e.length;l<n;l++){m=l*3;c._array[m]=e[l].x;
-c._array[m+1]=e[l].y;c._array[m+2]=e[l].z}g.uniform3fv(k,c._array)}else if(l==="v4v"){if(c._array===void 0)c._array=new Float32Array(4*e.length);l=0;for(n=e.length;l<n;l++){m=l*4;c._array[m]=e[l].x;c._array[m+1]=e[l].y;c._array[m+2]=e[l].z;c._array[m+3]=e[l].w}g.uniform4fv(k,c._array)}else if(l==="m4"){if(c._array===void 0)c._array=new Float32Array(16);e.flattenToArray(c._array);g.uniformMatrix4fv(k,false,c._array)}else if(l==="m4v"){if(c._array===void 0)c._array=new Float32Array(16*e.length);l=0;
-for(n=e.length;l<n;l++)e[l].flattenToArrayOffset(c._array,l*16);g.uniformMatrix4fv(k,false,c._array)}else if(l==="t"){g.uniform1i(k,e);if(k=c.texture)if(k.image instanceof Array&&k.image.length===6){c=k;if(c.image.length===6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(k=0;k<6;k++){l=e;n=k;if(I.autoScaleCubemaps){m=
-c.image[k];u=Qc;if(!(m.width<=u&&m.height<=u)){v=Math.max(m.width,m.height);s=Math.floor(m.width*u/v);u=Math.floor(m.height*u/v);v=document.createElement("canvas");v.width=s;v.height=u;v.getContext("2d").drawImage(m,0,0,m.width,m.height,0,0,s,u);m=v}}else m=c.image[k];l[n]=m}k=e[0];l=(k.width&k.width-1)===0&&(k.height&k.height-1)===0;n=O(c.format);m=O(c.type);x(g.TEXTURE_CUBE_MAP,c,l);for(k=0;k<6;k++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,n,n,m,e[k]);c.generateMipmaps&&l&&g.generateMipmap(g.TEXTURE_CUBE_MAP);
-c.needsUpdate=false;if(c.onUpdate)c.onUpdate()}else{g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}}else if(k instanceof THREE.WebGLRenderTargetCube){c=k;g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture)}else I.setTexture(k,e)}else if(l==="tv"){if(c._array===void 0){c._array=[];l=0;for(n=c.texture.length;l<n;l++)c._array[l]=e+l}g.uniform1iv(k,c._array);l=0;for(n=c.texture.length;l<n;l++)(k=c.texture[l])&&I.setTexture(k,c._array[l])}}if((d instanceof
+e.z,e.w);else if(l==="c")g.uniform3f(k,e.r,e.g,e.b);else if(l==="iv1")g.uniform1iv(k,e);else if(l==="iv")g.uniform3iv(k,e);else if(l==="fv1")g.uniform1fv(k,e);else if(l==="fv")g.uniform3fv(k,e);else if(l==="v2v"){if(c._array===void 0)c._array=new Float32Array(2*e.length);l=0;for(o=e.length;l<o;l++){m=l*2;c._array[m]=e[l].x;c._array[m+1]=e[l].y}g.uniform2fv(k,c._array)}else if(l==="v3v"){if(c._array===void 0)c._array=new Float32Array(3*e.length);l=0;for(o=e.length;l<o;l++){m=l*3;c._array[m]=e[l].x;
+c._array[m+1]=e[l].y;c._array[m+2]=e[l].z}g.uniform3fv(k,c._array)}else if(l==="v4v"){if(c._array===void 0)c._array=new Float32Array(4*e.length);l=0;for(o=e.length;l<o;l++){m=l*4;c._array[m]=e[l].x;c._array[m+1]=e[l].y;c._array[m+2]=e[l].z;c._array[m+3]=e[l].w}g.uniform4fv(k,c._array)}else if(l==="m4"){if(c._array===void 0)c._array=new Float32Array(16);e.flattenToArray(c._array);g.uniformMatrix4fv(k,false,c._array)}else if(l==="m4v"){if(c._array===void 0)c._array=new Float32Array(16*e.length);l=0;
+for(o=e.length;l<o;l++)e[l].flattenToArrayOffset(c._array,l*16);g.uniformMatrix4fv(k,false,c._array)}else if(l==="t"){g.uniform1i(k,e);if(k=c.texture)if(k.image instanceof Array&&k.image.length===6){c=k;if(c.image.length===6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(k=0;k<6;k++){l=e;o=k;if(I.autoScaleCubemaps){m=
+c.image[k];u=Qc;if(!(m.width<=u&&m.height<=u)){v=Math.max(m.width,m.height);r=Math.floor(m.width*u/v);u=Math.floor(m.height*u/v);v=document.createElement("canvas");v.width=r;v.height=u;v.getContext("2d").drawImage(m,0,0,m.width,m.height,0,0,r,u);m=v}}else m=c.image[k];l[o]=m}k=e[0];l=(k.width&k.width-1)===0&&(k.height&k.height-1)===0;o=O(c.format);m=O(c.type);x(g.TEXTURE_CUBE_MAP,c,l);for(k=0;k<6;k++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o,o,m,e[k]);c.generateMipmaps&&l&&g.generateMipmap(g.TEXTURE_CUBE_MAP);
+c.needsUpdate=false;if(c.onUpdate)c.onUpdate()}else{g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}}else if(k instanceof THREE.WebGLRenderTargetCube){c=k;g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture)}else I.setTexture(k,e)}else if(l==="tv"){if(c._array===void 0){c._array=[];l=0;for(o=c.texture.length;l<o;l++)c._array[l]=e+l}g.uniform1iv(k,c._array);l=0;for(o=c.texture.length;l<o;l++)(k=c.texture[l])&&I.setTexture(k,c._array[l])}}if((d instanceof
 THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&i.cameraPosition!==null){b=a.matrixWorld.getPosition();g.uniform3f(i.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&i.viewMatrix!==null&&g.uniformMatrix4fv(i.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(ic&&f.useVertexTexture){if(i.boneTexture!==null){g.uniform1i(i.boneTexture,12);I.setTexture(f.boneTexture,12)}}else i.boneGlobalMatrices!==
-null&&g.uniformMatrix4fv(i.boneGlobalMatrices,false,f.boneMatrices);g.uniformMatrix4fv(i.modelViewMatrix,false,f._modelViewMatrix.elements);i.normalMatrix&&g.uniformMatrix3fv(i.normalMatrix,false,f._normalMatrix.elements);i.modelMatrix!==null&&g.uniformMatrix4fv(i.modelMatrix,false,f.matrixWorld.elements);return h}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function w(a,b,c){if(Xa!==a){a?
+null&&g.uniformMatrix4fv(i.boneGlobalMatrices,false,f.boneMatrices);g.uniformMatrix4fv(i.modelViewMatrix,false,f._modelViewMatrix.elements);i.normalMatrix&&g.uniformMatrix3fv(i.normalMatrix,false,f._normalMatrix.elements);i.modelMatrix!==null&&g.uniformMatrix4fv(i.modelMatrix,false,f.matrixWorld.elements);return h}function r(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function w(a,b,c){if(Xa!==a){a?
 g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);Xa=a}if(a&&(Va!==b||Vb!==c)){g.polygonOffset(b,c);Va=b;Vb=c}}function v(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function H(a,b){var c;a==="fragment"?c=g.createShader(g.FRAGMENT_SHADER):a==="vertex"&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);if(!g.getShaderParameter(c,g.COMPILE_STATUS)){console.error(g.getShaderInfoLog(c));console.error(v(b));return null}return c}
 function x(a,b,c){if(c){g.texParameteri(a,g.TEXTURE_WRAP_S,O(b.wrapS));g.texParameteri(a,g.TEXTURE_WRAP_T,O(b.wrapT));g.texParameteri(a,g.TEXTURE_MAG_FILTER,O(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,O(b.minFilter))}else{g.texParameteri(a,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_MAG_FILTER,E(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,E(b.minFilter))}if(rb&&b.type!==THREE.FloatType&&(b.anisotropy>1||b.__oldAnisotropy)){g.texParameterf(a,
 rb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ac));b.__oldAnisotropy=b.anisotropy}}function D(a,b){g.bindRenderbuffer(g.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,b.width,b.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,
@@ -327,45 +327,45 @@ g.deleteBuffer(c.__webglVertexBuffer);g.deleteBuffer(c.__webglNormalBuffer);g.de
 THREE.Line){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);I.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);I.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;g.deleteTexture(a.__webglTexture);I.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){g.deleteTexture(a.__webglTexture);
 if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){g.deleteFramebuffer(a.__webglFramebuffer[b]);g.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{g.deleteFramebuffer(a.__webglFramebuffer);g.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=false,a=0;for(c=aa.length;a<c;a++){d=aa[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=aa.length;a<c;a++){d=aa[a];d.program!==
 b&&e.push(d)}aa=e;g.deleteProgram(b);I.info.memory.programs--}}};this.updateShadowMap=function(a,b){Aa=null;U=S=ua=Pa=fa=-1;ab=true;ia=ba=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=g.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=g.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=g.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=
-g.createBuffer();if(a.hasPositions){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,a.positionArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.position);g.vertexAttribPointer(b.attributes.position,3,g.FLOAT,false,0,0)}if(a.hasNormals){g.bindBuffer(g.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,h,i,j,k,l,n,m,o,p=a.count*3;for(o=0;o<p;o=o+9){m=a.normalArray;d=m[o];e=m[o+1];f=m[o+2];h=m[o+3];j=m[o+4];l=m[o+5];i=m[o+6];k=m[o+
-7];n=m[o+8];d=(d+h+i)/3;e=(e+j+k)/3;f=(f+l+n)/3;m[o]=d;m[o+1]=e;m[o+2]=f;m[o+3]=d;m[o+4]=e;m[o+5]=f;m[o+6]=d;m[o+7]=e;m[o+8]=f}}g.bufferData(g.ARRAY_BUFFER,a.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.normal);g.vertexAttribPointer(b.attributes.normal,3,g.FLOAT,false,0,0)}if(a.hasUvs&&c.map){g.bindBuffer(g.ARRAY_BUFFER,a.__webglUvBuffer);g.bufferData(g.ARRAY_BUFFER,a.uvArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.uv);g.vertexAttribPointer(b.attributes.uv,2,g.FLOAT,
+g.createBuffer();if(a.hasPositions){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,a.positionArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.position);g.vertexAttribPointer(b.attributes.position,3,g.FLOAT,false,0,0)}if(a.hasNormals){g.bindBuffer(g.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,h,i,j,k,l,o,m,n,p=a.count*3;for(n=0;n<p;n=n+9){m=a.normalArray;d=m[n];e=m[n+1];f=m[n+2];h=m[n+3];j=m[n+4];l=m[n+5];i=m[n+6];k=m[n+
+7];o=m[n+8];d=(d+h+i)/3;e=(e+j+k)/3;f=(f+l+o)/3;m[n]=d;m[n+1]=e;m[n+2]=f;m[n+3]=d;m[n+4]=e;m[n+5]=f;m[n+6]=d;m[n+7]=e;m[n+8]=f}}g.bufferData(g.ARRAY_BUFFER,a.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.normal);g.vertexAttribPointer(b.attributes.normal,3,g.FLOAT,false,0,0)}if(a.hasUvs&&c.map){g.bindBuffer(g.ARRAY_BUFFER,a.__webglUvBuffer);g.bufferData(g.ARRAY_BUFFER,a.uvArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.uv);g.vertexAttribPointer(b.attributes.uv,2,g.FLOAT,
 false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,a.colorArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.color);g.vertexAttribPointer(b.attributes.color,3,g.FLOAT,false,0,0)}g.drawArrays(g.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==S){S=d;b=true}if(f instanceof
 THREE.Mesh){f=e.offsets;f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){var h=f[d].index;if(b){var i=e.attributes.position,j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.position,j,g.FLOAT,false,0,h*j*4);i=e.attributes.normal;if(a.normal>=0&&i){j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.normal,j,g.FLOAT,false,0,h*j*4)}i=e.attributes.uv;if(a.uv>=0&&i)if(i.buffer){j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.uv,
 j,g.FLOAT,false,0,h*j*4);g.enableVertexAttribArray(a.uv)}else g.disableVertexAttribArray(a.uv);i=e.attributes.color;if(a.color>=0&&i){j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.color,j,g.FLOAT,false,0,h*j*4)}i=e.attributes.tangent;if(a.tangent>=0&&i){j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.tangent,j,g.FLOAT,false,0,h*j*4)}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.attributes.index.buffer)}g.drawElements(g.TRIANGLES,f[d].count,g.UNSIGNED_SHORT,
-f[d].start*2);I.info.render.calls++;I.info.render.vertices=I.info.render.vertices+f[d].count;I.info.render.faces=I.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var h,i,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==S){S=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer);g.vertexAttribPointer(b.position,3,g.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;
-if(f.morphTargetBase!==-1){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);g.vertexAttribPointer(c.position,3,g.FLOAT,false,0,0)}else if(c.position>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer);g.vertexAttribPointer(c.position,3,g.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var k=0;i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;k<d.numSupportedMorphTargets&&k<i.length;){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[k]]);g.vertexAttribPointer(c["morphTarget"+
-k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[k]]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[i[k]];k++}}else{i=[];h=f.morphTargetInfluences;var l,m=h.length;for(l=0;l<m;l++){k=h[l];k>0&&i.push([l,k])}if(i.length>d.numSupportedMorphTargets){i.sort(j);i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?i.sort(j):i.length===0&&i.push([0,0]);for(k=0;k<d.numSupportedMorphTargets;){if(i[k]){l=
-i[k][0];g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[l]}else{g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);d.morphNormals&&g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0);f.__webglMorphTargetInfluences[k]=0}k++}}d.program.uniforms.morphTargetInfluences!==
-null&&g.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){h=0;for(i=e.__webglCustomAttributesList.length;h<i;h++){c=e.__webglCustomAttributesList[h];if(b[c.buffer.belongsToAttribute]>=0){g.bindBuffer(g.ARRAY_BUFFER,c.buffer);g.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,g.FLOAT,false,0,0)}}}if(b.color>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglColorBuffer);g.vertexAttribPointer(b.color,3,g.FLOAT,false,0,0)}if(b.normal>=
+f[d].start*2);I.info.render.calls++;I.info.render.vertices=I.info.render.vertices+f[d].count;I.info.render.faces=I.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var h,j,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==S){S=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer);g.vertexAttribPointer(b.position,3,g.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;
+if(f.morphTargetBase!==-1){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);g.vertexAttribPointer(c.position,3,g.FLOAT,false,0,0)}else if(c.position>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer);g.vertexAttribPointer(c.position,3,g.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var k=0;j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;k<d.numSupportedMorphTargets&&k<j.length;){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[k]]);g.vertexAttribPointer(c["morphTarget"+
+k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[k]]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[j[k]];k++}}else{j=[];h=f.morphTargetInfluences;var l,m=h.length;for(l=0;l<m;l++){k=h[l];k>0&&j.push([l,k])}if(j.length>d.numSupportedMorphTargets){j.sort(i);j.length=d.numSupportedMorphTargets}else j.length>d.numSupportedMorphNormals?j.sort(i):j.length===0&&j.push([0,0]);for(k=0;k<d.numSupportedMorphTargets;){if(j[k]){l=
+j[k][0];g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[l]}else{g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);d.morphNormals&&g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0);f.__webglMorphTargetInfluences[k]=0}k++}}d.program.uniforms.morphTargetInfluences!==
+null&&g.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){h=0;for(j=e.__webglCustomAttributesList.length;h<j;h++){c=e.__webglCustomAttributesList[h];if(b[c.buffer.belongsToAttribute]>=0){g.bindBuffer(g.ARRAY_BUFFER,c.buffer);g.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,g.FLOAT,false,0,0)}}}if(b.color>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglColorBuffer);g.vertexAttribPointer(b.color,3,g.FLOAT,false,0,0)}if(b.normal>=
 0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglNormalBuffer);g.vertexAttribPointer(b.normal,3,g.FLOAT,false,0,0)}if(b.tangent>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglTangentBuffer);g.vertexAttribPointer(b.tangent,4,g.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){g.bindBuffer(g.ARRAY_BUFFER,e.__webglUVBuffer);g.vertexAttribPointer(b.uv,2,g.FLOAT,false,0,0);g.enableVertexAttribArray(b.uv)}else g.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){g.bindBuffer(g.ARRAY_BUFFER,e.__webglUV2Buffer);
 g.vertexAttribPointer(b.uv2,2,g.FLOAT,false,0,0);g.enableVertexAttribArray(b.uv2)}else g.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexABuffer);g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);g.vertexAttribPointer(b.skinIndex,
 4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==yb){g.lineWidth(d);yb=d}a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);g.drawElements(g.LINES,e.__webglLineCount,g.UNSIGNED_SHORT,0)}else{a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)}I.info.render.calls++;
 I.info.render.vertices=I.info.render.vertices+e.__webglFaceCount;I.info.render.faces=I.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES;d=d.linewidth;if(d!==yb){g.lineWidth(d);yb=d}g.drawArrays(f,0,e.__webglLineCount);I.info.render.calls++}else if(f instanceof THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);I.info.render.calls++;I.info.render.points=I.info.render.points+e.__webglParticleCount}else if(f instanceof
-THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);I.info.render.calls++}}};this.render=function(a,b,c,d){if(b instanceof THREE.Camera===false)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,j,l,m=a.__lights,o=a.fog;U=-1;ab=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.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);Xb.multiply(b.projectionMatrix,b.matrixWorldInverse);kc.setFromMatrix(Xb);this.autoUpdateObjects&&this.initWebGLObjects(a);n(this.renderPluginsPre,a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;I.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;d=0;for(e=l.length;d<e;d++){f=l[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||kc.contains(j))){s(j,b);var p=f,q=p.object,u=p.buffer,v=void 0,v=v=void 0,v=q.material;if(v instanceof THREE.MeshFaceMaterial){v=u.materialIndex;if(v>=0){v=q.geometry.materials[v];if(v.transparent){p.transparent=v;p.opaque=null}else{p.opaque=v;p.transparent=null}}}else if(v)if(v.transparent){p.transparent=
-v;p.opaque=null}else{p.opaque=v;p.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{Ya.copy(j.matrixWorld.getPosition());Xb.multiplyVector3(Ya);f.z=Ya.z}}}this.sortObjects&&l.sort(h);l=a.__webglObjectsImmediate;d=0;for(e=l.length;d<e;d++){f=l[d];j=f.object;if(j.visible){s(j,b);j=f.object.material;if(j.transparent){f.transparent=j;f.opaque=null}else{f.opaque=j;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);w(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,m,o,true,d);i(a.__webglObjectsImmediate,"",b,m,o,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,m,o,false);i(a.__webglObjectsImmediate,"opaque",b,m,o,false);k(a.__webglObjects,false,"transparent",b,m,o,true);i(a.__webglObjectsImmediate,"transparent",b,m,o,true)}n(this.renderPluginsPost,
+THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);I.info.render.calls++}}};this.render=function(a,b,c,d){if(b instanceof THREE.Camera===false)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,i,m,o=a.__lights,n=a.fog;U=-1;ab=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.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);Xb.multiply(b.projectionMatrix,b.matrixWorldInverse);kc.setFromMatrix(Xb);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;I.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];i=f.object;f.render=false;if(i.visible&&(!(i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem)||!i.frustumCulled||kc.contains(i))){r(i,b);var p=f,q=p.object,u=p.buffer,v=void 0,v=v=void 0,v=q.material;if(v instanceof THREE.MeshFaceMaterial){v=u.materialIndex;if(v>=0){v=q.geometry.materials[v];if(v.transparent){p.transparent=v;p.opaque=null}else{p.opaque=v;p.transparent=null}}}else if(v)if(v.transparent){p.transparent=
+v;p.opaque=null}else{p.opaque=v;p.transparent=null}f.render=true;if(this.sortObjects)if(i.renderDepth)f.z=i.renderDepth;else{Ya.copy(i.matrixWorld.getPosition());Xb.multiplyVector3(Ya);f.z=Ya.z}}}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];i=f.object;if(i.visible){r(i,b);i=f.object.material;if(i.transparent){f.transparent=i;f.opaque=null}else{f.opaque=i;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);w(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,o,n,true,d);j(a.__webglObjectsImmediate,"",b,o,n,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,o,n,false);j(a.__webglObjectsImmediate,"opaque",b,o,n,false);k(a.__webglObjects,false,"transparent",b,o,n,true);j(a.__webglObjectsImmediate,"transparent",b,o,n,true)}l(this.renderPluginsPost,
 a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture);g.generateMipmap(g.TEXTURE_CUBE_MAP);g.bindTexture(g.TEXTURE_CUBE_MAP,null)}else{g.bindTexture(g.TEXTURE_2D,c.__webglTexture);g.generateMipmap(g.TEXTURE_2D);g.bindTexture(g.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)}};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);
-S=-1;I.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,g,kc):e.render(function(a){I.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,k=void 0,n=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){k=
-h.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var q=k,s=void 0,v=void 0,w=void 0,x=void 0,B=void 0,A=void 0,D=void 0,E={},H=q.morphTargets.length,M=q.morphNormals.length;q.geometryGroups={};s=0;for(v=q.faces.length;s<v;s++){w=q.faces[s];x=w.materialIndex;A=x!==void 0?x:-1;E[A]===void 0&&(E[A]={hash:A,counter:0});D=E[A].hash+"_"+E[A].counter;q.geometryGroups[D]===void 0&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:M});
-B=w instanceof THREE.Face3?3:4;if(q.geometryGroups[D].vertices+B>65535){E[A].counter=E[A].counter+1;D=E[A].hash+"_"+E[A].counter;q.geometryGroups[D]===void 0&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:M})}w instanceof THREE.Face3?q.geometryGroups[D].faces3.push(s):q.geometryGroups[D].faces4.push(s);q.geometryGroups[D].vertices=q.geometryGroups[D].vertices+B}q.geometryGroupsList=[];var O=void 0;for(O in q.geometryGroups){q.geometryGroups[O].id=
-wa++;q.geometryGroupsList.push(q.geometryGroups[O])}}for(j in k.geometryGroups){n=k.geometryGroups[j];if(!n.__webglVertexBuffer){var G=n;G.__webglVertexBuffer=g.createBuffer();G.__webglNormalBuffer=g.createBuffer();G.__webglTangentBuffer=g.createBuffer();G.__webglColorBuffer=g.createBuffer();G.__webglUVBuffer=g.createBuffer();G.__webglUV2Buffer=g.createBuffer();G.__webglSkinVertexABuffer=g.createBuffer();G.__webglSkinVertexBBuffer=g.createBuffer();G.__webglSkinIndicesBuffer=g.createBuffer();G.__webglSkinWeightsBuffer=
-g.createBuffer();G.__webglFaceBuffer=g.createBuffer();G.__webglLineBuffer=g.createBuffer();var P=void 0,Q=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];P=0;for(Q=G.numMorphTargets;P<Q;P++)G.__webglMorphTargetsBuffers.push(g.createBuffer())}if(G.numMorphNormals){G.__webglMorphNormalsBuffers=[];P=0;for(Q=G.numMorphNormals;P<Q;P++)G.__webglMorphNormalsBuffers.push(g.createBuffer())}I.info.memory.geometries++;var F=n,S=h,T=S.geometry,V=F.faces3,W=F.faces4,U=V.length*3+W.length*4,ba=V.length*
+S=-1;I.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,g,kc):e.render(function(a){I.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,k=void 0,l=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){k=
+h.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var q=k,r=void 0,v=void 0,w=void 0,x=void 0,B=void 0,A=void 0,D=void 0,E={},H=q.morphTargets.length,M=q.morphNormals.length;q.geometryGroups={};r=0;for(v=q.faces.length;r<v;r++){w=q.faces[r];x=w.materialIndex;A=x!==void 0?x:-1;E[A]===void 0&&(E[A]={hash:A,counter:0});D=E[A].hash+"_"+E[A].counter;q.geometryGroups[D]===void 0&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:M});
+B=w instanceof THREE.Face3?3:4;if(q.geometryGroups[D].vertices+B>65535){E[A].counter=E[A].counter+1;D=E[A].hash+"_"+E[A].counter;q.geometryGroups[D]===void 0&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:M})}w instanceof THREE.Face3?q.geometryGroups[D].faces3.push(r):q.geometryGroups[D].faces4.push(r);q.geometryGroups[D].vertices=q.geometryGroups[D].vertices+B}q.geometryGroupsList=[];var O=void 0;for(O in q.geometryGroups){q.geometryGroups[O].id=
+wa++;q.geometryGroupsList.push(q.geometryGroups[O])}}for(j in k.geometryGroups){l=k.geometryGroups[j];if(!l.__webglVertexBuffer){var G=l;G.__webglVertexBuffer=g.createBuffer();G.__webglNormalBuffer=g.createBuffer();G.__webglTangentBuffer=g.createBuffer();G.__webglColorBuffer=g.createBuffer();G.__webglUVBuffer=g.createBuffer();G.__webglUV2Buffer=g.createBuffer();G.__webglSkinVertexABuffer=g.createBuffer();G.__webglSkinVertexBBuffer=g.createBuffer();G.__webglSkinIndicesBuffer=g.createBuffer();G.__webglSkinWeightsBuffer=
+g.createBuffer();G.__webglFaceBuffer=g.createBuffer();G.__webglLineBuffer=g.createBuffer();var P=void 0,Q=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];P=0;for(Q=G.numMorphTargets;P<Q;P++)G.__webglMorphTargetsBuffers.push(g.createBuffer())}if(G.numMorphNormals){G.__webglMorphNormalsBuffers=[];P=0;for(Q=G.numMorphNormals;P<Q;P++)G.__webglMorphNormalsBuffers.push(g.createBuffer())}I.info.memory.geometries++;var F=l,S=h,T=S.geometry,V=F.faces3,W=F.faces4,U=V.length*3+W.length*4,ba=V.length*
 1+W.length*2,ea=V.length*3+W.length*4,aa=c(S,F),la=e(aa),sa=d(aa),ta=aa.vertexColors?aa.vertexColors:false;F.__vertexArray=new Float32Array(U*3);if(sa)F.__normalArray=new Float32Array(U*3);if(T.hasTangents)F.__tangentArray=new Float32Array(U*4);if(ta)F.__colorArray=new Float32Array(U*3);if(la){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)F.__uvArray=new Float32Array(U*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)F.__uv2Array=new Float32Array(U*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){F.__skinVertexAArray=
 new Float32Array(U*4);F.__skinVertexBArray=new Float32Array(U*4);F.__skinIndexArray=new Float32Array(U*4);F.__skinWeightArray=new Float32Array(U*4)}F.__faceArray=new Uint16Array(ba*3);F.__lineArray=new Uint16Array(ea*2);var ia=void 0,Va=void 0;if(F.numMorphTargets){F.__morphTargetsArrays=[];ia=0;for(Va=F.numMorphTargets;ia<Va;ia++)F.__morphTargetsArrays.push(new Float32Array(U*3))}if(F.numMorphNormals){F.__morphNormalsArrays=[];ia=0;for(Va=F.numMorphNormals;ia<Va;ia++)F.__morphNormalsArrays.push(new Float32Array(U*
 3))}F.__webglFaceCount=ba*3;F.__webglLineCount=ea*2;if(aa.attributes){if(F.__webglCustomAttributesList===void 0)F.__webglCustomAttributesList=[];var ua=void 0;for(ua in aa.attributes){var Aa=aa.attributes[ua],fa={},Ja;for(Ja in Aa)fa[Ja]=Aa[Ja];if(!fa.__webglInitialized||fa.createUniqueBuffers){fa.__webglInitialized=true;var Ga=1;fa.type==="v2"?Ga=2:fa.type==="v3"?Ga=3:fa.type==="v4"?Ga=4:fa.type==="c"&&(Ga=3);fa.size=Ga;fa.array=new Float32Array(U*Ga);fa.buffer=g.createBuffer();fa.buffer.belongsToAttribute=
 ua;Aa.needsUpdate=true;fa.__original=Aa}F.__webglCustomAttributesList.push(fa)}}F.__inittedArrays=true;k.verticesNeedUpdate=true;k.morphTargetsNeedUpdate=true;k.elementsNeedUpdate=true;k.uvsNeedUpdate=true;k.normalsNeedUpdate=true;k.tangentsNeedUpdate=true;k.colorsNeedUpdate=true}}}else if(k instanceof THREE.BufferGeometry){var Pa=k,yb=void 0,Ma=void 0,Vb=void 0;for(yb in Pa.attributes){Vb=yb==="index"?g.ELEMENT_ARRAY_BUFFER:g.ARRAY_BUFFER;Ma=Pa.attributes[yb];Ma.buffer=g.createBuffer();g.bindBuffer(Vb,
 Ma.buffer);g.bufferData(Vb,Ma.array,g.STATIC_DRAW)}}}else if(h instanceof THREE.Ribbon){k=h.geometry;if(!k.__webglVertexBuffer){var Xa=k;Xa.__webglVertexBuffer=g.createBuffer();Xa.__webglColorBuffer=g.createBuffer();I.info.memory.geometries++;var Ya=k,ab=Ya.vertices.length;Ya.__vertexArray=new Float32Array(ab*3);Ya.__colorArray=new Float32Array(ab*3);Ya.__webglVertexCount=ab;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){k=h.geometry;if(!k.__webglVertexBuffer){var rb=
 k;rb.__webglVertexBuffer=g.createBuffer();rb.__webglColorBuffer=g.createBuffer();I.info.memory.geometries++;var lc=k,Xb=h,Mb=lc.vertices.length;lc.__vertexArray=new Float32Array(Mb*3);lc.__colorArray=new Float32Array(Mb*3);lc.__webglLineCount=Mb;b(lc,Xb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Wb=k;Wb.__webglVertexBuffer=g.createBuffer();Wb.__webglColorBuffer=g.createBuffer();I.info.geometries++;var Yb=
-k,ic=h,Nb=Yb.vertices.length;Yb.__vertexArray=new Float32Array(Nb*3);Yb.__colorArray=new Float32Array(Nb*3);Yb.__sortArray=[];Yb.__webglParticleCount=Nb;b(Yb,ic);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)l(i.__webglObjects,k,h);else for(j in k.geometryGroups){n=k.geometryGroups[j];l(i.__webglObjects,n,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=
-h.geometry;l(i.__webglObjects,k,h)}else h instanceof THREE.ImmediateRenderObject||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Sa=a.__objectsRemoved[0],Bc=a;Sa instanceof THREE.Mesh||Sa instanceof THREE.ParticleSystem||Sa instanceof THREE.Ribbon||Sa instanceof
-THREE.Line?u(Bc.__webglObjects,Sa):Sa instanceof THREE.Sprite?o(Bc.__webglSprites,Sa):Sa instanceof THREE.LensFlare?o(Bc.__webglFlares,Sa):(Sa instanceof THREE.ImmediateRenderObject||Sa.immediateRenderCallback)&&u(Bc.__webglObjectsImmediate,Sa);Sa.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Ob=0,jc=a.__webglObjects.length;Ob<jc;Ob++){var Za=a.__webglObjects[Ob].object,X=Za.geometry,mc=void 0,Zb=void 0,Na=void 0;if(Za instanceof THREE.Mesh)if(X instanceof THREE.BufferGeometry){if(X.verticesNeedUpdate||
+k,ic=h,Nb=Yb.vertices.length;Yb.__vertexArray=new Float32Array(Nb*3);Yb.__colorArray=new Float32Array(Nb*3);Yb.__sortArray=[];Yb.__webglParticleCount=Nb;b(Yb,ic);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)o(i.__webglObjects,k,h);else for(j in k.geometryGroups){l=k.geometryGroups[j];o(i.__webglObjects,l,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=
+h.geometry;o(i.__webglObjects,k,h)}else h instanceof THREE.ImmediateRenderObject||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Sa=a.__objectsRemoved[0],Bc=a;Sa instanceof THREE.Mesh||Sa instanceof THREE.ParticleSystem||Sa instanceof THREE.Ribbon||Sa instanceof
+THREE.Line?u(Bc.__webglObjects,Sa):Sa instanceof THREE.Sprite?n(Bc.__webglSprites,Sa):Sa instanceof THREE.LensFlare?n(Bc.__webglFlares,Sa):(Sa instanceof THREE.ImmediateRenderObject||Sa.immediateRenderCallback)&&u(Bc.__webglObjectsImmediate,Sa);Sa.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Ob=0,jc=a.__webglObjects.length;Ob<jc;Ob++){var Za=a.__webglObjects[Ob].object,X=Za.geometry,mc=void 0,Zb=void 0,Na=void 0;if(Za instanceof THREE.Mesh)if(X instanceof THREE.BufferGeometry){if(X.verticesNeedUpdate||
 X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate){var sb=X,$b=g.DYNAMIC_DRAW,kc=!X.dynamic,ac=sb.attributes,Pb=ac.index,Sc=ac.position,Tc=ac.normal,Uc=ac.uv,Vc=ac.color,Wc=ac.tangent;if(sb.elementsNeedUpdate&&Pb!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Pb.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Pb.array,$b)}if(sb.verticesNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,$b)}if(sb.normalsNeedUpdate&&
 Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,$b)}if(sb.uvsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,$b)}if(sb.colorsNeedUpdate&&Vc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Vc.buffer);g.bufferData(g.ARRAY_BUFFER,Vc.array,$b)}if(sb.tangentsNeedUpdate&&Wc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Wc.buffer);g.bufferData(g.ARRAY_BUFFER,Wc.array,$b)}if(kc){var hc=void 0;for(hc in sb.attributes)delete sb.attributes[hc].array}}X.verticesNeedUpdate=
 false;X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=false}else{for(var Xc=0,yc=X.geometryGroupsList.length;Xc<yc;Xc++){mc=X.geometryGroupsList[Xc];Na=c(Za,mc);Zb=Na.attributes&&m(Na);if(X.verticesNeedUpdate||X.morphTargetsNeedUpdate||X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate||Zb){var Z=mc,zc=Za,Qa=g.DYNAMIC_DRAW,Ac=!X.dynamic,Qb=Na;if(Z.__inittedArrays){var fd=d(Qb),
 Yc=Qb.vertexColors?Qb.vertexColors:false,gd=e(Qb),Cc=fd===THREE.SmoothShading,y=void 0,N=void 0,Wa=void 0,C=void 0,bc=void 0,zb=void 0,$a=void 0,Dc=void 0,tb=void 0,cc=void 0,dc=void 0,J=void 0,K=void 0,L=void 0,$=void 0,bb=void 0,cb=void 0,db=void 0,nc=void 0,eb=void 0,fb=void 0,gb=void 0,oc=void 0,hb=void 0,ib=void 0,jb=void 0,pc=void 0,kb=void 0,lb=void 0,mb=void 0,qc=void 0,nb=void 0,ob=void 0,pb=void 0,rc=void 0,Ab=void 0,Bb=void 0,Cb=void 0,Ec=void 0,Db=void 0,Eb=void 0,Fb=void 0,Fc=void 0,
-ga=void 0,hd=void 0,Gb=void 0,ec=void 0,fc=void 0,Da=void 0,id=void 0,Ba=void 0,Ca=void 0,Hb=void 0,ub=void 0,va=0,za=0,vb=0,wb=0,Ta=0,Ia=0,ja=0,Ka=0,xa=0,z=0,Y=0,t=0,ha=void 0,Ea=Z.__vertexArray,sc=Z.__uvArray,tc=Z.__uv2Array,Ua=Z.__normalArray,ma=Z.__tangentArray,Fa=Z.__colorArray,na=Z.__skinVertexAArray,oa=Z.__skinVertexBArray,pa=Z.__skinIndexArray,qa=Z.__skinWeightArray,Zc=Z.__morphTargetsArrays,$c=Z.__morphNormalsArrays,ad=Z.__webglCustomAttributesList,r=void 0,qb=Z.__faceArray,Ra=Z.__lineArray,
+ga=void 0,hd=void 0,Gb=void 0,ec=void 0,fc=void 0,Da=void 0,id=void 0,Ba=void 0,Ca=void 0,Hb=void 0,ub=void 0,va=0,za=0,vb=0,wb=0,Ta=0,Ia=0,ja=0,Ka=0,xa=0,z=0,Y=0,t=0,ha=void 0,Ea=Z.__vertexArray,sc=Z.__uvArray,tc=Z.__uv2Array,Ua=Z.__normalArray,ma=Z.__tangentArray,Fa=Z.__colorArray,na=Z.__skinVertexAArray,oa=Z.__skinVertexBArray,pa=Z.__skinIndexArray,qa=Z.__skinWeightArray,Zc=Z.__morphTargetsArrays,$c=Z.__morphNormalsArrays,ad=Z.__webglCustomAttributesList,s=void 0,qb=Z.__faceArray,Ra=Z.__lineArray,
 La=zc.geometry,Qc=La.elementsNeedUpdate,jd=La.uvsNeedUpdate,Rc=La.normalsNeedUpdate,qd=La.tangentsNeedUpdate,rd=La.colorsNeedUpdate,sd=La.morphTargetsNeedUpdate,Rb=La.vertices,ca=Z.faces3,da=Z.faces4,ya=La.faces,bd=La.faceVertexUvs[0],cd=La.faceVertexUvs[1],Sb=La.skinVerticesA,Tb=La.skinVerticesB,Ub=La.skinIndices,Ib=La.skinWeights,Jb=La.morphTargets,Gc=La.morphNormals;if(La.verticesNeedUpdate){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=Rb[C.a];K=Rb[C.b];L=Rb[C.c];Ea[za]=J.x;Ea[za+1]=J.y;Ea[za+2]=
 J.z;Ea[za+3]=K.x;Ea[za+4]=K.y;Ea[za+5]=K.z;Ea[za+6]=L.x;Ea[za+7]=L.y;Ea[za+8]=L.z;za=za+9}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];J=Rb[C.a];K=Rb[C.b];L=Rb[C.c];$=Rb[C.d];Ea[za]=J.x;Ea[za+1]=J.y;Ea[za+2]=J.z;Ea[za+3]=K.x;Ea[za+4]=K.y;Ea[za+5]=K.z;Ea[za+6]=L.x;Ea[za+7]=L.y;Ea[za+8]=L.z;Ea[za+9]=$.x;Ea[za+10]=$.y;Ea[za+11]=$.z;za=za+12}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Ea,Qa)}if(sd){Da=0;for(id=Jb.length;Da<id;Da++){y=Y=0;for(N=ca.length;y<N;y++){Hb=ca[y];
 C=ya[Hb];J=Jb[Da].vertices[C.a];K=Jb[Da].vertices[C.b];L=Jb[Da].vertices[C.c];Ba=Zc[Da];Ba[Y]=J.x;Ba[Y+1]=J.y;Ba[Y+2]=J.z;Ba[Y+3]=K.x;Ba[Y+4]=K.y;Ba[Y+5]=K.z;Ba[Y+6]=L.x;Ba[Y+7]=L.y;Ba[Y+8]=L.z;if(Qb.morphNormals){if(Cc){ub=Gc[Da].vertexNormals[Hb];eb=ub.a;fb=ub.b;gb=ub.c}else gb=fb=eb=Gc[Da].faceNormals[Hb];Ca=$c[Da];Ca[Y]=eb.x;Ca[Y+1]=eb.y;Ca[Y+2]=eb.z;Ca[Y+3]=fb.x;Ca[Y+4]=fb.y;Ca[Y+5]=fb.z;Ca[Y+6]=gb.x;Ca[Y+7]=gb.y;Ca[Y+8]=gb.z}Y=Y+9}y=0;for(N=da.length;y<N;y++){Hb=da[y];C=ya[Hb];J=Jb[Da].vertices[C.a];
@@ -381,38 +381,38 @@ ya[da[y]];tb=C.vertexTangents;bb=tb[0];cb=tb[1];db=tb[2];nc=tb[3];ma[ja]=bb.x;ma
 0;ga<3;ga++){Gb=bc[ga];Ua[Ia]=Gb.x;Ua[Ia+1]=Gb.y;Ua[Ia+2]=Gb.z;Ia=Ia+3}else for(ga=0;ga<3;ga++){Ua[Ia]=zb.x;Ua[Ia+1]=zb.y;Ua[Ia+2]=zb.z;Ia=Ia+3}}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];bc=C.vertexNormals;zb=C.normal;if(bc.length===4&&Cc)for(ga=0;ga<4;ga++){Gb=bc[ga];Ua[Ia]=Gb.x;Ua[Ia+1]=Gb.y;Ua[Ia+2]=Gb.z;Ia=Ia+3}else for(ga=0;ga<4;ga++){Ua[Ia]=zb.x;Ua[Ia+1]=zb.y;Ua[Ia+2]=zb.z;Ia=Ia+3}}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ua,Qa)}if(jd&&bd&&gd){y=0;for(N=
 ca.length;y<N;y++){Wa=ca[y];C=ya[Wa];cc=bd[Wa];if(cc!==void 0)for(ga=0;ga<3;ga++){ec=cc[ga];sc[vb]=ec.u;sc[vb+1]=ec.v;vb=vb+2}}y=0;for(N=da.length;y<N;y++){Wa=da[y];C=ya[Wa];cc=bd[Wa];if(cc!==void 0)for(ga=0;ga<4;ga++){ec=cc[ga];sc[vb]=ec.u;sc[vb+1]=ec.v;vb=vb+2}}if(vb>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,sc,Qa)}}if(jd&&cd&&gd){y=0;for(N=ca.length;y<N;y++){Wa=ca[y];C=ya[Wa];dc=cd[Wa];if(dc!==void 0)for(ga=0;ga<3;ga++){fc=dc[ga];tc[wb]=fc.u;tc[wb+1]=fc.v;wb=
 wb+2}}y=0;for(N=da.length;y<N;y++){Wa=da[y];C=ya[Wa];dc=cd[Wa];if(dc!==void 0)for(ga=0;ga<4;ga++){fc=dc[ga];tc[wb]=fc.u;tc[wb+1]=fc.v;wb=wb+2}}if(wb>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,tc,Qa)}}if(Qc){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];qb[Ta]=va;qb[Ta+1]=va+1;qb[Ta+2]=va+2;Ta=Ta+3;Ra[Ka]=va;Ra[Ka+1]=va+1;Ra[Ka+2]=va;Ra[Ka+3]=va+2;Ra[Ka+4]=va+1;Ra[Ka+5]=va+2;Ka=Ka+6;va=va+3}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];qb[Ta]=va;qb[Ta+1]=va+1;qb[Ta+2]=va+
-3;qb[Ta+3]=va+1;qb[Ta+4]=va+2;qb[Ta+5]=va+3;Ta=Ta+6;Ra[Ka]=va;Ra[Ka+1]=va+1;Ra[Ka+2]=va;Ra[Ka+3]=va+3;Ra[Ka+4]=va+1;Ra[Ka+5]=va+2;Ra[Ka+6]=va+2;Ra[Ka+7]=va+3;Ka=Ka+8;va=va+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,qb,Qa);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Ra,Qa)}if(ad){ga=0;for(hd=ad.length;ga<hd;ga++){r=ad[ga];if(r.__original.needsUpdate){t=0;if(r.size===1)if(r.boundTo===void 0||r.boundTo===
-"vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];r.array[t]=r.value[C.a];r.array[t+1]=r.value[C.b];r.array[t+2]=r.value[C.c];t=t+3}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];r.array[t]=r.value[C.a];r.array[t+1]=r.value[C.b];r.array[t+2]=r.value[C.c];r.array[t+3]=r.value[C.d];t=t+4}}else{if(r.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){ha=r.value[ca[y]];r.array[t]=ha;r.array[t+1]=ha;r.array[t+2]=ha;t=t+3}y=0;for(N=da.length;y<N;y++){ha=r.value[da[y]];r.array[t]=ha;r.array[t+1]=ha;r.array[t+2]=
-ha;r.array[t+3]=ha;t=t+4}}}else if(r.size===2)if(r.boundTo===void 0||r.boundTo==="vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=r.value[C.a];K=r.value[C.b];L=r.value[C.c];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=K.x;r.array[t+3]=K.y;r.array[t+4]=L.x;r.array[t+5]=L.y;t=t+6}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];J=r.value[C.a];K=r.value[C.b];L=r.value[C.c];$=r.value[C.d];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=K.x;r.array[t+3]=K.y;r.array[t+4]=L.x;r.array[t+5]=L.y;r.array[t+6]=$.x;
-r.array[t+7]=$.y;t=t+8}}else{if(r.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){L=K=J=ha=r.value[ca[y]];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=K.x;r.array[t+3]=K.y;r.array[t+4]=L.x;r.array[t+5]=L.y;t=t+6}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=r.value[da[y]];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=K.x;r.array[t+3]=K.y;r.array[t+4]=L.x;r.array[t+5]=L.y;r.array[t+6]=$.x;r.array[t+7]=$.y;t=t+8}}}else if(r.size===3){var R;R=r.type==="c"?["r","g","b"]:["x","y","z"];if(r.boundTo===void 0||
-r.boundTo==="vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=r.value[C.a];K=r.value[C.b];L=r.value[C.c];r.array[t]=J[R[0]];r.array[t+1]=J[R[1]];r.array[t+2]=J[R[2]];r.array[t+3]=K[R[0]];r.array[t+4]=K[R[1]];r.array[t+5]=K[R[2]];r.array[t+6]=L[R[0]];r.array[t+7]=L[R[1]];r.array[t+8]=L[R[2]];t=t+9}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];J=r.value[C.a];K=r.value[C.b];L=r.value[C.c];$=r.value[C.d];r.array[t]=J[R[0]];r.array[t+1]=J[R[1]];r.array[t+2]=J[R[2]];r.array[t+3]=K[R[0]];r.array[t+4]=K[R[1]];
-r.array[t+5]=K[R[2]];r.array[t+6]=L[R[0]];r.array[t+7]=L[R[1]];r.array[t+8]=L[R[2]];r.array[t+9]=$[R[0]];r.array[t+10]=$[R[1]];r.array[t+11]=$[R[2]];t=t+12}}else if(r.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){L=K=J=ha=r.value[ca[y]];r.array[t]=J[R[0]];r.array[t+1]=J[R[1]];r.array[t+2]=J[R[2]];r.array[t+3]=K[R[0]];r.array[t+4]=K[R[1]];r.array[t+5]=K[R[2]];r.array[t+6]=L[R[0]];r.array[t+7]=L[R[1]];r.array[t+8]=L[R[2]];t=t+9}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=r.value[da[y]];r.array[t]=J[R[0]];
-r.array[t+1]=J[R[1]];r.array[t+2]=J[R[2]];r.array[t+3]=K[R[0]];r.array[t+4]=K[R[1]];r.array[t+5]=K[R[2]];r.array[t+6]=L[R[0]];r.array[t+7]=L[R[1]];r.array[t+8]=L[R[2]];r.array[t+9]=$[R[0]];r.array[t+10]=$[R[1]];r.array[t+11]=$[R[2]];t=t+12}}else if(r.boundTo==="faceVertices"){y=0;for(N=ca.length;y<N;y++){ha=r.value[ca[y]];J=ha[0];K=ha[1];L=ha[2];r.array[t]=J[R[0]];r.array[t+1]=J[R[1]];r.array[t+2]=J[R[2]];r.array[t+3]=K[R[0]];r.array[t+4]=K[R[1]];r.array[t+5]=K[R[2]];r.array[t+6]=L[R[0]];r.array[t+
-7]=L[R[1]];r.array[t+8]=L[R[2]];t=t+9}y=0;for(N=da.length;y<N;y++){ha=r.value[da[y]];J=ha[0];K=ha[1];L=ha[2];$=ha[3];r.array[t]=J[R[0]];r.array[t+1]=J[R[1]];r.array[t+2]=J[R[2]];r.array[t+3]=K[R[0]];r.array[t+4]=K[R[1]];r.array[t+5]=K[R[2]];r.array[t+6]=L[R[0]];r.array[t+7]=L[R[1]];r.array[t+8]=L[R[2]];r.array[t+9]=$[R[0]];r.array[t+10]=$[R[1]];r.array[t+11]=$[R[2]];t=t+12}}}else if(r.size===4)if(r.boundTo===void 0||r.boundTo==="vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=r.value[C.a];K=
-r.value[C.b];L=r.value[C.c];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=J.z;r.array[t+3]=J.w;r.array[t+4]=K.x;r.array[t+5]=K.y;r.array[t+6]=K.z;r.array[t+7]=K.w;r.array[t+8]=L.x;r.array[t+9]=L.y;r.array[t+10]=L.z;r.array[t+11]=L.w;t=t+12}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];J=r.value[C.a];K=r.value[C.b];L=r.value[C.c];$=r.value[C.d];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=J.z;r.array[t+3]=J.w;r.array[t+4]=K.x;r.array[t+5]=K.y;r.array[t+6]=K.z;r.array[t+7]=K.w;r.array[t+8]=L.x;r.array[t+
-9]=L.y;r.array[t+10]=L.z;r.array[t+11]=L.w;r.array[t+12]=$.x;r.array[t+13]=$.y;r.array[t+14]=$.z;r.array[t+15]=$.w;t=t+16}}else if(r.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){L=K=J=ha=r.value[ca[y]];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=J.z;r.array[t+3]=J.w;r.array[t+4]=K.x;r.array[t+5]=K.y;r.array[t+6]=K.z;r.array[t+7]=K.w;r.array[t+8]=L.x;r.array[t+9]=L.y;r.array[t+10]=L.z;r.array[t+11]=L.w;t=t+12}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=r.value[da[y]];r.array[t]=J.x;r.array[t+1]=J.y;
-r.array[t+2]=J.z;r.array[t+3]=J.w;r.array[t+4]=K.x;r.array[t+5]=K.y;r.array[t+6]=K.z;r.array[t+7]=K.w;r.array[t+8]=L.x;r.array[t+9]=L.y;r.array[t+10]=L.z;r.array[t+11]=L.w;r.array[t+12]=$.x;r.array[t+13]=$.y;r.array[t+14]=$.z;r.array[t+15]=$.w;t=t+16}}else if(r.boundTo==="faceVertices"){y=0;for(N=ca.length;y<N;y++){ha=r.value[ca[y]];J=ha[0];K=ha[1];L=ha[2];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=J.z;r.array[t+3]=J.w;r.array[t+4]=K.x;r.array[t+5]=K.y;r.array[t+6]=K.z;r.array[t+7]=K.w;r.array[t+
-8]=L.x;r.array[t+9]=L.y;r.array[t+10]=L.z;r.array[t+11]=L.w;t=t+12}y=0;for(N=da.length;y<N;y++){ha=r.value[da[y]];J=ha[0];K=ha[1];L=ha[2];$=ha[3];r.array[t]=J.x;r.array[t+1]=J.y;r.array[t+2]=J.z;r.array[t+3]=J.w;r.array[t+4]=K.x;r.array[t+5]=K.y;r.array[t+6]=K.z;r.array[t+7]=K.w;r.array[t+8]=L.x;r.array[t+9]=L.y;r.array[t+10]=L.z;r.array[t+11]=L.w;r.array[t+12]=$.x;r.array[t+13]=$.y;r.array[t+14]=$.z;r.array[t+15]=$.w;t=t+16}}g.bindBuffer(g.ARRAY_BUFFER,r.buffer);g.bufferData(g.ARRAY_BUFFER,r.array,
+3;qb[Ta+3]=va+1;qb[Ta+4]=va+2;qb[Ta+5]=va+3;Ta=Ta+6;Ra[Ka]=va;Ra[Ka+1]=va+1;Ra[Ka+2]=va;Ra[Ka+3]=va+3;Ra[Ka+4]=va+1;Ra[Ka+5]=va+2;Ra[Ka+6]=va+2;Ra[Ka+7]=va+3;Ka=Ka+8;va=va+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,qb,Qa);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Ra,Qa)}if(ad){ga=0;for(hd=ad.length;ga<hd;ga++){s=ad[ga];if(s.__original.needsUpdate){t=0;if(s.size===1)if(s.boundTo===void 0||s.boundTo===
+"vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];s.array[t]=s.value[C.a];s.array[t+1]=s.value[C.b];s.array[t+2]=s.value[C.c];t=t+3}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];s.array[t]=s.value[C.a];s.array[t+1]=s.value[C.b];s.array[t+2]=s.value[C.c];s.array[t+3]=s.value[C.d];t=t+4}}else{if(s.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){ha=s.value[ca[y]];s.array[t]=ha;s.array[t+1]=ha;s.array[t+2]=ha;t=t+3}y=0;for(N=da.length;y<N;y++){ha=s.value[da[y]];s.array[t]=ha;s.array[t+1]=ha;s.array[t+2]=
+ha;s.array[t+3]=ha;t=t+4}}}else if(s.size===2)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.c];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;t=t+6}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.c];$=s.value[C.d];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;s.array[t+6]=$.x;
+s.array[t+7]=$.y;t=t+8}}else{if(s.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){L=K=J=ha=s.value[ca[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;t=t+6}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=s.value[da[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;s.array[t+6]=$.x;s.array[t+7]=$.y;t=t+8}}}else if(s.size===3){var R;R=s.type==="c"?["r","g","b"]:["x","y","z"];if(s.boundTo===void 0||
+s.boundTo==="vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.c];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.c];$=s.value[C.d];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];
+s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}else if(s.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){L=K=J=ha=s.value[ca[y]];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=s.value[da[y]];s.array[t]=J[R[0]];
+s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}else if(s.boundTo==="faceVertices"){y=0;for(N=ca.length;y<N;y++){ha=s.value[ca[y]];J=ha[0];K=ha[1];L=ha[2];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+
+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(N=da.length;y<N;y++){ha=s.value[da[y]];J=ha[0];K=ha[1];L=ha[2];$=ha[3];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}}else if(s.size===4)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=s.value[C.a];K=
+s.value[C.b];L=s.value[C.c];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.c];$=s.value[C.d];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+
+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}else if(s.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){L=K=J=ha=s.value[ca[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=s.value[da[y]];s.array[t]=J.x;s.array[t+1]=J.y;
+s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}else if(s.boundTo==="faceVertices"){y=0;for(N=ca.length;y<N;y++){ha=s.value[ca[y]];J=ha[0];K=ha[1];L=ha[2];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+
+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(N=da.length;y<N;y++){ha=s.value[da[y]];J=ha[0];K=ha[1];L=ha[2];$=ha[3];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}g.bindBuffer(g.ARRAY_BUFFER,s.buffer);g.bufferData(g.ARRAY_BUFFER,s.array,
 Qa)}}}if(Ac){delete Z.__inittedArrays;delete Z.__colorArray;delete Z.__normalArray;delete Z.__tangentArray;delete Z.__uvArray;delete Z.__uv2Array;delete Z.__faceArray;delete Z.__vertexArray;delete Z.__lineArray;delete Z.__skinVertexAArray;delete Z.__skinVertexBArray;delete Z.__skinIndexArray;delete Z.__skinWeightArray}}}}X.verticesNeedUpdate=false;X.morphTargetsNeedUpdate=false;X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=
 false;Na.attributes&&p(Na)}else if(Za instanceof THREE.Ribbon){if(X.verticesNeedUpdate||X.colorsNeedUpdate){var Kb=X,kd=g.DYNAMIC_DRAW,uc=void 0,vc=void 0,Hc=void 0,Lb=void 0,Ic=void 0,ld=Kb.vertices,md=Kb.colors,td=ld.length,ud=md.length,Jc=Kb.__vertexArray,Kc=Kb.__colorArray,vd=Kb.colorsNeedUpdate;if(Kb.verticesNeedUpdate){for(uc=0;uc<td;uc++){Hc=ld[uc];Lb=uc*3;Jc[Lb]=Hc.x;Jc[Lb+1]=Hc.y;Jc[Lb+2]=Hc.z}g.bindBuffer(g.ARRAY_BUFFER,Kb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Jc,kd)}if(vd){for(vc=
 0;vc<ud;vc++){Ic=md[vc];Lb=vc*3;Kc[Lb]=Ic.r;Kc[Lb+1]=Ic.g;Kc[Lb+2]=Ic.b}g.bindBuffer(g.ARRAY_BUFFER,Kb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Kc,kd)}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false}else if(Za instanceof THREE.Line){Na=c(Za,mc);Zb=Na.attributes&&m(Na);if(X.verticesNeedUpdate||X.colorsNeedUpdate||Zb){var xb=X,dd=g.DYNAMIC_DRAW,wc=void 0,xc=void 0,Lc=void 0,ra=void 0,Mc=void 0,nd=xb.vertices,od=xb.colors,wd=nd.length,xd=od.length,Nc=xb.__vertexArray,Oc=xb.__colorArray,yd=
 xb.colorsNeedUpdate,ed=xb.__webglCustomAttributesList,Pc=void 0,pd=void 0,Ha=void 0,gc=void 0,Oa=void 0,ka=void 0;if(xb.verticesNeedUpdate){for(wc=0;wc<wd;wc++){Lc=nd[wc];ra=wc*3;Nc[ra]=Lc.x;Nc[ra+1]=Lc.y;Nc[ra+2]=Lc.z}g.bindBuffer(g.ARRAY_BUFFER,xb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Nc,dd)}if(yd){for(xc=0;xc<xd;xc++){Mc=od[xc];ra=xc*3;Oc[ra]=Mc.r;Oc[ra+1]=Mc.g;Oc[ra+2]=Mc.b}g.bindBuffer(g.ARRAY_BUFFER,xb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Oc,dd)}if(ed){Pc=0;for(pd=ed.length;Pc<
 pd;Pc++){ka=ed[Pc];if(ka.needsUpdate&&(ka.boundTo===void 0||ka.boundTo==="vertices")){ra=0;gc=ka.value.length;if(ka.size===1)for(Ha=0;Ha<gc;Ha++)ka.array[Ha]=ka.value[Ha];else if(ka.size===2)for(Ha=0;Ha<gc;Ha++){Oa=ka.value[Ha];ka.array[ra]=Oa.x;ka.array[ra+1]=Oa.y;ra=ra+2}else if(ka.size===3)if(ka.type==="c")for(Ha=0;Ha<gc;Ha++){Oa=ka.value[Ha];ka.array[ra]=Oa.r;ka.array[ra+1]=Oa.g;ka.array[ra+2]=Oa.b;ra=ra+3}else for(Ha=0;Ha<gc;Ha++){Oa=ka.value[Ha];ka.array[ra]=Oa.x;ka.array[ra+1]=Oa.y;ka.array[ra+
 2]=Oa.z;ra=ra+3}else if(ka.size===4)for(Ha=0;Ha<gc;Ha++){Oa=ka.value[Ha];ka.array[ra]=Oa.x;ka.array[ra+1]=Oa.y;ka.array[ra+2]=Oa.z;ka.array[ra+3]=Oa.w;ra=ra+4}g.bindBuffer(g.ARRAY_BUFFER,ka.buffer);g.bufferData(g.ARRAY_BUFFER,ka.array,dd)}}}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false;Na.attributes&&p(Na)}else if(Za instanceof THREE.ParticleSystem){Na=c(Za,mc);Zb=Na.attributes&&m(Na);(X.verticesNeedUpdate||X.colorsNeedUpdate||Za.sortParticles||Zb)&&f(X,g.DYNAMIC_DRAW,Za);X.verticesNeedUpdate=
-false;X.colorsNeedUpdate=false;Na.attributes&&p(Na)}}};this.initMaterial=function(a,b,c,d){var e,f,h,i,j,k,l,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];a.uniforms=
-THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var o,p;o=h=e=n=0;for(f=b.length;o<f;o++){p=b[o];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&h++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&n++}}if(e+n+h<=ea){o=h;f=e}else{o=Math.ceil(ea*h/(e+h));n=f=ea-o}e=o;h=n;n=l=0;for(o=b.length;n<o;n++){p=b[n];if(p.castShadow){p instanceof THREE.SpotLight&&l++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&l++}}if(ic&&
-d&&d.useVertexTexture)k=1024;else{b=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}k=b}var q;a:{p=a.fragmentShader;o=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,specularMap:!!a.specularMap,
+false;X.colorsNeedUpdate=false;Na.attributes&&p(Na)}}};this.initMaterial=function(a,b,c,d){var e,f,h,i,j,k,l,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var o=THREE.ShaderLib[m];a.uniforms=
+THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var n,p;n=h=e=o=0;for(f=b.length;n<f;n++){p=b[n];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&h++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&o++}}if(e+o+h<=ea){n=h;f=e}else{n=Math.ceil(ea*h/(e+h));o=f=ea-n}e=n;h=o;o=l=0;for(n=b.length;o<n;o++){p=b[o];if(p.castShadow){p instanceof THREE.SpotLight&&l++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&l++}}if(ic&&
+d&&d.useVertexTexture)k=1024;else{b=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}k=b}var q;a:{p=a.fragmentShader;n=a.vertexShader;var o=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,specularMap:!!a.specularMap,
 vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:k,useVertexTexture:ic&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxShadows:l,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:a.side===THREE.DoubleSide},s,d=[];if(m)d.push(m);else{d.push(p);d.push(o)}for(s in c){d.push(s);d.push(c[s])}m=d.join();s=0;for(d=aa.length;s<d;s++){e=aa[s];if(e.code===m){e.usedTimes++;q=e.program;break a}}s=g.createProgram();d=["precision "+Q+" float;",Pb?"#define VERTEX_TEXTURES":"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?
+shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide},r,d=[];if(m)d.push(m);else{d.push(p);d.push(n)}for(r in c){d.push(r);d.push(c[r])}m=d.join();r=0;for(d=aa.length;r<d;r++){e=aa[r];if(e.code===m){e.usedTimes++;q=e.program;break a}}r=g.createProgram();d=["precision "+Q+" float;",Pb?"#define VERTEX_TEXTURES":"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?
 "#define GAMMA_OUTPUT":"",I.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.bumpMap?"#define USE_BUMPMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?
 "#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",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 modelMatrix;\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");
 e=["precision "+Q+" float;",c.bumpMap?"#extension GL_OES_standard_derivatives : enable":"","#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:"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?"#define GAMMA_OUTPUT":"",I.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.bumpMap?"#define USE_BUMPMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",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");e=H("fragment",e+p);d=H("vertex",d+o);g.attachShader(s,d);g.attachShader(s,e);g.linkProgram(s);g.getProgramParameter(s,g.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+g.getProgramParameter(s,g.VALIDATE_STATUS)+", gl error ["+g.getError()+"]");g.deleteShader(e);g.deleteShader(d);s.uniforms={};s.attributes={};var u,d=["viewMatrix",
-"modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):d.push("boneGlobalMatrices");for(u in n)d.push(u);u=d;d=0;for(n=u.length;d<n;d++){e=u[d];s.uniforms[e]=g.getUniformLocation(s,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)d.push("morphTarget"+u);for(u=0;u<c.maxMorphNormals;u++)d.push("morphNormal"+u);for(q in b)d.push(q);
-q=d;u=0;for(c=q.length;u<c;u++){d=q[u];s.attributes[d]=g.getAttribLocation(s,d)}s.id=P++;aa.push({program:s,code:m,usedTimes:1});I.info.memory.programs=aa.length;q=s}a.program=q;q=a.program.attributes;q.position>=0&&g.enableVertexAttribArray(q.position);q.color>=0&&g.enableVertexAttribArray(q.color);q.normal>=0&&g.enableVertexAttribArray(q.normal);q.tangent>=0&&g.enableVertexAttribArray(q.tangent);if(a.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0){g.enableVertexAttribArray(q.skinVertexA);
-g.enableVertexAttribArray(q.skinVertexB);g.enableVertexAttribArray(q.skinIndex);g.enableVertexAttribArray(q.skinWeight)}if(a.attributes)for(j in a.attributes)q[j]!==void 0&&q[j]>=0&&g.enableVertexAttribArray(q[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;s="morphTarget";for(j=0;j<this.maxMorphTargets;j++){u=s+j;if(q[u]>=0){g.enableVertexAttribArray(q[u]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;s="morphNormal";for(j=0;j<this.maxMorphNormals;j++){u=s+j;
+"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e=H("fragment",e+p);d=H("vertex",d+n);g.attachShader(r,d);g.attachShader(r,e);g.linkProgram(r);g.getProgramParameter(r,g.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+g.getProgramParameter(r,g.VALIDATE_STATUS)+", gl error ["+g.getError()+"]");g.deleteShader(e);g.deleteShader(d);r.uniforms={};r.attributes={};var u,d=["viewMatrix",
+"modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):d.push("boneGlobalMatrices");for(u in o)d.push(u);u=d;d=0;for(o=u.length;d<o;d++){e=u[d];r.uniforms[e]=g.getUniformLocation(r,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)d.push("morphTarget"+u);for(u=0;u<c.maxMorphNormals;u++)d.push("morphNormal"+u);for(q in b)d.push(q);
+q=d;u=0;for(c=q.length;u<c;u++){d=q[u];r.attributes[d]=g.getAttribLocation(r,d)}r.id=P++;aa.push({program:r,code:m,usedTimes:1});I.info.memory.programs=aa.length;q=r}a.program=q;q=a.program.attributes;q.position>=0&&g.enableVertexAttribArray(q.position);q.color>=0&&g.enableVertexAttribArray(q.color);q.normal>=0&&g.enableVertexAttribArray(q.normal);q.tangent>=0&&g.enableVertexAttribArray(q.tangent);if(a.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0){g.enableVertexAttribArray(q.skinVertexA);
+g.enableVertexAttribArray(q.skinVertexB);g.enableVertexAttribArray(q.skinIndex);g.enableVertexAttribArray(q.skinWeight)}if(a.attributes)for(j in a.attributes)q[j]!==void 0&&q[j]>=0&&g.enableVertexAttribArray(q[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;r="morphTarget";for(j=0;j<this.maxMorphTargets;j++){u=r+j;if(q[u]>=0){g.enableVertexAttribArray(q[u]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(j=0;j<this.maxMorphNormals;j++){u=r+j;
 if(q[u]>=0){g.enableVertexAttribArray(q[u]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?g.frontFace(g.CCW):g.frontFace(g.CW);a==="back"?g.cullFace(g.BACK):a==="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK);g.enable(g.CULL_FACE)}else g.disable(g.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;if(ba!==b){b?g.disable(g.CULL_FACE):
 g.enable(g.CULL_FACE);ba=b}if(ia!==a){a?g.frontFace(g.CW):g.frontFace(g.CCW);ia=a}};this.setDepthTest=function(a){if(Pa!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);Pa=a}};this.setDepthWrite=function(a){if(ua!==a){g.depthMask(a);ua=a}};this.setBlending=function(a,b,c,d){if(a!==fa){if(a===THREE.NoBlending)g.disable(g.BLEND);else if(a===THREE.AdditiveBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE)}else if(a===THREE.SubtractiveBlending){g.enable(g.BLEND);
 g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.SRC_COLOR)}else if(a===THREE.CustomBlending)g.enable(g.BLEND);else{g.enable(g.BLEND);g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD);g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,g.ONE_MINUS_SRC_ALPHA)}fa=a}if(a===THREE.CustomBlending){if(b!==Ja){g.blendEquation(O(b));Ja=b}if(c!==Ga||d!==la){g.blendFunc(O(c),O(d));
@@ -432,12 +432,12 @@ THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.obje
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;if(this.attributes.position)b=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(b!==void 0){a.multiplyVector3Array(b);this.verticesNeedUpdate=true}if(c!==void 0){b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
 Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,e,f=0,h=a.length;f<h;f=f+3){c=a[f];d=a[f+1];e=a[f+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(e<b.min.z)b.min.z=e;else if(e>b.max.z)b.max.z=e}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
 {radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,h=a.length;f<h;f=f+3){b=a[f];d=a[f+1];e=a[f+2];b=Math.sqrt(b*b+d*d+e*e);b>c&&(c=b)}this.boundingSphere.radius=c}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
-0}var e=this.offsets,f=this.attributes.index.array,h=this.attributes.position.array,j=this.attributes.normal.array,n,k,i,l,m,p,u=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,w=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;n=e[c].count;var v=e[c].index;a=b;for(b=b+n;a<b;a=a+3){n=v+f[a];k=v+f[a+1];i=v+f[a+2];l=h[n*3];m=h[n*3+1];p=h[n*3+2];u.set(l,m,p);l=h[k*3];m=h[k*3+1];p=h[k*3+2];o.set(l,m,p);l=h[i*3];m=h[i*3+1];p=h[i*3+2];q.set(l,m,p);s.sub(q,o);w.sub(u,
-o);s.crossSelf(w);j[n*3]=j[n*3]+s.x;j[n*3+1]=j[n*3+1]+s.y;j[n*3+2]=j[n*3+2]+s.z;j[k*3]=j[k*3]+s.x;j[k*3+1]=j[k*3+1]+s.y;j[k*3+2]=j[k*3+2]+s.z;j[i*3]=j[i*3]+s.x;j[i*3+1]=j[i*3+1]+s.y;j[i*3+2]=j[i*3+2]+s.z}}a=0;for(b=j.length;a<b;a=a+3){l=j[a];m=j[a+1];p=j[a+2];c=1/Math.sqrt(l*l+m*m+p*p);j[a]=j[a]*c;j[a+1]=j[a+1]*c;j[a+2]=j[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a,b,c){l=d[a*3];m=d[a*3+1];p=d[a*3+2];u=d[b*3];o=d[b*3+1];q=d[b*3+2];s=d[c*3];w=d[c*3+1];v=d[c*3+2];H=
-f[a*2];x=f[a*2+1];D=f[b*2];E=f[b*2+1];O=f[c*2];B=f[c*2+1];Q=u-l;F=s-l;W=o-m;V=w-m;T=q-p;A=v-p;M=D-H;G=O-H;ea=E-x;I=B-x;aa=1/(M*I-G*ea);P.set((I*Q-ea*F)*aa,(I*W-ea*V)*aa,(I*T-ea*A)*aa);Aa.set((M*F-G*Q)*aa,(M*V-G*W)*aa,(M*A-G*T)*aa);k[a].addSelf(P);k[b].addSelf(P);k[c].addSelf(P);i[a].addSelf(Aa);i[b].addSelf(Aa);i[c].addSelf(Aa)}function b(a){Ga.x=e[a*3];Ga.y=e[a*3+1];Ga.z=e[a*3+2];la.copy(Ga);ua=k[a];fa.copy(ua);fa.subSelf(Ga.multiplyScalar(Ga.dot(ua))).normalize();Ja.cross(la,ua);Xa=Ja.dot(i[a]);
-Pa=Xa<0?-1:1;n[a*4]=fa.x;n[a*4+1]=fa.y;n[a*4+2]=fa.z;n[a*4+3]=Pa}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,h=d.length/3;if(this.attributes.tangent===void 0){var j=4*h;this.attributes.tangent=
-{itemSize:4,array:new Float32Array(j),numItems:j}}for(var n=this.attributes.tangent.array,k=[],i=[],j=0;j<h;j++){k[j]=new THREE.Vector3;i[j]=new THREE.Vector3}var l,m,p,u,o,q,s,w,v,H,x,D,E,O,B,Q,F,W,V,T,A,M,G,ea,I,aa,P=new THREE.Vector3,Aa=new THREE.Vector3,sa,U,S,ta,wa,ba=this.offsets,j=0;for(U=ba.length;j<U;++j){sa=ba[j].start;S=ba[j].count;var ia=ba[j].index,h=sa;for(sa=sa+S;h<sa;h=h+3){S=ia+c[h];ta=ia+c[h+1];wa=ia+c[h+2];a(S,ta,wa)}}var fa=new THREE.Vector3,Ja=new THREE.Vector3,Ga=new THREE.Vector3,
-la=new THREE.Vector3,Pa,ua,Xa,j=0;for(U=ba.length;j<U;++j){sa=ba[j].start;S=ba[j].count;ia=ba[j].index;h=sa;for(sa=sa+S;h<sa;h=h+3){S=ia+c[h];ta=ia+c[h+1];wa=ia+c[h+2];b(S);b(ta);b(wa)}}this.tangentsNeedUpdate=this.hasTangents=true}}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
+0}var e=this.offsets,f=this.attributes.index.array,h=this.attributes.position.array,i=this.attributes.normal.array,l,k,j,o,m,p,u=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector3,w=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;l=e[c].count;var v=e[c].index;a=b;for(b=b+l;a<b;a=a+3){l=v+f[a];k=v+f[a+1];j=v+f[a+2];o=h[l*3];m=h[l*3+1];p=h[l*3+2];u.set(o,m,p);o=h[k*3];m=h[k*3+1];p=h[k*3+2];n.set(o,m,p);o=h[j*3];m=h[j*3+1];p=h[j*3+2];q.set(o,m,p);r.sub(q,n);w.sub(u,
+n);r.crossSelf(w);i[l*3]=i[l*3]+r.x;i[l*3+1]=i[l*3+1]+r.y;i[l*3+2]=i[l*3+2]+r.z;i[k*3]=i[k*3]+r.x;i[k*3+1]=i[k*3+1]+r.y;i[k*3+2]=i[k*3+2]+r.z;i[j*3]=i[j*3]+r.x;i[j*3+1]=i[j*3+1]+r.y;i[j*3+2]=i[j*3+2]+r.z}}a=0;for(b=i.length;a<b;a=a+3){o=i[a];m=i[a+1];p=i[a+2];c=1/Math.sqrt(o*o+m*m+p*p);i[a]=i[a]*c;i[a+1]=i[a+1]*c;i[a+2]=i[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a,b,c){o=d[a*3];m=d[a*3+1];p=d[a*3+2];u=d[b*3];n=d[b*3+1];q=d[b*3+2];r=d[c*3];w=d[c*3+1];v=d[c*3+2];H=
+f[a*2];x=f[a*2+1];D=f[b*2];E=f[b*2+1];O=f[c*2];B=f[c*2+1];Q=u-o;F=r-o;W=n-m;V=w-m;T=q-p;A=v-p;M=D-H;G=O-H;ea=E-x;I=B-x;aa=1/(M*I-G*ea);P.set((I*Q-ea*F)*aa,(I*W-ea*V)*aa,(I*T-ea*A)*aa);Aa.set((M*F-G*Q)*aa,(M*V-G*W)*aa,(M*A-G*T)*aa);k[a].addSelf(P);k[b].addSelf(P);k[c].addSelf(P);j[a].addSelf(Aa);j[b].addSelf(Aa);j[c].addSelf(Aa)}function b(a){Ga.x=e[a*3];Ga.y=e[a*3+1];Ga.z=e[a*3+2];la.copy(Ga);ua=k[a];fa.copy(ua);fa.subSelf(Ga.multiplyScalar(Ga.dot(ua))).normalize();Ja.cross(la,ua);Xa=Ja.dot(j[a]);
+Pa=Xa<0?-1:1;l[a*4]=fa.x;l[a*4+1]=fa.y;l[a*4+2]=fa.z;l[a*4+3]=Pa}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,h=d.length/3;if(this.attributes.tangent===void 0){var i=4*h;this.attributes.tangent=
+{itemSize:4,array:new Float32Array(i),numItems:i}}for(var l=this.attributes.tangent.array,k=[],j=[],i=0;i<h;i++){k[i]=new THREE.Vector3;j[i]=new THREE.Vector3}var o,m,p,u,n,q,r,w,v,H,x,D,E,O,B,Q,F,W,V,T,A,M,G,ea,I,aa,P=new THREE.Vector3,Aa=new THREE.Vector3,sa,U,S,ta,wa,ba=this.offsets,i=0;for(U=ba.length;i<U;++i){sa=ba[i].start;S=ba[i].count;var ia=ba[i].index,h=sa;for(sa=sa+S;h<sa;h=h+3){S=ia+c[h];ta=ia+c[h+1];wa=ia+c[h+2];a(S,ta,wa)}}var fa=new THREE.Vector3,Ja=new THREE.Vector3,Ga=new THREE.Vector3,
+la=new THREE.Vector3,Pa,ua,Xa,i=0;for(U=ba.length;i<U;++i){sa=ba[i].start;S=ba[i].count;ia=ba[i].index;h=sa;for(sa=sa+S;h<sa;h=h+3){S=ia+c[h];ta=ia+c[h+1];wa=ia+c[h+2];b(S);b(ta);b(wa)}}this.tangentsNeedUpdate=this.hasTangents=true}}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
 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;
 THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vector3);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4",
@@ -448,34 +448,34 @@ THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraH
 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=Object.create(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.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
-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,h,j,n,k,i,l,m,p;this.init=function(u){b=u.context;c=u;d=new Float32Array(16);e=new Uint16Array(6);u=0;d[u++]=-1;d[u++]=-1;d[u++]=0;d[u++]=0;d[u++]=1;d[u++]=-1;d[u++]=1;d[u++]=
-0;d[u++]=1;d[u++]=1;d[u++]=1;d[u++]=1;d[u++]=-1;d[u++]=1;d[u++]=0;d[u++]=1;u=0;e[u++]=0;e[u++]=1;e[u++]=2;e[u++]=0;e[u++]=2;e[u++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);j=b.createTexture();n=b.createTexture();b.bindTexture(b.TEXTURE_2D,j);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,n);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;i=a(THREE.ShaderFlares.lensFlare)}else{k=true;i=a(THREE.ShaderFlares.lensFlareVertexTexture)}l={};m={};l.vertex=b.getAttribLocation(i,"position");l.uv=b.getAttribLocation(i,"uv");m.renderType=b.getUniformLocation(i,"renderType");m.map=b.getUniformLocation(i,"map");m.occlusionMap=b.getUniformLocation(i,"occlusionMap");m.opacity=b.getUniformLocation(i,"opacity");m.color=b.getUniformLocation(i,
-"color");m.scale=b.getUniformLocation(i,"scale");m.rotation=b.getUniformLocation(i,"rotation");m.screenPosition=b.getUniformLocation(i,"screenPosition");p=false};this.render=function(a,d,e,s){var a=a.__webglFlares,w=a.length;if(w){var v=new THREE.Vector3,H=s/e,x=e*0.5,D=s*0.5,E=16/s,O=new THREE.Vector2(E*H,E),B=new THREE.Vector3(1,1,0),Q=new THREE.Vector2(1,1),F=m,E=l;b.useProgram(i);if(!p){b.enableVertexAttribArray(l.vertex);b.enableVertexAttribArray(l.uv);p=true}b.uniform1i(F.occlusionMap,0);b.uniform1i(F.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,h);b.disable(b.CULL_FACE);b.depthMask(false);var W,V,T,A,M;for(W=0;W<w;W++){E=16/s;O.set(E*H,E);A=a[W];v.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);B.copy(v);Q.x=B.x*x+x;Q.y=B.y*D+D;if(k||Q.x>0&&Q.x<e&&Q.y>0&&
-Q.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,Q.x-8,Q.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,O.x,O.y);b.uniform3f(F.screenPosition,B.x,B.y,B.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,n);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,Q.x-8,Q.y-8,16,16,0);b.uniform1i(F.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,j);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(B);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);V=0;for(T=A.lensFlares.length;V<T;V++){M=A.lensFlares[V];if(M.opacity>0.001&&M.scale>0.001){B.x=M.x;B.y=M.y;B.z=M.z;E=M.size*M.scale/s;O.x=E*H;O.y=E;b.uniform3f(F.screenPosition,B.x,B.y,B.z);b.uniform2f(F.scale,O.x,O.y);b.uniform1f(F.rotation,M.rotation);b.uniform1f(F.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,h,i,l,k,j,o,m,p;this.init=function(u){b=u.context;c=u;d=new Float32Array(16);e=new Uint16Array(6);u=0;d[u++]=-1;d[u++]=-1;d[u++]=0;d[u++]=0;d[u++]=1;d[u++]=-1;d[u++]=1;d[u++]=
+0;d[u++]=1;d[u++]=1;d[u++]=1;d[u++]=1;d[u++]=-1;d[u++]=1;d[u++]=0;d[u++]=1;u=0;e[u++]=0;e[u++]=1;e[u++]=2;e[u++]=0;e[u++]=2;e[u++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);i=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);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,l);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;j=a(THREE.ShaderFlares.lensFlare)}else{k=true;j=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(j,"position");o.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j,
+"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");p=false};this.render=function(a,d,e,r){var a=a.__webglFlares,w=a.length;if(w){var v=new THREE.Vector3,H=r/e,x=e*0.5,D=r*0.5,E=16/r,O=new THREE.Vector2(E*H,E),B=new THREE.Vector3(1,1,0),Q=new THREE.Vector2(1,1),F=m,E=o;b.useProgram(j);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(F.occlusionMap,0);b.uniform1i(F.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,h);b.disable(b.CULL_FACE);b.depthMask(false);var W,V,T,A,M;for(W=0;W<w;W++){E=16/r;O.set(E*H,E);A=a[W];v.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);B.copy(v);Q.x=B.x*x+x;Q.y=B.y*D+D;if(k||Q.x>0&&Q.x<e&&Q.y>0&&
+Q.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,Q.x-8,Q.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,O.x,O.y);b.uniform3f(F.screenPosition,B.x,B.y,B.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,l);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,Q.x-8,Q.y-8,16,16,0);b.uniform1i(F.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
+b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(B);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);V=0;for(T=A.lensFlares.length;V<T;V++){M=A.lensFlares[V];if(M.opacity>0.001&&M.scale>0.001){B.x=M.x;B.y=M.y;B.z=M.z;E=M.size*M.scale/r;O.x=E*H;O.y=E;b.uniform3f(F.screenPosition,B.x,B.y,B.z);b.uniform2f(F.scale,O.x,O.y);b.uniform1f(F.rotation,M.rotation);b.uniform1f(F.opacity,M.opacity);
 b.uniform3f(F.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,f=new THREE.Frustum,h=new THREE.Matrix4,j=new THREE.Vector3,n=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
-vertexShader:f.vertexShader,uniforms:h,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,i){var l,m,p,u,o,q,s,w,v,H=[];u=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);l=0;for(m=k.__lights.length;l<m;l++){p=k.__lights[l];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&
-p.shadowCascade)for(o=0;o<p.shadowCascadeCount;o++){var x;if(p.shadowCascadeArray[o])x=p.shadowCascadeArray[o];else{v=p;s=o;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=v.shadowCameraNear;x.shadowCameraFar=v.shadowCameraFar;x.shadowCameraLeft=v.shadowCameraLeft;x.shadowCameraRight=v.shadowCameraRight;x.shadowCameraBottom=v.shadowCameraBottom;x.shadowCameraTop=v.shadowCameraTop;x.shadowCameraVisible=v.shadowCameraVisible;x.shadowDarkness=v.shadowDarkness;
-x.shadowBias=v.shadowCascadeBias[s];x.shadowMapWidth=v.shadowCascadeWidth[s];x.shadowMapHeight=v.shadowCascadeHeight[s];x.pointsWorld=[];x.pointsFrustum=[];w=x.pointsWorld;q=x.pointsFrustum;for(var D=0;D<8;D++){w[D]=new THREE.Vector3;q[D]=new THREE.Vector3}w=v.shadowCascadeNearZ[s];v=v.shadowCascadeFarZ[s];q[0].set(-1,-1,w);q[1].set(1,-1,w);q[2].set(-1,1,w);q[3].set(1,1,w);q[4].set(-1,-1,v);q[5].set(1,-1,v);q[6].set(-1,1,v);q[7].set(1,1,v);x.originalCamera=i;q=new THREE.Gyroscope;q.position=p.shadowCascadeOffset;
-q.add(x);q.add(x.target);i.add(q);p.shadowCascadeArray[o]=x;console.log("Created virtualLight",x)}s=p;w=o;v=s.shadowCascadeArray[w];v.position.copy(s.position);v.target.position.copy(s.target.position);v.lookAt(v.target);v.shadowCameraVisible=s.shadowCameraVisible;v.shadowDarkness=s.shadowDarkness;v.shadowBias=s.shadowCascadeBias[w];q=s.shadowCascadeNearZ[w];s=s.shadowCascadeFarZ[w];v=v.pointsFrustum;v[0].z=q;v[1].z=q;v[2].z=q;v[3].z=q;v[4].z=s;v[5].z=s;v[6].z=s;v[7].z=s;H[u]=x;u++}else{H[u]=p;u++}}l=
-0;for(m=H.length;l<m;l++){p=H[l];if(!p.shadowMap){p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight);p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof
-THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}k.add(p.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(p.shadowCameraVisible&&!p.cameraHelper){p.cameraHelper=new THREE.CameraHelper(p.shadowCamera);p.shadowCamera.add(p.cameraHelper)}if(p.isVirtual&&x.originalCamera==i){o=i;u=p.shadowCamera;
-q=p.pointsFrustum;v=p.pointsWorld;j.set(Infinity,Infinity,Infinity);n.set(-Infinity,-Infinity,-Infinity);for(s=0;s<8;s++){w=v[s];w.copy(q[s]);THREE.ShadowMapPlugin.__projector.unprojectVector(w,o);u.matrixWorldInverse.multiplyVector3(w);if(w.x<j.x)j.x=w.x;if(w.x>n.x)n.x=w.x;if(w.y<j.y)j.y=w.y;if(w.y>n.y)n.y=w.y;if(w.z<j.z)j.z=w.z;if(w.z>n.z)n.z=w.z}u.left=j.x;u.right=n.x;u.top=n.y;u.bottom=j.y;u.updateProjectionMatrix()}u=p.shadowMap;q=p.shadowMatrix;o=p.shadowCamera;o.position.copy(p.matrixWorld.getPosition());
-o.lookAt(p.target.matrixWorld.getPosition());o.updateMatrixWorld();o.matrixWorldInverse.getInverse(o.matrixWorld);if(p.cameraHelper)p.cameraHelper.lines.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update();q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(o.projectionMatrix);q.multiplySelf(o.matrixWorldInverse);if(!o._viewMatrixArray)o._viewMatrixArray=new Float32Array(16);if(!o._projectionMatrixArray)o._projectionMatrixArray=new Float32Array(16);o.matrixWorldInverse.flattenToArray(o._viewMatrixArray);
-o.projectionMatrix.flattenToArray(o._projectionMatrixArray);h.multiply(o.projectionMatrix,o.matrixWorldInverse);f.setFromMatrix(h);b.setRenderTarget(u);b.clear();v=k.__webglObjects;p=0;for(u=v.length;p<u;p++){s=v[p];q=s.object;s.render=false;if(q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q))){q._modelViewMatrix.multiply(o.matrixWorldInverse,q.matrixWorld);s.render=true}}p=0;for(u=v.length;p<u;p++){s=v[p];if(s.render){q=s.object;s=s.buffer;w=q.customDepthMaterial?
-q.customDepthMaterial:q.geometry.morphTargets.length?d:q instanceof THREE.SkinnedMesh?e:c;s instanceof THREE.BufferGeometry?b.renderBufferDirect(o,k.__lights,null,w,s,q):b.renderBuffer(o,k.__lights,null,w,s,q)}}v=k.__webglObjectsImmediate;p=0;for(u=v.length;p<u;p++){s=v[p];q=s.object;if(q.visible&&q.castShadow){q._modelViewMatrix.multiply(o.matrixWorldInverse,q.matrixWorld);b.renderImmediateObject(o,k.__lights,null,c,q)}}}l=b.getClearColor();m=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,m);a.enable(a.BLEND);
+THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,l=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
+vertexShader:f.vertexShader,uniforms:h,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,j){var o,m,p,u,n,q,r,w,v,H=[];u=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);o=0;for(m=k.__lights.length;o<m;o++){p=k.__lights[o];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&
+p.shadowCascade)for(n=0;n<p.shadowCascadeCount;n++){var x;if(p.shadowCascadeArray[n])x=p.shadowCascadeArray[n];else{v=p;r=n;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=v.shadowCameraNear;x.shadowCameraFar=v.shadowCameraFar;x.shadowCameraLeft=v.shadowCameraLeft;x.shadowCameraRight=v.shadowCameraRight;x.shadowCameraBottom=v.shadowCameraBottom;x.shadowCameraTop=v.shadowCameraTop;x.shadowCameraVisible=v.shadowCameraVisible;x.shadowDarkness=v.shadowDarkness;
+x.shadowBias=v.shadowCascadeBias[r];x.shadowMapWidth=v.shadowCascadeWidth[r];x.shadowMapHeight=v.shadowCascadeHeight[r];x.pointsWorld=[];x.pointsFrustum=[];w=x.pointsWorld;q=x.pointsFrustum;for(var D=0;D<8;D++){w[D]=new THREE.Vector3;q[D]=new THREE.Vector3}w=v.shadowCascadeNearZ[r];v=v.shadowCascadeFarZ[r];q[0].set(-1,-1,w);q[1].set(1,-1,w);q[2].set(-1,1,w);q[3].set(1,1,w);q[4].set(-1,-1,v);q[5].set(1,-1,v);q[6].set(-1,1,v);q[7].set(1,1,v);x.originalCamera=j;q=new THREE.Gyroscope;q.position=p.shadowCascadeOffset;
+q.add(x);q.add(x.target);j.add(q);p.shadowCascadeArray[n]=x;console.log("Created virtualLight",x)}r=p;w=n;v=r.shadowCascadeArray[w];v.position.copy(r.position);v.target.position.copy(r.target.position);v.lookAt(v.target);v.shadowCameraVisible=r.shadowCameraVisible;v.shadowDarkness=r.shadowDarkness;v.shadowBias=r.shadowCascadeBias[w];q=r.shadowCascadeNearZ[w];r=r.shadowCascadeFarZ[w];v=v.pointsFrustum;v[0].z=q;v[1].z=q;v[2].z=q;v[3].z=q;v[4].z=r;v[5].z=r;v[6].z=r;v[7].z=r;H[u]=x;u++}else{H[u]=p;u++}}o=
+0;for(m=H.length;o<m;o++){p=H[o];if(!p.shadowMap){p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight);p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof
+THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}k.add(p.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(p.shadowCameraVisible&&!p.cameraHelper){p.cameraHelper=new THREE.CameraHelper(p.shadowCamera);p.shadowCamera.add(p.cameraHelper)}if(p.isVirtual&&x.originalCamera==j){n=j;u=p.shadowCamera;
+q=p.pointsFrustum;v=p.pointsWorld;i.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(r=0;r<8;r++){w=v[r];w.copy(q[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(w,n);u.matrixWorldInverse.multiplyVector3(w);if(w.x<i.x)i.x=w.x;if(w.x>l.x)l.x=w.x;if(w.y<i.y)i.y=w.y;if(w.y>l.y)l.y=w.y;if(w.z<i.z)i.z=w.z;if(w.z>l.z)l.z=w.z}u.left=i.x;u.right=l.x;u.top=l.y;u.bottom=i.y;u.updateProjectionMatrix()}u=p.shadowMap;q=p.shadowMatrix;n=p.shadowCamera;n.position.copy(p.matrixWorld.getPosition());
+n.lookAt(p.target.matrixWorld.getPosition());n.updateMatrixWorld();n.matrixWorldInverse.getInverse(n.matrixWorld);if(p.cameraHelper)p.cameraHelper.lines.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update();q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(n.projectionMatrix);q.multiplySelf(n.matrixWorldInverse);if(!n._viewMatrixArray)n._viewMatrixArray=new Float32Array(16);if(!n._projectionMatrixArray)n._projectionMatrixArray=new Float32Array(16);n.matrixWorldInverse.flattenToArray(n._viewMatrixArray);
+n.projectionMatrix.flattenToArray(n._projectionMatrixArray);h.multiply(n.projectionMatrix,n.matrixWorldInverse);f.setFromMatrix(h);b.setRenderTarget(u);b.clear();v=k.__webglObjects;p=0;for(u=v.length;p<u;p++){r=v[p];q=r.object;r.render=false;if(q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q))){q._modelViewMatrix.multiply(n.matrixWorldInverse,q.matrixWorld);r.render=true}}p=0;for(u=v.length;p<u;p++){r=v[p];if(r.render){q=r.object;r=r.buffer;w=q.customDepthMaterial?
+q.customDepthMaterial:q.geometry.morphTargets.length?d:q instanceof THREE.SkinnedMesh?e:c;r instanceof THREE.BufferGeometry?b.renderBufferDirect(n,k.__lights,null,w,r,q):b.renderBuffer(n,k.__lights,null,w,r,q)}}v=k.__webglObjectsImmediate;p=0;for(u=v.length;p<u;p++){r=v[p];q=r.object;if(q.visible&&q.castShadow){q._modelViewMatrix.multiply(n.matrixWorldInverse,q.matrixWorld);b.renderImmediateObject(n,k.__lights,null,c,q)}}}o=b.getClearColor();m=b.getClearAlpha();a.clearColor(o.r,o.g,o.b,m);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,h,j,n,k,i;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++]=0;d[a++]=1;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++]=0;d[a++]=1;a=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),u=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(u,a.vertexShader);b.compileShader(p);b.compileShader(u);b.attachShader(m,p);b.attachShader(m,u);b.linkProgram(m);j=m;n={};k={};n.position=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");k.uvOffset=b.getUniformLocation(j,"uvOffset");k.uvScale=b.getUniformLocation(j,
-"uvScale");k.rotation=b.getUniformLocation(j,"rotation");k.scale=b.getUniformLocation(j,"scale");k.alignment=b.getUniformLocation(j,"alignment");k.color=b.getUniformLocation(j,"color");k.map=b.getUniformLocation(j,"map");k.opacity=b.getUniformLocation(j,"opacity");k.useScreenCoordinates=b.getUniformLocation(j,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(j,"affectedByDistance");k.screenPosition=b.getUniformLocation(j,"screenPosition");k.modelViewMatrix=b.getUniformLocation(j,"modelViewMatrix");
-k.projectionMatrix=b.getUniformLocation(j,"projectionMatrix");i=false};this.render=function(d,e,p,u){var d=d.__webglSprites,o=d.length;if(o){var q=n,s=k,w=u/p,p=p*0.5,v=u*0.5,H=true;b.useProgram(j);if(!i){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);i=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,
-h);b.uniformMatrix4fv(s.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var x,D=[],q=0;q<o;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<o;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(s.useScreenCoordinates,1);
-b.uniform3f(s.screenPosition,(x.position.x-p)/p,(v-x.position.y)/v,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(s.useScreenCoordinates,0);b.uniform1i(s.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(s.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?u:1);D[0]=e*w*x.scale.x;D[1]=e*x.scale.y;b.uniform2f(s.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(s.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(s.alignment,x.alignment.x,x.alignment.y);
-b.uniform1f(s.opacity,x.opacity);b.uniform3f(s.color,x.color.r,x.color.g,x.color.b);b.uniform1f(s.rotation,x.rotation);b.uniform2fv(s.scale,D);if(x.mergeWith3D&&!H){b.enable(b.DEPTH_TEST);H=true}else if(!x.mergeWith3D&&H){b.disable(b.DEPTH_TEST);H=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)}}};
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,h,i,l,k,j;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++]=0;d[a++]=1;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++]=0;d[a++]=1;a=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),u=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(u,a.vertexShader);b.compileShader(p);b.compileShader(u);b.attachShader(m,p);b.attachShader(m,u);b.linkProgram(m);i=m;l={};k={};l.position=b.getAttribLocation(i,"position");l.uv=b.getAttribLocation(i,"uv");k.uvOffset=b.getUniformLocation(i,"uvOffset");k.uvScale=b.getUniformLocation(i,
+"uvScale");k.rotation=b.getUniformLocation(i,"rotation");k.scale=b.getUniformLocation(i,"scale");k.alignment=b.getUniformLocation(i,"alignment");k.color=b.getUniformLocation(i,"color");k.map=b.getUniformLocation(i,"map");k.opacity=b.getUniformLocation(i,"opacity");k.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(i,"affectedByDistance");k.screenPosition=b.getUniformLocation(i,"screenPosition");k.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");
+k.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");j=false};this.render=function(d,e,p,u){var d=d.__webglSprites,n=d.length;if(n){var q=l,r=k,w=u/p,p=p*0.5,v=u*0.5,H=true;b.useProgram(i);if(!j){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);j=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,
+h);b.uniformMatrix4fv(r.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(r.map,0);for(var x,D=[],q=0;q<n;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<n;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(r.useScreenCoordinates,1);
+b.uniform3f(r.screenPosition,(x.position.x-p)/p,(v-x.position.y)/v,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(r.useScreenCoordinates,0);b.uniform1i(r.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(r.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?u:1);D[0]=e*w*x.scale.x;D[1]=e*x.scale.y;b.uniform2f(r.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(r.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(r.alignment,x.alignment.x,x.alignment.y);
+b.uniform1f(r.opacity,x.opacity);b.uniform3f(r.color,x.color.r,x.color.g,x.color.b);b.uniform1f(r.rotation,x.rotation);b.uniform2fv(r.scale,D);if(x.mergeWith3D&&!H){b.enable(b.DEPTH_TEST);H=true}else if(!x.mergeWith3D&&H){b.disable(b.DEPTH_TEST);H=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)}}};
 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}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\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 sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",