Browse Source

Added shadow casting for SkinnedMeshes.

alteredq 13 years ago
parent
commit
80bc18fba6

+ 362 - 361
build/Three.js

@@ -17,9 +17,9 @@ 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=
 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())},
 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,
 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],o=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(o));if(Math.abs(o)<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(o,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(o,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],i=d[5],j=d[9],l=d[2],o=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(-l,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(o));if(Math.abs(o)<0.99999){this.y=Math.atan2(-l,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(l));if(Math.abs(l)<0.99999){this.x=Math.atan2(o,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(-l,
+e)}else{this.x=0;this.y=Math.atan2(l,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(o,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===
 "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*
 "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=
 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};
 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};
@@ -29,40 +29,40 @@ normalize:function(){return this.divideScalar(this.length())},setLength:function
 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>
 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.0010&&(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}};
 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.0010&&(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}};
 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.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],o=c[9],k=c[10],p=c[11],r=c[12],n=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+o,c+n);b[3].set(f-d,j-h,p-o,c-n);b[4].set(f-e,j-i,p-k,c-q);b[5].set(f+e,j+i,p+k,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],i=c[6],j=c[7],l=c[8],o=c[9],n=c[10],p=c[11],r=c[12],m=c[13],q=c[14],c=c[15];b[0].set(f-a,j-g,p-l,c-r);b[1].set(f+a,j+g,p+l,c+r);b[2].set(f+d,j+h,p+o,c+m);b[3].set(f-d,j-h,p-o,c-m);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.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.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,o=new THREE.Vector3,k=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,s,u,w,t=function(a,b,c){r.sub(c,a);s=r.dot(b);u=n.add(a,q.copy(b).multiplyScalar(s));
-return w=c.distanceTo(u)},x,F,C,z,v,H,E,O,Q=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);x=r.dot(r);F=r.dot(n);C=r.dot(q);z=n.dot(n);v=n.dot(q);H=1/(x*z-F*F);E=(z*C-F*v)*H;O=(x*v-F*C)*H;return E>=0&&O>=0&&E+O<1},Y=1.0E-4;this.setPrecision=function(a){Y=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var n=0,r=a.children.length;n<r;n++)Array.prototype.push.apply(d,this.intersectObject(a.children[n],b));if(a instanceof THREE.Particle){w=t(this.origin,this.direction,a.matrixWorld.getPosition());
-if(w>a.scale.x)return[];c={distance:w,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));w=t(this.origin,this.direction,a.matrixWorld.getPosition());if(w>n)return d;var q,s,u=a.geometry,v=u.vertices,x;a.matrixRotationWorld.extractRotation(a.matrixWorld);n=0;for(r=u.faces.length;n<
-r;n++){c=u.faces[n];i.copy(this.origin);j.copy(this.direction);x=a.matrixWorld;m=x.multiplyVector3(m.copy(c.centroid)).subSelf(i);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));q=j.dot(o);if(!(Math.abs(q)<Y)){s=o.dot(m)/q;if(!(s<0)&&(a.doubleSided||(a.flipSided?q>0:q<0))){k.add(i,j.multiplyScalar(s));w=i.distanceTo(k);if(!(w<this.near)&&!(w>this.far))if(c instanceof THREE.Face3){e=x.multiplyVector3(e.copy(v[c.a]));f=x.multiplyVector3(f.copy(v[c.b]));g=x.multiplyVector3(g.copy(v[c.c]));
-if(Q(k,e,f,g)){c={distance:w,point:k.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=x.multiplyVector3(e.copy(v[c.a]));f=x.multiplyVector3(f.copy(v[c.b]));g=x.multiplyVector3(g.copy(v[c.c]));h=x.multiplyVector3(h.copy(v[c.d]));if(Q(k,e,f,h)||Q(k,f,g,h)){c={distance:w,point:k.clone(),face:c,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);
+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,l=new THREE.Vector3,o=new THREE.Vector3,n=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,s,u,t,v=function(a,b,c){r.sub(c,a);s=r.dot(b);u=m.add(a,q.copy(b).multiplyScalar(s));
+return t=c.distanceTo(u)},x,F,C,z,w,H,E,O,Q=function(a,b,c,d){r.sub(d,b);m.sub(c,b);q.sub(a,b);x=r.dot(r);F=r.dot(m);C=r.dot(q);z=m.dot(m);w=m.dot(q);H=1/(x*z-F*F);E=(z*C-F*w)*H;O=(x*w-F*C)*H;return E>=0&&O>=0&&E+O<1},Y=1.0E-4;this.setPrecision=function(a){Y=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var m=0,r=a.children.length;m<r;m++)Array.prototype.push.apply(d,this.intersectObject(a.children[m],b));if(a instanceof THREE.Particle){t=v(this.origin,this.direction,a.matrixWorld.getPosition());
+if(t>a.scale.x)return[];c={distance:t,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){m=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());m=a.geometry.boundingSphere.radius*Math.max(m.x,Math.max(m.y,m.z));t=v(this.origin,this.direction,a.matrixWorld.getPosition());if(t>m)return d;var q,s,w=a.geometry,u=w.vertices,x;a.matrixRotationWorld.extractRotation(a.matrixWorld);m=0;for(r=w.faces.length;m<
+r;m++){c=w.faces[m];i.copy(this.origin);j.copy(this.direction);x=a.matrixWorld;l=x.multiplyVector3(l.copy(c.centroid)).subSelf(i);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));q=j.dot(o);if(!(Math.abs(q)<Y)){s=o.dot(l)/q;if(!(s<0)&&(a.doubleSided||(a.flipSided?q>0:q<0))){n.add(i,j.multiplyScalar(s));t=i.distanceTo(n);if(!(t<this.near)&&!(t>this.far))if(c instanceof THREE.Face3){e=x.multiplyVector3(e.copy(u[c.a]));f=x.multiplyVector3(f.copy(u[c.b]));g=x.multiplyVector3(g.copy(u[c.c]));
+if(Q(n,e,f,g)){c={distance:t,point:n.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=x.multiplyVector3(e.copy(u[c.a]));f=x.multiplyVector3(f.copy(u[c.b]));g=x.multiplyVector3(g.copy(u[c.c]));h=x.multiplyVector3(h.copy(u[c.d]));if(Q(n,e,f,h)||Q(n,f,g,h)){c={distance:t,point:n.clone(),face:c,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}};
 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,o){h=false;b=f;c=g;d=m;e=o;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,o,k,p){if(h===true){h=false;b=f<m?f<k?f:k:m<k?m:k;c=g<o?g<p?g:p:o<p?o:p;d=f>m?f>k?f:k:m>k?m:k;e=g>o?g>p?g:p:o>p?o:p}else{b=f<m?f<k?f<b?f:b:k<b?k:b:m<k?m<b?m:b:k<b?k:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>m?f>k?f>d?f:d:k>d?k:d:m>k?m>d?m:d:k>d?k:d;e=g>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h===true){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();
+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,l,o){h=false;b=f;c=g;d=l;e=o;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,l,o,n,p){if(h===true){h=false;b=f<l?f<n?f:n:l<n?l:n;c=g<o?g<p?g:p:o<p?o:p;d=f>l?f>n?f:n:l>n?l:n;e=g>o?g>p?g:p:o>p?o:p}else{b=f<l?f<n?f<b?f:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>l?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d;e=g>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h===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}};
 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.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,o,k,p,r,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,g||0,h||0,i||0,j||0,m!==void 0?m:1,o||0,k||0,p||0,r||0,n!==void 0?n:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,m,o,k,p,r,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]=g;q[13]=h;q[2]=i;q[6]=j;q[10]=m;q[14]=o;q[3]=k;q[7]=p;q[11]=r;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,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],o=c[9],k=c[13],p=c[2],r=c[6],n=c[10],q=c[14],s=c[3],u=c[7],w=c[11],c=c[15],t=d[0],x=d[4],
-F=d[8],C=d[12],z=d[1],v=d[5],H=d[9],E=d[13],O=d[2],Q=d[6],Y=d[10],B=d[14],J=d[3],P=d[7],D=d[11],d=d[15];e[0]=f*t+g*z+h*O+i*J;e[4]=f*x+g*v+h*Q+i*P;e[8]=f*F+g*H+h*Y+i*D;e[12]=f*C+g*E+h*B+i*d;e[1]=j*t+m*z+o*O+k*J;e[5]=j*x+m*v+o*Q+k*P;e[9]=j*F+m*H+o*Y+k*D;e[13]=j*C+m*E+o*B+k*d;e[2]=p*t+r*z+n*O+q*J;e[6]=p*x+r*v+n*Q+q*P;e[10]=p*F+r*H+n*Y+q*D;e[14]=p*C+r*E+n*B+q*d;e[3]=s*t+u*z+w*O+c*J;e[7]=s*x+u*v+w*Q+c*P;e[11]=s*F+u*H+w*Y+c*D;e[15]=s*C+u*E+w*B+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],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,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*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,l,o,n,p,r,m){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,j||0,l!==void 0?l:1,o||0,n||0,p||0,r||0,m!==void 0?m:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,l,o,n,p,r,m){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=j;q[10]=l;q[14]=o;q[3]=n;q[7]=p;q[11]=r;q[15]=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],o=c[9],n=c[13],p=c[2],r=c[6],m=c[10],q=c[14],s=c[3],u=c[7],t=c[11],c=c[15],v=d[0],x=d[4],
+F=d[8],C=d[12],z=d[1],w=d[5],H=d[9],E=d[13],O=d[2],Q=d[6],Y=d[10],B=d[14],J=d[3],P=d[7],D=d[11],d=d[15];e[0]=f*v+g*z+h*O+i*J;e[4]=f*x+g*w+h*Q+i*P;e[8]=f*F+g*H+h*Y+i*D;e[12]=f*C+g*E+h*B+i*d;e[1]=j*v+l*z+o*O+n*J;e[5]=j*x+l*w+o*Q+n*P;e[9]=j*F+l*H+o*Y+n*D;e[13]=j*C+l*E+o*B+n*d;e[2]=p*v+r*z+m*O+q*J;e[6]=p*x+r*w+m*Q+q*P;e[10]=p*F+r*H+m*Y+q*D;e[14]=p*C+r*E+m*B+q*d;e[3]=s*v+u*z+t*O+c*J;e[7]=s*x+u*w+t*Q+c*P;e[11]=s*F+u*H+t*Y+c*D;e[15]=s*C+u*E+t*B+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]=
 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,
 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]*
 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],o=a[10],k=a[14],p=a[3],r=a[7],n=a[11],a=a[15];return e*h*m*p-d*i*m*p-e*g*o*p+c*i*o*p+d*g*k*p-c*h*k*p-e*h*j*r+d*i*j*r+e*f*o*r-b*i*o*r-d*f*k*r+b*h*k*r+e*g*j*n-c*i*j*n-e*f*m*n+b*i*m*n+c*f*k*n-b*g*k*n-d*g*j*a+c*h*j*a+d*f*m*a-b*h*m*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
+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],l=a[6],o=a[10],n=a[14],p=a[3],r=a[7],m=a[11],a=a[15];return e*h*l*p-d*i*l*p-e*g*o*p+c*i*o*p+d*g*n*p-c*h*n*p-e*h*j*r+d*i*j*r+e*f*o*r-b*i*o*r-d*f*n*r+b*h*n*r+e*g*j*m-c*i*j*m-e*f*l*m+b*i*l*m+c*f*n*m-b*g*n*m-d*g*j*a+c*h*j*a+d*f*l*a-b*h*l*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
 b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];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]=
 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],
 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],o=c[2],k=c[6],p=c[10],r=c[14],n=c[3],q=c[7],s=c[11],c=c[15];b[0]=j*r*q-m*p*q+m*k*s-i*r*s-j*k*c+i*p*c;b[4]=g*p*q-f*r*q-g*k*s+e*r*s+f*k*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*k-f*m*k-g*i*p+e*m*p+f*i*r-e*j*r;b[1]=m*p*n-j*r*n-m*o*s+h*r*s+j*o*c-h*p*c;b[5]=f*r*n-g*p*n+g*o*s-d*r*s-f*o*c+d*p*c;b[9]=g*j*n-f*m*n-g*h*s+d*m*s+f*h*c-d*j*c;b[13]=f*m*o-g*j*o+g*h*p-d*
-m*p-f*h*r+d*j*r;b[2]=i*r*n-m*k*n+m*o*q-h*r*q-i*o*c+h*k*c;b[6]=g*k*n-e*r*n-g*o*q+d*r*q+e*o*c-d*k*c;b[10]=e*m*n-g*i*n+g*h*q-d*m*q-e*h*c+d*i*c;b[14]=g*i*o-e*m*o-g*h*k+d*m*k+e*h*r-d*i*r;b[3]=j*k*n-i*p*n-j*o*q+h*p*q+i*o*s-h*k*s;b[7]=e*p*n-f*k*n+f*o*q-d*p*q-e*o*s+d*k*s;b[11]=f*i*n-e*j*n-f*h*q+d*j*q+e*h*s-d*i*s;b[15]=e*j*o-f*i*o+f*h*k-d*j*k-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,o=d*i,k=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=m+o*e;c[5]=j-k*e;c[9]=-d*h;c[2]=k-j*e;c[6]=o+m*e;c[10]=g*h}else if(b==="YXZ"){j=h*i;m=h*f;o=e*i;k=e*f;c[0]=j+k*d;c[4]=o*d-m;c[8]=g*e;c[1]=g*f;c[5]=g*i;c[9]=-d;c[2]=m*d-o;c[6]=k+j*d;c[10]=g*h}else if(b==="ZXY"){j=h*i;m=h*f;o=e*i;k=e*f;c[0]=j-k*d;c[4]=-g*f;c[8]=o+m*d;c[1]=m+o*d;c[5]=g*i;c[9]=k-j*d;c[2]=-g*e;c[6]=d;c[10]=g*h}else if(b==="ZYX"){j=g*i;m=g*f;o=d*i;
-k=d*f;c[0]=h*i;c[4]=o*e-m;c[8]=j*e+k;c[1]=h*f;c[5]=k*e+j;c[9]=m*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){j=g*h;m=g*e;o=d*h;k=d*e;c[0]=h*i;c[4]=k-j*f;c[8]=o*f+m;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=m*f+o;c[10]=j-k*f}else if(b==="XZY"){j=g*h;m=g*e;o=d*h;k=d*e;c[0]=h*i;c[4]=-f;c[8]=e*i;c[1]=j*f+k;c[5]=g*i;c[9]=m*f-o;c[2]=o*f-m;c[6]=d*i;c[10]=k*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],i=c[5],j=c[9],l=c[13],o=c[2],n=c[6],p=c[10],r=c[14],m=c[3],q=c[7],s=c[11],c=c[15];b[0]=j*r*q-l*p*q+l*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*l*q-g*j*q+g*i*s-e*l*s-f*i*c+e*j*c;b[12]=g*j*n-f*l*n-g*i*p+e*l*p+f*i*r-e*j*r;b[1]=l*p*m-j*r*m-l*o*s+h*r*s+j*o*c-h*p*c;b[5]=f*r*m-g*p*m+g*o*s-d*r*s-f*o*c+d*p*c;b[9]=g*j*m-f*l*m-g*h*s+d*l*s+f*h*c-d*j*c;b[13]=f*l*o-g*j*o+g*h*p-d*
+l*p-f*h*r+d*j*r;b[2]=i*r*m-l*n*m+l*o*q-h*r*q-i*o*c+h*n*c;b[6]=g*n*m-e*r*m-g*o*q+d*r*q+e*o*c-d*n*c;b[10]=e*l*m-g*i*m+g*h*q-d*l*q-e*h*c+d*i*c;b[14]=g*i*o-e*l*o-g*h*n+d*l*n+e*h*r-d*i*r;b[3]=j*n*m-i*p*m-j*o*q+h*p*q+i*o*s-h*n*s;b[7]=e*p*m-f*n*m+f*o*q-d*p*q-e*o*s+d*n*s;b[11]=f*i*m-e*j*m-f*h*q+d*j*q+e*h*s-d*i*s;b[15]=e*j*o-f*i*o+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,l=g*f,o=d*i,n=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+o*e;c[5]=j-n*e;c[9]=-d*h;c[2]=n-j*e;c[6]=o+l*e;c[10]=g*h}else if(b==="YXZ"){j=h*i;l=h*f;o=e*i;n=e*f;c[0]=j+n*d;c[4]=o*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*i;c[9]=-d;c[2]=l*d-o;c[6]=n+j*d;c[10]=g*h}else if(b==="ZXY"){j=h*i;l=h*f;o=e*i;n=e*f;c[0]=j-n*d;c[4]=-g*f;c[8]=o+l*d;c[1]=l+o*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;l=g*f;o=d*i;
+n=d*f;c[0]=h*i;c[4]=o*e-l;c[8]=j*e+n;c[1]=h*f;c[5]=n*e+j;c[9]=l*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){j=g*h;l=g*e;o=d*h;n=d*e;c[0]=h*i;c[4]=n-j*f;c[8]=o*f+l;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=l*f+o;c[10]=j-n*f}else if(b==="XZY"){j=g*h;l=g*e;o=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]=l*f-o;c[2]=o*f-l;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,l=d*h,d=d*
+i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=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+l);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);
 g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/
 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.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),o=1-j,k=d*e*o,p=d*f*o,o=e*f*o,d=d*m,r=e*m,m=f*m,f=g+(1-g)*j,g=k+m,e=p-r,k=k-m,h=h+(1-h)*j,m=o+d,p=p+r,o=o-d,i=i+(1-i)*j,j=c[0],d=c[1],r=c[2],n=c[3],q=c[4],s=c[5],u=c[6],w=c[7],t=c[8],x=c[9],F=c[10],C=c[11];c[0]=f*j+g*q+e*t;c[1]=f*d+g*
-s+e*x;c[2]=f*r+g*u+e*F;c[3]=f*n+g*w+e*C;c[4]=k*j+h*q+m*t;c[5]=k*d+h*s+m*x;c[6]=k*r+h*u+m*F;c[7]=k*n+h*w+m*C;c[8]=p*j+o*q+i*t;c[9]=p*d+o*s+i*x;c[10]=p*r+o*u+i*F;c[11]=p*n+o*w+i*C;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],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*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],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*j;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*i+a*e;b[11]=l*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],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*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),l=Math.sin(b),o=1-j,n=d*e*o,p=d*f*o,o=e*f*o,d=d*l,r=e*l,l=f*l,f=g+(1-g)*j,g=n+l,e=p-r,n=n-l,h=h+(1-h)*j,l=o+d,p=p+r,o=o-d,i=i+(1-i)*j,j=c[0],d=c[1],r=c[2],m=c[3],q=c[4],s=c[5],u=c[6],t=c[7],v=c[8],x=c[9],F=c[10],C=c[11];c[0]=f*j+g*q+e*v;c[1]=f*d+g*
+s+e*x;c[2]=f*r+g*u+e*F;c[3]=f*m+g*t+e*C;c[4]=n*j+h*q+l*v;c[5]=n*d+h*s+l*x;c[6]=n*r+h*u+l*F;c[7]=n*m+h*t+l*C;c[8]=p*j+o*q+i*v;c[9]=p*d+o*s+i*x;c[10]=p*r+o*u+i*F;c[11]=p*m+o*t+i*C;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);
 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]=
 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],
 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],
@@ -75,24 +75,24 @@ b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:functio
 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.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)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 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)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a;if(f===g.length){a=new THREE.RenderableObject;g.push(a)}else a=g[f];f++;return a}function b(){var a;if(i===j.length){a=new THREE.RenderableVertex;j.push(a)}else a=j[i];i++;return a}function c(a,b){return b.z-a.z}function d(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,
 THREE.Projector=function(){function a(){var a;if(f===g.length){a=new THREE.RenderableObject;g.push(a)}else a=g[f];f++;return a}function b(){var a;if(i===j.length){a=new THREE.RenderableVertex;j.push(a)}else a=j[i];i++;return a}function c(a,b){return b.z-a.z}function d(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 e,f,g=[],h,i,j=[],m,o,k=[],p,r=[],n,q,s=[],u,w,t=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,C=new THREE.Vector4,z=new THREE.Matrix4,v=new THREE.Matrix4,H=new THREE.Frustum,E=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=
+g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,f,g=[],h,i,j=[],l,o,n=[],p,r=[],m,q,s=[],u,t,v=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,C=new THREE.Vector4,z=new THREE.Matrix4,w=new THREE.Matrix4,H=new THREE.Frustum,E=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=
 function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof
 function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof
 THREE.Line)&&(b.frustumCulled===false||H.contains(b)===true)){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d===true&&x.objects.sort(c);return x};this.projectScene=function(a,
 THREE.Line)&&(b.frustumCulled===false||H.contains(b)===true)){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d===true&&x.objects.sort(c);return x};this.projectScene=function(a,
-f,e){var g=f.near,F=f.far,D=false,W,R,N,ba,U,I,ca,ha,L,X,S,T,ia,ma,Aa;w=q=p=o=0;x.elements.length=0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(f)}a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);z.multiply(f.projectionMatrix,f.matrixWorldInverse);H.setFromMatrix(z);x=this.projectGraph(a,false);a=0;for(W=x.objects.length;a<W;a++){L=x.objects[a].object;X=L.matrixWorld;i=0;if(L instanceof THREE.Mesh){S=L.geometry;T=L.geometry.materials;
+f,e){var g=f.near,F=f.far,D=false,W,R,N,ba,U,I,ca,ha,L,X,S,T,ia,ma,za;t=q=p=o=0;x.elements.length=0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(f)}a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);z.multiply(f.projectionMatrix,f.matrixWorldInverse);H.setFromMatrix(z);x=this.projectGraph(a,false);a=0;for(W=x.objects.length;a<W;a++){L=x.objects[a].object;X=L.matrixWorld;i=0;if(L instanceof THREE.Mesh){S=L.geometry;T=L.geometry.materials;
 ba=S.vertices;ia=S.faces;ma=S.faceVertexUvs;S=L.matrixRotationWorld.extractRotation(X);R=0;for(N=ba.length;R<N;R++){h=b();h.positionWorld.copy(ba[R]);X.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}ba=0;for(R=ia.length;ba<R;ba++){N=ia[ba];if(N instanceof THREE.Face3){U=j[N.a];
 ba=S.vertices;ia=S.faces;ma=S.faceVertexUvs;S=L.matrixRotationWorld.extractRotation(X);R=0;for(N=ba.length;R<N;R++){h=b();h.positionWorld.copy(ba[R]);X.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}ba=0;for(R=ia.length;ba<R;ba++){N=ia[ba];if(N instanceof THREE.Face3){U=j[N.a];
-I=j[N.b];ca=j[N.c];if(U.visible===true&&I.visible===true&&ca.visible===true){D=(ca.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ca.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){ha=void 0;if(o===k.length){ha=new THREE.RenderableFace3;k.push(ha)}else ha=k[o];o++;m=ha;m.v1.copy(U);m.v2.copy(I);m.v3.copy(ca)}else continue}else continue}else if(N instanceof THREE.Face4){U=j[N.a];I=j[N.b];ca=j[N.c];
-ha=j[N.d];if(U.visible===true&&I.visible===true&&ca.visible===true&&ha.visible===true){D=(ha.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ha.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0||(I.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-(I.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){Aa=void 0;if(p===r.length){Aa=new THREE.RenderableFace4;
-r.push(Aa)}else Aa=r[p];p++;m=Aa;m.v1.copy(U);m.v2.copy(I);m.v3.copy(ca);m.v4.copy(ha)}else continue}else continue}m.normalWorld.copy(N.normal);D===false&&(L.flipSided===true||L.doubleSided===true)&&m.normalWorld.negate();S.multiplyVector3(m.normalWorld);m.centroidWorld.copy(N.centroid);X.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);z.multiplyVector3(m.centroidScreen);ca=N.vertexNormals;U=0;for(I=ca.length;U<I;U++){ha=m.vertexNormalsWorld[U];ha.copy(ca[U]);D===false&&(L.flipSided===
-true||L.doubleSided===true)&&ha.negate();S.multiplyVector3(ha)}U=0;for(I=ma.length;U<I;U++){Aa=ma[U][ba];if(Aa!==void 0){ca=0;for(ha=Aa.length;ca<ha;ca++)m.uvs[U][ca]=Aa[ca]}}m.material=L.material;m.faceMaterial=N.materialIndex!==null?T[N.materialIndex]:null;m.z=m.centroidScreen.z;x.elements.push(m)}}else if(L instanceof THREE.Line){v.multiply(z,X);ba=L.geometry.vertices;U=b();U.positionScreen.copy(ba[0]);v.multiplyVector4(U.positionScreen);X=L.type===THREE.LinePieces?2:1;R=1;for(N=ba.length;R<N;R++){U=
-b();U.positionScreen.copy(ba[R]);v.multiplyVector4(U.positionScreen);if(!((R+1)%X>0)){I=j[i-2];E.copy(U.positionScreen);O.copy(I.positionScreen);if(d(E,O)===true){E.multiplyScalar(1/E.w);O.multiplyScalar(1/O.w);T=void 0;if(q===s.length){T=new THREE.RenderableLine;s.push(T)}else T=s[q];q++;n=T;n.v1.positionScreen.copy(E);n.v2.positionScreen.copy(O);n.z=Math.max(E.z,O.z);n.material=L.material;x.elements.push(n)}}}}}a=0;for(W=x.sprites.length;a<W;a++){L=x.sprites[a].object;X=L.matrixWorld;if(L instanceof
-THREE.Particle){C.set(X.elements[12],X.elements[13],X.elements[14],1);z.multiplyVector4(C);C.z=C.z/C.w;if(C.z>0&&C.z<1){g=void 0;if(w===t.length){g=new THREE.RenderableParticle;t.push(g)}else g=t[w];w++;u=g;u.x=C.x/C.w;u.y=C.y/C.w;u.z=C.z;u.rotation=L.rotation.z;u.scale.x=L.scale.x*Math.abs(u.x-(C.x+f.projectionMatrix.elements[0])/(C.w+f.projectionMatrix.elements[12]));u.scale.y=L.scale.y*Math.abs(u.y-(C.y+f.projectionMatrix.elements[5])/(C.w+f.projectionMatrix.elements[13]));u.material=L.material;
+I=j[N.b];ca=j[N.c];if(U.visible===true&&I.visible===true&&ca.visible===true){D=(ca.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ca.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){ha=void 0;if(o===n.length){ha=new THREE.RenderableFace3;n.push(ha)}else ha=n[o];o++;l=ha;l.v1.copy(U);l.v2.copy(I);l.v3.copy(ca)}else continue}else continue}else if(N instanceof THREE.Face4){U=j[N.a];I=j[N.b];ca=j[N.c];
+ha=j[N.d];if(U.visible===true&&I.visible===true&&ca.visible===true&&ha.visible===true){D=(ha.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ha.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0||(I.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-(I.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){za=void 0;if(p===r.length){za=new THREE.RenderableFace4;
+r.push(za)}else za=r[p];p++;l=za;l.v1.copy(U);l.v2.copy(I);l.v3.copy(ca);l.v4.copy(ha)}else continue}else continue}l.normalWorld.copy(N.normal);D===false&&(L.flipSided===true||L.doubleSided===true)&&l.normalWorld.negate();S.multiplyVector3(l.normalWorld);l.centroidWorld.copy(N.centroid);X.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);z.multiplyVector3(l.centroidScreen);ca=N.vertexNormals;U=0;for(I=ca.length;U<I;U++){ha=l.vertexNormalsWorld[U];ha.copy(ca[U]);D===false&&(L.flipSided===
+true||L.doubleSided===true)&&ha.negate();S.multiplyVector3(ha)}U=0;for(I=ma.length;U<I;U++){za=ma[U][ba];if(za!==void 0){ca=0;for(ha=za.length;ca<ha;ca++)l.uvs[U][ca]=za[ca]}}l.material=L.material;l.faceMaterial=N.materialIndex!==null?T[N.materialIndex]:null;l.z=l.centroidScreen.z;x.elements.push(l)}}else if(L instanceof THREE.Line){w.multiply(z,X);ba=L.geometry.vertices;U=b();U.positionScreen.copy(ba[0]);w.multiplyVector4(U.positionScreen);X=L.type===THREE.LinePieces?2:1;R=1;for(N=ba.length;R<N;R++){U=
+b();U.positionScreen.copy(ba[R]);w.multiplyVector4(U.positionScreen);if(!((R+1)%X>0)){I=j[i-2];E.copy(U.positionScreen);O.copy(I.positionScreen);if(d(E,O)===true){E.multiplyScalar(1/E.w);O.multiplyScalar(1/O.w);T=void 0;if(q===s.length){T=new THREE.RenderableLine;s.push(T)}else T=s[q];q++;m=T;m.v1.positionScreen.copy(E);m.v2.positionScreen.copy(O);m.z=Math.max(E.z,O.z);m.material=L.material;x.elements.push(m)}}}}}a=0;for(W=x.sprites.length;a<W;a++){L=x.sprites[a].object;X=L.matrixWorld;if(L instanceof
+THREE.Particle){C.set(X.elements[12],X.elements[13],X.elements[14],1);z.multiplyVector4(C);C.z=C.z/C.w;if(C.z>0&&C.z<1){g=void 0;if(t===v.length){g=new THREE.RenderableParticle;v.push(g)}else g=v[t];t++;u=g;u.x=C.x/C.w;u.y=C.y/C.w;u.z=C.z;u.rotation=L.rotation.z;u.scale.x=L.scale.x*Math.abs(u.x-(C.x+f.projectionMatrix.elements[0])/(C.w+f.projectionMatrix.elements[12]));u.scale.y=L.scale.y*Math.abs(u.y-(C.y+f.projectionMatrix.elements[5])/(C.w+f.projectionMatrix.elements[13]));u.material=L.material;
 x.elements.push(u)}}}e&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 x.elements.push(u)}}}e&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.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=
 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*
 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;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=
 (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,
 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,o=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+m*-h-o*-g;b.y=m*i+c*-g+o*-f-j*-h;b.z=o*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.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
+f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,o=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-o*-g;b.y=l*i+c*-g+o*-f-j*-h;b.z=o*i+c*-h+j*-g-l*-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.0010){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)}};
 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)}};
 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.0010){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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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.0010){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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3=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};
@@ -109,14 +109,14 @@ for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;
 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=
 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];
 [];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,z){h=a.vertices[b];i=a.vertices[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,z){h=a.vertices[b];i=a.vertices[c];
-j=a.vertices[d];m=g[f];o=g[e];k=g[z];p=i.x-h.x;r=j.x-h.x;n=i.y-h.y;q=j.y-h.y;s=i.z-h.z;u=j.z-h.z;w=o.u-m.u;t=k.u-m.u;x=o.v-m.v;F=k.v-m.v;C=1/(w*F-t*x);E.set((F*p-x*r)*C,(F*n-x*q)*C,(F*s-x*u)*C);O.set((w*r-t*p)*C,(w*q-t*n)*C,(w*u-t*s)*C);v[b].addSelf(E);v[c].addSelf(E);v[d].addSelf(E);H[b].addSelf(O);H[c].addSelf(O);H[d].addSelf(O)}var b,c,d,e,f,g,h,i,j,m,o,k,p,r,n,q,s,u,w,t,x,F,C,z,v=[],H=[],E=new THREE.Vector3,O=new THREE.Vector3,Q=new THREE.Vector3,Y=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
-this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;H[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 J=["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++){B.copy(f.vertexNormals[d]);e=f[J[d]];z=v[e];Q.copy(z);Q.subSelf(B.multiplyScalar(B.dot(z))).normalize();
+j=a.vertices[d];l=g[f];o=g[e];n=g[z];p=i.x-h.x;r=j.x-h.x;m=i.y-h.y;q=j.y-h.y;s=i.z-h.z;u=j.z-h.z;t=o.u-l.u;v=n.u-l.u;x=o.v-l.v;F=n.v-l.v;C=1/(t*F-v*x);E.set((F*p-x*r)*C,(F*m-x*q)*C,(F*s-x*u)*C);O.set((t*r-v*p)*C,(t*q-v*m)*C,(t*u-v*s)*C);w[b].addSelf(E);w[c].addSelf(E);w[d].addSelf(E);H[b].addSelf(O);H[c].addSelf(O);H[d].addSelf(O)}var b,c,d,e,f,g,h,i,j,l,o,n,p,r,m,q,s,u,t,v,x,F,C,z,w=[],H=[],E=new THREE.Vector3,O=new THREE.Vector3,Q=new THREE.Vector3,Y=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){w[b]=new THREE.Vector3;H[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 J=["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++){B.copy(f.vertexNormals[d]);e=f[J[d]];z=w[e];Q.copy(z);Q.subSelf(B.multiplyScalar(B.dot(z))).normalize();
 Y.cross(f.vertexNormals[d],z);e=Y.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.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=
 Y.cross(f.vertexNormals[d],z);e=Y.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.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,i;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);
 [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}};THREE.GeometryCount=0;
 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}};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,o,k;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){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]];o=this.points[c[2]];k=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,m.x,o.x,k.x,g,h,i);d.y=b(j.y,m.y,o.y,k.y,g,h,i);d.z=b(j.z,m.z,o.z,k.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=
+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,l,o,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
+f+2;j=this.points[c[0]];l=this.points[c[1]];o=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,o.x,n.x,g,h,i);d.y=b(j.y,l.y,o.y,n.y,g,h,i);d.z=b(j.z,l.z,o.z,n.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,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);
 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)};
 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)};
 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.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)};
@@ -133,60 +133,60 @@ THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStat
 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=
 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=
 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,wireframe:a.wireframe};
 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,wireframe:a.wireframe};
-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.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
+if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)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.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.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
 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.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)};
+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;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=j.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(j.map){l.tDiffuse.texture=j.map;l.enableDiffuse.value=true}if(j.specularMap){l.tSpecular.texture=j.specularMap;l.enableSpecular.value=true}if(j.lightMap){l.tAO.texture=j.lightMap;
+l.enableAO.value=true}l.uDiffuseColor.value.setHex(j.color);l.uSpecularColor.value.setHex(j.specular);l.uAmbientColor.value.setHex(j.ambient);l.uShininess.value=j.shininess;if(j.opacity!==void 0)l.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,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)};
 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.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
 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,o,k,p,r,n,q,s,u,w,t;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,f,e,g,h,i,j,m,k=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=k[d*3];e=k[d*3+1];g=k[d*3+2];h=P[f*2];f=P[f*2+1];i=P[e*2];j=P[e*2+1];e=P[g*2];m=P[g*2+1];g=Y.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 v(b,c){var d,f,e,g,h,i,j,m,k,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=P[f*2];f=P[f*2+1];j=P[e*2];k=P[e*2+1];m=P[g*2];n=P[g*2+1];g=P[h*2];e=P[h*2+1];h=Y.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(j,k));p.push(new THREE.UV(m,n));p.push(new THREE.UV(g,e));h.push(p)}}function H(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];
-Y.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function E(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];Y.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,k,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];k=d[f*3+2];i=n[f];var o=J[m*3],p=J[m*3+1];m=J[m*3+2];var r=J[k*3],
-q=J[k*3+1];k=J[k*3+2];Y.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(J[j*3],J[j*3+1],J[j*3+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(r,q,k)],null,i))}}function Q(b,c,d,f){for(var e,g,h,i,j,m,k,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];k=d[f*4+1];n=d[f*4+2];o=d[f*4+3];j=p[f];var r=J[k*3],q=J[k*3+1];k=J[k*3+2];var s=J[n*3],t=J[n*3+1];n=J[n*3+2];var u=J[o*3],v=J[o*3+1];o=J[o*3+2];Y.faces.push(new THREE.Face4(e,
-g,h,i,[new THREE.Vector3(J[m*3],J[m*3+1],J[m*3+2]),new THREE.Vector3(r,q,k),new THREE.Vector3(s,t,n),new THREE.Vector3(u,v,o)],null,j))}}var Y=this,B=0,J=[],P=[],D,W,R;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Y,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,B,12);c=F(a,B+12);F(a,B+13);F(a,B+14);F(a,B+15);e=F(a,B+16);i=F(a,B+17);j=F(a,B+18);m=F(a,B+19);o=C(a,B+20);k=C(a,B+20+4);p=C(a,B+20+8);b=C(a,B+20+12);r=
-C(a,B+20+16);n=C(a,B+20+20);q=C(a,B+20+24);s=C(a,B+20+28);u=C(a,B+20+32);w=C(a,B+20+36);t=C(a,B+20+40);B=B+c;c=e*3+m;R=e*4+m;D=b*c;W=r*(c+i*3);e=n*(c+j*3);m=q*(c+i*3+j*3);c=s*R;i=u*(R+i*4);j=w*(R+j*4);B=B+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];Y.vertices.push(new THREE.Vector3(d,f,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(k){var b=new Int8Array(a,b,k*3),c,d,f,e;for(c=0;c<k;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];J.push(d/
-127,f/127,e/127)}}return k*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(k*3);B=B+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];P.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);D=B+D+x(b*2);W=D+W+x(r*2);e=W+e+x(n*2);m=e+m+x(q*2);c=m+c+x(s*2);i=c+i+x(u*2);j=i+j+x(w*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;H(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);z(n,b)}})(W);(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);z(q,c)}})(e);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;E(w,a,b+w*Uint32Array.BYTES_PER_ELEMENT*4);v(w,b)}})(i);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4,c=b+t*Uint32Array.BYTES_PER_ELEMENT*4;Q(t,a,b,c+t*Uint32Array.BYTES_PER_ELEMENT*4);v(t,c)}})(j);b&&H(b,B,B+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)}})(D);s&&E(s,m,m+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;Q(u,a,b,b+u*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.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,l,o,n,p,r,m,q,s,u,t,v;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,f,e,g,h,i,j,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=m[d*3];e=m[d*3+1];g=m[d*3+2];h=P[f*2];f=P[f*2+1];i=P[e*2];j=P[e*2+1];e=P[g*2];l=P[g*2+1];g=Y.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,f));n.push(new THREE.UV(i,j));n.push(new THREE.UV(e,
+l));g.push(n)}}function w(b,c){var d,f,e,g,h,i,j,l,m,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=P[f*2];f=P[f*2+1];j=P[e*2];m=P[e*2+1];l=P[g*2];n=P[g*2+1];g=P[h*2];e=P[h*2+1];h=Y.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(j,m));p.push(new THREE.UV(l,n));p.push(new THREE.UV(g,e));h.push(p)}}function H(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];
+Y.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function E(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];Y.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,l,m,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];l=d[f*3+1];m=d[f*3+2];i=n[f];var o=J[l*3],p=J[l*3+1];l=J[l*3+2];var r=J[m*3],
+q=J[m*3+1];m=J[m*3+2];Y.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(J[j*3],J[j*3+1],J[j*3+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(r,q,m)],null,i))}}function Q(b,c,d,f){for(var e,g,h,i,j,l,m,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];l=d[f*4];m=d[f*4+1];n=d[f*4+2];o=d[f*4+3];j=p[f];var r=J[m*3],q=J[m*3+1];m=J[m*3+2];var s=J[n*3],v=J[n*3+1];n=J[n*3+2];var w=J[o*3],t=J[o*3+1];o=J[o*3+2];Y.faces.push(new THREE.Face4(e,
+g,h,i,[new THREE.Vector3(J[l*3],J[l*3+1],J[l*3+2]),new THREE.Vector3(r,q,m),new THREE.Vector3(s,v,n),new THREE.Vector3(w,t,o)],null,j))}}var Y=this,B=0,J=[],P=[],D,W,R;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Y,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,B,12);c=F(a,B+12);F(a,B+13);F(a,B+14);F(a,B+15);e=F(a,B+16);i=F(a,B+17);j=F(a,B+18);l=F(a,B+19);o=C(a,B+20);n=C(a,B+20+4);p=C(a,B+20+8);b=C(a,B+20+12);r=
+C(a,B+20+16);m=C(a,B+20+20);q=C(a,B+20+24);s=C(a,B+20+28);u=C(a,B+20+32);t=C(a,B+20+36);v=C(a,B+20+40);B=B+c;c=e*3+l;R=e*4+l;D=b*c;W=r*(c+i*3);e=m*(c+j*3);l=q*(c+i*3+j*3);c=s*R;i=u*(R+i*4);j=t*(R+j*4);B=B+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];Y.vertices.push(new THREE.Vector3(d,f,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+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];J.push(d/
+127,f/127,e/127)}}return n*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(n*3);B=B+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];P.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);D=B+D+x(b*2);W=D+W+x(r*2);e=W+e+x(m*2);l=e+l+x(q*2);c=l+c+x(s*2);i=c+i+x(u*2);j=i+j+x(t*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;H(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);z(m,b)}})(W);(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);z(q,c)}})(e);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;E(t,a,b+t*Uint32Array.BYTES_PER_ELEMENT*4);w(t,b)}})(i);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4,c=b+v*Uint32Array.BYTES_PER_ELEMENT*4;Q(v,a,b,c+v*Uint32Array.BYTES_PER_ELEMENT*4);w(v,c)}})(j);b&&H(b,B,B+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)}})(D);s&&E(s,l,l+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;Q(u,a,b,b+u*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){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},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.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},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.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.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"));
 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)};
 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,o,k,p,r,n,q,s,u,w,t=a.faces;o=a.vertices;var x=a.normals,F=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(m=o.length;j<m;){k=new THREE.Vector3;k.x=o[j++]*b;k.y=o[j++]*b;k.z=o[j++]*b;d.vertices.push(k)}j=0;for(m=t.length;j<m;){b=t[j++];o=b&1;i=b&2;c=b&
-4;e=b&8;p=b&16;k=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=t[j++];q.b=t[j++];q.c=t[j++];q.d=t[j++];o=4}else{q=new THREE.Face3;q.a=t[j++];q.b=t[j++];q.c=t[j++];o=3}if(i){i=t[j++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<C;c++){s=a.uvs[c];r=t[j++];w=s[r*2];r=s[r*2+1];d.faceUvs[c][i]=new THREE.UV(w,r)}if(e)for(c=0;c<C;c++){s=a.uvs[c];u=[];for(e=0;e<o;e++){r=t[j++];w=s[r*2];r=s[r*2+1];u[e]=new THREE.UV(w,r)}d.faceVertexUvs[c][i]=u}if(p){p=t[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
-e.z=x[p];q.normal=e}if(k)for(c=0;c<o;c++){p=t[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(n){k=t[j++];k=new THREE.Color(F[k]);q.color=k}if(b)for(c=0;c<o;c++){k=t[j++];k=new THREE.Color(F[k]);q.vertexColors.push(k)}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,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=[];m=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;i=0;for(j=o.length;i<j;i=i+3){var k=new THREE.Vector3;k.x=o[i]*b;k.y=o[i+1]*b;k.z=o[i+2]*b;m.push(k)}}}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){o=new THREE.Color(16755200);o.setRGB(m[b],m[b+1],m[b+2]);j.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.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,l,o,n,p,r,m,q,s,u,t,v=a.faces;o=a.vertices;var x=a.normals,F=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(l=o.length;j<l;){n=new THREE.Vector3;n.x=o[j++]*b;n.y=o[j++]*b;n.z=o[j++]*b;d.vertices.push(n)}j=0;for(l=v.length;j<l;){b=v[j++];o=b&1;i=b&2;c=b&
+4;e=b&8;p=b&16;n=b&32;m=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=v[j++];q.b=v[j++];q.c=v[j++];q.d=v[j++];o=4}else{q=new THREE.Face3;q.a=v[j++];q.b=v[j++];q.c=v[j++];o=3}if(i){i=v[j++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<C;c++){s=a.uvs[c];r=v[j++];t=s[r*2];r=s[r*2+1];d.faceUvs[c][i]=new THREE.UV(t,r)}if(e)for(c=0;c<C;c++){s=a.uvs[c];u=[];for(e=0;e<o;e++){r=v[j++];t=s[r*2];r=s[r*2+1];u[e]=new THREE.UV(t,r)}d.faceVertexUvs[c][i]=u}if(p){p=v[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
+e.z=x[p];q.normal=e}if(n)for(c=0;c<o;c++){p=v[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(m){n=v[j++];n=new THREE.Color(F[n]);q.color=n}if(b)for(c=0;c<o;c++){n=v[j++];n=new THREE.Color(F[n]);q.vertexColors.push(n)}d.faces.push(q)}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){e=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,j,l,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;i=0;for(j=o.length;i<j;i=i+3){var n=new THREE.Vector3;n.x=o[i]*b;n.y=o[i+1]*b;n.z=o[i+2]*b;l.push(n)}}}if(a.morphColors!==
+void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b=b+3){o=new THREE.Color(16755200);o.setRGB(l[b],l[b+1],l[b+2]);j.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",
 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=
 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=
-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},o="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var p=g.shading.toLowerCase();p==="phong"?o="MeshPhongMaterial":p==="basic"&&(o="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=m(g.colorDiffuse);else if(g.DbgColor)k.color=g.DbgColor;if(g.colorSpecular)k.specular=m(g.colorSpecular);if(g.colorAmbient)k.ambient=m(g.colorAmbient);
-if(g.transparency)k.opacity=g.transparency;if(g.specularCoef)k.shininess=g.specularCoef;g.mapDiffuse&&j(k,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(k,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&j(k,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(k,"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=k.normalMap;if(g.mapNormalFactor)m.uNormalScale.value=g.mapNormalFactor;if(k.map){m.tDiffuse.texture=k.map;m.enableDiffuse.value=true}if(k.specularMap){m.tSpecular.texture=k.specularMap;m.enableSpecular.value=true}if(k.lightMap){m.tAO.texture=k.lightMap;m.enableAO.value=true}m.uDiffuseColor.value.setHex(k.color);m.uSpecularColor.value.setHex(k.specular);m.uAmbientColor.value.setHex(k.ambient);m.uShininess.value=k.shininess;if(k.opacity!==void 0)m.uOpacity.value=
-k.opacity;k=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:m,lights:true,fog:true})}else k=new THREE[o](k);if(g.DbgName!==void 0)k.name=g.DbgName;d.materials[f]=k}}var g=a.faces,r=a.vertices,k=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]=[]}o=0;for(p=r.length;o<p;){var n=new THREE.Vector3;n.x=r[o++]*e;n.y=r[o++]*e;n.z=r[o++]*e;d.vertices.push(n)}o=0;for(p=g.length;o<
-p;){var q=g[o++],s=q&2,f=q&4,u=q&8,w=q&16,r=q&32,t=q&64,n=q&128;if(q&1){q=new THREE.Face4;q.a=g[o++];q.b=g[o++];q.c=g[o++];q.d=g[o++];var x=4}else{q=new THREE.Face3;q.a=g[o++];q.b=g[o++];q.c=g[o++];x=3}if(s){s=g[o++];q.materialIndex=s}var F=d.faces.length;if(f)for(f=0;f<m;f++){var C=a.uvs[f],s=g[o++],z=C[s*2],s=C[s*2+1];d.faceUvs[f][F]=new THREE.UV(z,s)}if(u)for(f=0;f<m;f++){for(var C=a.uvs[f],u=[],v=0;v<x;v++){s=g[o++];z=C[s*2];s=C[s*2+1];u[v]=new THREE.UV(z,s)}d.faceVertexUvs[f][F]=u}if(w){w=g[o++]*
-3;s=new THREE.Vector3;s.x=k[w++];s.y=k[w++];s.z=k[w];q.normal=s}if(r)for(f=0;f<x;f++){w=g[o++]*3;s=new THREE.Vector3;s.x=k[w++];s.y=k[w++];s.z=k[w];q.vertexNormals.push(s)}if(t){r=g[o++];q.color=new THREE.Color(j[r])}if(n)for(f=0;f<x;f++){r=g[o++];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){k=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],k,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=[];k=d.morphTargets[f].vertices;j=a.morphTargets[f].vertices;s=0;for(m=j.length;s<m;s=s+3){n=new THREE.Vector3;n.x=j[s]*e;n.y=j[s+1]*e;n.z=j[s+2]*e;k.push(n)}}}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;k=0;for(m=j.length;k<m;k=k+3){o=new THREE.Color(16755200);o.setRGB(j[k],j[k+1],j[k+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(){}};
+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 l=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);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)},l=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},o="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var p=g.shading.toLowerCase();p==="phong"?o="MeshPhongMaterial":p==="basic"&&(o="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=l(g.colorDiffuse);else if(g.DbgColor)n.color=g.DbgColor;if(g.colorSpecular)n.specular=l(g.colorSpecular);if(g.colorAmbient)n.ambient=l(g.colorAmbient);
+if(g.transparency)n.opacity=g.transparency;if(g.specularCoef)n.shininess=g.specularCoef;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.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;
+l=THREE.UniformsUtils.clone(j.uniforms);l.tNormal.texture=n.normalMap;if(g.mapNormalFactor)l.uNormalScale.value=g.mapNormalFactor;if(n.map){l.tDiffuse.texture=n.map;l.enableDiffuse.value=true}if(n.specularMap){l.tSpecular.texture=n.specularMap;l.enableSpecular.value=true}if(n.lightMap){l.tAO.texture=n.lightMap;l.enableAO.value=true}l.uDiffuseColor.value.setHex(n.color);l.uSpecularColor.value.setHex(n.specular);l.uAmbientColor.value.setHex(n.ambient);l.uShininess.value=n.shininess;if(n.opacity!==void 0)l.uOpacity.value=
+n.opacity;n=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:l,lights:true,fog:true})}else n=new THREE[o](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,l=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&l++;for(f=0;f<l;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}o=0;for(p=r.length;o<p;){var m=new THREE.Vector3;m.x=r[o++]*e;m.y=r[o++]*e;m.z=r[o++]*e;d.vertices.push(m)}o=0;for(p=g.length;o<
+p;){var q=g[o++],s=q&2,f=q&4,u=q&8,t=q&16,r=q&32,v=q&64,m=q&128;if(q&1){q=new THREE.Face4;q.a=g[o++];q.b=g[o++];q.c=g[o++];q.d=g[o++];var x=4}else{q=new THREE.Face3;q.a=g[o++];q.b=g[o++];q.c=g[o++];x=3}if(s){s=g[o++];q.materialIndex=s}var F=d.faces.length;if(f)for(f=0;f<l;f++){var C=a.uvs[f],s=g[o++],z=C[s*2],s=C[s*2+1];d.faceUvs[f][F]=new THREE.UV(z,s)}if(u)for(f=0;f<l;f++){for(var C=a.uvs[f],u=[],w=0;w<x;w++){s=g[o++];z=C[s*2];s=C[s*2+1];u[w]=new THREE.UV(z,s)}d.faceVertexUvs[f][F]=u}if(t){t=g[o++]*
+3;s=new THREE.Vector3;s.x=n[t++];s.y=n[t++];s.z=n[t];q.normal=s}if(r)for(f=0;f<x;f++){t=g[o++]*3;s=new THREE.Vector3;s.x=n[t++];s.y=n[t++];s.z=n[t];q.vertexNormals.push(s)}if(v){r=g[o++];q.color=new THREE.Color(j[r])}if(m)for(f=0;f<x;f++){r=g[o++];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(l=j.length;s<l;s=s+3){m=new THREE.Vector3;m.x=j[s]*e;m.y=j[s+1]*e;m.z=j[s+2]*e;n.push(m)}}}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(l=j.length;n<l;n=n+3){o=new THREE.Color(16755200);o.setRGB(j[n],j[n+1],j[n+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.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.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(){var a;for(k in B.objects)if(!N.objects[k]){s=B.objects[k];if(s.geometry!==void 0){if(E=N.geometries[s.geometry]){a=false;O=N.materials[s.materials[0]];(a=O instanceof THREE.ShaderMaterial)&&E.computeTangents();x=s.position;F=s.rotation;C=s.quaternion;z=s.scale;u=s.matrix;C=0;s.materials.length==0&&(O=new THREE.MeshFaceMaterial);s.materials.length>1&&(O=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(E,O);a.name=k;if(u){a.matrixAutoUpdate=false;a.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{a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2])}a.visible=s.visible;a.doubleSided=s.doubleSided;a.castShadow=s.castShadow;a.receiveShadow=s.receiveShadow;N.scene.add(a);N.objects[k]=a}}else{x=s.position;F=s.rotation;C=s.quaternion;
-z=s.scale;C=0;a=new THREE.Object3D;a.name=k;a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2]);a.visible=s.visible!==void 0?s.visible:false;N.scene.add(a);N.objects[k]=a;N.empties[k]=a}}}function f(a){return function(b){N.geometries[a]=b;e();P=P-1;i.onLoadComplete();h()}}function g(a){return function(b){N.geometries[a]=b}}function h(){i.callbackProgress({totalModels:W,totalTextures:R,loadedModels:W-
-P,loadedTextures:R-D},N);i.onLoadProgress();P===0&&D===0&&b(N)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),m,o,k,p,r,n,q,s,u,w,t,x,F,C,z,v,H,E,O,Q,Y,B,J,P,D,W,R,N;B=a;c=new THREE.BinaryLoader;J=new THREE.JSONLoader;D=P=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;w=B.transform.rotation;v=B.transform.scale;a&&N.scene.position.set(a[0],a[1],a[2]);w&&N.scene.rotation.set(w[0],w[1],
-w[2]);v&&N.scene.scale.set(v[0],v[1],v[2]);if(a||w||v){N.scene.updateMatrix();N.scene.updateMatrixWorld()}}a=function(a){return function(){D=D-a;h();i.onLoadComplete()}};for(r in B.cameras){v=B.cameras[r];v.type==="perspective"?Q=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type==="ortho"&&(Q=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));x=v.position;w=v.target;v=v.up;Q.position.set(x[0],x[1],x[2]);Q.target=new THREE.Vector3(w[0],w[1],w[2]);v&&Q.up.set(v[0],
-v[1],v[2]);N.cameras[r]=Q}for(p in B.lights){w=B.lights[p];r=w.color!==void 0?w.color:16777215;Q=w.intensity!==void 0?w.intensity:1;if(w.type==="directional"){x=w.direction;t=new THREE.DirectionalLight(r,Q);t.position.set(x[0],x[1],x[2]);t.position.normalize()}else if(w.type==="point"){x=w.position;t=w.distance;t=new THREE.PointLight(r,Q,t);t.position.set(x[0],x[1],x[2])}else w.type==="ambient"&&(t=new THREE.AmbientLight(r));N.scene.add(t);N.lights[p]=t}for(n in B.fogs){p=B.fogs[n];p.type==="linear"?
-Y=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(Y=new THREE.FogExp2(0,p.density));v=p.color;Y.color.setRGB(v[0],v[1],v[2]);N.fogs[n]=Y}if(N.cameras&&B.defaults.camera)N.currentCamera=N.cameras[B.defaults.camera];if(N.fogs&&B.defaults.fog)N.scene.fog=N.fogs[B.defaults.fog];v=B.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(v[0],v[1],v[2]);N.bgColorAlpha=B.defaults.bgalpha;for(m in B.geometries){n=B.geometries[m];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){P=P+1;i.onLoadStart()}}W=P;
-for(m in B.geometries){n=B.geometries[m];if(n.type==="cube"){E=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);N.geometries[m]=E}else if(n.type==="plane"){E=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);N.geometries[m]=E}else if(n.type==="sphere"){E=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);N.geometries[m]=E}else if(n.type==="cylinder"){E=new THREE.CylinderGeometry(n.topRad,
-n.botRad,n.height,n.radSegs,n.heightSegs);N.geometries[m]=E}else if(n.type==="torus"){E=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);N.geometries[m]=E}else if(n.type==="icosahedron"){E=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);N.geometries[m]=E}else if(n.type==="bin_mesh")c.load(d(n.url,B.urlBaseType),f(m));else if(n.type==="ascii_mesh")J.load(d(n.url,B.urlBaseType),f(m));else if(n.type==="embedded_mesh"){n=B.embeds[n.id];n.metadata=B.metadata;n&&J.createModel(n,g(m),
-"")}}for(q in B.textures){m=B.textures[q];if(m.url instanceof Array){D=D+m.url.length;for(n=0;n<m.url.length;n++)i.onLoadStart()}else{D=D+1;i.onLoadStart()}}R=D;for(q in B.textures){m=B.textures[q];if(m.mapping!==void 0&&THREE[m.mapping]!==void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){n=m.url.length;Y=[];for(c=0;c<n;c++)Y[c]=d(m.url[c],B.urlBaseType);n=THREE.ImageUtils.loadTextureCube(Y,m.mapping,a(n))}else{n=THREE.ImageUtils.loadTexture(d(m.url,B.urlBaseType),m.mapping,a(1));if(THREE[m.minFilter]!==
-void 0)n.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!==void 0)n.magFilter=THREE[m.magFilter];if(m.repeat){n.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!==1)n.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!==1)n.wrapT=THREE.RepeatWrapping}m.offset&&n.offset.set(m.offset[0],m.offset[1]);if(m.wrap){Y={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Y[m.wrap[0]]!==void 0)n.wrapS=Y[m.wrap[0]];if(Y[m.wrap[1]]!==void 0)n.wrapT=Y[m.wrap[1]]}}N.textures[q]=n}for(o in B.materials){u=
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(n in B.objects)if(!N.objects[n]){s=B.objects[n];if(s.geometry!==void 0){if(E=N.geometries[s.geometry]){a=false;O=N.materials[s.materials[0]];(a=O instanceof THREE.ShaderMaterial)&&E.computeTangents();x=s.position;F=s.rotation;C=s.quaternion;z=s.scale;u=s.matrix;C=0;s.materials.length==0&&(O=new THREE.MeshFaceMaterial);s.materials.length>1&&(O=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(E,O);a.name=n;if(u){a.matrixAutoUpdate=false;a.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{a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2])}a.visible=s.visible;a.doubleSided=s.doubleSided;a.castShadow=s.castShadow;a.receiveShadow=s.receiveShadow;N.scene.add(a);N.objects[n]=a}}else{x=s.position;F=s.rotation;C=s.quaternion;
+z=s.scale;C=0;a=new THREE.Object3D;a.name=n;a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2]);a.visible=s.visible!==void 0?s.visible:false;N.scene.add(a);N.objects[n]=a;N.empties[n]=a}}}function f(a){return function(b){N.geometries[a]=b;e();P=P-1;i.onLoadComplete();h()}}function g(a){return function(b){N.geometries[a]=b}}function h(){i.callbackProgress({totalModels:W,totalTextures:R,loadedModels:W-
+P,loadedTextures:R-D},N);i.onLoadProgress();P===0&&D===0&&b(N)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),l,o,n,p,r,m,q,s,u,t,v,x,F,C,z,w,H,E,O,Q,Y,B,J,P,D,W,R,N;B=a;c=new THREE.BinaryLoader;J=new THREE.JSONLoader;D=P=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;t=B.transform.rotation;w=B.transform.scale;a&&N.scene.position.set(a[0],a[1],a[2]);t&&N.scene.rotation.set(t[0],t[1],
+t[2]);w&&N.scene.scale.set(w[0],w[1],w[2]);if(a||t||w){N.scene.updateMatrix();N.scene.updateMatrixWorld()}}a=function(a){return function(){D=D-a;h();i.onLoadComplete()}};for(r in B.cameras){w=B.cameras[r];w.type==="perspective"?Q=new THREE.PerspectiveCamera(w.fov,w.aspect,w.near,w.far):w.type==="ortho"&&(Q=new THREE.OrthographicCamera(w.left,w.right,w.top,w.bottom,w.near,w.far));x=w.position;t=w.target;w=w.up;Q.position.set(x[0],x[1],x[2]);Q.target=new THREE.Vector3(t[0],t[1],t[2]);w&&Q.up.set(w[0],
+w[1],w[2]);N.cameras[r]=Q}for(p in B.lights){t=B.lights[p];r=t.color!==void 0?t.color:16777215;Q=t.intensity!==void 0?t.intensity:1;if(t.type==="directional"){x=t.direction;v=new THREE.DirectionalLight(r,Q);v.position.set(x[0],x[1],x[2]);v.position.normalize()}else if(t.type==="point"){x=t.position;v=t.distance;v=new THREE.PointLight(r,Q,v);v.position.set(x[0],x[1],x[2])}else t.type==="ambient"&&(v=new THREE.AmbientLight(r));N.scene.add(v);N.lights[p]=v}for(m in B.fogs){p=B.fogs[m];p.type==="linear"?
+Y=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(Y=new THREE.FogExp2(0,p.density));w=p.color;Y.color.setRGB(w[0],w[1],w[2]);N.fogs[m]=Y}if(N.cameras&&B.defaults.camera)N.currentCamera=N.cameras[B.defaults.camera];if(N.fogs&&B.defaults.fog)N.scene.fog=N.fogs[B.defaults.fog];w=B.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(w[0],w[1],w[2]);N.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries){m=B.geometries[l];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){P=P+1;i.onLoadStart()}}W=P;
+for(l in B.geometries){m=B.geometries[l];if(m.type==="cube"){E=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);N.geometries[l]=E}else if(m.type==="plane"){E=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);N.geometries[l]=E}else if(m.type==="sphere"){E=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);N.geometries[l]=E}else if(m.type==="cylinder"){E=new THREE.CylinderGeometry(m.topRad,
+m.botRad,m.height,m.radSegs,m.heightSegs);N.geometries[l]=E}else if(m.type==="torus"){E=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);N.geometries[l]=E}else if(m.type==="icosahedron"){E=new THREE.IcosahedronGeometry(m.radius,m.subdivisions);N.geometries[l]=E}else if(m.type==="bin_mesh")c.load(d(m.url,B.urlBaseType),f(l));else if(m.type==="ascii_mesh")J.load(d(m.url,B.urlBaseType),f(l));else if(m.type==="embedded_mesh"){m=B.embeds[m.id];m.metadata=B.metadata;m&&J.createModel(m,g(l),
+"")}}for(q in B.textures){l=B.textures[q];if(l.url instanceof Array){D=D+l.url.length;for(m=0;m<l.url.length;m++)i.onLoadStart()}else{D=D+1;i.onLoadStart()}}R=D;for(q in B.textures){l=B.textures[q];if(l.mapping!==void 0&&THREE[l.mapping]!==void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=l.url.length;Y=[];for(c=0;c<m;c++)Y[c]=d(l.url[c],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(Y,l.mapping,a(m))}else{m=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a(1));if(THREE[l.minFilter]!==
+void 0)m.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!==void 0)m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!==1)m.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!==1)m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){Y={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Y[l.wrap[0]]!==void 0)m.wrapS=Y[l.wrap[0]];if(Y[l.wrap[1]]!==void 0)m.wrapT=Y[l.wrap[1]]}}N.textures[q]=m}for(o in B.materials){u=
 B.materials[o];for(H in u.parameters)if(H==="envMap"||H==="map"||H==="lightMap")u.parameters[H]=N.textures[u.parameters[H]];else if(H==="shading")u.parameters[H]=u.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H==="blending")u.parameters[H]=u.parameters[H]in THREE?THREE[u.parameters[H]]:THREE.NormalBlending;else if(H==="combine")u.parameters[H]=u.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==="vertexColors")if(u.parameters[H]=="face")u.parameters[H]=
 B.materials[o];for(H in u.parameters)if(H==="envMap"||H==="map"||H==="lightMap")u.parameters[H]=N.textures[u.parameters[H]];else if(H==="shading")u.parameters[H]=u.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H==="blending")u.parameters[H]=u.parameters[H]in THREE?THREE[u.parameters[H]]:THREE.NormalBlending;else if(H==="combine")u.parameters[H]=u.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==="vertexColors")if(u.parameters[H]=="face")u.parameters[H]=
-THREE.FaceColors;else if(u.parameters[H])u.parameters[H]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);m=u.parameters.color;n=u.parameters.specular;Y=u.parameters.ambient;c=u.parameters.shininess;a.tNormal.texture=N.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=N.textures[u.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(Y);a.uShininess.value=c;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;O=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
+THREE.FaceColors;else if(u.parameters[H])u.parameters[H]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=u.parameters.color;m=u.parameters.specular;Y=u.parameters.ambient;c=u.parameters.shininess;a.tNormal.texture=N.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=N.textures[u.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(m);a.uAmbientColor.value.setHex(Y);a.uShininess.value=c;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;O=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
 uniforms:a,lights:true,fog:true})}else O=new THREE[u.type](u.parameters);N.materials[o]=O}e();i.callbackSync(N);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 uniforms:a,lights:true,fog:true})}else O=new THREE[u.type](u.parameters);N.materials[o]=O}e();i.callbackSync(N);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.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(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
@@ -238,36 +238,36 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else 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.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.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(u!==a)u=n.globalAlpha=a}function c(a){if(w!==a){if(a===THREE.NormalBlending)n.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)n.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)n.globalCompositeOperation="darker";w=a}}function d(a){if(t!==a)t=n.strokeStyle=a}function e(a){if(x!==a)x=n.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,m=a.canvas!==
-void 0?a.canvas:document.createElement("canvas"),o,k,p,r,n=m.getContext("2d"),q=new THREE.Color(0),s=0,u=1,w=0,t=null,x=null,F=null,C=null,z=null,v,H,E,O,Q=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,B,J,P,D,W,R,N,ba,U,I,ca,ha,L=new THREE.Color,X=new THREE.Color,S=new THREE.Color,T=new THREE.Color,ia=new THREE.Color,ma=[],Aa=[],Ha,Pa,Qa,Va,ob,hb,bb,Nb,pb,kb,cb=new THREE.Rectangle,Ea=new THREE.Rectangle,Ba=new THREE.Rectangle,db=false,pa=new THREE.Color,Ga=new THREE.Color,Sa=new THREE.Color,
-sa=new THREE.Vector3,l,lb,Ob,Wa,qa,Fc,a=16;l=document.createElement("canvas");l.width=l.height=2;lb=l.getContext("2d");lb.fillStyle="rgba(0,0,0,1)";lb.fillRect(0,0,2,2);Ob=lb.getImageData(0,0,2,2);Wa=Ob.data;qa=document.createElement("canvas");qa.width=qa.height=a;Fc=qa.getContext("2d");Fc.translate(-a/2,-a/2);Fc.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){o=a;k=b;p=Math.floor(o/2);r=Math.floor(k/
-2);m.width=o;m.height=k;cb.set(-p,-r,p,r);Ea.set(-p,-r,p,r);u=1;w=0;z=C=F=x=t=null};this.setClearColor=function(a,b){q.copy(a);s=b!==void 0?b:1;Ea.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b!==void 0?b:1;Ea.set(-p,-r,p,r)};this.clear=function(){n.setTransform(1,0,0,-1,p,r);if(Ea.isEmpty()===false){Ea.minSelf(cb);Ea.inflate(2);s<1&&n.clearRect(Math.floor(Ea.getX()),Math.floor(Ea.getY()),Math.floor(Ea.getWidth()),Math.floor(Ea.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+")");n.fillRect(Math.floor(Ea.getX()),Math.floor(Ea.getY()),Math.floor(Ea.getWidth()),Math.floor(Ea.getHeight()))}Ea.empty()}};this.render=function(a,m){function k(a){var b,c,d,e;pa.setRGB(0,0,0);Ga.setRGB(0,0,0);Sa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){pa.r=pa.r+e.r;pa.g=pa.g+e.g;pa.b=pa.b+e.b}else if(d instanceof THREE.DirectionalLight){Ga.r=Ga.r+e.r;Ga.g=
-Ga.g+e.g;Ga.b=Ga.b+e.b}else if(d instanceof THREE.PointLight){Sa.r=Sa.r+e.r;Sa.g=Sa.g+e.g;Sa.b=Sa.b+e.b}}}function o(a,b,c,d){var e,f,g,h,l,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){l=g.matrixWorld.getPosition();i=c.dot(l);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){l=g.matrixWorld.getPosition();i=c.dot(sa.sub(l,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(l)/
-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,i,l,j,m,k;if(g instanceof THREE.ParticleBasicMaterial){if(g.map!==null){j=g.map.image;m=j.width>>1;k=j.height>>1;g=f.scale.x*p;l=f.scale.y*r;h=g*m;i=l*k;Ba.set(a.x-h,a.y-i,a.x+h,a.y+i);if(cb.intersects(Ba)!==false){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-l);n.translate(-m,-k);n.drawImage(j,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=
-f.scale.x*p;i=f.scale.y*r;Ba.set(a.x-h,a.y-i,a.x+h,a.y+i);if(cb.intersects(Ba)!==false){d(g.color.getContextStyle());e(g.color.getContextStyle());n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(h,i);g.program(n);n.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!==a)F=n.lineWidth=a;a=g.linecap;
-if(C!==a)C=n.lineCap=a;a=g.linejoin;if(z!==a)z=n.lineJoin=a;d(g.color.getContextStyle());n.stroke();Ba.inflate(g.linewidth*2)}}function t(a,d,e,g,h,l,j,k){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(k.opacity);c(k.blending);B=a.positionScreen.x;J=a.positionScreen.y;P=d.positionScreen.x;D=d.positionScreen.y;W=e.positionScreen.x;R=e.positionScreen.y;x(B,J,P,D,W,R);if(k instanceof THREE.MeshBasicMaterial)if(k.map!==null){if(k.map.mapping instanceof THREE.UVMapping){Va=j.uvs[0];
-kd(B,J,P,D,W,R,Va[g].u,Va[g].v,Va[h].u,Va[h].v,Va[l].u,Va[l].v,k.map)}}else if(k.envMap!==null){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=m.matrixWorldInverse;sa.copy(j.vertexNormalsWorld[g]);ob=(sa.x*a.elements[0]+sa.y*a.elements[4]+sa.z*a.elements[8])*0.5+0.5;hb=-(sa.x*a.elements[1]+sa.y*a.elements[5]+sa.z*a.elements[9])*0.5+0.5;sa.copy(j.vertexNormalsWorld[h]);bb=(sa.x*a.elements[0]+sa.y*a.elements[4]+sa.z*a.elements[8])*0.5+0.5;Nb=-(sa.x*a.elements[1]+sa.y*a.elements[5]+
-sa.z*a.elements[9])*0.5+0.5;sa.copy(j.vertexNormalsWorld[l]);pb=(sa.x*a.elements[0]+sa.y*a.elements[4]+sa.z*a.elements[8])*0.5+0.5;kb=-(sa.x*a.elements[1]+sa.y*a.elements[5]+sa.z*a.elements[9])*0.5+0.5;kd(B,J,P,D,W,R,ob,hb,bb,Nb,pb,kb,k.envMap)}}else k.wireframe===true?Pb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color);else if(k instanceof THREE.MeshLambertMaterial)if(db===true)if(k.wireframe===false&&k.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3){X.r=
-S.r=T.r=pa.r;X.g=S.g=T.g=pa.g;X.b=S.b=T.b=pa.b;o(i,j.v1.positionWorld,j.vertexNormalsWorld[0],X);o(i,j.v2.positionWorld,j.vertexNormalsWorld[1],S);o(i,j.v3.positionWorld,j.vertexNormalsWorld[2],T);X.r=Math.max(0,Math.min(k.color.r*X.r,1));X.g=Math.max(0,Math.min(k.color.g*X.g,1));X.b=Math.max(0,Math.min(k.color.b*X.b,1));S.r=Math.max(0,Math.min(k.color.r*S.r,1));S.g=Math.max(0,Math.min(k.color.g*S.g,1));S.b=Math.max(0,Math.min(k.color.b*S.b,1));T.r=Math.max(0,Math.min(k.color.r*T.r,1));T.g=Math.max(0,
-Math.min(k.color.g*T.g,1));T.b=Math.max(0,Math.min(k.color.b*T.b,1));ia.r=(S.r+T.r)*0.5;ia.g=(S.g+T.g)*0.5;ia.b=(S.b+T.b)*0.5;Qa=Gc(X,S,T,ia);jc(B,J,P,D,W,R,0,0,1,0,0,1,Qa)}else{L.r=pa.r;L.g=pa.g;L.b=pa.b;o(i,j.centroidWorld,j.normalWorld,L);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));k.wireframe===true?Pb(L,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(L)}else k.wireframe===true?Pb(k.color,k.wireframeLinewidth,
-k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color);else if(k instanceof THREE.MeshDepthMaterial){Ha=m.near;Pa=m.far;X.r=X.g=X.b=1-dc(a.positionScreen.z,Ha,Pa);S.r=S.g=S.b=1-dc(d.positionScreen.z,Ha,Pa);T.r=T.g=T.b=1-dc(e.positionScreen.z,Ha,Pa);ia.r=(S.r+T.r)*0.5;ia.g=(S.g+T.g)*0.5;ia.b=(S.b+T.b)*0.5;Qa=Gc(X,S,T,ia);jc(B,J,P,D,W,R,0,0,1,0,0,1,Qa)}else if(k instanceof THREE.MeshNormalMaterial){L.r=kc(j.normalWorld.x);L.g=kc(j.normalWorld.y);L.b=kc(j.normalWorld.z);k.wireframe===true?Pb(L,k.wireframeLinewidth,
-k.wireframeLinecap,k.wireframeLinejoin):Gb(L)}}function u(a,d,e,g,h,l,j,k,n){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(k.opacity);c(k.blending);if(k.map!==null||k.envMap!==null){t(a,d,g,0,1,3,j,k,n);t(h,e,l,1,2,3,j,k,n)}else{B=a.positionScreen.x;J=a.positionScreen.y;P=d.positionScreen.x;D=d.positionScreen.y;W=e.positionScreen.x;R=e.positionScreen.y;N=g.positionScreen.x;ba=g.positionScreen.y;U=h.positionScreen.x;I=h.positionScreen.y;ca=l.positionScreen.x;ha=l.positionScreen.y;
-if(k instanceof THREE.MeshBasicMaterial){w(B,J,P,D,W,R,N,ba);k.wireframe===true?Pb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color)}else if(k instanceof THREE.MeshLambertMaterial)if(db===true)if(!k.wireframe&&k.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4){X.r=S.r=T.r=ia.r=pa.r;X.g=S.g=T.g=ia.g=pa.g;X.b=S.b=T.b=ia.b=pa.b;o(i,j.v1.positionWorld,j.vertexNormalsWorld[0],X);o(i,j.v2.positionWorld,j.vertexNormalsWorld[1],S);o(i,j.v4.positionWorld,j.vertexNormalsWorld[3],
-T);o(i,j.v3.positionWorld,j.vertexNormalsWorld[2],ia);X.r=Math.max(0,Math.min(k.color.r*X.r,1));X.g=Math.max(0,Math.min(k.color.g*X.g,1));X.b=Math.max(0,Math.min(k.color.b*X.b,1));S.r=Math.max(0,Math.min(k.color.r*S.r,1));S.g=Math.max(0,Math.min(k.color.g*S.g,1));S.b=Math.max(0,Math.min(k.color.b*S.b,1));T.r=Math.max(0,Math.min(k.color.r*T.r,1));T.g=Math.max(0,Math.min(k.color.g*T.g,1));T.b=Math.max(0,Math.min(k.color.b*T.b,1));ia.r=Math.max(0,Math.min(k.color.r*ia.r,1));ia.g=Math.max(0,Math.min(k.color.g*
-ia.g,1));ia.b=Math.max(0,Math.min(k.color.b*ia.b,1));Qa=Gc(X,S,T,ia);x(B,J,P,D,N,ba);jc(B,J,P,D,N,ba,0,0,1,0,0,1,Qa);x(U,I,W,R,ca,ha);jc(U,I,W,R,ca,ha,1,0,1,1,0,1,Qa)}else{L.r=pa.r;L.g=pa.g;L.b=pa.b;o(i,j.centroidWorld,j.normalWorld,L);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));w(B,J,P,D,W,R,N,ba);k.wireframe===true?Pb(L,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(L)}else{w(B,J,P,D,W,R,N,ba);k.wireframe===
-true?Pb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color)}else if(k instanceof THREE.MeshNormalMaterial){L.r=kc(j.normalWorld.x);L.g=kc(j.normalWorld.y);L.b=kc(j.normalWorld.z);w(B,J,P,D,W,R,N,ba);k.wireframe===true?Pb(L,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(L)}else if(k instanceof THREE.MeshDepthMaterial){Ha=m.near;Pa=m.far;X.r=X.g=X.b=1-dc(a.positionScreen.z,Ha,Pa);S.r=S.g=S.b=1-dc(d.positionScreen.z,Ha,Pa);T.r=T.g=T.b=1-dc(g.positionScreen.z,
-Ha,Pa);ia.r=ia.g=ia.b=1-dc(e.positionScreen.z,Ha,Pa);Qa=Gc(X,S,T,ia);x(B,J,P,D,N,ba);jc(B,J,P,D,N,ba,0,0,1,0,0,1,Qa);x(U,I,W,R,ca,ha);jc(U,I,W,R,ca,ha,1,0,1,1,0,1,Qa)}}}function x(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b)}function w(a,b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b)}function Pb(a,b,c,e){if(F!==b)F=n.lineWidth=b;if(C!==c)C=n.lineCap=c;if(z!==e)z=n.lineJoin=e;d(a.getContextStyle());n.stroke();
-Ba.inflate(b*2)}function Gb(a){e(a.getContextStyle());n.fill()}function kd(a,b,c,d,f,g,h,i,l,k,j,m,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||ma[o.id]===void 0){var qa=o.wrapS==THREE.RepeatWrapping,p=o.wrapT==THREE.RepeatWrapping;ma[o.id]=n.createPattern(o.image,qa===true&&p===true?"repeat":qa===true&&p===false?"repeat-x":qa===false&&p===true?"repeat-y":"no-repeat");o.needsUpdate=false}e(ma[o.id]);var qa=o.offset.x/o.repeat.x,p=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,
-q=o.image.height*o.repeat.y,h=(h+qa)*r,i=(i+p)*q,c=c-a,d=d-b,f=f-a,g=g-b,l=(l+qa)*r-h,k=(k+p)*q-i,j=(j+qa)*r-h,m=(m+p)*q-i,qa=l*m-j*k;if(qa===0){if(Aa[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);Aa[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=Aa[o.id];h=(Math.floor(h)+Math.floor(i)*o.image.width)*4;L.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(L)}else{qa=1/qa;o=(m*c-k*f)*qa;k=(m*d-k*g)*
-qa;c=(l*f-j*c)*qa;d=(l*g-j*d)*qa;a=a-o*h-c*i;h=b-k*h-d*i;n.save();n.transform(o,k,c,d,a,h);n.fill();n.restore()}}}function jc(a,b,c,d,e,f,g,h,i,l,k,j,m){var o,qa;o=m.width-1;qa=m.height-1;g=g*o;h=h*qa;c=c-a;d=d-b;e=e-a;f=f-b;i=i*o-g;l=l*qa-h;k=k*o-g;j=j*qa-h;qa=1/(i*j-k*l);o=(j*c-l*e)*qa;l=(j*d-l*f)*qa;c=(i*e-k*c)*qa;d=(i*f-k*d)*qa;a=a-o*g-c*h;b=b-l*g-d*h;n.save();n.transform(o,l,c,d,a,b);n.clip();n.drawImage(m,0,0);n.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),k=~~(c.g*255),c=~~(c.b*255),j=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);Wa[0]=e<0?0:e>255?255:e;Wa[1]=f<0?0:f>255?255:f;Wa[2]=a<0?0:a>255?255:a;Wa[4]=g<0?0:g>255?255:g;Wa[5]=h<0?0:h>255?255:h;Wa[6]=b<0?0:b>255?255:b;Wa[8]=i<0?0:i>255?255:i;Wa[9]=k<0?0:k>255?255:k;Wa[10]=c<0?0:c>255?255:c;Wa[12]=j<0?0:j>255?255:j;Wa[13]=m<0?0:m>255?255:m;Wa[14]=d<0?0:d>255?255:d;lb.putImageData(Ob,0,0);Fc.drawImage(l,0,0);return qa}function dc(a,b,c){a=(a-b)/(c-b);
-return a*a*(3-2*a)}function kc(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}}var Hc,ld,Na,ib;this.autoClear===true?this.clear():n.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;db=i.length>0;db===true&&k(i);Hc=0;for(ld=h.length;Hc<ld;Hc++){Na=h[Hc];ib=Na.material;ib=ib instanceof THREE.MeshFaceMaterial?
-Na.faceMaterial:ib;if(!(ib===void 0||ib.visible===false)){Ba.empty();if(Na instanceof THREE.RenderableParticle){v=Na;v.x=v.x*p;v.y=v.y*r;q(v,Na,ib,a)}else if(Na instanceof THREE.RenderableLine){v=Na.v1;H=Na.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;Ba.addPoint(v.positionScreen.x,v.positionScreen.y);Ba.addPoint(H.positionScreen.x,H.positionScreen.y);cb.intersects(Ba)===true&&s(v,
-H,Na,ib,a)}else if(Na instanceof THREE.RenderableFace3){v=Na.v1;H=Na.v2;E=Na.v3;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;E.positionScreen.x=E.positionScreen.x*p;E.positionScreen.y=E.positionScreen.y*r;if(ib.overdraw===true){Qb(v.positionScreen,H.positionScreen);Qb(H.positionScreen,E.positionScreen);Qb(E.positionScreen,v.positionScreen)}Ba.add3Points(v.positionScreen.x,v.positionScreen.y,
-H.positionScreen.x,H.positionScreen.y,E.positionScreen.x,E.positionScreen.y);cb.intersects(Ba)===true&&t(v,H,E,0,1,2,Na,ib,a)}else if(Na instanceof THREE.RenderableFace4){v=Na.v1;H=Na.v2;E=Na.v3;O=Na.v4;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;E.positionScreen.x=E.positionScreen.x*p;E.positionScreen.y=E.positionScreen.y*r;O.positionScreen.x=O.positionScreen.x*p;O.positionScreen.y=
-O.positionScreen.y*r;Q.positionScreen.copy(H.positionScreen);Y.positionScreen.copy(O.positionScreen);if(ib.overdraw===true){Qb(v.positionScreen,H.positionScreen);Qb(H.positionScreen,O.positionScreen);Qb(O.positionScreen,v.positionScreen);Qb(E.positionScreen,Q.positionScreen);Qb(E.positionScreen,Y.positionScreen)}Ba.addPoint(v.positionScreen.x,v.positionScreen.y);Ba.addPoint(H.positionScreen.x,H.positionScreen.y);Ba.addPoint(E.positionScreen.x,E.positionScreen.y);Ba.addPoint(O.positionScreen.x,O.positionScreen.y);
-cb.intersects(Ba)===true&&u(v,H,E,O,Q,Y,Na,ib,a)}Ea.addRectangle(Ba)}}n.setTransform(1,0,0,1,0,0)}};
+THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=m.globalAlpha=a}function c(a){if(t!==a){if(a===THREE.NormalBlending)m.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)m.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)m.globalCompositeOperation="darker";t=a}}function d(a){if(v!==a)v=m.strokeStyle=a}function e(a){if(x!==a)x=m.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),o,n,p,r,m=l.getContext("2d"),q=new THREE.Color(0),s=0,u=1,t=0,v=null,x=null,F=null,C=null,z=null,w,H,E,O,Q=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,B,J,P,D,W,R,N,ba,U,I,ca,ha,L=new THREE.Color,X=new THREE.Color,S=new THREE.Color,T=new THREE.Color,ia=new THREE.Color,ma=[],za=[],Ga,Oa,Pa,Ua,ob,hb,ab,Nb,pb,kb,bb=new THREE.Rectangle,Da=new THREE.Rectangle,Aa=new THREE.Rectangle,cb=false,pa=new THREE.Color,Fa=new THREE.Color,Ra=new THREE.Color,
+ra=new THREE.Vector3,k,lb,Ob,Va,db,Fc,a=16;k=document.createElement("canvas");k.width=k.height=2;lb=k.getContext("2d");lb.fillStyle="rgba(0,0,0,1)";lb.fillRect(0,0,2,2);Ob=lb.getImageData(0,0,2,2);Va=Ob.data;db=document.createElement("canvas");db.width=db.height=a;Fc=db.getContext("2d");Fc.translate(-a/2,-a/2);Fc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;n=b;p=Math.floor(o/2);r=Math.floor(n/
+2);l.width=o;l.height=n;bb.set(-p,-r,p,r);Da.set(-p,-r,p,r);u=1;t=0;z=C=F=x=v=null};this.setClearColor=function(a,b){q.copy(a);s=b!==void 0?b:1;Da.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b!==void 0?b:1;Da.set(-p,-r,p,r)};this.clear=function(){m.setTransform(1,0,0,-1,p,r);if(Da.isEmpty()===false){Da.minSelf(bb);Da.inflate(2);s<1&&m.clearRect(Math.floor(Da.getX()),Math.floor(Da.getY()),Math.floor(Da.getWidth()),Math.floor(Da.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+")");m.fillRect(Math.floor(Da.getX()),Math.floor(Da.getY()),Math.floor(Da.getWidth()),Math.floor(Da.getHeight()))}Da.empty()}};this.render=function(a,l){function n(a){var b,c,d,e;pa.setRGB(0,0,0);Fa.setRGB(0,0,0);Ra.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){pa.r=pa.r+e.r;pa.g=pa.g+e.g;pa.b=pa.b+e.b}else if(d instanceof THREE.DirectionalLight){Fa.r=Fa.r+e.r;Fa.g=
+Fa.g+e.g;Fa.b=Fa.b+e.b}else if(d instanceof THREE.PointLight){Ra.r=Ra.r+e.r;Ra.g=Ra.g+e.g;Ra.b=Ra.b+e.b}}}function o(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();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(ra.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,l,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map!==null){j=g.map.image;l=j.width>>1;n=j.height>>1;g=f.scale.x*p;i=f.scale.y*r;h=g*l;k=i*n;Aa.set(a.x-h,a.y-k,a.x+h,a.y+k);if(bb.intersects(Aa)!==false){m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(g,-i);m.translate(-l,-n);m.drawImage(j,0,0);m.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=
+f.scale.x*p;k=f.scale.y*r;Aa.set(a.x-h,a.y-k,a.x+h,a.y+k);if(bb.intersects(Aa)!==false){d(g.color.getContextStyle());e(g.color.getContextStyle());m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(h,k);g.program(m);m.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!==a)F=m.lineWidth=a;a=g.linecap;
+if(C!==a)C=m.lineCap=a;a=g.linejoin;if(z!==a)z=m.lineJoin=a;d(g.color.getContextStyle());m.stroke();Aa.inflate(g.linewidth*2)}}function v(a,d,e,g,h,k,j,m){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(m.opacity);c(m.blending);B=a.positionScreen.x;J=a.positionScreen.y;P=d.positionScreen.x;D=d.positionScreen.y;W=e.positionScreen.x;R=e.positionScreen.y;u(B,J,P,D,W,R);if(m instanceof THREE.MeshBasicMaterial)if(m.map!==null){if(m.map.mapping instanceof THREE.UVMapping){Ua=j.uvs[0];
+kd(B,J,P,D,W,R,Ua[g].u,Ua[g].v,Ua[h].u,Ua[h].v,Ua[k].u,Ua[k].v,m.map)}}else if(m.envMap!==null){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;ra.copy(j.vertexNormalsWorld[g]);ob=(ra.x*a.elements[0]+ra.y*a.elements[4]+ra.z*a.elements[8])*0.5+0.5;hb=-(ra.x*a.elements[1]+ra.y*a.elements[5]+ra.z*a.elements[9])*0.5+0.5;ra.copy(j.vertexNormalsWorld[h]);ab=(ra.x*a.elements[0]+ra.y*a.elements[4]+ra.z*a.elements[8])*0.5+0.5;Nb=-(ra.x*a.elements[1]+ra.y*a.elements[5]+
+ra.z*a.elements[9])*0.5+0.5;ra.copy(j.vertexNormalsWorld[k]);pb=(ra.x*a.elements[0]+ra.y*a.elements[4]+ra.z*a.elements[8])*0.5+0.5;kb=-(ra.x*a.elements[1]+ra.y*a.elements[5]+ra.z*a.elements[9])*0.5+0.5;kd(B,J,P,D,W,R,ob,hb,ab,Nb,pb,kb,m.envMap)}}else m.wireframe===true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshLambertMaterial)if(cb===true)if(m.wireframe===false&&m.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3){X.r=
+S.r=T.r=pa.r;X.g=S.g=T.g=pa.g;X.b=S.b=T.b=pa.b;o(i,j.v1.positionWorld,j.vertexNormalsWorld[0],X);o(i,j.v2.positionWorld,j.vertexNormalsWorld[1],S);o(i,j.v3.positionWorld,j.vertexNormalsWorld[2],T);X.r=Math.max(0,Math.min(m.color.r*X.r,1));X.g=Math.max(0,Math.min(m.color.g*X.g,1));X.b=Math.max(0,Math.min(m.color.b*X.b,1));S.r=Math.max(0,Math.min(m.color.r*S.r,1));S.g=Math.max(0,Math.min(m.color.g*S.g,1));S.b=Math.max(0,Math.min(m.color.b*S.b,1));T.r=Math.max(0,Math.min(m.color.r*T.r,1));T.g=Math.max(0,
+Math.min(m.color.g*T.g,1));T.b=Math.max(0,Math.min(m.color.b*T.b,1));ia.r=(S.r+T.r)*0.5;ia.g=(S.g+T.g)*0.5;ia.b=(S.b+T.b)*0.5;Pa=Gc(X,S,T,ia);jc(B,J,P,D,W,R,0,0,1,0,0,1,Pa)}else{L.r=pa.r;L.g=pa.g;L.b=pa.b;o(i,j.centroidWorld,j.normalWorld,L);L.r=Math.max(0,Math.min(m.color.r*L.r,1));L.g=Math.max(0,Math.min(m.color.g*L.g,1));L.b=Math.max(0,Math.min(m.color.b*L.b,1));m.wireframe===true?Pb(L,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(L)}else m.wireframe===true?Pb(m.color,m.wireframeLinewidth,
+m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshDepthMaterial){Ga=l.near;Oa=l.far;X.r=X.g=X.b=1-dc(a.positionScreen.z,Ga,Oa);S.r=S.g=S.b=1-dc(d.positionScreen.z,Ga,Oa);T.r=T.g=T.b=1-dc(e.positionScreen.z,Ga,Oa);ia.r=(S.r+T.r)*0.5;ia.g=(S.g+T.g)*0.5;ia.b=(S.b+T.b)*0.5;Pa=Gc(X,S,T,ia);jc(B,J,P,D,W,R,0,0,1,0,0,1,Pa)}else if(m instanceof THREE.MeshNormalMaterial){L.r=kc(j.normalWorld.x);L.g=kc(j.normalWorld.y);L.b=kc(j.normalWorld.z);m.wireframe===true?Pb(L,m.wireframeLinewidth,
+m.wireframeLinecap,m.wireframeLinejoin):Gb(L)}}function t(a,d,e,g,h,k,j,m,n){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(m.opacity);c(m.blending);if(m.map!==null||m.envMap!==null){v(a,d,g,0,1,3,j,m,n);v(h,e,k,1,2,3,j,m,n)}else{B=a.positionScreen.x;J=a.positionScreen.y;P=d.positionScreen.x;D=d.positionScreen.y;W=e.positionScreen.x;R=e.positionScreen.y;N=g.positionScreen.x;ba=g.positionScreen.y;U=h.positionScreen.x;I=h.positionScreen.y;ca=k.positionScreen.x;ha=k.positionScreen.y;
+if(m instanceof THREE.MeshBasicMaterial){x(B,J,P,D,W,R,N,ba);m.wireframe===true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color)}else if(m instanceof THREE.MeshLambertMaterial)if(cb===true)if(!m.wireframe&&m.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4){X.r=S.r=T.r=ia.r=pa.r;X.g=S.g=T.g=ia.g=pa.g;X.b=S.b=T.b=ia.b=pa.b;o(i,j.v1.positionWorld,j.vertexNormalsWorld[0],X);o(i,j.v2.positionWorld,j.vertexNormalsWorld[1],S);o(i,j.v4.positionWorld,j.vertexNormalsWorld[3],
+T);o(i,j.v3.positionWorld,j.vertexNormalsWorld[2],ia);X.r=Math.max(0,Math.min(m.color.r*X.r,1));X.g=Math.max(0,Math.min(m.color.g*X.g,1));X.b=Math.max(0,Math.min(m.color.b*X.b,1));S.r=Math.max(0,Math.min(m.color.r*S.r,1));S.g=Math.max(0,Math.min(m.color.g*S.g,1));S.b=Math.max(0,Math.min(m.color.b*S.b,1));T.r=Math.max(0,Math.min(m.color.r*T.r,1));T.g=Math.max(0,Math.min(m.color.g*T.g,1));T.b=Math.max(0,Math.min(m.color.b*T.b,1));ia.r=Math.max(0,Math.min(m.color.r*ia.r,1));ia.g=Math.max(0,Math.min(m.color.g*
+ia.g,1));ia.b=Math.max(0,Math.min(m.color.b*ia.b,1));Pa=Gc(X,S,T,ia);u(B,J,P,D,N,ba);jc(B,J,P,D,N,ba,0,0,1,0,0,1,Pa);u(U,I,W,R,ca,ha);jc(U,I,W,R,ca,ha,1,0,1,1,0,1,Pa)}else{L.r=pa.r;L.g=pa.g;L.b=pa.b;o(i,j.centroidWorld,j.normalWorld,L);L.r=Math.max(0,Math.min(m.color.r*L.r,1));L.g=Math.max(0,Math.min(m.color.g*L.g,1));L.b=Math.max(0,Math.min(m.color.b*L.b,1));x(B,J,P,D,W,R,N,ba);m.wireframe===true?Pb(L,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(L)}else{x(B,J,P,D,W,R,N,ba);m.wireframe===
+true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color)}else if(m instanceof THREE.MeshNormalMaterial){L.r=kc(j.normalWorld.x);L.g=kc(j.normalWorld.y);L.b=kc(j.normalWorld.z);x(B,J,P,D,W,R,N,ba);m.wireframe===true?Pb(L,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(L)}else if(m instanceof THREE.MeshDepthMaterial){Ga=l.near;Oa=l.far;X.r=X.g=X.b=1-dc(a.positionScreen.z,Ga,Oa);S.r=S.g=S.b=1-dc(d.positionScreen.z,Ga,Oa);T.r=T.g=T.b=1-dc(g.positionScreen.z,
+Ga,Oa);ia.r=ia.g=ia.b=1-dc(e.positionScreen.z,Ga,Oa);Pa=Gc(X,S,T,ia);u(B,J,P,D,N,ba);jc(B,J,P,D,N,ba,0,0,1,0,0,1,Pa);u(U,I,W,R,ca,ha);jc(U,I,W,R,ca,ha,1,0,1,1,0,1,Pa)}}}function u(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b)}function x(a,b,c,d,e,f,g,h){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,h);m.lineTo(a,b)}function Pb(a,b,c,e){if(F!==b)F=m.lineWidth=b;if(C!==c)C=m.lineCap=c;if(z!==e)z=m.lineJoin=e;d(a.getContextStyle());m.stroke();
+Aa.inflate(b*2)}function Gb(a){e(a.getContextStyle());m.fill()}function kd(a,b,c,d,f,g,h,k,j,i,l,n,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||ma[o.id]===void 0){var p=o.wrapS==THREE.RepeatWrapping,db=o.wrapT==THREE.RepeatWrapping;ma[o.id]=m.createPattern(o.image,p===true&&db===true?"repeat":p===true&&db===false?"repeat-x":p===false&&db===true?"repeat-y":"no-repeat");o.needsUpdate=false}e(ma[o.id]);var p=o.offset.x/o.repeat.x,db=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,
+q=o.image.height*o.repeat.y,h=(h+p)*r,k=(k+db)*q,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+p)*r-h,i=(i+db)*q-k,l=(l+p)*r-h,n=(n+db)*q-k,p=j*n-l*i;if(p===0){if(za[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);za[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=za[o.id];h=(Math.floor(h)+Math.floor(k)*o.image.width)*4;L.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(L)}else{p=1/p;o=(n*c-i*f)*p;i=(n*d-i*g)*p;c=
+(j*f-l*c)*p;d=(j*g-l*d)*p;a=a-o*h-c*k;h=b-i*h-d*k;m.save();m.transform(o,i,c,d,a,h);m.fill();m.restore()}}}function jc(a,b,c,d,e,f,g,h,k,j,i,l,o){var n,p;n=o.width-1;p=o.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;m.save();m.transform(n,j,c,d,a,b);m.clip();m.drawImage(o,0,0);m.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);Va[0]=e<0?0:e>255?255:e;Va[1]=f<0?0:f>255?255:f;Va[2]=a<0?0:a>255?255:a;Va[4]=g<0?0:g>255?255:g;Va[5]=h<0?0:h>255?255:h;Va[6]=b<0?0:b>255?255:b;Va[8]=j<0?0:j>255?255:j;Va[9]=i<0?0:i>255?255:i;Va[10]=c<0?0:c>255?255:c;Va[12]=l<0?0:l>255?255:l;Va[13]=m<0?0:m>255?255:m;Va[14]=d<0?0:d>255?255:d;lb.putImageData(Ob,0,0);Fc.drawImage(k,0,0);return db}function dc(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}
+function kc(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}}var Hc,ld,Ma,ib;this.autoClear===true?this.clear():m.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,l,this.sortElements);h=g.elements;i=g.lights;cb=i.length>0;cb===true&&n(i);Hc=0;for(ld=h.length;Hc<ld;Hc++){Ma=h[Hc];ib=Ma.material;ib=ib instanceof THREE.MeshFaceMaterial?Ma.faceMaterial:
+ib;if(!(ib===void 0||ib.visible===false)){Aa.empty();if(Ma instanceof THREE.RenderableParticle){w=Ma;w.x=w.x*p;w.y=w.y*r;q(w,Ma,ib,a)}else if(Ma instanceof THREE.RenderableLine){w=Ma.v1;H=Ma.v2;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;Aa.addPoint(w.positionScreen.x,w.positionScreen.y);Aa.addPoint(H.positionScreen.x,H.positionScreen.y);bb.intersects(Aa)===true&&s(w,H,Ma,ib,a)}else if(Ma instanceof
+THREE.RenderableFace3){w=Ma.v1;H=Ma.v2;E=Ma.v3;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;E.positionScreen.x=E.positionScreen.x*p;E.positionScreen.y=E.positionScreen.y*r;if(ib.overdraw===true){Qb(w.positionScreen,H.positionScreen);Qb(H.positionScreen,E.positionScreen);Qb(E.positionScreen,w.positionScreen)}Aa.add3Points(w.positionScreen.x,w.positionScreen.y,H.positionScreen.x,H.positionScreen.y,
+E.positionScreen.x,E.positionScreen.y);bb.intersects(Aa)===true&&v(w,H,E,0,1,2,Ma,ib,a)}else if(Ma instanceof THREE.RenderableFace4){w=Ma.v1;H=Ma.v2;E=Ma.v3;O=Ma.v4;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;E.positionScreen.x=E.positionScreen.x*p;E.positionScreen.y=E.positionScreen.y*r;O.positionScreen.x=O.positionScreen.x*p;O.positionScreen.y=O.positionScreen.y*r;Q.positionScreen.copy(H.positionScreen);
+Y.positionScreen.copy(O.positionScreen);if(ib.overdraw===true){Qb(w.positionScreen,H.positionScreen);Qb(H.positionScreen,O.positionScreen);Qb(O.positionScreen,w.positionScreen);Qb(E.positionScreen,Q.positionScreen);Qb(E.positionScreen,Y.positionScreen)}Aa.addPoint(w.positionScreen.x,w.positionScreen.y);Aa.addPoint(H.positionScreen.x,H.positionScreen.y);Aa.addPoint(E.positionScreen.x,E.positionScreen.y);Aa.addPoint(O.positionScreen.x,O.positionScreen.y);bb.intersects(Aa)===true&&t(w,H,E,O,Q,Y,Ma,ib,
+a)}Da.addRectangle(Aa)}}m.setTransform(1,0,0,1,0,0)}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
 envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
@@ -303,142 +303,142 @@ THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk
 "}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",
 "}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",
 THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
 THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
-THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=l.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
+THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+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 instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
-var i=a.colors,k=i.length,j=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,n=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){db.copy(Ba);db.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];pa.copy(e);db.multiplyVector3(pa);o[d]=[pa.z,d]}o.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[o[d][1]];f=d*3;j[f]=e.x;j[f+1]=e.y;j[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=i[o[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];
+var j=a.colors,i=j.length,l=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,n=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){cb.copy(Aa);cb.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];pa.copy(e);cb.multiplyVector3(pa);o[d]=[pa.z,d]}o.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[o[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<i;d++){f=d*3;e=j[o[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=o[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=o[d][1];
 if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=o[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=o[d][1];
-g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(n)for(d=0;d<g;d++){e=h[d];f=d*3;j[f]=e.x;j[f+1]=e.y;j[f+2]=e.z}if(p)for(d=0;d<k;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(k=r.length;i<k;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+1]=g.y;f=f+2}else if(h.size===
-3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(n||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,j,b)}if(p||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,
-m,b)}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];if(h.needsUpdate||c.sortParticles){l.bindBuffer(l.ARRAY_BUFFER,h.buffer);l.bufferData(l.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++){ca=N=null;U=I=X=L=Ha=Aa=S=-1;Sa=true;a[d].render(b,c,kb,cb);ca=N=null;U=I=X=L=Ha=Aa=S=-1;Sa=true}}function j(a,b,c,d,f,e,g,h){var i,l,k,j;if(b){l=a.length-1;j=b=-1}else{l=0;b=a.length;j=1}for(var m=l;m!==b;m=m+j){i=
-a[m];if(i.render){l=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&D.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);D.setDepthTest(i.depthTest);D.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}D.setObjectFaces(l);k instanceof THREE.BufferGeometry?D.renderBufferDirect(d,f,e,i,k,l):D.renderBuffer(d,f,e,i,k,l)}}}function m(a,b,c,d,f,e,g){for(var h,i,l=0,k=a.length;l<k;l++){h=a[l];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;
-e&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,f,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function k(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 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&&D.deallocateMaterial(d);D.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==N){l.useProgram(g);N=g;e=true}if(d.id!==U){U=d.id;e=true}if(e||a!==ca){l.uniformMatrix4fv(h.projectionMatrix,
-false,a._projectionMatrixArray);a!==ca&&(ca=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(Sa){for(var k,j=0,m=0,o=0,n,p,r,q=sa,s=q.directional.colors,u=q.directional.positions,v=q.point.colors,x=q.point.positions,w=q.point.distances,F=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
-I=q.spot.directions,X=q.spot.angles,E=q.spot.exponents,J=0,O=0,T=0,L=r=0,c=L=0,e=b.length;c<e;c++){k=b[c];if(!k.onlyShadow&&k.visible){n=k.color;p=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(D.gammaInput){j=j+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{j=j+n.r;m=m+n.g;o=o+n.b}else if(k instanceof THREE.DirectionalLight){r=J*3;if(D.gammaInput){s[r]=n.r*n.r*p*p;s[r+1]=n.g*n.g*p*p;s[r+2]=n.b*n.b*p*p}else{s[r]=n.r*p;s[r+1]=n.g*p;s[r+2]=n.b*p}Ga.copy(k.matrixWorld.getPosition());Ga.subSelf(k.target.matrixWorld.getPosition());
-Ga.normalize();u[r]=Ga.x;u[r+1]=Ga.y;u[r+2]=Ga.z;J=J+1}else if(k instanceof THREE.PointLight){L=O*3;if(D.gammaInput){v[L]=n.r*n.r*p*p;v[L+1]=n.g*n.g*p*p;v[L+2]=n.b*n.b*p*p}else{v[L]=n.r*p;v[L+1]=n.g*p;v[L+2]=n.b*p}n=k.matrixWorld.getPosition();x[L]=n.x;x[L+1]=n.y;x[L+2]=n.z;w[O]=r;O=O+1}else if(k instanceof THREE.SpotLight){L=T*3;if(D.gammaInput){F[L]=n.r*n.r*p*p;F[L+1]=n.g*n.g*p*p;F[L+2]=n.b*n.b*p*p}else{F[L]=n.r*p;F[L+1]=n.g*p;F[L+2]=n.b*p}n=k.matrixWorld.getPosition();B[L]=n.x;B[L+1]=n.y;B[L+2]=
-n.z;H[T]=r;Ga.copy(n);Ga.subSelf(k.target.matrixWorld.getPosition());Ga.normalize();I[L]=Ga.x;I[L+1]=Ga.y;I[L+2]=Ga.z;X[T]=Math.cos(k.angle);E[T]=k.exponent;T=T+1}}}c=J*3;for(e=s.length;c<e;c++)s[c]=0;c=O*3;for(e=v.length;c<e;c++)v[c]=0;c=T*3;for(e=F.length;c<e;c++)F[c]=0;q.directional.length=J;q.point.length=O;q.spot.length=T;q.ambient[0]=j;q.ambient[1]=m;q.ambient[2]=o;Sa=false}c=sa;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;D.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);i.lightMap.texture=d.lightMap;i.envMap.texture=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
-THREE.LineBasicMaterial){i.diffuse.value=d.color;i.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){i.psColor.value=d.color;i.opacity.value=d.opacity;i.size.value=d.size;i.scale.value=z.height/2;i.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(D.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(D.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){e=c=0;for(k=b.length;e<k;e++){j=b[e];if(j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade)){i.shadowMap.texture[c]=j.shadowMap;i.shadowMapSize.value[c]=j.shadowMapSize;i.shadowMatrix.value[c]=j.shadowMatrix;i.shadowDarkness.value[c]=j.shadowDarkness;i.shadowBias.value[c]=j.shadowBias;c++}}}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(j=g.uniforms[b[i][1]]){e=b[i][0];m=e.type;k=e.value;
-if(m==="i")l.uniform1i(j,k);else if(m==="f")l.uniform1f(j,k);else if(m==="v2")l.uniform2f(j,k.x,k.y);else if(m==="v3")l.uniform3f(j,k.x,k.y,k.z);else if(m==="v4")l.uniform4f(j,k.x,k.y,k.z,k.w);else if(m==="c")l.uniform3f(j,k.r,k.g,k.b);else if(m==="fv1")l.uniform1fv(j,k);else if(m==="fv")l.uniform3fv(j,k);else if(m==="v2v"){if(e._array===void 0)e._array=new Float32Array(2*k.length);m=0;for(o=k.length;m<o;m++){q=m*2;e._array[q]=k[m].x;e._array[q+1]=k[m].y}l.uniform2fv(j,e._array)}else if(m==="v3v"){if(e._array===
-void 0)e._array=new Float32Array(3*k.length);m=0;for(o=k.length;m<o;m++){q=m*3;e._array[q]=k[m].x;e._array[q+1]=k[m].y;e._array[q+2]=k[m].z}l.uniform3fv(j,e._array)}else if(m==="v4v"){if(e._array===void 0)e._array=new Float32Array(4*k.length);m=0;for(o=k.length;m<o;m++){q=m*4;e._array[q]=k[m].x;e._array[q+1]=k[m].y;e._array[q+2]=k[m].z;e._array[q+3]=k[m].w}l.uniform4fv(j,e._array)}else if(m==="m4"){if(e._array===void 0)e._array=new Float32Array(16);k.flattenToArray(e._array);l.uniformMatrix4fv(j,
-false,e._array)}else if(m==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*k.length);m=0;for(o=k.length;m<o;m++)k[m].flattenToArrayOffset(e._array,m*16);l.uniformMatrix4fv(j,false,e._array)}else if(m==="t"){l.uniform1i(j,k);if(j=e.texture)if(j.image instanceof Array&&j.image.length===6){e=j;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);
-l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,e.flipY);k=[];for(j=0;j<6;j++){m=k;o=j;if(D.autoScaleCubemaps){q=e.image[j];u=Wa;if(!(q.width<=u&&q.height<=u)){v=Math.max(q.width,q.height);s=Math.floor(q.width*u/v);u=Math.floor(q.height*u/v);v=document.createElement("canvas");v.width=s;v.height=u;v.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,u);q=v}}else q=e.image[j];m[o]=q}j=k[0];m=(j.width&j.width-1)===0&&(j.height&j.height-1)===0;o=C(e.format);q=C(e.type);t(l.TEXTURE_CUBE_MAP,e,m);for(j=0;j<6;j++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
-j,0,o,o,q,k[j]);e.generateMipmaps&&m&&l.generateMipmap(l.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(j instanceof THREE.WebGLRenderTargetCube){e=j;l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,e.__webglTexture)}else D.setTexture(j,k)}else if(m==="tv"){if(e._array===void 0){e._array=[];m=0;for(o=e.texture.length;m<o;m++)e._array[m]=k+m}l.uniform1iv(j,e._array);
-m=0;for(o=e.texture.length;m<o;m++)(j=e.texture[m])&&D.setTexture(j,e._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();l.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&&l.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray);d.skinning&&l.uniformMatrix4fv(h.boneGlobalMatrices,
-false,f.boneMatrices)}l.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&l.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.objectMatrix!==null&&l.uniformMatrix4fv(h.objectMatrix,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 u(a,b,c){if(Pa!==a){a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL);
-Pa=a}if(a&&(Qa!==b||Va!==c)){l.polygonOffset(b,c);Qa=b;Va=c}}function w(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS)){console.error(l.getShaderInfoLog(c));console.error(b);return null}return c}function t(a,b,c){if(c){l.texParameteri(a,l.TEXTURE_WRAP_S,C(b.wrapS));l.texParameteri(a,l.TEXTURE_WRAP_T,C(b.wrapT));l.texParameteri(a,l.TEXTURE_MAG_FILTER,
-C(b.magFilter));l.texParameteri(a,l.TEXTURE_MIN_FILTER,C(b.minFilter))}else{l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE);l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE);l.texParameteri(a,l.TEXTURE_MAG_FILTER,F(b.magFilter));l.texParameteri(a,l.TEXTURE_MIN_FILTER,F(b.minFilter))}}function x(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height);l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,
-l.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height);l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)}else l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function F(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:l.LINEAR}function C(a){return a===THREE.RepeatWrapping?l.REPEAT:a===THREE.ClampToEdgeWrapping?
-l.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?l.MIRRORED_REPEAT:a===THREE.NearestFilter?l.NEAREST:a===THREE.NearestMipMapNearestFilter?l.NEAREST_MIPMAP_NEAREST:a===THREE.NearestMipMapLinearFilter?l.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?l.LINEAR:a===THREE.LinearMipMapNearestFilter?l.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?l.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?l.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?l.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?
-l.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?l.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?l.BYTE:a===THREE.ShortType?l.SHORT:a===THREE.UnsignedShortType?l.UNSIGNED_SHORT:a===THREE.IntType?l.INT:a===THREE.UnsignedIntType?l.UNSIGNED_INT:a===THREE.FloatType?l.FLOAT:a===THREE.AlphaFormat?l.ALPHA:a===THREE.RGBFormat?l.RGB:a===THREE.RGBAFormat?l.RGBA:a===THREE.LuminanceFormat?l.LUMINANCE:a===THREE.LuminanceAlphaFormat?l.LUMINANCE_ALPHA:a===THREE.AddEquation?l.FUNC_ADD:a===THREE.SubtractEquation?
-l.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?l.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?l.ZERO:a===THREE.OneFactor?l.ONE:a===THREE.SrcColorFactor?l.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?l.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?l.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?l.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?l.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?l.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?l.DST_COLOR:a===THREE.OneMinusDstColorFactor?l.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?
-l.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},z=a.canvas!==void 0?a.canvas:document.createElement("canvas"),v=a.precision!==void 0?a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,E=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,O=a.antialias!==void 0?a.antialias:false,Q=a.stencil!==void 0?a.stencil:true,Y=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),J=a.clearAlpha!==
+g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(n)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<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(n||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){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 i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ca=N=null;U=I=X=L=Ga=za=S=-1;Ra=true;a[d].render(b,c,kb,bb);ca=N=null;U=I=X=L=Ga=za=S=-1;Ra=true}}function j(a,b,c,d,f,e,g,h){var j,k,i,l;if(b){k=a.length-1;l=b=-1}else{k=0;b=a.length;l=1}for(var m=k;m!==b;m=m+l){j=
+a[m];if(j.render){k=j.object;i=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&D.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);D.setDepthTest(j.depthTest);D.setDepthWrite(j.depthWrite);u(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}D.setObjectFaces(k);i instanceof THREE.BufferGeometry?D.renderBufferDirect(d,f,e,j,i,k):D.renderBuffer(d,f,e,j,i,k)}}}function l(a,b,c,d,f,e,g){for(var h,j,k=0,i=a.length;k<i;k++){h=a[k];j=h.object;if(j.visible){if(g)h=g;else{h=h[b];if(!h)continue;
+e&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,f,h,j)}}}function o(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 m(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&&D.deallocateMaterial(d);D.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,j=d.uniforms;if(g!==N){k.useProgram(g);N=g;e=true}if(d.id!==U){U=d.id;e=true}if(e||a!==ca){k.uniformMatrix4fv(h.projectionMatrix,
+false,a._projectionMatrixArray);a!==ca&&(ca=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(Ra){for(var i,l=0,m=0,o=0,n,p,r,q=ra,s=q.directional.colors,w=q.directional.positions,t=q.point.colors,u=q.point.positions,x=q.point.distances,F=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
+I=q.spot.directions,X=q.spot.angles,E=q.spot.exponents,J=0,O=0,T=0,L=r=0,c=L=0,e=b.length;c<e;c++){i=b[c];if(!i.onlyShadow&&i.visible){n=i.color;p=i.intensity;r=i.distance;if(i instanceof THREE.AmbientLight)if(D.gammaInput){l=l+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{l=l+n.r;m=m+n.g;o=o+n.b}else if(i instanceof THREE.DirectionalLight){r=J*3;if(D.gammaInput){s[r]=n.r*n.r*p*p;s[r+1]=n.g*n.g*p*p;s[r+2]=n.b*n.b*p*p}else{s[r]=n.r*p;s[r+1]=n.g*p;s[r+2]=n.b*p}Fa.copy(i.matrixWorld.getPosition());Fa.subSelf(i.target.matrixWorld.getPosition());
+Fa.normalize();w[r]=Fa.x;w[r+1]=Fa.y;w[r+2]=Fa.z;J=J+1}else if(i instanceof THREE.PointLight){L=O*3;if(D.gammaInput){t[L]=n.r*n.r*p*p;t[L+1]=n.g*n.g*p*p;t[L+2]=n.b*n.b*p*p}else{t[L]=n.r*p;t[L+1]=n.g*p;t[L+2]=n.b*p}n=i.matrixWorld.getPosition();u[L]=n.x;u[L+1]=n.y;u[L+2]=n.z;x[O]=r;O=O+1}else if(i instanceof THREE.SpotLight){L=T*3;if(D.gammaInput){F[L]=n.r*n.r*p*p;F[L+1]=n.g*n.g*p*p;F[L+2]=n.b*n.b*p*p}else{F[L]=n.r*p;F[L+1]=n.g*p;F[L+2]=n.b*p}n=i.matrixWorld.getPosition();B[L]=n.x;B[L+1]=n.y;B[L+2]=
+n.z;H[T]=r;Fa.copy(n);Fa.subSelf(i.target.matrixWorld.getPosition());Fa.normalize();I[L]=Fa.x;I[L+1]=Fa.y;I[L+2]=Fa.z;X[T]=Math.cos(i.angle);E[T]=i.exponent;T=T+1}}}c=J*3;for(e=s.length;c<e;c++)s[c]=0;c=O*3;for(e=t.length;c<e;c++)t[c]=0;c=T*3;for(e=F.length;c<e;c++)F[c]=0;q.directional.length=J;q.point.length=O;q.spot.length=T;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=o;Ra=false}c=ra;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;D.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;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=z.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(D.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(D.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){e=c=0;for(i=b.length;e<i;e++){l=b[e];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){j.shadowMap.texture[c]=l.shadowMap;j.shadowMapSize.value[c]=l.shadowMapSize;j.shadowMatrix.value[c]=l.shadowMatrix;j.shadowDarkness.value[c]=l.shadowDarkness;j.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(l=g.uniforms[b[j][1]]){e=b[j][0];m=e.type;i=e.value;
+if(m==="i")k.uniform1i(l,i);else if(m==="f")k.uniform1f(l,i);else if(m==="v2")k.uniform2f(l,i.x,i.y);else if(m==="v3")k.uniform3f(l,i.x,i.y,i.z);else if(m==="v4")k.uniform4f(l,i.x,i.y,i.z,i.w);else if(m==="c")k.uniform3f(l,i.r,i.g,i.b);else if(m==="fv1")k.uniform1fv(l,i);else if(m==="fv")k.uniform3fv(l,i);else if(m==="v2v"){if(e._array===void 0)e._array=new Float32Array(2*i.length);m=0;for(o=i.length;m<o;m++){q=m*2;e._array[q]=i[m].x;e._array[q+1]=i[m].y}k.uniform2fv(l,e._array)}else if(m==="v3v"){if(e._array===
+void 0)e._array=new Float32Array(3*i.length);m=0;for(o=i.length;m<o;m++){q=m*3;e._array[q]=i[m].x;e._array[q+1]=i[m].y;e._array[q+2]=i[m].z}k.uniform3fv(l,e._array)}else if(m==="v4v"){if(e._array===void 0)e._array=new Float32Array(4*i.length);m=0;for(o=i.length;m<o;m++){q=m*4;e._array[q]=i[m].x;e._array[q+1]=i[m].y;e._array[q+2]=i[m].z;e._array[q+3]=i[m].w}k.uniform4fv(l,e._array)}else if(m==="m4"){if(e._array===void 0)e._array=new Float32Array(16);i.flattenToArray(e._array);k.uniformMatrix4fv(l,
+false,e._array)}else if(m==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*i.length);m=0;for(o=i.length;m<o;m++)i[m].flattenToArrayOffset(e._array,m*16);k.uniformMatrix4fv(l,false,e._array)}else if(m==="t"){k.uniform1i(l,i);if(l=e.texture)if(l.image instanceof Array&&l.image.length===6){e=l;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+i);k.bindTexture(k.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);
+k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,e.flipY);i=[];for(l=0;l<6;l++){m=i;o=l;if(D.autoScaleCubemaps){q=e.image[l];w=Va;if(!(q.width<=w&&q.height<=w)){t=Math.max(q.width,q.height);s=Math.floor(q.width*w/t);w=Math.floor(q.height*w/t);t=document.createElement("canvas");t.width=s;t.height=w;t.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,w);q=t}}else q=e.image[l];m[o]=q}l=i[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;o=C(e.format);q=C(e.type);v(k.TEXTURE_CUBE_MAP,e,m);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+
+l,0,o,o,q,i[l]);e.generateMipmaps&&m&&k.generateMipmap(k.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{k.activeTexture(k.TEXTURE0+i);k.bindTexture(k.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){e=l;k.activeTexture(k.TEXTURE0+i);k.bindTexture(k.TEXTURE_CUBE_MAP,e.__webglTexture)}else D.setTexture(l,i)}else if(m==="tv"){if(e._array===void 0){e._array=[];m=0;for(o=e.texture.length;m<o;m++)e._array[m]=i+m}k.uniform1iv(l,e._array);
+m=0;for(o=e.texture.length;m<o;m++)(l=e.texture[m])&&D.setTexture(l,e._array[m])}}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);d.skinning&&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.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,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 u(a,b,c){if(Oa!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);
+Oa=a}if(a&&(Pa!==b||Ua!==c)){k.polygonOffset(b,c);Pa=b;Ua=c}}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(b);return null}return c}function v(a,b,c){if(c){k.texParameteri(a,k.TEXTURE_WRAP_S,C(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,C(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,
+C(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,C(b.minFilter))}else{k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,F(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,F(b.minFilter))}}function x(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,
+k.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)}else k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function F(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function C(a){return a===THREE.RepeatWrapping?k.REPEAT:a===THREE.ClampToEdgeWrapping?
+k.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?k.MIRRORED_REPEAT:a===THREE.NearestFilter?k.NEAREST:a===THREE.NearestMipMapNearestFilter?k.NEAREST_MIPMAP_NEAREST:a===THREE.NearestMipMapLinearFilter?k.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?k.LINEAR:a===THREE.LinearMipMapNearestFilter?k.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?k.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?k.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?k.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?
+k.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?k.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?k.BYTE:a===THREE.ShortType?k.SHORT:a===THREE.UnsignedShortType?k.UNSIGNED_SHORT:a===THREE.IntType?k.INT:a===THREE.UnsignedIntType?k.UNSIGNED_INT:a===THREE.FloatType?k.FLOAT:a===THREE.AlphaFormat?k.ALPHA:a===THREE.RGBFormat?k.RGB:a===THREE.RGBAFormat?k.RGBA:a===THREE.LuminanceFormat?k.LUMINANCE:a===THREE.LuminanceAlphaFormat?k.LUMINANCE_ALPHA:a===THREE.AddEquation?k.FUNC_ADD:a===THREE.SubtractEquation?
+k.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?k.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?k.ZERO:a===THREE.OneFactor?k.ONE:a===THREE.SrcColorFactor?k.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?k.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?k.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?k.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?k.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?k.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?k.DST_COLOR:a===THREE.OneMinusDstColorFactor?k.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?
+k.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},z=a.canvas!==void 0?a.canvas:document.createElement("canvas"),w=a.precision!==void 0?a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,E=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,O=a.antialias!==void 0?a.antialias:false,Q=a.stencil!==void 0?a.stencil:true,Y=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),J=a.clearAlpha!==
 void 0?a.clearAlpha:0,P=a.maxLights!==void 0?a.maxLights:4;this.domElement=z;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=
 void 0?a.clearAlpha:0,P=a.maxLights!==void 0?a.maxLights:4;this.domElement=z;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=
-true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var D=this,W=[],R=0,N=null,ba=null,U=-1,I=null,ca=null,ha=0,L=-1,X=-1,S=-1,T=-1,ia=-1,ma=-1,Aa=-1,Ha=-1,Pa=null,Qa=null,Va=null,ob=null,hb=0,bb=0,Nb=0,pb=0,kb=0,cb=0,Ea=new THREE.Frustum,Ba=new THREE.Matrix4,db=new THREE.Matrix4,pa=new THREE.Vector4,Ga=new THREE.Vector3,Sa=true,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},
-point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}},l;try{if(!(l=z.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:E,antialias:O,stencil:Q,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";}catch(lb){console.error(lb)}l.getExtension("OES_texture_float")||console.log("THREE.WebGLRenderer: Float textures not supported.");l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);
-l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(B.r,B.g,B.b,J);this.context=l;var Ob=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS);l.getParameter(l.MAX_TEXTURE_SIZE);var Wa=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return l};this.supportsVertexTextures=function(){return Ob>0};this.setSize=function(a,b){z.width=a;z.height=b;this.setViewport(0,
-0,z.width,z.height)};this.setViewport=function(a,b,c,d){hb=a;bb=b;Nb=c;pb=d;l.viewport(hb,bb,Nb,pb)};this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=function(a,b){B.setHex(a);J=b;l.clearColor(B.r,B.g,B.b,J)};this.setClearColor=function(a,b){B.copy(a);J=b;l.clearColor(B.r,B.g,B.b,J)};this.getClearColor=function(){return B};this.getClearAlpha=function(){return J};this.clear=function(a,
-b,c){var d=0;if(a===void 0||a)d=d|l.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|l.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;
-delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];l.deleteBuffer(c.__webglVertexBuffer);l.deleteBuffer(c.__webglNormalBuffer);l.deleteBuffer(c.__webglTangentBuffer);l.deleteBuffer(c.__webglColorBuffer);l.deleteBuffer(c.__webglUVBuffer);l.deleteBuffer(c.__webglUV2Buffer);l.deleteBuffer(c.__webglSkinVertexABuffer);l.deleteBuffer(c.__webglSkinVertexBBuffer);l.deleteBuffer(c.__webglSkinIndicesBuffer);
-l.deleteBuffer(c.__webglSkinWeightsBuffer);l.deleteBuffer(c.__webglFaceBuffer);l.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)l.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}D.info.memory.geometries--}else if(a instanceof
-THREE.Ribbon){a=a.geometry;l.deleteBuffer(a.__webglVertexBuffer);l.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;l.deleteBuffer(a.__webglVertexBuffer);l.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;l.deleteBuffer(a.__webglVertexBuffer);l.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
-false;l.deleteTexture(a.__webglTexture);D.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){l.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){l.deleteFramebuffer(a.__webglFramebuffer[b]);l.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{l.deleteFramebuffer(a.__webglFramebuffer);l.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=W.length;a<c;a++){d=W[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=W.length;a<c;a++){d=W[a];d.program!==b&&e.push(d)}W=e;l.deleteProgram(b);D.info.memory.programs--}}};this.updateShadowMap=function(a,b){N=null;U=I=Ha=Aa=S=-1;Sa=true;X=L=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=l.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=
-l.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=l.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=l.createBuffer();if(a.hasPositions){l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.position);l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,false,0,0)}if(a.hasNormals){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
-e,f,g,h,i,k,j,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];j=n[o+5];h=n[o+6];k=n[o+7];m=n[o+8];d=(d+g+h)/3;e=(e+i+k)/3;f=(f+j+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}}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,false,0,0)}if(a.hasUvs&&c.map){l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer);l.bufferData(l.ARRAY_BUFFER,
-a.uvArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.uv);l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.color);l.vertexAttribPointer(b.attributes.color,3,l.FLOAT,false,0,0)}l.drawArrays(l.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!==I){I=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;l.bindBuffer(l.ARRAY_BUFFER,h.buffer);l.vertexAttribPointer(a.position,i,l.FLOAT,false,0,g*i*4);h=e.attributes.normal;if(a.normal>=0&&h){i=h.itemSize;l.bindBuffer(l.ARRAY_BUFFER,h.buffer);l.vertexAttribPointer(a.normal,i,l.FLOAT,false,0,g*i*4)}h=e.attributes.uv;
-if(a.uv>=0&&h)if(h.buffer){i=h.itemSize;l.bindBuffer(l.ARRAY_BUFFER,h.buffer);l.vertexAttribPointer(a.uv,i,l.FLOAT,false,0,g*i*4);l.enableVertexAttribArray(a.uv)}else l.disableVertexAttribArray(a.uv);h=e.attributes.color;if(a.color>=0&&h){i=h.itemSize;l.bindBuffer(l.ARRAY_BUFFER,h.buffer);l.vertexAttribPointer(a.color,i,l.FLOAT,false,0,g*i*4)}h=e.attributes.tangent;if(a.tangent>=0&&h){i=h.itemSize;l.bindBuffer(l.ARRAY_BUFFER,h.buffer);l.vertexAttribPointer(a.tangent,i,l.FLOAT,false,0,g*i*4)}l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
-e.attributes.index.buffer)}l.drawElements(l.TRIANGLES,f[d].count,l.UNSIGNED_SHORT,f[d].start*2);D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+f[d].count;D.info.render.faces=D.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!==I){I=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer);l.vertexAttribPointer(b.position,
-3,l.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);l.vertexAttribPointer(c.position,3,l.FLOAT,false,0,0)}else if(c.position>=0){l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer);l.vertexAttribPointer(c.position,3,l.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var k=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;k<d.numSupportedMorphTargets&&k<i.length;){l.bindBuffer(l.ARRAY_BUFFER,
-e.__webglMorphTargetsBuffers[i[k]]);l.vertexAttribPointer(c["morphTarget"+k],3,l.FLOAT,false,0,0);if(d.morphNormals){l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[k]]);l.vertexAttribPointer(c["morphNormal"+k],3,l.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=g[i[k]];k++}}else{i=[];g=f.morphTargetInfluences;var j,m=g.length;for(j=0;j<m;j++){k=g[j];k>0&&i.push([j,k])}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(k=0;k<d.numSupportedMorphTargets;){if(i[k]){j=i[k][0];l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);l.vertexAttribPointer(c["morphTarget"+k],3,l.FLOAT,false,0,0);if(d.morphNormals){l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j]);l.vertexAttribPointer(c["morphNormal"+k],3,l.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=g[j]}else{l.vertexAttribPointer(c["morphTarget"+k],3,l.FLOAT,false,0,0);d.morphNormals&&l.vertexAttribPointer(c["morphNormal"+
-k],3,l.FLOAT,false,0,0);f.__webglMorphTargetInfluences[k]=0}k++}}d.program.uniforms.morphTargetInfluences!==null&&l.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){l.bindBuffer(l.ARRAY_BUFFER,c.buffer);l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,false,0,0)}}}if(b.color>=0){l.bindBuffer(l.ARRAY_BUFFER,
-e.__webglColorBuffer);l.vertexAttribPointer(b.color,3,l.FLOAT,false,0,0)}if(b.normal>=0){l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer);l.vertexAttribPointer(b.normal,3,l.FLOAT,false,0,0)}if(b.tangent>=0){l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer);l.vertexAttribPointer(b.tangent,4,l.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer);l.vertexAttribPointer(b.uv,2,l.FLOAT,false,0,0);l.enableVertexAttribArray(b.uv)}else l.disableVertexAttribArray(b.uv);
-if(b.uv2>=0)if(e.__webglUV2Buffer){l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer);l.vertexAttribPointer(b.uv2,2,l.FLOAT,false,0,0);l.enableVertexAttribArray(b.uv2)}else l.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexABuffer);l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,false,0,0);l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,
-false,0,0);l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,false,0,0);l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==ob){l.lineWidth(d);ob=d}a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);l.drawElements(l.LINES,e.__webglLineCount,l.UNSIGNED_SHORT,0)}else{a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);
-l.drawElements(l.TRIANGLES,e.__webglFaceCount,l.UNSIGNED_SHORT,0)}D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+e.__webglFaceCount;D.info.render.faces=D.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?l.LINE_STRIP:l.LINES;d=d.linewidth;if(d!==ob){l.lineWidth(d);ob=d}l.drawArrays(f,0,e.__webglLineCount);D.info.render.calls++}else if(f instanceof THREE.ParticleSystem){l.drawArrays(l.POINTS,0,e.__webglParticleCount);D.info.render.calls++;
-D.info.render.points=D.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount);D.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,k,o=a.__lights,n=a.fog;U=-1;Sa=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=
-new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ba.multiply(b.projectionMatrix,b.matrixWorldInverse);Ea.setFromMatrix(Ba);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=0;D.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);k=a.__webglObjects;d=0;for(e=k.length;d<e;d++){f=k[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Ea.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{pa.copy(h.matrixWorld.getPosition());Ba.multiplyVector3(pa);f.z=pa.z}}}this.sortObjects&&k.sort(g);k=a.__webglObjectsImmediate;d=0;for(e=k.length;d<e;d++){f=k[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);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,o,n,true,d);m(a.__webglObjectsImmediate,"",b,o,n,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,o,n,false);m(a.__webglObjectsImmediate,"opaque",b,o,n,false);j(a.__webglObjects,false,"transparent",b,o,n,true);m(a.__webglObjectsImmediate,"transparent",b,o,n,true)}i(this.renderPluginsPost,
-a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture);l.generateMipmap(l.TEXTURE_CUBE_MAP);l.bindTexture(l.TEXTURE_CUBE_MAP,null)}else{l.bindTexture(l.TEXTURE_2D,c.__webglTexture);l.generateMipmap(l.TEXTURE_2D);l.bindTexture(l.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);I=
--1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,l,Ea):e.render(function(a){D.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,v=void 0,u=void 0,x=void 0,w=void 0,z=void 0,F={},C=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){v=q.faces[s];u=v.materialIndex;w=u!==void 0?u:-1;F[w]===void 0&&(F[w]={hash:w,counter:0});z=F[w].hash+"_"+F[w].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:B});
-x=v instanceof THREE.Face3?3:4;if(q.geometryGroups[z].vertices+x>65535){F[w].counter=F[w].counter+1;z=F[w].hash+"_"+F[w].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:B})}v instanceof THREE.Face3?q.geometryGroups[z].faces3.push(s):q.geometryGroups[z].faces4.push(s);q.geometryGroups[z].vertices=q.geometryGroups[z].vertices+x}q.geometryGroupsList=[];var H=void 0;for(H in q.geometryGroups){q.geometryGroups[H].id=
-ha++;q.geometryGroupsList.push(q.geometryGroups[H])}}for(i in j.geometryGroups){m=j.geometryGroups[i];if(!m.__webglVertexBuffer){var I=m;I.__webglVertexBuffer=l.createBuffer();I.__webglNormalBuffer=l.createBuffer();I.__webglTangentBuffer=l.createBuffer();I.__webglColorBuffer=l.createBuffer();I.__webglUVBuffer=l.createBuffer();I.__webglUV2Buffer=l.createBuffer();I.__webglSkinVertexABuffer=l.createBuffer();I.__webglSkinVertexBBuffer=l.createBuffer();I.__webglSkinIndicesBuffer=l.createBuffer();I.__webglSkinWeightsBuffer=
-l.createBuffer();I.__webglFaceBuffer=l.createBuffer();I.__webglLineBuffer=l.createBuffer();var X=void 0,L=void 0;if(I.numMorphTargets){I.__webglMorphTargetsBuffers=[];X=0;for(L=I.numMorphTargets;X<L;X++)I.__webglMorphTargetsBuffers.push(l.createBuffer())}if(I.numMorphNormals){I.__webglMorphNormalsBuffers=[];X=0;for(L=I.numMorphNormals;X<L;X++)I.__webglMorphNormalsBuffers.push(l.createBuffer())}D.info.memory.geometries++;var E=m,J=g,T=J.geometry,O=E.faces3,N=E.faces4,S=O.length*3+N.length*4,U=O.length*
+true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var D=this,W=[],R=0,N=null,ba=null,U=-1,I=null,ca=null,ha=0,L=-1,X=-1,S=-1,T=-1,ia=-1,ma=-1,za=-1,Ga=-1,Oa=null,Pa=null,Ua=null,ob=null,hb=0,ab=0,Nb=0,pb=0,kb=0,bb=0,Da=new THREE.Frustum,Aa=new THREE.Matrix4,cb=new THREE.Matrix4,pa=new THREE.Vector4,Fa=new THREE.Vector3,Ra=true,ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},
+point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}},k;try{if(!(k=z.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:E,antialias:O,stencil:Q,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";}catch(lb){console.error(lb)}k.getExtension("OES_texture_float")||console.log("THREE.WebGLRenderer: Float textures not supported.");k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);
+k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(B.r,B.g,B.b,J);this.context=k;var Ob=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Va=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return k};this.supportsVertexTextures=function(){return Ob>0};this.setSize=function(a,b){z.width=a;z.height=b;this.setViewport(0,
+0,z.width,z.height)};this.setViewport=function(a,b,c,d){hb=a;ab=b;Nb=c;pb=d;k.viewport(hb,ab,Nb,pb)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){B.setHex(a);J=b;k.clearColor(B.r,B.g,B.b,J)};this.setClearColor=function(a,b){B.copy(a);J=b;k.clearColor(B.r,B.g,B.b,J)};this.getClearColor=function(){return B};this.getClearAlpha=function(){return J};this.clear=function(a,
+b,c){var d=0;if(a===void 0||a)d=d|k.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|k.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;
+delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);
+k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)k.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}D.info.memory.geometries--}else if(a instanceof
+THREE.Ribbon){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
+false;k.deleteTexture(a.__webglTexture);D.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=W.length;a<c;a++){d=W[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=W.length;a<c;a++){d=W[a];d.program!==b&&e.push(d)}W=e;k.deleteProgram(b);D.info.memory.programs--}}};this.updateShadowMap=function(a,b){N=null;U=I=Ga=za=S=-1;Ra=true;X=L=-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,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!==I){I=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,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);D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+f[d].count;D.info.render.faces=D.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!==I){I=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)}D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+e.__webglFaceCount;D.info.render.faces=D.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);D.info.render.calls++}else if(f instanceof THREE.ParticleSystem){k.drawArrays(k.POINTS,0,e.__webglParticleCount);D.info.render.calls++;
+D.info.render.points=D.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount);D.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,m,n=a.__lights,o=a.fog;U=-1;Ra=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=
+new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Aa.multiply(b.projectionMatrix,b.matrixWorldInverse);Da.setFromMatrix(Aa);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=0;D.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];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Da.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{pa.copy(h.matrixWorld.getPosition());Aa.multiplyVector3(pa);f.z=pa.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[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);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);l(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);l(a.__webglObjectsImmediate,"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",b,n,o,true);l(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(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);I=
+-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,Da):e.render(function(a){D.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,l=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,v=void 0,u=void 0,x=void 0,z=void 0,F={},C=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){w=q.faces[s];v=w.materialIndex;x=v!==void 0?v:-1;F[x]===void 0&&(F[x]={hash:x,counter:0});z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B});
+u=w instanceof THREE.Face3?3:4;if(q.geometryGroups[z].vertices+u>65535){F[x].counter=F[x].counter+1;z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B})}w instanceof THREE.Face3?q.geometryGroups[z].faces3.push(s):q.geometryGroups[z].faces4.push(s);q.geometryGroups[z].vertices=q.geometryGroups[z].vertices+u}q.geometryGroupsList=[];var H=void 0;for(H in q.geometryGroups){q.geometryGroups[H].id=
+ha++;q.geometryGroupsList.push(q.geometryGroups[H])}}for(j in i.geometryGroups){l=i.geometryGroups[j];if(!l.__webglVertexBuffer){var I=l;I.__webglVertexBuffer=k.createBuffer();I.__webglNormalBuffer=k.createBuffer();I.__webglTangentBuffer=k.createBuffer();I.__webglColorBuffer=k.createBuffer();I.__webglUVBuffer=k.createBuffer();I.__webglUV2Buffer=k.createBuffer();I.__webglSkinVertexABuffer=k.createBuffer();I.__webglSkinVertexBBuffer=k.createBuffer();I.__webglSkinIndicesBuffer=k.createBuffer();I.__webglSkinWeightsBuffer=
+k.createBuffer();I.__webglFaceBuffer=k.createBuffer();I.__webglLineBuffer=k.createBuffer();var X=void 0,L=void 0;if(I.numMorphTargets){I.__webglMorphTargetsBuffers=[];X=0;for(L=I.numMorphTargets;X<L;X++)I.__webglMorphTargetsBuffers.push(k.createBuffer())}if(I.numMorphNormals){I.__webglMorphNormalsBuffers=[];X=0;for(L=I.numMorphNormals;X<L;X++)I.__webglMorphNormalsBuffers.push(k.createBuffer())}D.info.memory.geometries++;var E=l,J=g,T=J.geometry,O=E.faces3,N=E.faces4,S=O.length*3+N.length*4,U=O.length*
 1+N.length*2,P=O.length*3+N.length*4,Q=c(J,E),ba=e(Q),R=d(Q),Y=Q.vertexColors?Q.vertexColors:false;E.__vertexArray=new Float32Array(S*3);if(R)E.__normalArray=new Float32Array(S*3);if(T.hasTangents)E.__tangentArray=new Float32Array(S*4);if(Y)E.__colorArray=new Float32Array(S*3);if(ba){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)E.__uvArray=new Float32Array(S*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)E.__uv2Array=new Float32Array(S*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){E.__skinVertexAArray=
 1+N.length*2,P=O.length*3+N.length*4,Q=c(J,E),ba=e(Q),R=d(Q),Y=Q.vertexColors?Q.vertexColors:false;E.__vertexArray=new Float32Array(S*3);if(R)E.__normalArray=new Float32Array(S*3);if(T.hasTangents)E.__tangentArray=new Float32Array(S*4);if(Y)E.__colorArray=new Float32Array(S*3);if(ba){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)E.__uvArray=new Float32Array(S*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)E.__uv2Array=new Float32Array(S*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){E.__skinVertexAArray=
 new Float32Array(S*4);E.__skinVertexBArray=new Float32Array(S*4);E.__skinIndexArray=new Float32Array(S*4);E.__skinWeightArray=new Float32Array(S*4)}E.__faceArray=new Uint16Array(U*3);E.__lineArray=new Uint16Array(P*2);var W=void 0,ca=void 0;if(E.numMorphTargets){E.__morphTargetsArrays=[];W=0;for(ca=E.numMorphTargets;W<ca;W++)E.__morphTargetsArrays.push(new Float32Array(S*3))}if(E.numMorphNormals){E.__morphNormalsArrays=[];W=0;for(ca=E.numMorphNormals;W<ca;W++)E.__morphNormalsArrays.push(new Float32Array(S*
 new Float32Array(S*4);E.__skinVertexBArray=new Float32Array(S*4);E.__skinIndexArray=new Float32Array(S*4);E.__skinWeightArray=new Float32Array(S*4)}E.__faceArray=new Uint16Array(U*3);E.__lineArray=new Uint16Array(P*2);var W=void 0,ca=void 0;if(E.numMorphTargets){E.__morphTargetsArrays=[];W=0;for(ca=E.numMorphTargets;W<ca;W++)E.__morphTargetsArrays.push(new Float32Array(S*3))}if(E.numMorphNormals){E.__morphNormalsArrays=[];W=0;for(ca=E.numMorphNormals;W<ca;W++)E.__morphNormalsArrays.push(new Float32Array(S*
-3))}E.__webglFaceCount=U*3;E.__webglLineCount=P*2;if(Q.attributes){if(E.__webglCustomAttributesList===void 0)E.__webglCustomAttributesList=[];var ia=void 0;for(ia in Q.attributes){var Ha=Q.attributes[ia],ma={},Aa;for(Aa in Ha)ma[Aa]=Ha[Aa];if(!ma.__webglInitialized||ma.createUniqueBuffers){ma.__webglInitialized=true;var Va=1;ma.type==="v2"?Va=2:ma.type==="v3"?Va=3:ma.type==="v4"?Va=4:ma.type==="c"&&(Va=3);ma.size=Va;ma.array=new Float32Array(S*Va);ma.buffer=l.createBuffer();ma.buffer.belongsToAttribute=
-ia;Ha.needsUpdate=true;ma.__original=Ha}E.__webglCustomAttributesList.push(ma)}}E.__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 Pa=j,Qa=void 0,pa=void 0,sa=void 0;for(Qa in Pa.attributes){sa=Qa==="index"?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER;pa=Pa.attributes[Qa];pa.buffer=l.createBuffer();l.bindBuffer(sa,
-pa.buffer);l.bufferData(sa,pa.array,l.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Ba=j;Ba.__webglVertexBuffer=l.createBuffer();Ba.__webglColorBuffer=l.createBuffer();D.info.memory.geometries++;var Ea=j,Ga=Ea.vertices.length;Ea.__vertexArray=new Float32Array(Ga*3);Ea.__colorArray=new Float32Array(Ga*3);Ea.__webglVertexCount=Ga;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var ob=
-j;ob.__webglVertexBuffer=l.createBuffer();ob.__webglColorBuffer=l.createBuffer();D.info.memory.geometries++;var hb=j,Wa=g,Sa=hb.vertices.length;hb.__vertexArray=new Float32Array(Sa*3);hb.__colorArray=new Float32Array(Sa*3);hb.__webglLineCount=Sa;b(hb,Wa);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var cb=j;cb.__webglVertexBuffer=l.createBuffer();cb.__webglColorBuffer=l.createBuffer();D.info.geometries++;var bb=
-j,Nb=g,pb=bb.vertices.length;bb.__vertexArray=new Float32Array(pb*3);bb.__colorArray=new Float32Array(pb*3);bb.__sortArray=[];bb.__webglParticleCount=pb;b(bb,Nb);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.BufferGeometry)o(h.__webglObjects,j,g);else for(i in j.geometryGroups){m=j.geometryGroups[i];o(h.__webglObjects,m,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){j=
-g.geometry;o(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 eb=a.__objectsRemoved[0],db=a;eb instanceof THREE.Mesh||eb instanceof THREE.ParticleSystem||eb instanceof THREE.Ribbon||eb instanceof
-THREE.Line?r(db.__webglObjects,eb):eb instanceof THREE.Sprite?n(db.__webglSprites,eb):eb instanceof THREE.LensFlare?n(db.__webglFlares,eb):(eb instanceof THREE.ImmediateRenderObject||eb.immediateRenderCallback)&&r(db.__webglObjectsImmediate,eb);eb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var lb=0,Ob=a.__webglObjects.length;lb<Ob;lb++){var mb=a.__webglObjects[lb].object,da=mb.geometry,kb=void 0,lc=void 0,Xa=void 0;if(mb instanceof THREE.Mesh)if(da instanceof THREE.BufferGeometry){if(da.verticesNeedUpdate||
-da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate){var Hb=da,mc=l.DYNAMIC_DRAW,yd=!da.dynamic,nc=Hb.attributes,Wc=nc.index,Xc=nc.position,Yc=nc.normal,Zc=nc.uv,$c=nc.color,ad=nc.tangent;if(Hb.elementsNeedUpdate&&Wc!==void 0){l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,Wc.buffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Wc.array,mc)}if(Hb.verticesNeedUpdate&&Xc!==void 0){l.bindBuffer(l.ARRAY_BUFFER,Xc.buffer);l.bufferData(l.ARRAY_BUFFER,Xc.array,mc)}if(Hb.normalsNeedUpdate&&
-Yc!==void 0){l.bindBuffer(l.ARRAY_BUFFER,Yc.buffer);l.bufferData(l.ARRAY_BUFFER,Yc.array,mc)}if(Hb.uvsNeedUpdate&&Zc!==void 0){l.bindBuffer(l.ARRAY_BUFFER,Zc.buffer);l.bufferData(l.ARRAY_BUFFER,Zc.array,mc)}if(Hb.colorsNeedUpdate&&$c!==void 0){l.bindBuffer(l.ARRAY_BUFFER,$c.buffer);l.bufferData(l.ARRAY_BUFFER,$c.array,mc)}if(Hb.tangentsNeedUpdate&&ad!==void 0){l.bindBuffer(l.ARRAY_BUFFER,ad.buffer);l.bufferData(l.ARRAY_BUFFER,ad.array,mc)}if(yd){var md=void 0;for(md in Hb.attributes)delete Hb.attributes[md].array}}da.verticesNeedUpdate=
-false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false}else{for(var bd=0,zd=da.geometryGroupsList.length;bd<zd;bd++){kb=da.geometryGroupsList[bd];Xa=c(mb,kb);lc=Xa.attributes&&k(Xa);if(da.verticesNeedUpdate||da.morphTargetsNeedUpdate||da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate||lc){var fa=kb,Ad=mb,Za=l.DYNAMIC_DRAW,Bd=!da.dynamic,ec=Xa;if(fa.__inittedArrays){var nd=
+3))}E.__webglFaceCount=U*3;E.__webglLineCount=P*2;if(Q.attributes){if(E.__webglCustomAttributesList===void 0)E.__webglCustomAttributesList=[];var ia=void 0;for(ia in Q.attributes){var Ga=Q.attributes[ia],ma={},za;for(za in Ga)ma[za]=Ga[za];if(!ma.__webglInitialized||ma.createUniqueBuffers){ma.__webglInitialized=true;var Ua=1;ma.type==="v2"?Ua=2:ma.type==="v3"?Ua=3:ma.type==="v4"?Ua=4:ma.type==="c"&&(Ua=3);ma.size=Ua;ma.array=new Float32Array(S*Ua);ma.buffer=k.createBuffer();ma.buffer.belongsToAttribute=
+ia;Ga.needsUpdate=true;ma.__original=Ga}E.__webglCustomAttributesList.push(ma)}}E.__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 Oa=i,Pa=void 0,pa=void 0,ra=void 0;for(Pa in Oa.attributes){ra=Pa==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;pa=Oa.attributes[Pa];pa.buffer=k.createBuffer();k.bindBuffer(ra,
+pa.buffer);k.bufferData(ra,pa.array,k.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){i=g.geometry;if(!i.__webglVertexBuffer){var Aa=i;Aa.__webglVertexBuffer=k.createBuffer();Aa.__webglColorBuffer=k.createBuffer();D.info.memory.geometries++;var Da=i,Fa=Da.vertices.length;Da.__vertexArray=new Float32Array(Fa*3);Da.__colorArray=new Float32Array(Fa*3);Da.__webglVertexCount=Fa;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();D.info.memory.geometries++;var hb=i,Va=g,Ra=hb.vertices.length;hb.__vertexArray=new Float32Array(Ra*3);hb.__colorArray=new Float32Array(Ra*3);hb.__webglLineCount=Ra;b(hb,Va);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();D.info.geometries++;var ab=
+i,Nb=g,pb=ab.vertices.length;ab.__vertexArray=new Float32Array(pb*3);ab.__colorArray=new Float32Array(pb*3);ab.__sortArray=[];ab.__webglParticleCount=pb;b(ab,Nb);i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){i=g.geometry;if(i instanceof THREE.BufferGeometry)o(h.__webglObjects,i,g);else for(j in i.geometryGroups){l=i.geometryGroups[j];o(h.__webglObjects,l,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){i=
+g.geometry;o(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 eb=a.__objectsRemoved[0],cb=a;eb instanceof THREE.Mesh||eb instanceof THREE.ParticleSystem||eb instanceof THREE.Ribbon||eb instanceof
+THREE.Line?r(cb.__webglObjects,eb):eb instanceof THREE.Sprite?m(cb.__webglSprites,eb):eb instanceof THREE.LensFlare?m(cb.__webglFlares,eb):(eb instanceof THREE.ImmediateRenderObject||eb.immediateRenderCallback)&&r(cb.__webglObjectsImmediate,eb);eb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var lb=0,Ob=a.__webglObjects.length;lb<Ob;lb++){var mb=a.__webglObjects[lb].object,da=mb.geometry,kb=void 0,lc=void 0,Wa=void 0;if(mb instanceof THREE.Mesh)if(da instanceof THREE.BufferGeometry){if(da.verticesNeedUpdate||
+da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate){var Hb=da,mc=k.DYNAMIC_DRAW,yd=!da.dynamic,nc=Hb.attributes,Wc=nc.index,Xc=nc.position,Yc=nc.normal,Zc=nc.uv,$c=nc.color,ad=nc.tangent;if(Hb.elementsNeedUpdate&&Wc!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Wc.buffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Wc.array,mc)}if(Hb.verticesNeedUpdate&&Xc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Xc.buffer);k.bufferData(k.ARRAY_BUFFER,Xc.array,mc)}if(Hb.normalsNeedUpdate&&
+Yc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Yc.buffer);k.bufferData(k.ARRAY_BUFFER,Yc.array,mc)}if(Hb.uvsNeedUpdate&&Zc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Zc.buffer);k.bufferData(k.ARRAY_BUFFER,Zc.array,mc)}if(Hb.colorsNeedUpdate&&$c!==void 0){k.bindBuffer(k.ARRAY_BUFFER,$c.buffer);k.bufferData(k.ARRAY_BUFFER,$c.array,mc)}if(Hb.tangentsNeedUpdate&&ad!==void 0){k.bindBuffer(k.ARRAY_BUFFER,ad.buffer);k.bufferData(k.ARRAY_BUFFER,ad.array,mc)}if(yd){var md=void 0;for(md in Hb.attributes)delete Hb.attributes[md].array}}da.verticesNeedUpdate=
+false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false}else{for(var bd=0,zd=da.geometryGroupsList.length;bd<zd;bd++){kb=da.geometryGroupsList[bd];Wa=c(mb,kb);lc=Wa.attributes&&n(Wa);if(da.verticesNeedUpdate||da.morphTargetsNeedUpdate||da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate||lc){var fa=kb,Ad=mb,Ya=k.DYNAMIC_DRAW,Bd=!da.dynamic,ec=Wa;if(fa.__inittedArrays){var nd=
 d(ec),cd=ec.vertexColors?ec.vertexColors:false,od=e(ec),Ic=nd===THREE.SmoothShading,G=void 0,V=void 0,jb=void 0,M=void 0,oc=void 0,Rb=void 0,nb=void 0,Jc=void 0,Ib=void 0,pc=void 0,qc=void 0,Z=void 0,$=void 0,aa=void 0,na=void 0,qb=void 0,rb=void 0,sb=void 0,uc=void 0,tb=void 0,ub=void 0,vb=void 0,vc=void 0,wb=void 0,xb=void 0,yb=void 0,wc=void 0,zb=void 0,Ab=void 0,Bb=void 0,xc=void 0,Cb=void 0,Db=void 0,Eb=void 0,yc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Kc=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Lc=
 d(ec),cd=ec.vertexColors?ec.vertexColors:false,od=e(ec),Ic=nd===THREE.SmoothShading,G=void 0,V=void 0,jb=void 0,M=void 0,oc=void 0,Rb=void 0,nb=void 0,Jc=void 0,Ib=void 0,pc=void 0,qc=void 0,Z=void 0,$=void 0,aa=void 0,na=void 0,qb=void 0,rb=void 0,sb=void 0,uc=void 0,tb=void 0,ub=void 0,vb=void 0,vc=void 0,wb=void 0,xb=void 0,yb=void 0,wc=void 0,zb=void 0,Ab=void 0,Bb=void 0,xc=void 0,Cb=void 0,Db=void 0,Eb=void 0,yc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Kc=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Lc=
-void 0,ja=void 0,pd=void 0,Yb=void 0,rc=void 0,sc=void 0,Ka=void 0,qd=void 0,Ia=void 0,Ja=void 0,Zb=void 0,Jb=void 0,za=0,Fa=0,Kb=0,Lb=0,fb=0,Ra=0,oa=0,Ta=0,Ca=0,K=0,ea=0,A=0,$a=void 0,La=fa.__vertexArray,zc=fa.__uvArray,Ac=fa.__uv2Array,gb=fa.__normalArray,ta=fa.__tangentArray,Ma=fa.__colorArray,ua=fa.__skinVertexAArray,va=fa.__skinVertexBArray,wa=fa.__skinIndexArray,xa=fa.__skinWeightArray,dd=fa.__morphTargetsArrays,ed=fa.__morphNormalsArrays,fd=fa.__webglCustomAttributesList,y=void 0,Fb=fa.__faceArray,
-ab=fa.__lineArray,Ua=Ad.geometry,Cd=Ua.elementsNeedUpdate,rd=Ua.uvsNeedUpdate,Dd=Ua.normalsNeedUpdate,Ed=Ua.tangentsNeedUpdate,Fd=Ua.colorsNeedUpdate,Gd=Ua.morphTargetsNeedUpdate,fc=Ua.vertices,ka=fa.faces3,la=fa.faces4,Da=Ua.faces,gd=Ua.faceVertexUvs[0],hd=Ua.faceVertexUvs[1],gc=Ua.skinVerticesA,hc=Ua.skinVerticesB,ic=Ua.skinIndices,$b=Ua.skinWeights,ac=Ua.morphTargets,Mc=Ua.morphNormals;if(Ua.verticesNeedUpdate){G=0;for(V=ka.length;G<V;G++){M=Da[ka[G]];Z=fc[M.a];$=fc[M.b];aa=fc[M.c];La[Fa]=Z.x;
-La[Fa+1]=Z.y;La[Fa+2]=Z.z;La[Fa+3]=$.x;La[Fa+4]=$.y;La[Fa+5]=$.z;La[Fa+6]=aa.x;La[Fa+7]=aa.y;La[Fa+8]=aa.z;Fa=Fa+9}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];Z=fc[M.a];$=fc[M.b];aa=fc[M.c];na=fc[M.d];La[Fa]=Z.x;La[Fa+1]=Z.y;La[Fa+2]=Z.z;La[Fa+3]=$.x;La[Fa+4]=$.y;La[Fa+5]=$.z;La[Fa+6]=aa.x;La[Fa+7]=aa.y;La[Fa+8]=aa.z;La[Fa+9]=na.x;La[Fa+10]=na.y;La[Fa+11]=na.z;Fa=Fa+12}l.bindBuffer(l.ARRAY_BUFFER,fa.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,La,Za)}if(Gd){Ka=0;for(qd=ac.length;Ka<qd;Ka++){G=ea=
-0;for(V=ka.length;G<V;G++){Zb=ka[G];M=Da[Zb];Z=ac[Ka].vertices[M.a];$=ac[Ka].vertices[M.b];aa=ac[Ka].vertices[M.c];Ia=dd[Ka];Ia[ea]=Z.x;Ia[ea+1]=Z.y;Ia[ea+2]=Z.z;Ia[ea+3]=$.x;Ia[ea+4]=$.y;Ia[ea+5]=$.z;Ia[ea+6]=aa.x;Ia[ea+7]=aa.y;Ia[ea+8]=aa.z;if(ec.morphNormals){if(Ic){Jb=Mc[Ka].vertexNormals[Zb];tb=Jb.a;ub=Jb.b;vb=Jb.c}else vb=ub=tb=Mc[Ka].faceNormals[Zb];Ja=ed[Ka];Ja[ea]=tb.x;Ja[ea+1]=tb.y;Ja[ea+2]=tb.z;Ja[ea+3]=ub.x;Ja[ea+4]=ub.y;Ja[ea+5]=ub.z;Ja[ea+6]=vb.x;Ja[ea+7]=vb.y;Ja[ea+8]=vb.z}ea=ea+9}G=
-0;for(V=la.length;G<V;G++){Zb=la[G];M=Da[Zb];Z=ac[Ka].vertices[M.a];$=ac[Ka].vertices[M.b];aa=ac[Ka].vertices[M.c];na=ac[Ka].vertices[M.d];Ia=dd[Ka];Ia[ea]=Z.x;Ia[ea+1]=Z.y;Ia[ea+2]=Z.z;Ia[ea+3]=$.x;Ia[ea+4]=$.y;Ia[ea+5]=$.z;Ia[ea+6]=aa.x;Ia[ea+7]=aa.y;Ia[ea+8]=aa.z;Ia[ea+9]=na.x;Ia[ea+10]=na.y;Ia[ea+11]=na.z;if(ec.morphNormals){if(Ic){Jb=Mc[Ka].vertexNormals[Zb];tb=Jb.a;ub=Jb.b;vb=Jb.c;vc=Jb.d}else vc=vb=ub=tb=Mc[Ka].faceNormals[Zb];Ja=ed[Ka];Ja[ea]=tb.x;Ja[ea+1]=tb.y;Ja[ea+2]=tb.z;Ja[ea+3]=ub.x;
-Ja[ea+4]=ub.y;Ja[ea+5]=ub.z;Ja[ea+6]=vb.x;Ja[ea+7]=vb.y;Ja[ea+8]=vb.z;Ja[ea+9]=vc.x;Ja[ea+10]=vc.y;Ja[ea+11]=vc.z}ea=ea+12}l.bindBuffer(l.ARRAY_BUFFER,fa.__webglMorphTargetsBuffers[Ka]);l.bufferData(l.ARRAY_BUFFER,dd[Ka],Za);if(ec.morphNormals){l.bindBuffer(l.ARRAY_BUFFER,fa.__webglMorphNormalsBuffers[Ka]);l.bufferData(l.ARRAY_BUFFER,ed[Ka],Za)}}}if($b.length){G=0;for(V=ka.length;G<V;G++){M=Da[ka[G]];zb=$b[M.a];Ab=$b[M.b];Bb=$b[M.c];xa[K]=zb.x;xa[K+1]=zb.y;xa[K+2]=zb.z;xa[K+3]=zb.w;xa[K+4]=Ab.x;xa[K+
-5]=Ab.y;xa[K+6]=Ab.z;xa[K+7]=Ab.w;xa[K+8]=Bb.x;xa[K+9]=Bb.y;xa[K+10]=Bb.z;xa[K+11]=Bb.w;Cb=ic[M.a];Db=ic[M.b];Eb=ic[M.c];wa[K]=Cb.x;wa[K+1]=Cb.y;wa[K+2]=Cb.z;wa[K+3]=Cb.w;wa[K+4]=Db.x;wa[K+5]=Db.y;wa[K+6]=Db.z;wa[K+7]=Db.w;wa[K+8]=Eb.x;wa[K+9]=Eb.y;wa[K+10]=Eb.z;wa[K+11]=Eb.w;Sb=gc[M.a];Tb=gc[M.b];Ub=gc[M.c];ua[K]=Sb.x;ua[K+1]=Sb.y;ua[K+2]=Sb.z;ua[K+3]=1;ua[K+4]=Tb.x;ua[K+5]=Tb.y;ua[K+6]=Tb.z;ua[K+7]=1;ua[K+8]=Ub.x;ua[K+9]=Ub.y;ua[K+10]=Ub.z;ua[K+11]=1;Vb=hc[M.a];Wb=hc[M.b];Xb=hc[M.c];va[K]=Vb.x;
-va[K+1]=Vb.y;va[K+2]=Vb.z;va[K+3]=1;va[K+4]=Wb.x;va[K+5]=Wb.y;va[K+6]=Wb.z;va[K+7]=1;va[K+8]=Xb.x;va[K+9]=Xb.y;va[K+10]=Xb.z;va[K+11]=1;K=K+12}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];zb=$b[M.a];Ab=$b[M.b];Bb=$b[M.c];xc=$b[M.d];xa[K]=zb.x;xa[K+1]=zb.y;xa[K+2]=zb.z;xa[K+3]=zb.w;xa[K+4]=Ab.x;xa[K+5]=Ab.y;xa[K+6]=Ab.z;xa[K+7]=Ab.w;xa[K+8]=Bb.x;xa[K+9]=Bb.y;xa[K+10]=Bb.z;xa[K+11]=Bb.w;xa[K+12]=xc.x;xa[K+13]=xc.y;xa[K+14]=xc.z;xa[K+15]=xc.w;Cb=ic[M.a];Db=ic[M.b];Eb=ic[M.c];yc=ic[M.d];wa[K]=Cb.x;wa[K+1]=
-Cb.y;wa[K+2]=Cb.z;wa[K+3]=Cb.w;wa[K+4]=Db.x;wa[K+5]=Db.y;wa[K+6]=Db.z;wa[K+7]=Db.w;wa[K+8]=Eb.x;wa[K+9]=Eb.y;wa[K+10]=Eb.z;wa[K+11]=Eb.w;wa[K+12]=yc.x;wa[K+13]=yc.y;wa[K+14]=yc.z;wa[K+15]=yc.w;Sb=gc[M.a];Tb=gc[M.b];Ub=gc[M.c];Kc=gc[M.d];ua[K]=Sb.x;ua[K+1]=Sb.y;ua[K+2]=Sb.z;ua[K+3]=1;ua[K+4]=Tb.x;ua[K+5]=Tb.y;ua[K+6]=Tb.z;ua[K+7]=1;ua[K+8]=Ub.x;ua[K+9]=Ub.y;ua[K+10]=Ub.z;ua[K+11]=1;ua[K+12]=Kc.x;ua[K+13]=Kc.y;ua[K+14]=Kc.z;ua[K+15]=1;Vb=hc[M.a];Wb=hc[M.b];Xb=hc[M.c];Lc=hc[M.d];va[K]=Vb.x;va[K+1]=Vb.y;
-va[K+2]=Vb.z;va[K+3]=1;va[K+4]=Wb.x;va[K+5]=Wb.y;va[K+6]=Wb.z;va[K+7]=1;va[K+8]=Xb.x;va[K+9]=Xb.y;va[K+10]=Xb.z;va[K+11]=1;va[K+12]=Lc.x;va[K+13]=Lc.y;va[K+14]=Lc.z;va[K+15]=1;K=K+16}if(K>0){l.bindBuffer(l.ARRAY_BUFFER,fa.__webglSkinVertexABuffer);l.bufferData(l.ARRAY_BUFFER,ua,Za);l.bindBuffer(l.ARRAY_BUFFER,fa.__webglSkinVertexBBuffer);l.bufferData(l.ARRAY_BUFFER,va,Za);l.bindBuffer(l.ARRAY_BUFFER,fa.__webglSkinIndicesBuffer);l.bufferData(l.ARRAY_BUFFER,wa,Za);l.bindBuffer(l.ARRAY_BUFFER,fa.__webglSkinWeightsBuffer);
-l.bufferData(l.ARRAY_BUFFER,xa,Za)}}if(Fd&&cd){G=0;for(V=ka.length;G<V;G++){M=Da[ka[G]];nb=M.vertexColors;Jc=M.color;if(nb.length===3&&cd===THREE.VertexColors){wb=nb[0];xb=nb[1];yb=nb[2]}else yb=xb=wb=Jc;Ma[Ca]=wb.r;Ma[Ca+1]=wb.g;Ma[Ca+2]=wb.b;Ma[Ca+3]=xb.r;Ma[Ca+4]=xb.g;Ma[Ca+5]=xb.b;Ma[Ca+6]=yb.r;Ma[Ca+7]=yb.g;Ma[Ca+8]=yb.b;Ca=Ca+9}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];nb=M.vertexColors;Jc=M.color;if(nb.length===4&&cd===THREE.VertexColors){wb=nb[0];xb=nb[1];yb=nb[2];wc=nb[3]}else wc=yb=xb=wb=
-Jc;Ma[Ca]=wb.r;Ma[Ca+1]=wb.g;Ma[Ca+2]=wb.b;Ma[Ca+3]=xb.r;Ma[Ca+4]=xb.g;Ma[Ca+5]=xb.b;Ma[Ca+6]=yb.r;Ma[Ca+7]=yb.g;Ma[Ca+8]=yb.b;Ma[Ca+9]=wc.r;Ma[Ca+10]=wc.g;Ma[Ca+11]=wc.b;Ca=Ca+12}if(Ca>0){l.bindBuffer(l.ARRAY_BUFFER,fa.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,Ma,Za)}}if(Ed&&Ua.hasTangents){G=0;for(V=ka.length;G<V;G++){M=Da[ka[G]];Ib=M.vertexTangents;qb=Ib[0];rb=Ib[1];sb=Ib[2];ta[oa]=qb.x;ta[oa+1]=qb.y;ta[oa+2]=qb.z;ta[oa+3]=qb.w;ta[oa+4]=rb.x;ta[oa+5]=rb.y;ta[oa+6]=rb.z;ta[oa+7]=rb.w;ta[oa+
-8]=sb.x;ta[oa+9]=sb.y;ta[oa+10]=sb.z;ta[oa+11]=sb.w;oa=oa+12}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];Ib=M.vertexTangents;qb=Ib[0];rb=Ib[1];sb=Ib[2];uc=Ib[3];ta[oa]=qb.x;ta[oa+1]=qb.y;ta[oa+2]=qb.z;ta[oa+3]=qb.w;ta[oa+4]=rb.x;ta[oa+5]=rb.y;ta[oa+6]=rb.z;ta[oa+7]=rb.w;ta[oa+8]=sb.x;ta[oa+9]=sb.y;ta[oa+10]=sb.z;ta[oa+11]=sb.w;ta[oa+12]=uc.x;ta[oa+13]=uc.y;ta[oa+14]=uc.z;ta[oa+15]=uc.w;oa=oa+16}l.bindBuffer(l.ARRAY_BUFFER,fa.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,ta,Za)}if(Dd&&nd){G=0;for(V=
-ka.length;G<V;G++){M=Da[ka[G]];oc=M.vertexNormals;Rb=M.normal;if(oc.length===3&&Ic)for(ja=0;ja<3;ja++){Yb=oc[ja];gb[Ra]=Yb.x;gb[Ra+1]=Yb.y;gb[Ra+2]=Yb.z;Ra=Ra+3}else for(ja=0;ja<3;ja++){gb[Ra]=Rb.x;gb[Ra+1]=Rb.y;gb[Ra+2]=Rb.z;Ra=Ra+3}}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];oc=M.vertexNormals;Rb=M.normal;if(oc.length===4&&Ic)for(ja=0;ja<4;ja++){Yb=oc[ja];gb[Ra]=Yb.x;gb[Ra+1]=Yb.y;gb[Ra+2]=Yb.z;Ra=Ra+3}else for(ja=0;ja<4;ja++){gb[Ra]=Rb.x;gb[Ra+1]=Rb.y;gb[Ra+2]=Rb.z;Ra=Ra+3}}l.bindBuffer(l.ARRAY_BUFFER,
-fa.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,gb,Za)}if(rd&&gd&&od){G=0;for(V=ka.length;G<V;G++){jb=ka[G];M=Da[jb];pc=gd[jb];if(pc!==void 0)for(ja=0;ja<3;ja++){rc=pc[ja];zc[Kb]=rc.u;zc[Kb+1]=rc.v;Kb=Kb+2}}G=0;for(V=la.length;G<V;G++){jb=la[G];M=Da[jb];pc=gd[jb];if(pc!==void 0)for(ja=0;ja<4;ja++){rc=pc[ja];zc[Kb]=rc.u;zc[Kb+1]=rc.v;Kb=Kb+2}}if(Kb>0){l.bindBuffer(l.ARRAY_BUFFER,fa.__webglUVBuffer);l.bufferData(l.ARRAY_BUFFER,zc,Za)}}if(rd&&hd&&od){G=0;for(V=ka.length;G<V;G++){jb=ka[G];M=Da[jb];
-qc=hd[jb];if(qc!==void 0)for(ja=0;ja<3;ja++){sc=qc[ja];Ac[Lb]=sc.u;Ac[Lb+1]=sc.v;Lb=Lb+2}}G=0;for(V=la.length;G<V;G++){jb=la[G];M=Da[jb];qc=hd[jb];if(qc!==void 0)for(ja=0;ja<4;ja++){sc=qc[ja];Ac[Lb]=sc.u;Ac[Lb+1]=sc.v;Lb=Lb+2}}if(Lb>0){l.bindBuffer(l.ARRAY_BUFFER,fa.__webglUV2Buffer);l.bufferData(l.ARRAY_BUFFER,Ac,Za)}}if(Cd){G=0;for(V=ka.length;G<V;G++){M=Da[ka[G]];Fb[fb]=za;Fb[fb+1]=za+1;Fb[fb+2]=za+2;fb=fb+3;ab[Ta]=za;ab[Ta+1]=za+1;ab[Ta+2]=za;ab[Ta+3]=za+2;ab[Ta+4]=za+1;ab[Ta+5]=za+2;Ta=Ta+6;
-za=za+3}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];Fb[fb]=za;Fb[fb+1]=za+1;Fb[fb+2]=za+3;Fb[fb+3]=za+1;Fb[fb+4]=za+2;Fb[fb+5]=za+3;fb=fb+6;ab[Ta]=za;ab[Ta+1]=za+1;ab[Ta+2]=za;ab[Ta+3]=za+3;ab[Ta+4]=za+1;ab[Ta+5]=za+2;ab[Ta+6]=za+2;ab[Ta+7]=za+3;Ta=Ta+8;za=za+4}l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,fa.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Fb,Za);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,fa.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ab,Za)}if(fd){ja=0;for(pd=fd.length;ja<pd;ja++){y=
-fd[ja];if(y.__original.needsUpdate){A=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Da[ka[G]];y.array[A]=y.value[M.a];y.array[A+1]=y.value[M.b];y.array[A+2]=y.value[M.c];A=A+3}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];y.array[A]=y.value[M.a];y.array[A+1]=y.value[M.b];y.array[A+2]=y.value[M.c];y.array[A+3]=y.value[M.d];A=A+4}}else{if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){$a=y.value[ka[G]];y.array[A]=$a;y.array[A+1]=$a;y.array[A+2]=$a;A=A+3}G=
-0;for(V=la.length;G<V;G++){$a=y.value[la[G]];y.array[A]=$a;y.array[A+1]=$a;y.array[A+2]=$a;y.array[A+3]=$a;A=A+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Da[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;A=A+6}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];na=y.value[M.d];y.array[A]=Z.x;y.array[A+
-1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;y.array[A+6]=na.x;y.array[A+7]=na.y;A=A+8}}else{if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=$a=y.value[ka[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;A=A+6}G=0;for(V=la.length;G<V;G++){na=aa=$=Z=$a=y.value[la[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;y.array[A+6]=na.x;y.array[A+7]=
-na.y;A=A+8}}}else if(y.size===3){var ga;ga=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Da[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];A=A+9}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];
-na=y.value[M.d];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];y.array[A+9]=na[ga[0]];y.array[A+10]=na[ga[1]];y.array[A+11]=na[ga[2]];A=A+12}}else if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=$a=y.value[ka[G]];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];
-y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];A=A+9}G=0;for(V=la.length;G<V;G++){na=aa=$=Z=$a=y.value[la[G]];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];y.array[A+9]=na[ga[0]];y.array[A+10]=na[ga[1]];y.array[A+11]=na[ga[2]];A=A+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=
-Da[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;A=A+12}G=0;for(V=la.length;G<V;G++){M=Da[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];na=y.value[M.d];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+
-7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}else if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=$a=y.value[ka[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;A=A+12}G=0;for(V=la.length;G<V;G++){na=aa=$=Z=
-$a=y.value[la[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}l.bindBuffer(l.ARRAY_BUFFER,y.buffer);l.bufferData(l.ARRAY_BUFFER,y.array,Za)}}}if(Bd){delete fa.__inittedArrays;delete fa.__colorArray;delete fa.__normalArray;delete fa.__tangentArray;delete fa.__uvArray;
-delete fa.__uv2Array;delete fa.__faceArray;delete fa.__vertexArray;delete fa.__lineArray;delete fa.__skinVertexAArray;delete fa.__skinVertexBArray;delete fa.__skinIndexArray;delete fa.__skinWeightArray}}}}da.verticesNeedUpdate=false;da.morphTargetsNeedUpdate=false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false;Xa.attributes&&p(Xa)}else if(mb instanceof THREE.Ribbon){if(da.verticesNeedUpdate||da.colorsNeedUpdate){var bc=
-da,sd=l.DYNAMIC_DRAW,Bc=void 0,Cc=void 0,Nc=void 0,cc=void 0,Oc=void 0,td=bc.vertices,ud=bc.colors,Hd=td.length,Id=ud.length,Pc=bc.__vertexArray,Qc=bc.__colorArray,Jd=bc.colorsNeedUpdate;if(bc.verticesNeedUpdate){for(Bc=0;Bc<Hd;Bc++){Nc=td[Bc];cc=Bc*3;Pc[cc]=Nc.x;Pc[cc+1]=Nc.y;Pc[cc+2]=Nc.z}l.bindBuffer(l.ARRAY_BUFFER,bc.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Pc,sd)}if(Jd){for(Cc=0;Cc<Id;Cc++){Oc=ud[Cc];cc=Cc*3;Qc[cc]=Oc.r;Qc[cc+1]=Oc.g;Qc[cc+2]=Oc.b}l.bindBuffer(l.ARRAY_BUFFER,bc.__webglColorBuffer);
-l.bufferData(l.ARRAY_BUFFER,Qc,sd)}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false}else if(mb instanceof THREE.Line){Xa=c(mb,kb);lc=Xa.attributes&&k(Xa);if(da.verticesNeedUpdate||da.colorsNeedUpdate||lc){var Mb=da,id=l.DYNAMIC_DRAW,Dc=void 0,Ec=void 0,Rc=void 0,ya=void 0,Sc=void 0,vd=Mb.vertices,wd=Mb.colors,Kd=vd.length,Ld=wd.length,Tc=Mb.__vertexArray,Uc=Mb.__colorArray,Md=Mb.colorsNeedUpdate,jd=Mb.__webglCustomAttributesList,Vc=void 0,xd=void 0,Oa=void 0,tc=void 0,Ya=void 0,ra=void 0;if(Mb.verticesNeedUpdate){for(Dc=
-0;Dc<Kd;Dc++){Rc=vd[Dc];ya=Dc*3;Tc[ya]=Rc.x;Tc[ya+1]=Rc.y;Tc[ya+2]=Rc.z}l.bindBuffer(l.ARRAY_BUFFER,Mb.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Tc,id)}if(Md){for(Ec=0;Ec<Ld;Ec++){Sc=wd[Ec];ya=Ec*3;Uc[ya]=Sc.r;Uc[ya+1]=Sc.g;Uc[ya+2]=Sc.b}l.bindBuffer(l.ARRAY_BUFFER,Mb.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,Uc,id)}if(jd){Vc=0;for(xd=jd.length;Vc<xd;Vc++){ra=jd[Vc];if(ra.needsUpdate&&(ra.boundTo===void 0||ra.boundTo==="vertices")){ya=0;tc=ra.value.length;if(ra.size===1)for(Oa=0;Oa<tc;Oa++)ra.array[Oa]=
-ra.value[Oa];else if(ra.size===2)for(Oa=0;Oa<tc;Oa++){Ya=ra.value[Oa];ra.array[ya]=Ya.x;ra.array[ya+1]=Ya.y;ya=ya+2}else if(ra.size===3)if(ra.type==="c")for(Oa=0;Oa<tc;Oa++){Ya=ra.value[Oa];ra.array[ya]=Ya.r;ra.array[ya+1]=Ya.g;ra.array[ya+2]=Ya.b;ya=ya+3}else for(Oa=0;Oa<tc;Oa++){Ya=ra.value[Oa];ra.array[ya]=Ya.x;ra.array[ya+1]=Ya.y;ra.array[ya+2]=Ya.z;ya=ya+3}else if(ra.size===4)for(Oa=0;Oa<tc;Oa++){Ya=ra.value[Oa];ra.array[ya]=Ya.x;ra.array[ya+1]=Ya.y;ra.array[ya+2]=Ya.z;ra.array[ya+3]=Ya.w;ya=
-ya+4}l.bindBuffer(l.ARRAY_BUFFER,ra.buffer);l.bufferData(l.ARRAY_BUFFER,ra.array,id)}}}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Xa.attributes&&p(Xa)}else if(mb instanceof THREE.ParticleSystem){Xa=c(mb,kb);lc=Xa.attributes&&k(Xa);(da.verticesNeedUpdate||da.colorsNeedUpdate||mb.sortParticles||lc)&&f(da,l.DYNAMIC_DRAW,mb);da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Xa.attributes&&p(Xa)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":
-a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var i,j,k,m,o;i=m=o=h=0;for(j=b.length;i<j;i++){k=b[i];
-if(!k.onlyShadow){k instanceof THREE.DirectionalLight&&m++;k instanceof THREE.PointLight&&o++;k instanceof THREE.SpotLight&&h++}}if(o+h+m<=P){j=m;k=o;m=h}else{j=Math.ceil(P*m/(o+m));m=k=P-j}var n=0,h=0;for(o=b.length;h<o;h++){i=b[h];if(i.castShadow){i instanceof THREE.SpotLight&&n++;i instanceof THREE.DirectionalLight&&!i.shadowCascade&&n++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{i=a.fragmentShader;o=a.vertexShader;var h=a.uniforms,b=a.attributes,c={map:!!a.map,
-envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:p,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:j,maxPointLights:k,maxSpotLights:m,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
-alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(i);d.push(o)}for(q in c){d.push(q);d.push(c[q])}g=d.join();q=0;for(d=W.length;q<d;q++){j=W[q];if(j.code===g){j.usedTimes++;r=j.program;break a}}q=l.createProgram();d=["precision "+v+" float;",Ob>0?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
+void 0,ja=void 0,pd=void 0,Yb=void 0,rc=void 0,sc=void 0,Ja=void 0,qd=void 0,Ha=void 0,Ia=void 0,Zb=void 0,Jb=void 0,ya=0,Ea=0,Kb=0,Lb=0,fb=0,Qa=0,oa=0,Sa=0,Ba=0,K=0,ea=0,A=0,Za=void 0,Ka=fa.__vertexArray,zc=fa.__uvArray,Ac=fa.__uv2Array,gb=fa.__normalArray,sa=fa.__tangentArray,La=fa.__colorArray,ta=fa.__skinVertexAArray,ua=fa.__skinVertexBArray,va=fa.__skinIndexArray,wa=fa.__skinWeightArray,dd=fa.__morphTargetsArrays,ed=fa.__morphNormalsArrays,fd=fa.__webglCustomAttributesList,y=void 0,Fb=fa.__faceArray,
+$a=fa.__lineArray,Ta=Ad.geometry,Cd=Ta.elementsNeedUpdate,rd=Ta.uvsNeedUpdate,Dd=Ta.normalsNeedUpdate,Ed=Ta.tangentsNeedUpdate,Fd=Ta.colorsNeedUpdate,Gd=Ta.morphTargetsNeedUpdate,fc=Ta.vertices,ka=fa.faces3,la=fa.faces4,Ca=Ta.faces,gd=Ta.faceVertexUvs[0],hd=Ta.faceVertexUvs[1],gc=Ta.skinVerticesA,hc=Ta.skinVerticesB,ic=Ta.skinIndices,$b=Ta.skinWeights,ac=Ta.morphTargets,Mc=Ta.morphNormals;if(Ta.verticesNeedUpdate){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Z=fc[M.a];$=fc[M.b];aa=fc[M.c];Ka[Ea]=Z.x;
+Ka[Ea+1]=Z.y;Ka[Ea+2]=Z.z;Ka[Ea+3]=$.x;Ka[Ea+4]=$.y;Ka[Ea+5]=$.z;Ka[Ea+6]=aa.x;Ka[Ea+7]=aa.y;Ka[Ea+8]=aa.z;Ea=Ea+9}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Z=fc[M.a];$=fc[M.b];aa=fc[M.c];na=fc[M.d];Ka[Ea]=Z.x;Ka[Ea+1]=Z.y;Ka[Ea+2]=Z.z;Ka[Ea+3]=$.x;Ka[Ea+4]=$.y;Ka[Ea+5]=$.z;Ka[Ea+6]=aa.x;Ka[Ea+7]=aa.y;Ka[Ea+8]=aa.z;Ka[Ea+9]=na.x;Ka[Ea+10]=na.y;Ka[Ea+11]=na.z;Ea=Ea+12}k.bindBuffer(k.ARRAY_BUFFER,fa.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ka,Ya)}if(Gd){Ja=0;for(qd=ac.length;Ja<qd;Ja++){G=ea=
+0;for(V=ka.length;G<V;G++){Zb=ka[G];M=Ca[Zb];Z=ac[Ja].vertices[M.a];$=ac[Ja].vertices[M.b];aa=ac[Ja].vertices[M.c];Ha=dd[Ja];Ha[ea]=Z.x;Ha[ea+1]=Z.y;Ha[ea+2]=Z.z;Ha[ea+3]=$.x;Ha[ea+4]=$.y;Ha[ea+5]=$.z;Ha[ea+6]=aa.x;Ha[ea+7]=aa.y;Ha[ea+8]=aa.z;if(ec.morphNormals){if(Ic){Jb=Mc[Ja].vertexNormals[Zb];tb=Jb.a;ub=Jb.b;vb=Jb.c}else vb=ub=tb=Mc[Ja].faceNormals[Zb];Ia=ed[Ja];Ia[ea]=tb.x;Ia[ea+1]=tb.y;Ia[ea+2]=tb.z;Ia[ea+3]=ub.x;Ia[ea+4]=ub.y;Ia[ea+5]=ub.z;Ia[ea+6]=vb.x;Ia[ea+7]=vb.y;Ia[ea+8]=vb.z}ea=ea+9}G=
+0;for(V=la.length;G<V;G++){Zb=la[G];M=Ca[Zb];Z=ac[Ja].vertices[M.a];$=ac[Ja].vertices[M.b];aa=ac[Ja].vertices[M.c];na=ac[Ja].vertices[M.d];Ha=dd[Ja];Ha[ea]=Z.x;Ha[ea+1]=Z.y;Ha[ea+2]=Z.z;Ha[ea+3]=$.x;Ha[ea+4]=$.y;Ha[ea+5]=$.z;Ha[ea+6]=aa.x;Ha[ea+7]=aa.y;Ha[ea+8]=aa.z;Ha[ea+9]=na.x;Ha[ea+10]=na.y;Ha[ea+11]=na.z;if(ec.morphNormals){if(Ic){Jb=Mc[Ja].vertexNormals[Zb];tb=Jb.a;ub=Jb.b;vb=Jb.c;vc=Jb.d}else vc=vb=ub=tb=Mc[Ja].faceNormals[Zb];Ia=ed[Ja];Ia[ea]=tb.x;Ia[ea+1]=tb.y;Ia[ea+2]=tb.z;Ia[ea+3]=ub.x;
+Ia[ea+4]=ub.y;Ia[ea+5]=ub.z;Ia[ea+6]=vb.x;Ia[ea+7]=vb.y;Ia[ea+8]=vb.z;Ia[ea+9]=vc.x;Ia[ea+10]=vc.y;Ia[ea+11]=vc.z}ea=ea+12}k.bindBuffer(k.ARRAY_BUFFER,fa.__webglMorphTargetsBuffers[Ja]);k.bufferData(k.ARRAY_BUFFER,dd[Ja],Ya);if(ec.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglMorphNormalsBuffers[Ja]);k.bufferData(k.ARRAY_BUFFER,ed[Ja],Ya)}}}if($b.length){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];zb=$b[M.a];Ab=$b[M.b];Bb=$b[M.c];wa[K]=zb.x;wa[K+1]=zb.y;wa[K+2]=zb.z;wa[K+3]=zb.w;wa[K+4]=Ab.x;wa[K+
+5]=Ab.y;wa[K+6]=Ab.z;wa[K+7]=Ab.w;wa[K+8]=Bb.x;wa[K+9]=Bb.y;wa[K+10]=Bb.z;wa[K+11]=Bb.w;Cb=ic[M.a];Db=ic[M.b];Eb=ic[M.c];va[K]=Cb.x;va[K+1]=Cb.y;va[K+2]=Cb.z;va[K+3]=Cb.w;va[K+4]=Db.x;va[K+5]=Db.y;va[K+6]=Db.z;va[K+7]=Db.w;va[K+8]=Eb.x;va[K+9]=Eb.y;va[K+10]=Eb.z;va[K+11]=Eb.w;Sb=gc[M.a];Tb=gc[M.b];Ub=gc[M.c];ta[K]=Sb.x;ta[K+1]=Sb.y;ta[K+2]=Sb.z;ta[K+3]=1;ta[K+4]=Tb.x;ta[K+5]=Tb.y;ta[K+6]=Tb.z;ta[K+7]=1;ta[K+8]=Ub.x;ta[K+9]=Ub.y;ta[K+10]=Ub.z;ta[K+11]=1;Vb=hc[M.a];Wb=hc[M.b];Xb=hc[M.c];ua[K]=Vb.x;
+ua[K+1]=Vb.y;ua[K+2]=Vb.z;ua[K+3]=1;ua[K+4]=Wb.x;ua[K+5]=Wb.y;ua[K+6]=Wb.z;ua[K+7]=1;ua[K+8]=Xb.x;ua[K+9]=Xb.y;ua[K+10]=Xb.z;ua[K+11]=1;K=K+12}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];zb=$b[M.a];Ab=$b[M.b];Bb=$b[M.c];xc=$b[M.d];wa[K]=zb.x;wa[K+1]=zb.y;wa[K+2]=zb.z;wa[K+3]=zb.w;wa[K+4]=Ab.x;wa[K+5]=Ab.y;wa[K+6]=Ab.z;wa[K+7]=Ab.w;wa[K+8]=Bb.x;wa[K+9]=Bb.y;wa[K+10]=Bb.z;wa[K+11]=Bb.w;wa[K+12]=xc.x;wa[K+13]=xc.y;wa[K+14]=xc.z;wa[K+15]=xc.w;Cb=ic[M.a];Db=ic[M.b];Eb=ic[M.c];yc=ic[M.d];va[K]=Cb.x;va[K+1]=
+Cb.y;va[K+2]=Cb.z;va[K+3]=Cb.w;va[K+4]=Db.x;va[K+5]=Db.y;va[K+6]=Db.z;va[K+7]=Db.w;va[K+8]=Eb.x;va[K+9]=Eb.y;va[K+10]=Eb.z;va[K+11]=Eb.w;va[K+12]=yc.x;va[K+13]=yc.y;va[K+14]=yc.z;va[K+15]=yc.w;Sb=gc[M.a];Tb=gc[M.b];Ub=gc[M.c];Kc=gc[M.d];ta[K]=Sb.x;ta[K+1]=Sb.y;ta[K+2]=Sb.z;ta[K+3]=1;ta[K+4]=Tb.x;ta[K+5]=Tb.y;ta[K+6]=Tb.z;ta[K+7]=1;ta[K+8]=Ub.x;ta[K+9]=Ub.y;ta[K+10]=Ub.z;ta[K+11]=1;ta[K+12]=Kc.x;ta[K+13]=Kc.y;ta[K+14]=Kc.z;ta[K+15]=1;Vb=hc[M.a];Wb=hc[M.b];Xb=hc[M.c];Lc=hc[M.d];ua[K]=Vb.x;ua[K+1]=Vb.y;
+ua[K+2]=Vb.z;ua[K+3]=1;ua[K+4]=Wb.x;ua[K+5]=Wb.y;ua[K+6]=Wb.z;ua[K+7]=1;ua[K+8]=Xb.x;ua[K+9]=Xb.y;ua[K+10]=Xb.z;ua[K+11]=1;ua[K+12]=Lc.x;ua[K+13]=Lc.y;ua[K+14]=Lc.z;ua[K+15]=1;K=K+16}if(K>0){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglSkinVertexABuffer);k.bufferData(k.ARRAY_BUFFER,ta,Ya);k.bindBuffer(k.ARRAY_BUFFER,fa.__webglSkinVertexBBuffer);k.bufferData(k.ARRAY_BUFFER,ua,Ya);k.bindBuffer(k.ARRAY_BUFFER,fa.__webglSkinIndicesBuffer);k.bufferData(k.ARRAY_BUFFER,va,Ya);k.bindBuffer(k.ARRAY_BUFFER,fa.__webglSkinWeightsBuffer);
+k.bufferData(k.ARRAY_BUFFER,wa,Ya)}}if(Fd&&cd){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];nb=M.vertexColors;Jc=M.color;if(nb.length===3&&cd===THREE.VertexColors){wb=nb[0];xb=nb[1];yb=nb[2]}else yb=xb=wb=Jc;La[Ba]=wb.r;La[Ba+1]=wb.g;La[Ba+2]=wb.b;La[Ba+3]=xb.r;La[Ba+4]=xb.g;La[Ba+5]=xb.b;La[Ba+6]=yb.r;La[Ba+7]=yb.g;La[Ba+8]=yb.b;Ba=Ba+9}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];nb=M.vertexColors;Jc=M.color;if(nb.length===4&&cd===THREE.VertexColors){wb=nb[0];xb=nb[1];yb=nb[2];wc=nb[3]}else wc=yb=xb=wb=
+Jc;La[Ba]=wb.r;La[Ba+1]=wb.g;La[Ba+2]=wb.b;La[Ba+3]=xb.r;La[Ba+4]=xb.g;La[Ba+5]=xb.b;La[Ba+6]=yb.r;La[Ba+7]=yb.g;La[Ba+8]=yb.b;La[Ba+9]=wc.r;La[Ba+10]=wc.g;La[Ba+11]=wc.b;Ba=Ba+12}if(Ba>0){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,La,Ya)}}if(Ed&&Ta.hasTangents){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Ib=M.vertexTangents;qb=Ib[0];rb=Ib[1];sb=Ib[2];sa[oa]=qb.x;sa[oa+1]=qb.y;sa[oa+2]=qb.z;sa[oa+3]=qb.w;sa[oa+4]=rb.x;sa[oa+5]=rb.y;sa[oa+6]=rb.z;sa[oa+7]=rb.w;sa[oa+
+8]=sb.x;sa[oa+9]=sb.y;sa[oa+10]=sb.z;sa[oa+11]=sb.w;oa=oa+12}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Ib=M.vertexTangents;qb=Ib[0];rb=Ib[1];sb=Ib[2];uc=Ib[3];sa[oa]=qb.x;sa[oa+1]=qb.y;sa[oa+2]=qb.z;sa[oa+3]=qb.w;sa[oa+4]=rb.x;sa[oa+5]=rb.y;sa[oa+6]=rb.z;sa[oa+7]=rb.w;sa[oa+8]=sb.x;sa[oa+9]=sb.y;sa[oa+10]=sb.z;sa[oa+11]=sb.w;sa[oa+12]=uc.x;sa[oa+13]=uc.y;sa[oa+14]=uc.z;sa[oa+15]=uc.w;oa=oa+16}k.bindBuffer(k.ARRAY_BUFFER,fa.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,sa,Ya)}if(Dd&&nd){G=0;for(V=
+ka.length;G<V;G++){M=Ca[ka[G]];oc=M.vertexNormals;Rb=M.normal;if(oc.length===3&&Ic)for(ja=0;ja<3;ja++){Yb=oc[ja];gb[Qa]=Yb.x;gb[Qa+1]=Yb.y;gb[Qa+2]=Yb.z;Qa=Qa+3}else for(ja=0;ja<3;ja++){gb[Qa]=Rb.x;gb[Qa+1]=Rb.y;gb[Qa+2]=Rb.z;Qa=Qa+3}}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];oc=M.vertexNormals;Rb=M.normal;if(oc.length===4&&Ic)for(ja=0;ja<4;ja++){Yb=oc[ja];gb[Qa]=Yb.x;gb[Qa+1]=Yb.y;gb[Qa+2]=Yb.z;Qa=Qa+3}else for(ja=0;ja<4;ja++){gb[Qa]=Rb.x;gb[Qa+1]=Rb.y;gb[Qa+2]=Rb.z;Qa=Qa+3}}k.bindBuffer(k.ARRAY_BUFFER,
+fa.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,gb,Ya)}if(rd&&gd&&od){G=0;for(V=ka.length;G<V;G++){jb=ka[G];M=Ca[jb];pc=gd[jb];if(pc!==void 0)for(ja=0;ja<3;ja++){rc=pc[ja];zc[Kb]=rc.u;zc[Kb+1]=rc.v;Kb=Kb+2}}G=0;for(V=la.length;G<V;G++){jb=la[G];M=Ca[jb];pc=gd[jb];if(pc!==void 0)for(ja=0;ja<4;ja++){rc=pc[ja];zc[Kb]=rc.u;zc[Kb+1]=rc.v;Kb=Kb+2}}if(Kb>0){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglUVBuffer);k.bufferData(k.ARRAY_BUFFER,zc,Ya)}}if(rd&&hd&&od){G=0;for(V=ka.length;G<V;G++){jb=ka[G];M=Ca[jb];
+qc=hd[jb];if(qc!==void 0)for(ja=0;ja<3;ja++){sc=qc[ja];Ac[Lb]=sc.u;Ac[Lb+1]=sc.v;Lb=Lb+2}}G=0;for(V=la.length;G<V;G++){jb=la[G];M=Ca[jb];qc=hd[jb];if(qc!==void 0)for(ja=0;ja<4;ja++){sc=qc[ja];Ac[Lb]=sc.u;Ac[Lb+1]=sc.v;Lb=Lb+2}}if(Lb>0){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglUV2Buffer);k.bufferData(k.ARRAY_BUFFER,Ac,Ya)}}if(Cd){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Fb[fb]=ya;Fb[fb+1]=ya+1;Fb[fb+2]=ya+2;fb=fb+3;$a[Sa]=ya;$a[Sa+1]=ya+1;$a[Sa+2]=ya;$a[Sa+3]=ya+2;$a[Sa+4]=ya+1;$a[Sa+5]=ya+2;Sa=Sa+6;
+ya=ya+3}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Fb[fb]=ya;Fb[fb+1]=ya+1;Fb[fb+2]=ya+3;Fb[fb+3]=ya+1;Fb[fb+4]=ya+2;Fb[fb+5]=ya+3;fb=fb+6;$a[Sa]=ya;$a[Sa+1]=ya+1;$a[Sa+2]=ya;$a[Sa+3]=ya+3;$a[Sa+4]=ya+1;$a[Sa+5]=ya+2;$a[Sa+6]=ya+2;$a[Sa+7]=ya+3;Sa=Sa+8;ya=ya+4}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,fa.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Fb,Ya);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,fa.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,$a,Ya)}if(fd){ja=0;for(pd=fd.length;ja<pd;ja++){y=
+fd[ja];if(y.__original.needsUpdate){A=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];y.array[A]=y.value[M.a];y.array[A+1]=y.value[M.b];y.array[A+2]=y.value[M.c];A=A+3}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];y.array[A]=y.value[M.a];y.array[A+1]=y.value[M.b];y.array[A+2]=y.value[M.c];y.array[A+3]=y.value[M.d];A=A+4}}else{if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){Za=y.value[ka[G]];y.array[A]=Za;y.array[A+1]=Za;y.array[A+2]=Za;A=A+3}G=
+0;for(V=la.length;G<V;G++){Za=y.value[la[G]];y.array[A]=Za;y.array[A+1]=Za;y.array[A+2]=Za;y.array[A+3]=Za;A=A+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;A=A+6}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];na=y.value[M.d];y.array[A]=Z.x;y.array[A+
+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;y.array[A+6]=na.x;y.array[A+7]=na.y;A=A+8}}else{if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=Za=y.value[ka[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;A=A+6}G=0;for(V=la.length;G<V;G++){na=aa=$=Z=Za=y.value[la[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;y.array[A+6]=na.x;y.array[A+7]=
+na.y;A=A+8}}}else if(y.size===3){var ga;ga=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];A=A+9}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];
+na=y.value[M.d];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];y.array[A+9]=na[ga[0]];y.array[A+10]=na[ga[1]];y.array[A+11]=na[ga[2]];A=A+12}}else if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=Za=y.value[ka[G]];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];
+y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];A=A+9}G=0;for(V=la.length;G<V;G++){na=aa=$=Z=Za=y.value[la[G]];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];y.array[A+9]=na[ga[0]];y.array[A+10]=na[ga[1]];y.array[A+11]=na[ga[2]];A=A+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=
+Ca[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;A=A+12}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];na=y.value[M.d];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+
+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}else if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=Za=y.value[ka[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;A=A+12}G=0;for(V=la.length;G<V;G++){na=aa=$=Z=
+Za=y.value[la[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}k.bindBuffer(k.ARRAY_BUFFER,y.buffer);k.bufferData(k.ARRAY_BUFFER,y.array,Ya)}}}if(Bd){delete fa.__inittedArrays;delete fa.__colorArray;delete fa.__normalArray;delete fa.__tangentArray;delete fa.__uvArray;
+delete fa.__uv2Array;delete fa.__faceArray;delete fa.__vertexArray;delete fa.__lineArray;delete fa.__skinVertexAArray;delete fa.__skinVertexBArray;delete fa.__skinIndexArray;delete fa.__skinWeightArray}}}}da.verticesNeedUpdate=false;da.morphTargetsNeedUpdate=false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false;Wa.attributes&&p(Wa)}else if(mb instanceof THREE.Ribbon){if(da.verticesNeedUpdate||da.colorsNeedUpdate){var bc=
+da,sd=k.DYNAMIC_DRAW,Bc=void 0,Cc=void 0,Nc=void 0,cc=void 0,Oc=void 0,td=bc.vertices,ud=bc.colors,Hd=td.length,Id=ud.length,Pc=bc.__vertexArray,Qc=bc.__colorArray,Jd=bc.colorsNeedUpdate;if(bc.verticesNeedUpdate){for(Bc=0;Bc<Hd;Bc++){Nc=td[Bc];cc=Bc*3;Pc[cc]=Nc.x;Pc[cc+1]=Nc.y;Pc[cc+2]=Nc.z}k.bindBuffer(k.ARRAY_BUFFER,bc.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Pc,sd)}if(Jd){for(Cc=0;Cc<Id;Cc++){Oc=ud[Cc];cc=Cc*3;Qc[cc]=Oc.r;Qc[cc+1]=Oc.g;Qc[cc+2]=Oc.b}k.bindBuffer(k.ARRAY_BUFFER,bc.__webglColorBuffer);
+k.bufferData(k.ARRAY_BUFFER,Qc,sd)}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false}else if(mb instanceof THREE.Line){Wa=c(mb,kb);lc=Wa.attributes&&n(Wa);if(da.verticesNeedUpdate||da.colorsNeedUpdate||lc){var Mb=da,id=k.DYNAMIC_DRAW,Dc=void 0,Ec=void 0,Rc=void 0,xa=void 0,Sc=void 0,vd=Mb.vertices,wd=Mb.colors,Kd=vd.length,Ld=wd.length,Tc=Mb.__vertexArray,Uc=Mb.__colorArray,Md=Mb.colorsNeedUpdate,jd=Mb.__webglCustomAttributesList,Vc=void 0,xd=void 0,Na=void 0,tc=void 0,Xa=void 0,qa=void 0;if(Mb.verticesNeedUpdate){for(Dc=
+0;Dc<Kd;Dc++){Rc=vd[Dc];xa=Dc*3;Tc[xa]=Rc.x;Tc[xa+1]=Rc.y;Tc[xa+2]=Rc.z}k.bindBuffer(k.ARRAY_BUFFER,Mb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Tc,id)}if(Md){for(Ec=0;Ec<Ld;Ec++){Sc=wd[Ec];xa=Ec*3;Uc[xa]=Sc.r;Uc[xa+1]=Sc.g;Uc[xa+2]=Sc.b}k.bindBuffer(k.ARRAY_BUFFER,Mb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Uc,id)}if(jd){Vc=0;for(xd=jd.length;Vc<xd;Vc++){qa=jd[Vc];if(qa.needsUpdate&&(qa.boundTo===void 0||qa.boundTo==="vertices")){xa=0;tc=qa.value.length;if(qa.size===1)for(Na=0;Na<tc;Na++)qa.array[Na]=
+qa.value[Na];else if(qa.size===2)for(Na=0;Na<tc;Na++){Xa=qa.value[Na];qa.array[xa]=Xa.x;qa.array[xa+1]=Xa.y;xa=xa+2}else if(qa.size===3)if(qa.type==="c")for(Na=0;Na<tc;Na++){Xa=qa.value[Na];qa.array[xa]=Xa.r;qa.array[xa+1]=Xa.g;qa.array[xa+2]=Xa.b;xa=xa+3}else for(Na=0;Na<tc;Na++){Xa=qa.value[Na];qa.array[xa]=Xa.x;qa.array[xa+1]=Xa.y;qa.array[xa+2]=Xa.z;xa=xa+3}else if(qa.size===4)for(Na=0;Na<tc;Na++){Xa=qa.value[Na];qa.array[xa]=Xa.x;qa.array[xa+1]=Xa.y;qa.array[xa+2]=Xa.z;qa.array[xa+3]=Xa.w;xa=
+xa+4}k.bindBuffer(k.ARRAY_BUFFER,qa.buffer);k.bufferData(k.ARRAY_BUFFER,qa.array,id)}}}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Wa.attributes&&p(Wa)}else if(mb instanceof THREE.ParticleSystem){Wa=c(mb,kb);lc=Wa.attributes&&n(Wa);(da.verticesNeedUpdate||da.colorsNeedUpdate||mb.sortParticles||lc)&&f(da,k.DYNAMIC_DRAW,mb);da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Wa.attributes&&p(Wa)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":
+a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var j,i,l,m,n;j=m=n=h=0;for(i=b.length;j<i;j++){l=b[j];
+if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&h++}}if(n+h+m<=P){i=m;l=n;m=h}else{i=Math.ceil(P*m/(n+m));m=l=P-i}var o=0,h=0;for(n=b.length;h<n;h++){j=b[h];if(j.castShadow){j instanceof THREE.SpotLight&&o++;j instanceof THREE.DirectionalLight&&!j.shadowCascade&&o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{j=a.fragmentShader;n=a.vertexShader;var h=a.uniforms,b=a.attributes,c={map:!!a.map,
+envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:p,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:i,maxPointLights:l,maxSpotLights:m,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
+alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(j);d.push(n)}for(q in c){d.push(q);d.push(c[q])}g=d.join();q=0;for(d=W.length;q<d;q++){i=W[q];if(i.code===g){i.usedTimes++;r=i.program;break a}}q=k.createProgram();d=["precision "+w+" float;",Ob>0?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
 "","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",
 "","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",
 c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-j=["precision "+v+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
+i=["precision "+w+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.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");
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-i=w("fragment",j+i);d=w("vertex",d+o);l.attachShader(q,d);l.attachShader(q,i);l.linkProgram(q);l.getProgramParameter(q,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(q,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");l.deleteShader(i);l.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);
-s=d;d=0;for(h=s.length;d<h;d++){o=s[d];q.uniforms[o]=l.getUniformLocation(q,o)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=l.getAttribLocation(q,c)}q.id=R++;W.push({program:q,code:g,usedTimes:1});D.info.memory.programs=W.length;r=q}a.program=r;r=a.program.attributes;
-r.position>=0&&l.enableVertexAttribArray(r.position);r.color>=0&&l.enableVertexAttribArray(r.color);r.normal>=0&&l.enableVertexAttribArray(r.normal);r.tangent>=0&&l.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){l.enableVertexAttribArray(r.skinVertexA);l.enableVertexAttribArray(r.skinVertexB);l.enableVertexAttribArray(r.skinIndex);l.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(f in a.attributes)r[f]!==void 0&&r[f]>=
-0&&l.enableVertexAttribArray(r[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=b+f;if(r[s]>=0){l.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=b+f;if(r[s]>=0){l.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,
-b){if(a){!b||b==="ccw"?l.frontFace(l.CCW):l.frontFace(l.CW);a==="back"?l.cullFace(l.BACK):a==="front"?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK);l.enable(l.CULL_FACE)}else l.disable(l.CULL_FACE)};this.setObjectFaces=function(a){if(L!==a.doubleSided){a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE);L=a.doubleSided}if(X!==a.flipSided){a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW);X=a.flipSided}};this.setDepthTest=function(a){if(Aa!==a){a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST);
-Aa=a}};this.setDepthWrite=function(a){if(Ha!==a){l.depthMask(a);Ha=a}};this.setBlending=function(a,b,c,d){if(a!==S){if(a===THREE.NoBlending)l.disable(l.BLEND);else if(a===THREE.AdditiveBlending){l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE)}else if(a===THREE.SubtractiveBlending){l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR)}else if(a===
-THREE.CustomBlending)l.enable(l.BLEND);else{l.enable(l.BLEND);l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD);l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}S=a}if(a===THREE.CustomBlending){if(b!==T){l.blendEquation(C(b));T=b}if(c!==ia||d!==ma){l.blendFunc(C(c),C(d));ia=c;ma=d}}else ma=ia=T=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=l.createTexture();D.info.memory.textures++}l.activeTexture(l.TEXTURE0+
-b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=C(a.format),f=C(a.type);t(l.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):l.texImage2D(l.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{l.activeTexture(l.TEXTURE0+
-b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=l.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=C(a.format),e=C(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);t(l.TEXTURE_CUBE_MAP,a,c);
-for(var f=0;f<6;f++){a.__webglFramebuffer[f]=l.createFramebuffer();a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,h,g.__webglTexture,0);x(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=l.createFramebuffer();a.__webglRenderbuffer=
-l.createRenderbuffer();l.bindTexture(l.TEXTURE_2D,a.__webglTexture);t(l.TEXTURE_2D,a,c);l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=l.TEXTURE_2D;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0);x(a.__webglRenderbuffer,a);c&&l.generateMipmap(l.TEXTURE_2D)}b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,
-null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=Nb;a=pb;d=hb;e=bb}if(b!==ba){l.bindFramebuffer(l.FRAMEBUFFER,b);l.viewport(d,e,c,a);ba=b}kb=c;cb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+j=t("fragment",i+j);d=t("vertex",d+n);k.attachShader(q,d);k.attachShader(q,j);k.linkProgram(q);k.getProgramParameter(q,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(q,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(j);k.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);
+s=d;d=0;for(h=s.length;d<h;d++){n=s[d];q.uniforms[n]=k.getUniformLocation(q,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=k.getAttribLocation(q,c)}q.id=R++;W.push({program:q,code:g,usedTimes:1});D.info.memory.programs=W.length;r=q}a.program=r;r=a.program.attributes;
+r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinVertexA);k.enableVertexAttribArray(r.skinVertexB);k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(f in a.attributes)r[f]!==void 0&&r[f]>=
+0&&k.enableVertexAttribArray(r[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=b+f;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=b+f;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,
+b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(L!==a.doubleSided){a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE);L=a.doubleSided}if(X!==a.flipSided){a.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW);X=a.flipSided}};this.setDepthTest=function(a){if(za!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);
+za=a}};this.setDepthWrite=function(a){if(Ga!==a){k.depthMask(a);Ga=a}};this.setBlending=function(a,b,c,d){if(a!==S){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===
+THREE.CustomBlending)k.enable(k.BLEND);else{k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}S=a}if(a===THREE.CustomBlending){if(b!==T){k.blendEquation(C(b));T=b}if(c!==ia||d!==ma){k.blendFunc(C(c),C(d));ia=c;ma=d}}else ma=ia=T=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();D.info.memory.textures++}k.activeTexture(k.TEXTURE0+
+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=C(a.format),f=C(a.type);v(k.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{k.activeTexture(k.TEXTURE0+
+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=k.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=C(a.format),e=C(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);v(k.TEXTURE_CUBE_MAP,a,c);
+for(var f=0;f<6;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);x(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=k.createFramebuffer();a.__webglRenderbuffer=
+k.createRenderbuffer();k.bindTexture(k.TEXTURE_2D,a.__webglTexture);v(k.TEXTURE_2D,a,c);k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=k.TEXTURE_2D;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0);x(a.__webglRenderbuffer,a);c&&k.generateMipmap(k.TEXTURE_2D)}b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,
+null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=Nb;a=pb;d=hb;e=ab}if(b!==ba){k.bindFramebuffer(k.FRAMEBUFFER,b);k.viewport(d,e,c,a);ba=b}kb=c;bb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -448,31 +448,31 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils={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.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],o=f.faceVertexUvs[0],k={},p=0;p<a.materials.length;p++)k[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 n=h[p].clone();c&&c.multiplyVector3(n);g.push(n)}p=0;for(r=j.length;p<r;p++){var g=
-j[p],q,s,u=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=u.length;h<n;h++){s=u[h].clone();d&&d.multiplyVector3(s);q.vertexNormals.push(s)}q.color.copy(g.color);h=0;for(n=w.length;h<n;h++){s=w[h];q.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;w=k[n];if(w===void 0){w=
-a.materials.length;k[n]=w;a.materials.push(h)}q.materialIndex=w}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}p=0;for(r=o.length;p<r;p++){c=o[p];d=[];h=0;for(n=c.length;h<n;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,i=a.faces,j=f.faces,l=a.faceVertexUvs[0],o=f.faceVertexUvs[0],n={},p=0;p<a.materials.length;p++)n[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var m=h[p].clone();c&&c.multiplyVector3(m);g.push(m)}p=0;for(r=j.length;p<r;p++){var g=
+j[p],q,s,u=g.vertexNormals,t=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=u.length;h<m;h++){s=u[h].clone();d&&d.multiplyVector3(s);q.vertexNormals.push(s)}q.color.copy(g.color);h=0;for(m=t.length;h<m;h++){s=t[h];q.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];m=h.id;t=n[m];if(t===void 0){t=
+a.materials.length;n[m]=t;a.materials.push(h)}q.materialIndex=t}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}p=0;for(r=o.length;p<r;p++){c=o[p];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
 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
 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()*
 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,o,k,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){m=g[d.a];o=g[d.b];k=g[d.c];d._area=THREE.GeometryUtils.triangleArea(m,o,k)}else if(d instanceof THREE.Face4){m=
-g[d.a];o=g[d.b];k=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(m,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,k,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 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=[],l,o,n,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];o=g[d.b];n=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,o,n)}else if(d instanceof THREE.Face4){l=
+g[d.a];o=g[d.b];n=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,n,p);d._area=d._area1+d._area2}i=i+d._area;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();
 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<
 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,o=new THREE.Face3,k=new THREE.Face3;o.color.copy(d.color);k.color.copy(d.color);o.materialIndex=d.materialIndex;k.materialIndex=d.materialIndex;o.a=e;o.b=i;o.c=m;k.a=i;k.b=j;k.c=m;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();k.vertexColors[0]=d.vertexColors[1].clone();
-k.vertexColors[1]=d.vertexColors[2].clone();k.vertexColors[2]=d.vertexColors[3].clone()}f.push(o,k);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];i=o[1];j=o[2];m=o[3];o=[o[0].clone(),i.clone(),m.clone()];i=[i.clone(),j.clone(),m.clone()];h[d].push(o,i)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
+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,l=d.d,o=new THREE.Face3,n=new THREE.Face3;o.color.copy(d.color);n.color.copy(d.color);o.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;o.a=e;o.b=i;o.c=l;n.a=i;n.b=j;n.c=l;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();n.vertexColors[0]=d.vertexColors[1].clone();
+n.vertexColors[1]=d.vertexColors[2].clone();n.vertexColors[2]=d.vertexColors[3].clone()}f.push(o,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];i=o[1];j=o[2];l=o[3];o=[o[0].clone(),i.clone(),l.clone()];i=[i.clone(),j.clone(),l.clone()];h[d].push(o,i)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
 e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],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;
 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,o,k,p,r,n,q,s,u,w,t,x=[],F=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)F[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;j=a.vertices[f];m=a.vertices[g];o=a.vertices[h];p=j.distanceTo(m);r=m.distanceTo(o);k=j.distanceTo(o);if(p>
-b||r>b||k>b){i=a.vertices.length;w=e.clone();t=e.clone();if(p>=r&&p>=k){j=j.clone();j.lerpSelf(m,0.5);w.a=f;w.b=i;w.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);w.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);w.vertexColors[1].copy(f);t.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=k){j=m.clone();j.lerpSelf(o,0.5);w.a=f;w.b=g;w.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);w.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);w.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(o,0.5);w.a=f;w.b=g;w.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);w.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);w.vertexColors[2].copy(f);t.vertexColors[0].copy(f)}e=2}x.push(w,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];w=j[2];if(e===
-0){m=t.clone();m.lerpSelf(h,0.5);j=[t.clone(),m.clone(),w.clone()];h=[m.clone(),h.clone(),w.clone()]}else if(e===1){m=h.clone();m.lerpSelf(w,0.5);j=[t.clone(),h.clone(),m.clone()];h=[m.clone(),w.clone(),t.clone()]}else{m=t.clone();m.lerpSelf(w,0.5);j=[t.clone(),h.clone(),m.clone()];h=[m.clone(),h.clone(),w.clone()]}F[f].push(j,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;j=a.vertices[f];m=a.vertices[g];o=a.vertices[h];k=
-a.vertices[i];p=j.distanceTo(m);r=m.distanceTo(o);n=o.distanceTo(k);q=j.distanceTo(k);if(p>b||r>b||n>b||q>b){s=a.vertices.length;u=a.vertices.length+1;w=e.clone();t=e.clone();if(p>=r&&p>=n&&p>=q||n>=r&&n>=p&&n>=q){p=j.clone();p.lerpSelf(m,0.5);m=o.clone();m.lerpSelf(k,0.5);w.a=f;w.b=s;w.c=u;w.d=i;t.a=s;t.b=g;t.c=h;t.d=u;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);w.vertexNormals[1].copy(f);
-w.vertexNormals[2].copy(g);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);w.vertexColors[1].copy(f);w.vertexColors[2].copy(g);t.vertexColors[0].copy(f);t.vertexColors[3].copy(g)}e=0}else{p=m.clone();p.lerpSelf(o,0.5);m=k.clone();m.lerpSelf(j,0.5);w.a=f;w.b=g;w.c=s;w.d=u;t.a=u;t.b=s;t.c=h;t.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
-f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);w.vertexNormals[2].copy(f);w.vertexNormals[3].copy(g);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);w.vertexColors[2].copy(f);w.vertexColors[3].copy(g);t.vertexColors[0].copy(g);t.vertexColors[1].copy(f)}e=1}x.push(w,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];w=j[2];j=j[3];if(e===0){m=t.clone();m.lerpSelf(h,0.5);o=w.clone();o.lerpSelf(j,0.5);t=[t.clone(),m.clone(),o.clone(),j.clone()];h=[m.clone(),h.clone(),w.clone(),o.clone()]}else{m=h.clone();m.lerpSelf(w,0.5);o=j.clone();o.lerpSelf(t,0.5);t=[t.clone(),h.clone(),m.clone(),o.clone()];h=[o.clone(),m.clone(),w.clone(),j.clone()]}F[f].push(t,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
+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,l,o,n,p,r,m,q,s,u,t,v,x=[],F=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)F[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;j=a.vertices[f];l=a.vertices[g];o=a.vertices[h];p=j.distanceTo(l);r=l.distanceTo(o);n=j.distanceTo(o);if(p>
+b||r>b||n>b){i=a.vertices.length;t=e.clone();v=e.clone();if(p>=r&&p>=n){j=j.clone();j.lerpSelf(l,0.5);t.a=f;t.b=i;t.c=h;v.a=i;v.b=g;v.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);t.vertexNormals[1].copy(f);v.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);t.vertexColors[1].copy(f);v.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=n){j=l.clone();j.lerpSelf(o,0.5);t.a=f;t.b=g;t.c=
+i;v.a=i;v.b=h;v.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);t.vertexNormals[2].copy(f);v.vertexNormals[0].copy(f);v.vertexNormals[1].copy(e.vertexNormals[2]);v.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);t.vertexColors[2].copy(f);v.vertexColors[0].copy(f);v.vertexColors[1].copy(e.vertexColors[2]);v.vertexColors[2].copy(e.vertexColors[0])}e=1}else{j=j.clone();
+j.lerpSelf(o,0.5);t.a=f;t.b=g;t.c=i;v.a=i;v.b=g;v.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);t.vertexNormals[2].copy(f);v.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);t.vertexColors[2].copy(f);v.vertexColors[0].copy(f)}e=2}x.push(t,v);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];v=j[0];h=j[1];t=j[2];if(e===
+0){l=v.clone();l.lerpSelf(h,0.5);j=[v.clone(),l.clone(),t.clone()];h=[l.clone(),h.clone(),t.clone()]}else if(e===1){l=h.clone();l.lerpSelf(t,0.5);j=[v.clone(),h.clone(),l.clone()];h=[l.clone(),t.clone(),v.clone()]}else{l=v.clone();l.lerpSelf(t,0.5);j=[v.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),t.clone()]}F[f].push(j,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;j=a.vertices[f];l=a.vertices[g];o=a.vertices[h];n=
+a.vertices[i];p=j.distanceTo(l);r=l.distanceTo(o);m=o.distanceTo(n);q=j.distanceTo(n);if(p>b||r>b||m>b||q>b){s=a.vertices.length;u=a.vertices.length+1;t=e.clone();v=e.clone();if(p>=r&&p>=m&&p>=q||m>=r&&m>=p&&m>=q){p=j.clone();p.lerpSelf(l,0.5);l=o.clone();l.lerpSelf(n,0.5);t.a=f;t.b=s;t.c=u;t.d=i;v.a=s;v.b=g;v.c=h;v.d=u;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);t.vertexNormals[1].copy(f);
+t.vertexNormals[2].copy(g);v.vertexNormals[0].copy(f);v.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);t.vertexColors[1].copy(f);t.vertexColors[2].copy(g);v.vertexColors[0].copy(f);v.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(o,0.5);l=n.clone();l.lerpSelf(j,0.5);t.a=f;t.b=g;t.c=s;t.d=u;v.a=u;v.b=s;v.c=h;v.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
+f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);t.vertexNormals[2].copy(f);t.vertexNormals[3].copy(g);v.vertexNormals[0].copy(g);v.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);t.vertexColors[2].copy(f);t.vertexColors[3].copy(g);v.vertexColors[0].copy(g);v.vertexColors[1].copy(f)}e=1}x.push(t,v);a.vertices.push(p,l);
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];v=j[0];h=j[1];t=j[2];j=j[3];if(e===0){l=v.clone();l.lerpSelf(h,0.5);o=t.clone();o.lerpSelf(j,0.5);v=[v.clone(),l.clone(),o.clone(),j.clone()];h=[l.clone(),h.clone(),t.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(t,0.5);o=j.clone();o.lerpSelf(v,0.5);v=[v.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),t.clone(),j.clone()]}F[f].push(v,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
 x;a.faceVertexUvs=F}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 x;a.faceVertexUvs=F}};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 THREE.Texture(void 0,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a);return e},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+
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new THREE.Texture(void 0,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a);return e},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 o=0;o<e;o++){var k=o-1<0?0:o-1,p=o+1>e-1?e-1:o+1,r=
-m-1<0?0:m-1,n=m+1>d-1?d-1:m+1,q=[],s=[0,0,h[(o*d+m)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(k*d+r)*4]/255*b]);q.push([0,-1,h[(k*d+m)*4]/255*b]);q.push([1,-1,h[(k*d+n)*4]/255*b]);q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(p*d+n)*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]);k=[];r=q.length;for(p=0;p<r;p++){var n=q[p],u=q[(p+1)%r],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];k.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*
-u[2],n[0]*u[1]-n[1]*u[0]]))}q=[0,0,0];for(p=0;p<k.length;p++){q[0]=q[0]+k[p][0];q[1]=q[1]+k[p][1];q[2]=q[2]+k[p][2]}q[0]=q[0]/k.length;q[1]=q[1]/k.length;q[2]=q[2]/k.length;s=(o*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,a,
+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,l=0;l<d;l++)for(var o=0;o<e;o++){var n=o-1<0?0:o-1,p=o+1>e-1?e-1:o+1,r=
+l-1<0?0:l-1,m=l+1>d-1?d-1:l+1,q=[],s=[0,0,h[(o*d+l)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(n*d+r)*4]/255*b]);q.push([0,-1,h[(n*d+l)*4]/255*b]);q.push([1,-1,h[(n*d+m)*4]/255*b]);q.push([1,0,h[(o*d+m)*4]/255*b]);q.push([1,1,h[(p*d+m)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);n=[];r=q.length;for(p=0;p<r;p++){var m=q[p],u=q[(p+1)%r],m=[m[0]-s[0],m[1]-s[1],m[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];n.push(c([m[1]*u[2]-m[2]*u[1],m[2]*u[0]-m[0]*
+u[2],m[0]*u[1]-m[1]*u[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=(o*d+l)*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,a,
 b,THREE.RGBFormat);a.needsUpdate=true;return 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);
 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);
 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);
@@ -490,21 +490,21 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvWorldPosition = mPosition.xyz;\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvWorldPosition = mPosition.xyz;\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
 THREE.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=
 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,o,k,p,r,n,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]){o=g.x;k=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,o,p,i);THREE.Shape.Utils.b2(u,k,r,m)}}break;case "b":i=b[a++]*c+d;m=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;n=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(i,m,p,r,n,q);if(g=f[f.length-1]){o=g.x;k=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,o,p,n,i);THREE.Shape.Utils.b3(u,k,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,i,j,l,o,n,p,r,m,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;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
+c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,i,l);if(g=f[f.length-1]){o=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,o,p,i);THREE.Shape.Utils.b2(u,n,r,l)}}break;case "b":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;m=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(i,l,p,r,m,q);if(g=f[f.length-1]){o=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,o,p,m,i);THREE.Shape.Utils.b3(u,n,r,q,l)}}}}}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};
 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 o=2*e;for(j=e-1;e>2;){if(o--<=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 k;a:{k=a;var p=i,r=j,n=m,q=e,s=g,u=void 0,w=void 0,t=void 0,x=void 0,F=void 0,
-C=void 0,z=void 0,v=void 0,H=void 0,w=k[s[p]].x,t=k[s[p]].y,x=k[s[r]].x,F=k[s[r]].y,C=k[s[n]].x,z=k[s[n]].y;if(1.0E-10>(x-w)*(z-t)-(F-t)*(C-w))k=false;else{for(u=0;u<q;u++)if(!(u==p||u==r||u==n)){var v=k[s[u]].x,H=k[s[u]].y,E=void 0,O=void 0,Q=void 0,Y=void 0,B=void 0,J=void 0,P=void 0,D=void 0,W=void 0,R=void 0,N=void 0,ba=void 0,E=Q=B=void 0,E=C-x,O=z-F,Q=w-C,Y=t-z,B=x-w,J=F-t,P=v-w,D=H-t,W=v-x,R=H-F,N=v-C,ba=H-z,E=E*R-O*W,B=B*D-J*P,Q=Q*ba-Y*N;if(E>=0&&Q>=0&&B>=0){k=false;break a}}k=true}}if(k){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--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};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=[],i,j,l;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 o=2*e;for(j=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{n=a;var p=i,r=j,m=l,q=e,s=g,u=void 0,t=void 0,v=void 0,x=void 0,F=void 0,
+C=void 0,z=void 0,w=void 0,H=void 0,t=n[s[p]].x,v=n[s[p]].y,x=n[s[r]].x,F=n[s[r]].y,C=n[s[m]].x,z=n[s[m]].y;if(1.0E-10>(x-t)*(z-v)-(F-v)*(C-t))n=false;else{for(u=0;u<q;u++)if(!(u==p||u==r||u==m)){var w=n[s[u]].x,H=n[s[u]].y,E=void 0,O=void 0,Q=void 0,Y=void 0,B=void 0,J=void 0,P=void 0,D=void 0,W=void 0,R=void 0,N=void 0,ba=void 0,E=Q=B=void 0,E=C-x,O=z-F,Q=t-C,Y=v-z,B=x-t,J=F-v,P=w-t,D=H-v,W=w-x,R=H-F,N=w-C,ba=H-z,E=E*R-O*W,B=B*D-J*P,Q=Q*ba-Y*N;if(E>=0&&Q>=0&&B>=0){n=false;break a}}n=true}}if(n){f.push([a[g[i]],
+a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};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,
 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=
 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]=
 {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,o,k,p,r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var w=e[c].index;a=b;for(b=b+i;a<b;a=a+3){i=w+f[a];j=w+f[a+1];m=w+f[a+2];o=g[i*3];k=g[i*3+1];p=g[i*3+2];r.set(o,k,p);o=g[j*3];k=g[j*3+1];p=g[j*3+2];n.set(o,k,p);o=g[m*3];k=g[m*3+1];p=g[m*3+2];q.set(o,k,p);s.sub(q,n);u.sub(r,
-n);s.crossSelf(u);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){o=h[a];k=h[a+1];p=h[a+2];c=1/Math.sqrt(o*o+k*k+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){o=d[a*3];k=d[a*3+1];p=d[a*3+2];r=d[b*3];n=d[b*3+1];q=d[b*3+2];s=d[c*3];u=d[c*3+1];w=d[c*3+2];t=
-f[a*2];x=f[a*2+1];F=f[b*2];C=f[b*2+1];z=f[c*2];v=f[c*2+1];H=r-o;E=s-o;O=n-k;Q=u-k;Y=q-p;B=w-p;J=F-t;P=z-t;D=C-x;W=v-x;R=1/(J*W-P*D);N.set((W*H-D*E)*R,(W*O-D*Q)*R,(W*Y-D*B)*R);ba.set((J*E-P*H)*R,(J*Q-P*O)*R,(J*B-P*Y)*R);j[a].addSelf(N);j[b].addSelf(N);j[c].addSelf(N);m[a].addSelf(ba);m[b].addSelf(ba);m[c].addSelf(ba)}function b(a){ma.x=e[a*3];ma.y=e[a*3+1];ma.z=e[a*3+2];Aa.copy(ma);Pa=j[a];T.copy(Pa);T.subSelf(ma.multiplyScalar(ma.dot(Pa))).normalize();ia.cross(Aa,Pa);Qa=ia.dot(m[a]);Ha=Qa<0?-1:1;
-i[a*4]=T.x;i[a*4+1]=T.y;i[a*4+2]=T.z;i[a*4+3]=Ha}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 o,k,p,r,n,q,s,u,w,t,x,F,C,z,v,H,E,O,Q,Y,B,J,P,D,W,R,N=new THREE.Vector3,ba=new THREE.Vector3,U,I,ca,ha,L,X=this.offsets,h=0;for(I=X.length;h<I;++h){U=X[h].start;ca=X[h].count;var S=X[h].index,g=U;for(U=U+ca;g<U;g=g+3){ca=S+c[g];ha=S+c[g+1];L=S+c[g+2];a(ca,ha,L)}}var T=new THREE.Vector3,ia=new THREE.Vector3,ma=new THREE.Vector3,Aa=new THREE.Vector3,
-Ha,Pa,Qa,h=0;for(I=X.length;h<I;++h){U=X[h].start;ca=X[h].count;S=X[h].index;g=U;for(U=U+ca;g<U;g=g+3){ca=S+c[g];ha=S+c[g+1];L=S+c[g+2];b(ca);b(ha);b(L)}}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))};
+0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,o,n,p,r=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var t=e[c].index;a=b;for(b=b+i;a<b;a=a+3){i=t+f[a];j=t+f[a+1];l=t+f[a+2];o=g[i*3];n=g[i*3+1];p=g[i*3+2];r.set(o,n,p);o=g[j*3];n=g[j*3+1];p=g[j*3+2];m.set(o,n,p);o=g[l*3];n=g[l*3+1];p=g[l*3+2];q.set(o,n,p);s.sub(q,m);u.sub(r,
+m);s.crossSelf(u);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[l*3]=h[l*3]+s.x;h[l*3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z}}a=0;for(b=h.length;a<b;a=a+3){o=h[a];n=h[a+1];p=h[a+2];c=1/Math.sqrt(o*o+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){o=d[a*3];n=d[a*3+1];p=d[a*3+2];r=d[b*3];m=d[b*3+1];q=d[b*3+2];s=d[c*3];u=d[c*3+1];t=d[c*3+2];v=
+f[a*2];x=f[a*2+1];F=f[b*2];C=f[b*2+1];z=f[c*2];w=f[c*2+1];H=r-o;E=s-o;O=m-n;Q=u-n;Y=q-p;B=t-p;J=F-v;P=z-v;D=C-x;W=w-x;R=1/(J*W-P*D);N.set((W*H-D*E)*R,(W*O-D*Q)*R,(W*Y-D*B)*R);ba.set((J*E-P*H)*R,(J*Q-P*O)*R,(J*B-P*Y)*R);j[a].addSelf(N);j[b].addSelf(N);j[c].addSelf(N);l[a].addSelf(ba);l[b].addSelf(ba);l[c].addSelf(ba)}function b(a){ma.x=e[a*3];ma.y=e[a*3+1];ma.z=e[a*3+2];za.copy(ma);Oa=j[a];T.copy(Oa);T.subSelf(ma.multiplyScalar(ma.dot(Oa))).normalize();ia.cross(za,Oa);Pa=ia.dot(l[a]);Ga=Pa<0?-1:1;
+i[a*4]=T.x;i[a*4+1]=T.y;i[a*4+2]=T.z;i[a*4+3]=Ga}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=[],l=[],h=0;h<g;h++){j[h]=new THREE.Vector3;l[h]=new THREE.Vector3}var o,n,p,r,m,q,s,u,t,v,x,F,C,z,w,H,E,O,Q,Y,B,J,P,D,W,R,N=new THREE.Vector3,ba=new THREE.Vector3,U,I,ca,ha,L,X=this.offsets,h=0;for(I=X.length;h<I;++h){U=X[h].start;ca=X[h].count;var S=X[h].index,g=U;for(U=U+ca;g<U;g=g+3){ca=S+c[g];ha=S+c[g+1];L=S+c[g+2];a(ca,ha,L)}}var T=new THREE.Vector3,ia=new THREE.Vector3,ma=new THREE.Vector3,za=new THREE.Vector3,
+Ga,Oa,Pa,h=0;for(I=X.length;h<I;++h){U=X[h].start;ca=X[h].count;S=X[h].index;g=U;for(U=U+ca;g<U;g=g+3){ca=S+c[g];ha=S+c[g+1];L=S+c[g+2];b(ca);b(ha);b(L)}}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.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.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,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)};
@@ -538,33 +538,33 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1];this.absellipse(h.x+a,h.y+b,c,d,e,f,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.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1];this.absellipse(h.x+a,h.y+b,c,d,e,f,g)};
 THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1];this.absarc(g.x+a,g.y+b,c,d,e,f)};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.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1];this.absarc(g.x+a,g.y+b,c,d,e,f)};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.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.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,o,k,p,r,n;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];k=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++){n=f/a;g=THREE.Shape.Utils.b2(n,p,o,h);n=THREE.Shape.Utils.b2(n,r,k,i);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];k=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++){n=f/a;g=THREE.Shape.Utils.b3(n,p,o,j,h);n=THREE.Shape.Utils.b3(n,r,k,m,i);c.push(new THREE.Vector2(g,
-n))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];k=f[2];j=f[3];g=f[4];o=!!f[5];p=g-j;r=a*2;for(f=1;f<=r;f++){n=f/r;o||(n=1-n);n=j+n*p;g=h+k*Math.cos(n);n=i+k*Math.sin(n);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];k=f[2];m=f[3];j=f[4];g=f[5];
-o=!!f[6];p=g-j;r=a*2;for(f=1;f<=r;f++){n=f/r;o||(n=1-n);n=j+n*p;g=h+k*Math.cos(n);n=i+m*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}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,i,j,l,o,n,p,r,m;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];n=f[1];if(c.length>0){g=c[c.length-1];
+p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){m=f/a;g=THREE.Shape.Utils.b2(m,p,o,h);m=THREE.Shape.Utils.b2(m,r,n,i);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];n=f[1];j=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){m=f/a;g=THREE.Shape.Utils.b3(m,p,o,j,h);m=THREE.Shape.Utils.b3(m,r,n,l,i);c.push(new THREE.Vector2(g,
+m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;m=m.concat(f[0]);m=new THREE.SplineCurve(m);for(f=1;f<=g;f++)c.push(m.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];n=f[2];j=f[3];g=f[4];o=!!f[5];p=g-j;r=a*2;for(f=1;f<=r;f++){m=f/r;o||(m=1-m);m=j+m*p;g=h+n*Math.cos(m);m=i+n*Math.sin(m);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];n=f[2];l=f[3];j=f[4];g=f[5];
+o=!!f[6];p=g-j;r=a*2;for(f=1;f<=r;f++){m=f/r;o||(m=1-m);m=j+m*p;g=h+n*Math.cos(m);m=i+l*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
 THREE.Path.prototype.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<
 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);
 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.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.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,o,k,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++){k=j[e];p=[];for(o=0;o<c.length;o++){m=c[o];m=k.distanceToSquared(m);p.push(m);if(m<f){f=m;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var n=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[j[g],j[f],c[h]];k=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;n=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+k>n+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}o=c.slice(0,h);k=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=o.concat(p).concat(m).concat(k)}return{shape:c,
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,l,o,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(o=0;o<c.length;o++){l=c[o];l=n.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var m=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(m);var q=[j[g],j[f],c[h]];n=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;m=[j[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+n>m+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+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=c.slice(0,h);n=c.slice(h);p=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];r.push([j[g],c[h],c[e]]);r.push(f);c=o.concat(p).concat(l).concat(n)}return{shape:c,
 isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,i,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)},
 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)},
 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)+
 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)}};
 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=
 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 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 l=
+{};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){l[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0){this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0){this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,m=this.data.JIT.hierarchy,o,k;k=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];i=a.animationCache;if(this.JITCompile&&m[p][j]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=m[p][j];a.matrixAutoUpdate=
-false;a.matrixWorldNeedsUpdate=false}else{a.matrix=m[p][j];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=k){if(o<k)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,l=this.data.JIT.hierarchy,o,n;n=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];i=a.animationCache;if(this.JITCompile&&l[p][j]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[p][j];a.matrixAutoUpdate=
+false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[p][j];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(o<n)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
 p,h.index+1)}while(h.time<o)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
 p,h.index+1)}while(h.time<o)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
 THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",p,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,
 THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",p,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,
-this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&m[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)m[p][j]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
+this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)l[p][j]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,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,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.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.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.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]};
@@ -573,14 +573,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?
 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};
 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.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,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
-true}else if(m.length){if(this.JITCompile&&o)d instanceof THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=m[0];for(c=m[1];c.time<g;){b=c;c=m[b.index+1]}}else if(!i)for(var k=m.length-1;c.time<g&&c.index!==k;){b=c;c=m[b.index+1]}o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,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 l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
+this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
+true}else if(l.length){if(this.JITCompile&&o)d instanceof THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!i)for(var n=l.length-1;c.time<g&&c.index!==n;){b=c;c=l[b.index+1]}o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
 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]};
 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.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,
 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,k=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=k;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 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()};
 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=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.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()}};
 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()}};
@@ -614,76 +614,76 @@ 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.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",
 -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()};
 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,o=0,k=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*o);this.rotateVertically(b*k)}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,i=0,j=0,l=0,o=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*o);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
 d.set(0,1,0);c.cross(d,e).normalize();d.cross(e,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
 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]*
 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-
 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()},
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;k=(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){o=(a.clientX-p)/window.innerWidth;n=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
+1;break;case 37:case 65: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:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65: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:l=0;break;case 70:l=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=
 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,o=new THREE.Vector2,k=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,i=new THREE.Vector3,j=new THREE.Vector2,l=new THREE.Vector2,o=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};
 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.dynamicDampingFactor}};this.panCamera=function(){var a=k.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=k:o.addSelf(a.sub(k,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);
+this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=l:j.y=j.y+(l.y-j.y)*
+this.dynamicDampingFactor}};this.panCamera=function(){var a=n.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=n:o.addSelf(a.sub(n,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);
 g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceToSquared(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);
 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);o=k=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&&(k=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||(o=k=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=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);j=l=c.getMouseOnScreen(a.clientX,a.clientY);o=n=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
+a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?j=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=n=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?
 f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false);this.handleResize()};
 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){o.set(a.clientX,a.clientY);k.sub(o,m);i.rotateLeft(2*Math.PI*k.x/j*i.userRotateSpeed);i.rotateUp(2*Math.PI*k.y/j*i.userRotateSpeed);m.copy(o)}else if(t===d){r.set(a.clientX,a.clientY);n.sub(r,p);n.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,o=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2,r=new THREE.Vector2,n=new THREE.Vector2,q=0,s=0,u=1,w=new THREE.Vector3;e=-1;c=0;d=1;var t=e,x={type:"change"};this.rotateLeft=function(a){a===void 0&&(a=f());
+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(v===c){o.set(a.clientX,a.clientY);n.sub(o,l);i.rotateLeft(2*Math.PI*n.x/j*i.userRotateSpeed);i.rotateUp(2*Math.PI*n.y/j*i.userRotateSpeed);l.copy(o)}else if(v===d){r.set(a.clientX,a.clientY);m.sub(r,p);m.y>0?i.zoomIn():i.zoomOut();p.copy(r)}}function h(){if(i.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
+v=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,l=new THREE.Vector2,o=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,r=new THREE.Vector2,m=new THREE.Vector2,q=0,s=0,u=1,t=new THREE.Vector3;e=-1;c=0;d=1;var v=e,x={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));u=u/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));u=u*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());
 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));u=u/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));u=u*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(u);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=s=0;u=1;if(w.distanceTo(this.object.position)>0){this.dispatchEvent(x);w.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.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,m){var o,n=d||1,p=e||1,r=h/2,q=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){o="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){o="x";n=f||1}var u=n+1,w=p+1,R=h/n,N=i/p,ba=new THREE.Vector3;ba[o]=k>0?1:-1;for(h=0;h<w;h++)for(i=0;i<u;i++){var U=new THREE.Vector3;U[a]=(i*R-r)*c;U[b]=(h*N-q)*g;U[o]=k;j.vertices.push(U)}for(h=0;h<p;h++)for(i=0;i<n;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(ba);a.vertexNormals.push(ba.clone(),ba.clone(),ba.clone(),ba.clone());a.materialIndex=m;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/n,1-h/p),new THREE.UV(i/n,1-(h+1)/p),new THREE.UV((i+1)/n,1-(h+1)/p),new THREE.UV((i+1)/n,1-h/p)])}}THREE.Geometry.call(this);var j=this,m=a/2,o=b/2,k=c/2,p,r,n,q,s,u;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;n=
-4;u=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var w in h)this.sides[w]!==void 0&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,m,p);this.sides.nx&&i("z","y",1,-1,c,b,-m,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,k,n);this.sides.nz&&i("x","y",-1,-1,a,b,-k,u);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 o=[],k=[],p=i/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=r*Math.sin(n*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(n*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);k.push(new THREE.UV(n,p))}j.push(o);m.push(k)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[j[0][h]].clone();k=this.vertices[j[0][h+
-1]].clone()}else{o=this.vertices[j[1][h]].clone();k=this.vertices[j[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.z)*c).normalize();k.setY(Math.sqrt(k.x*k.x+k.z*k.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][h],r=j[i+1][h],n=j[i+1][h+1],q=j[i][h+1],s=o.clone(),u=o.clone(),w=k.clone(),t=k.clone(),x=m[i][h].clone(),F=m[i+1][h].clone(),C=m[i+1][h+1].clone(),z=m[i][h+1].clone();this.faces.push(new THREE.Face4(p,r,n,q,[s,u,w,t]));this.faceVertexUvs[0].push([x,F,C,z])}}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];n=this.vertices.length-1;s=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);w=new THREE.Vector3(0,1,0);x=m[0][h].clone();F=m[0][h+1].clone();C=new THREE.UV(F.u,0);this.faces.push(new THREE.Face3(p,r,n,[s,u,w]));this.faceVertexUvs[0].push([x,F,C])}}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];n=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,-1,0);w=new THREE.Vector3(0,-1,0);
-x=m[i][h+1].clone();F=m[i][h].clone();C=new THREE.UV(F.u,1);this.faces.push(new THREE.Face3(p,r,n,[s,u,w]));this.faceVertexUvs[0].push([x,F,C])}}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()}};
+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(u);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=s=0;u=1;if(t.distanceTo(this.object.position)>0){this.dispatchEvent(x);t.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){v=c;l.set(a.clientX,a.clientY)}else if(a.button===1){v=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.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 t=o+1,u=p+1,R=h/o,N=i/p,ba=new THREE.Vector3;ba[n]=l>0?1:-1;for(h=0;h<u;h++)for(i=0;i<t;i++){var U=new THREE.Vector3;U[a]=(i*R-q)*c;U[b]=(h*N-r)*g;U[n]=l;j.vertices.push(U)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
+t*h+s,i+t*(h+1)+s,i+1+t*(h+1)+s,i+1+t*h+s);a.normal.copy(ba);a.vertexNormals.push(ba.clone(),ba.clone(),ba.clone(),ba.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,l=a/2,o=b/2,n=c/2,p,r,m,q,s,u;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;m=
+4;u=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,l,p);this.sides.nx&&i("z","y",1,-1,c,b,-l,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,n,m);this.sides.nz&&i("x","y",-1,-1,a,b,-n,u);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=[],l=[];for(i=0;i<=e;i++){var o=[],n=[],p=i/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,q=new THREE.Vector3;q.x=r*Math.sin(m*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(m*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);n.push(new THREE.UV(m,p))}j.push(o);l.push(n)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[j[0][h]].clone();n=this.vertices[j[0][h+
+1]].clone()}else{o=this.vertices[j[1][h]].clone();n=this.vertices[j[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.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],m=j[i+1][h+1],q=j[i][h+1],s=o.clone(),u=o.clone(),t=n.clone(),v=n.clone(),x=l[i][h].clone(),F=l[i+1][h].clone(),C=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,r,m,q,[s,u,t,v]));this.faceVertexUvs[0].push([x,F,C,z])}}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];m=this.vertices.length-1;s=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);x=l[0][h].clone();F=l[0][h+1].clone();C=new THREE.UV(F.u,0);this.faces.push(new THREE.Face3(p,r,m,[s,u,t]));this.faceVertexUvs[0].push([x,F,C])}}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];m=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);
+x=l[i][h+1].clone();F=l[i][h].clone();C=new THREE.UV(F.u,1);this.faces.push(new THREE.Face3(p,r,m,[s,u,t]));this.faceVertexUvs[0].push([x,F,C])}}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=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=k+m*2,g=0;g<h;g++){var i=N*g,j=N*(g+1),o=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,p=c,r=g,q=h,s=e,t=f,o=o+O,i=i+O,n=n+O,j=j+O;E.faces.push(new THREE.Face4(o,i,n,j,null,null,u));o=w.generateSideWallUV(E,a,p,b,o,i,n,j,r,q,s,t);E.faceVertexUvs[0].push(o)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+O;d=d+O;e=e+O;E.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?w.generateBottomUV(E,a,b,c,d,e):w.generateTopUV(E,a,b,c,d,e);E.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,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,k=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,n,q=false,s=b.material,u=b.extrudeMaterial,w=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,x,F,C;if(r){n=r.getSpacedPoints(k);q=true;o=false;t=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
-k,false);x=new THREE.Vector3;F=new THREE.Vector3;C=new THREE.Vector3}if(!o)j=i=m=0;var z,v,H,E=this,O=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,Q=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();v=0;for(H=Q.length;v<H;v++){z=Q[v];THREE.Shape.Utils.isClockWise(z)&&(Q[v]=z.reverse())}r=false}var Y=THREE.Shape.Utils.triangulateShape(p,Q),B=p;v=0;for(H=Q.length;v<H;v++){z=Q[v];p=p.concat(z)}var J,P,D,W,R,N=p.length,ba,U=Y.length,r=[],I=0;D=B.length;J=D-1;
-for(P=I+1;I<D;I++,J++,P++){J===D&&(J=0);P===D&&(P=0);r[I]=d(B[I],B[J],B[P])}var ca=[],ha,L=r.concat();v=0;for(H=Q.length;v<H;v++){z=Q[v];ha=[];I=0;D=z.length;J=D-1;for(P=I+1;I<D;I++,J++,P++){J===D&&(J=0);P===D&&(P=0);ha[I]=d(z[I],z[J],z[P])}ca.push(ha);L=L.concat(ha)}for(J=0;J<m;J++){D=J/m;W=i*(1-D);P=j*Math.sin(D*Math.PI/2);I=0;for(D=B.length;I<D;I++){R=c(B[I],r[I],P);f(R.x,R.y,-W)}v=0;for(H=Q.length;v<H;v++){z=Q[v];ha=ca[v];I=0;for(D=z.length;I<D;I++){R=c(z[I],ha[I],P);f(R.x,R.y,-W)}}}P=j;for(I=
-0;I<N;I++){R=o?c(p[I],L[I],P):p[I];if(q){F.copy(t.normals[0]).multiplyScalar(R.x);x.copy(t.binormals[0]).multiplyScalar(R.y);C.copy(n[0]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(R.x,R.y,0)}for(D=1;D<=k;D++)for(I=0;I<N;I++){R=o?c(p[I],L[I],P):p[I];if(q){F.copy(t.normals[D]).multiplyScalar(R.x);x.copy(t.binormals[D]).multiplyScalar(R.y);C.copy(n[D]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(R.x,R.y,h/k*D)}for(J=m-1;J>=0;J--){D=J/m;W=i*(1-D);P=j*Math.sin(D*Math.PI/2);I=0;for(D=B.length;I<D;I++){R=
-c(B[I],r[I],P);f(R.x,R.y,h+W)}v=0;for(H=Q.length;v<H;v++){z=Q[v];ha=ca[v];I=0;for(D=z.length;I<D;I++){R=c(z[I],ha[I],P);q?f(R.x,R.y+n[k-1].y,n[k-1].x+W):f(R.x,R.y,h+W)}}}(function(){if(o){var a;a=N*0;for(I=0;I<U;I++){ba=Y[I];g(ba[2]+a,ba[1]+a,ba[0]+a,true)}a=k+m*2;a=N*a;for(I=0;I<U;I++){ba=Y[I];g(ba[0]+a,ba[1]+a,ba[2]+a,false)}}else{for(I=0;I<U;I++){ba=Y[I];g(ba[2],ba[1],ba[0],true)}for(I=0;I<U;I++){ba=Y[I];g(ba[0]+N*k,ba[1]+N*k,ba[2]+N*k,false)}}})();(function(){var a=0;e(B,a);a=a+B.length;v=0;for(H=
-Q.length;v<H;v++){z=Q[v];e(z,a);a=a+z.length}})()};
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,m=
-a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,k=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(m,g),new THREE.UV(k,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,j=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);j.copy(a).addSelf(g);if(h.equals(j))return g.clone();
+h.copy(b).addSelf(f);j.copy(c).addSelf(g);f=d.dot(g);g=j.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(I=c.length;--I>=0;){e=I;f=I-1;f<0&&(f=
+c.length-1);for(var g=0,h=n+l*2,g=0;g<h;g++){var j=N*g,i=N*(g+1),m=d+e+j,j=d+f+j,o=d+f+i,i=d+e+i,p=c,q=g,r=h,s=e,v=f,m=m+O,j=j+O,o=o+O,i=i+O;E.faces.push(new THREE.Face4(m,j,o,i,null,null,u));m=t.generateSideWallUV(E,a,p,b,m,j,o,i,q,r,s,v);E.faceVertexUvs[0].push(m)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+O;d=d+O;e=e+O;E.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?t.generateBottomUV(E,a,b,c,d,e):t.generateTopUV(E,a,b,c,d,e);E.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,l=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,n=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,m,q=false,s=b.material,u=b.extrudeMaterial,t=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,x,F,C;if(r){m=r.getSpacedPoints(n);q=true;o=false;v=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
+n,false);x=new THREE.Vector3;F=new THREE.Vector3;C=new THREE.Vector3}if(!o)j=i=l=0;var z,w,H,E=this,O=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,Q=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();w=0;for(H=Q.length;w<H;w++){z=Q[w];THREE.Shape.Utils.isClockWise(z)&&(Q[w]=z.reverse())}r=false}var Y=THREE.Shape.Utils.triangulateShape(p,Q),B=p;w=0;for(H=Q.length;w<H;w++){z=Q[w];p=p.concat(z)}var J,P,D,W,R,N=p.length,ba,U=Y.length,r=[],I=0;D=B.length;J=D-1;
+for(P=I+1;I<D;I++,J++,P++){J===D&&(J=0);P===D&&(P=0);r[I]=d(B[I],B[J],B[P])}var ca=[],ha,L=r.concat();w=0;for(H=Q.length;w<H;w++){z=Q[w];ha=[];I=0;D=z.length;J=D-1;for(P=I+1;I<D;I++,J++,P++){J===D&&(J=0);P===D&&(P=0);ha[I]=d(z[I],z[J],z[P])}ca.push(ha);L=L.concat(ha)}for(J=0;J<l;J++){D=J/l;W=i*(1-D);P=j*Math.sin(D*Math.PI/2);I=0;for(D=B.length;I<D;I++){R=c(B[I],r[I],P);f(R.x,R.y,-W)}w=0;for(H=Q.length;w<H;w++){z=Q[w];ha=ca[w];I=0;for(D=z.length;I<D;I++){R=c(z[I],ha[I],P);f(R.x,R.y,-W)}}}P=j;for(I=
+0;I<N;I++){R=o?c(p[I],L[I],P):p[I];if(q){F.copy(v.normals[0]).multiplyScalar(R.x);x.copy(v.binormals[0]).multiplyScalar(R.y);C.copy(m[0]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(R.x,R.y,0)}for(D=1;D<=n;D++)for(I=0;I<N;I++){R=o?c(p[I],L[I],P):p[I];if(q){F.copy(v.normals[D]).multiplyScalar(R.x);x.copy(v.binormals[D]).multiplyScalar(R.y);C.copy(m[D]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(R.x,R.y,h/n*D)}for(J=l-1;J>=0;J--){D=J/l;W=i*(1-D);P=j*Math.sin(D*Math.PI/2);I=0;for(D=B.length;I<D;I++){R=
+c(B[I],r[I],P);f(R.x,R.y,h+W)}w=0;for(H=Q.length;w<H;w++){z=Q[w];ha=ca[w];I=0;for(D=z.length;I<D;I++){R=c(z[I],ha[I],P);q?f(R.x,R.y+m[n-1].y,m[n-1].x+W):f(R.x,R.y,h+W)}}}(function(){if(o){var a;a=N*0;for(I=0;I<U;I++){ba=Y[I];g(ba[2]+a,ba[1]+a,ba[0]+a,true)}a=n+l*2;a=N*a;for(I=0;I<U;I++){ba=Y[I];g(ba[0]+a,ba[1]+a,ba[2]+a,false)}}else{for(I=0;I<U;I++){ba=Y[I];g(ba[2],ba[1],ba[0],true)}for(I=0;I<U;I++){ba=Y[I];g(ba[0]+N*n,ba[1]+N*n,ba[2]+N*n,false)}}})();(function(){var a=0;e(B,a);a=a+B.length;w=0;for(H=
+Q.length;w<H;w++){z=Q[w];e(z,a);a=a+z.length}})()};
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,l=
+a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(n,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v6=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-
 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);
 (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,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,0,a*j-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(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,i=a/c,j=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,0,a*j-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,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);
 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 o=[],k=[];for(h=0;h<=b;h++){var p=h/b,r=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);n.y=a*Math.cos(f+r*g);n.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(n);o.push(this.vertices.length-1);k.push(new THREE.UV(p,
-1-r))}j.push(o);m.push(k)}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],o=this.vertices[d].clone().normalize(),k=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),n=m[i][h+1].clone(),q=m[i][h].clone(),s=m[i+1][h].clone(),u=m[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([n,s,u])}else if(Math.abs(this.vertices[f].y)==
-a){this.faces.push(new THREE.Face3(d,e,f,[o,k,p]));this.faceVertexUvs[0].push([n,q,s])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,k,p,r]));this.faceVertexUvs[0].push([n,q,s,u])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.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=[],l=[];for(i=0;i<=c;i++){var o=[],n=[];for(h=0;h<=b;h++){var p=h/b,r=i/c,m=new THREE.Vector3;m.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);m.y=a*Math.cos(f+r*g);m.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(m);o.push(this.vertices.length-1);n.push(new THREE.UV(p,
+1-r))}j.push(o);l.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],o=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),m=l[i][h+1].clone(),q=l[i][h].clone(),s=l[i+1][h].clone(),u=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([m,s,u])}else if(Math.abs(this.vertices[f].y)==
+a){this.faces.push(new THREE.Face3(d,e,f,[o,n,p]));this.faceVertexUvs[0].push([m,q,s])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,n,p,r]));this.faceVertexUvs[0].push([m,q,s,u])}}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.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=
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
 this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,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(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);
 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]=
 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<
 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();
+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),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,j,l])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
 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,o=new THREE.Vector3,k,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);k=b.tangents;p=b.normals;r=b.binormals;this.tangents=k;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);m=a.getPointAt(d);d=k[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);o.copy(m);o.x=o.x+(j*g.x+i*h.x);o.y=o.y+(j*g.y+i*h.y);o.z=o.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
-a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];k=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([k,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,o;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);o=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)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
+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,l,o=new THREE.Vector3,n,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);n=b.tangents;p=b.normals;r=b.binormals;this.tangents=n;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=n[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);o.copy(l);o.x=o.x+(j*g.x+i*h.x);o.y=o.y+(j*g.y+i*h.y);o.z=o.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
+a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];n=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([n,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=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,l,o;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++){l=j/(b-1);e[j]=a.getTangentAt(l);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);o=Math.abs(e[0].z);if(j<=a){a=j;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
 f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(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])}}};
 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,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);
 THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
 i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
 i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
-for(var c=c||1,d=d||0,i=this,j=0,m=a.length;j<m;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var o=[],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);
+for(var c=c||1,d=d||0,i=this,j=0,l=a.length;j<l;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var o=[],a=this.vertices,j=0,l=b.length;j<l;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].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.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.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,o=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 k,p,r,n;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*o+i;e=h*o+i+1;m=(h+1)*o+i;j=(h+1)*o+i+1;k=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);n=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([k,
-p,r]);g.push([p,n,r])}else{f.push(new THREE.Face4(a,e,j,m));g.push([k,p,n,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 u=a[h[1]],w=a[h[2]],t=new THREE.Vector3,x=new THREE.Vector3;t.sub(w,u);x.sub(s,u);t.crossSelf(x);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(u=0;u<f.length;u++)if(f[u][0]===j[1]&&f[u][1]===j[0]){f[u]=f[f.length-1];f.pop();s=false;break}s&&f.push(j)}e[g]=
+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,l,o=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++){j=i/b;j=a(j,l);e.push(j)}}var n,p,r,m;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*o+i;e=h*o+i+1;l=(h+1)*o+i;j=(h+1)*o+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);m=new THREE.UV((i+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,l));f.push(new THREE.Face3(e,j,l));g.push([n,
+p,r]);g.push([p,m,r])}else{f.push(new THREE.Face4(a,e,j,l));g.push([n,p,m,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],j=d,i=a[h[0]],s;s=i;var u=a[h[1]],t=a[h[2]],v=new THREE.Vector3,x=new THREE.Vector3;v.sub(t,u);x.sub(s,u);v.crossSelf(x);v.isZero()||v.normalize();s=v;i=s.dot(i);if(s.dot(j)>=i){for(j=0;j<3;j++){i=[h[j],h[(j+1)%3]];s=true;for(u=0;u<f.length;u++)if(f[u][0]===i[1]&&f[u][1]===i[0]){f[u]=f[f.length-1];f.pop();s=false;break}s&&f.push(i)}e[g]=
 e[e.length-1];e.pop()}else g++}for(u=0;u<f.length;u++)e.push([f[u][0],f[u][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]));
 e[e.length-1];e.pop()}else g++}for(u=0;u<f.length;u++)e.push([f[u][0],f[u][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);
 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);
 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);
 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);
@@ -697,15 +697,15 @@ this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);
 THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
 THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
 1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
 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(){k.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(k.useOldVertexColors){j.vertexColors=[];for(var n,p,q,r=0;r<4;r++){q=h[r];n=new THREE.Color;n.setRGB(0,0,0);for(var s=0;s<q.length;s++){p=g.vertexColors[q[s]-1];n.r=n.r+p.r;n.g=n.g+p.g;n.b=n.b+p.b}n.r=n.r/q.length;n.g=n.g/q.length;n.b=n.b/
-q.length;j.vertexColors[r]=n}}m.push(j);if(k.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?o.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=u[e];if(!f){a>=w&&a<w+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in u?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,u[e]):u[e]=d}function h(a,
-b){Q[a]===void 0&&(Q[a]=[]);Q[a].push(b)}function i(a,b,c){Y[a]===void 0&&(Y[a]={});Y[a][b]=c}var j=[],m=[],o=[],k=this,p=a.vertices,r=a.faces,j=p.concat(),n=[],q={},s={},u={},w=p.length,t,x,F,C,z,v=a.faceVertexUvs[0],H;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,w);if(k.supportUVs){t=0;for(x=v.length;t<x;t++){F=0;for(C=v[t].length;F<C;F++){H=r[t]["abcd".charAt(F)];g(H,t,v[t][F])}}}if(v.length==0)k.supportUVs=false;t=0;for(z in u)t++;if(!t){k.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-u,"vs",v.length);t=0;for(x=r.length;t<x;t++){z=r[t];n.push(z.centroid);j.push(z.centroid);if(k.supportUVs){v=new THREE.UV;if(z instanceof THREE.Face3){v.u=f(z.a,t).u+f(z.b,t).u+f(z.c,t).u;v.v=f(z.a,t).v+f(z.b,t).v+f(z.c,t).v;v.u=v.u/3;v.v=v.v/3}else if(z instanceof THREE.Face4){v.u=f(z.a,t).u+f(z.b,t).u+f(z.c,t).u+f(z.d,t).u;v.v=f(z.a,t).v+f(z.b,t).v+f(z.c,t).v+f(z.d,t).v;v.u=v.u/4;v.v=v.v/4}g(w+t,"",v)}}b("-- added UVs for new Faces",u);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
-var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);H=0;var E,O,Q={},Y={};for(t in x){v=x[t];E=t.split("_");O=E[0];E=E[1];h(O,[O,E]);h(E,[O,E]);F=0;for(C=v.length;F<C;F++){z=v[F];i(O,z,t);i(E,z,t)}v.length<2&&(s[t]=true)}b("vertexEdgeMap",Q,"vertexFaceMap",Y);for(t in x){v=
-x[t];z=v[0];C=v[1];E=t.split("_");O=E[0];E=E[1];v=new THREE.Vector3;if(s[t]){v.addSelf(p[O]);v.addSelf(p[E]);v.multiplyScalar(0.5)}else{v.addSelf(n[z]);v.addSelf(n[C]);v.addSelf(p[O]);v.addSelf(p[E]);v.multiplyScalar(0.25)}q[t]=w+r.length+H;j.push(v);H++;if(k.supportUVs){v=new THREE.UV;v.u=f(O,z).u+f(E,z).u;v.v=f(O,z).v+f(E,z).v;v.u=v.u/2;v.v=v.v/2;g(q[t],z,v);if(!s[t]){v=new THREE.UV;v.u=f(O,C).u+f(E,C).u;v.v=f(O,C).v+f(E,C).v;v.u=v.u/2;v.v=v.v/2;g(q[t],C,v)}}}b("-- Step 2 done");var B,J;C=["123",
-"12","2","23"];E=["123","23","3","31"];var P=["123","31","1","12"],D=["1234","12","2","23"],W=["1234","23","3","34"],R=["1234","34","4","41"],N=["1234","41","1","12"];t=0;for(x=n.length;t<x;t++){z=r[t];v=w+t;if(z instanceof THREE.Face3){H=e(z.a,z.b);O=e(z.b,z.c);B=e(z.c,z.a);d(v,q[H],z.b,q[O],z,C,t);d(v,q[O],z.c,q[B],z,E,t);d(v,q[B],z.a,q[H],z,P,t)}else if(z instanceof THREE.Face4){H=e(z.a,z.b);O=e(z.b,z.c);B=e(z.c,z.d);J=e(z.d,z.a);d(v,q[H],z.b,q[O],z,D,t);d(v,q[O],z.c,q[B],z,W,t);d(v,q[B],z.d,q[J],
-z,R,t);d(v,q[J],z.a,q[H],z,N,t)}else b("face should be a face!",z)}q=new THREE.Vector3;z=new THREE.Vector3;t=0;for(x=p.length;t<x;t++)if(Q[t]!==void 0){q.set(0,0,0);z.set(0,0,0);O=new THREE.Vector3(0,0,0);v=0;for(F in Y[t]){q.addSelf(n[F]);v++}C=0;H=Q[t].length;for(F=0;F<H;F++)s[e(Q[t][F][0],Q[t][F][1])]&&C++;if(C!=2){q.divideScalar(v);for(F=0;F<H;F++){v=Q[t][F];v=p[v[0]].clone().addSelf(p[v[1]]).divideScalar(2);z.addSelf(v)}z.divideScalar(H);O.addSelf(p[t]);O.multiplyScalar(H-3);O.addSelf(q);O.addSelf(z.multiplyScalar(2));
-O.divideScalar(H);j[t]=O}}a.vertices=j;a.faces=m;a.faceVertexUvs[0]=o;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.SubdivisionModifier.prototype.smooth=function(a){function b(){n.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,j){var i=new THREE.Face4(a,c,d,e,null,g.color,g.materialIndex);if(n.useOldVertexColors){i.vertexColors=[];for(var m,p,q,r=0;r<4;r++){q=h[r];m=new THREE.Color;m.setRGB(0,0,0);for(var s=0;s<q.length;s++){p=g.vertexColors[q[s]-1];m.r=m.r+p.r;m.g=m.g+p.g;m.b=m.b+p.b}m.r=m.r/q.length;m.g=m.g/q.length;m.b=m.b/
+q.length;i.vertexColors[r]=m}}l.push(i);if(n.supportUVs){g=[f(a,""),f(c,j),f(d,j),f(e,j)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",e+":"+j):b("c :( ",d+":"+j):b("b :( ",c+":"+j):b("a :( ",a+":"+j)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=u[e];if(!f){a>=t&&a<t+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in u?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,u[e]):u[e]=d}function h(a,
+b){Q[a]===void 0&&(Q[a]=[]);Q[a].push(b)}function i(a,b,c){Y[a]===void 0&&(Y[a]={});Y[a][b]=c}var j=[],l=[],o=[],n=this,p=a.vertices,r=a.faces,j=p.concat(),m=[],q={},s={},u={},t=p.length,v,x,F,C,z,w=a.faceVertexUvs[0],H;b("originalFaces, uvs, originalVerticesLength",r.length,w.length,t);if(n.supportUVs){v=0;for(x=w.length;v<x;v++){F=0;for(C=w[v].length;F<C;F++){H=r[v]["abcd".charAt(F)];g(H,v,w[v][F])}}}if(w.length==0)n.supportUVs=false;v=0;for(z in u)v++;if(!v){n.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
+u,"vs",w.length);v=0;for(x=r.length;v<x;v++){z=r[v];m.push(z.centroid);j.push(z.centroid);if(n.supportUVs){w=new THREE.UV;if(z instanceof THREE.Face3){w.u=f(z.a,v).u+f(z.b,v).u+f(z.c,v).u;w.v=f(z.a,v).v+f(z.b,v).v+f(z.c,v).v;w.u=w.u/3;w.v=w.v/3}else if(z instanceof THREE.Face4){w.u=f(z.a,v).u+f(z.b,v).u+f(z.c,v).u+f(z.d,v).u;w.v=f(z.a,v).v+f(z.b,v).v+f(z.c,v).v+f(z.d,v).v;w.u=w.u/4;w.v=w.v/4}g(t+v,"",w)}}b("-- added UVs for new Faces",u);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
+var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);H=0;var E,O,Q={},Y={};for(v in x){w=x[v];E=v.split("_");O=E[0];E=E[1];h(O,[O,E]);h(E,[O,E]);F=0;for(C=w.length;F<C;F++){z=w[F];i(O,z,v);i(E,z,v)}w.length<2&&(s[v]=true)}b("vertexEdgeMap",Q,"vertexFaceMap",Y);for(v in x){w=
+x[v];z=w[0];C=w[1];E=v.split("_");O=E[0];E=E[1];w=new THREE.Vector3;if(s[v]){w.addSelf(p[O]);w.addSelf(p[E]);w.multiplyScalar(0.5)}else{w.addSelf(m[z]);w.addSelf(m[C]);w.addSelf(p[O]);w.addSelf(p[E]);w.multiplyScalar(0.25)}q[v]=t+r.length+H;j.push(w);H++;if(n.supportUVs){w=new THREE.UV;w.u=f(O,z).u+f(E,z).u;w.v=f(O,z).v+f(E,z).v;w.u=w.u/2;w.v=w.v/2;g(q[v],z,w);if(!s[v]){w=new THREE.UV;w.u=f(O,C).u+f(E,C).u;w.v=f(O,C).v+f(E,C).v;w.u=w.u/2;w.v=w.v/2;g(q[v],C,w)}}}b("-- Step 2 done");var B,J;C=["123",
+"12","2","23"];E=["123","23","3","31"];var P=["123","31","1","12"],D=["1234","12","2","23"],W=["1234","23","3","34"],R=["1234","34","4","41"],N=["1234","41","1","12"];v=0;for(x=m.length;v<x;v++){z=r[v];w=t+v;if(z instanceof THREE.Face3){H=e(z.a,z.b);O=e(z.b,z.c);B=e(z.c,z.a);d(w,q[H],z.b,q[O],z,C,v);d(w,q[O],z.c,q[B],z,E,v);d(w,q[B],z.a,q[H],z,P,v)}else if(z instanceof THREE.Face4){H=e(z.a,z.b);O=e(z.b,z.c);B=e(z.c,z.d);J=e(z.d,z.a);d(w,q[H],z.b,q[O],z,D,v);d(w,q[O],z.c,q[B],z,W,v);d(w,q[B],z.d,q[J],
+z,R,v);d(w,q[J],z.a,q[H],z,N,v)}else b("face should be a face!",z)}q=new THREE.Vector3;z=new THREE.Vector3;v=0;for(x=p.length;v<x;v++)if(Q[v]!==void 0){q.set(0,0,0);z.set(0,0,0);O=new THREE.Vector3(0,0,0);w=0;for(F in Y[v]){q.addSelf(m[F]);w++}C=0;H=Q[v].length;for(F=0;F<H;F++)s[e(Q[v][F][0],Q[v][F][1])]&&C++;if(C!=2){q.divideScalar(w);for(F=0;F<H;F++){w=Q[v][F];w=p[w[0]].clone().addSelf(p[w[1]]).divideScalar(2);z.addSelf(w)}z.divideScalar(H);O.addSelf(p[v]);O.multiplyScalar(H-3);O.addSelf(q);O.addSelf(z.multiplyScalar(2));
+O.divideScalar(H);j[v]=O}}a.vertices=j;a.faces=l;a.faceVertexUvs[0]=o;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=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.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.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}};
@@ -717,37 +717,38 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 THREE.MorphBlendMesh.prototype.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/
 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}}};
 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,o,k,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++]=
+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,l,o,n,p;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
 0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 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.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)}o={};k={};o.vertex=b.getAttribLocation(m,"position");o.uv=b.getAttribLocation(m,"uv");k.renderType=b.getUniformLocation(m,"renderType");k.map=b.getUniformLocation(m,"map");k.occlusionMap=b.getUniformLocation(m,"occlusionMap");k.opacity=b.getUniformLocation(m,"opacity");k.color=b.getUniformLocation(m,
-"color");k.scale=b.getUniformLocation(m,"scale");k.rotation=b.getUniformLocation(m,"rotation");k.screenPosition=b.getUniformLocation(m,"screenPosition");p=false};this.render=function(a,d,e,s){var a=a.__webglFlares,u=a.length;if(u){var w=new THREE.Vector3,t=s/e,x=e*0.5,F=s*0.5,C=16/s,z=new THREE.Vector2(C*t,C),v=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),E=k,C=o;b.useProgram(m);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(C.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var O,Q,Y,B,J;for(O=0;O<u;O++){C=16/s;z.set(C*t,C);B=a[O];w.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(w);d.projectionMatrix.multiplyVector3(w);v.copy(w);H.x=v.x*x+x;H.y=v.y*F+F;if(j||H.x>0&&H.x<e&&H.y>0&&
-H.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,z.x,z.y);b.uniform3f(E.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(v);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);Q=0;for(Y=B.lensFlares.length;Q<Y;Q++){J=B.lensFlares[Q];if(J.opacity>0.0010&&J.scale>0.0010){v.x=J.x;v.y=J.y;v.z=J.z;C=J.size*J.scale/s;z.x=C*t;z.y=C;b.uniform3f(E.screenPosition,v.x,v.y,v.z);b.uniform2f(E.scale,z.x,z.y);b.uniform1f(E.rotation,J.rotation);b.uniform1f(E.opacity,J.opacity);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;l=a(THREE.ShaderFlares.lensFlare)}else{j=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};n={};o.vertex=b.getAttribLocation(l,"position");o.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
+"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,s){var a=a.__webglFlares,u=a.length;if(u){var t=new THREE.Vector3,v=s/e,x=e*0.5,F=s*0.5,C=16/s,z=new THREE.Vector2(C*v,C),w=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),E=n,C=o;b.useProgram(l);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(C.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var O,Q,Y,B,J;for(O=0;O<u;O++){C=16/s;z.set(C*v,C);B=a[O];t.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);w.copy(t);H.x=w.x*x+x;H.y=w.y*F+F;if(j||H.x>0&&H.x<e&&H.y>0&&
+H.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,z.x,z.y);b.uniform3f(E.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,H.x-8,H.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
+b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(w);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);Q=0;for(Y=B.lensFlares.length;Q<Y;Q++){J=B.lensFlares[Q];if(J.opacity>0.0010&&J.scale>0.0010){w.x=J.x;w.y=J.y;w.z=J.z;C=J.size*J.scale/s;z.x=C*v;z.y=C;b.uniform3f(E.screenPosition,w.x,w.y,w.z);b.uniform2f(E.scale,z.x,z.y);b.uniform1f(E.rotation,J.rotation);b.uniform1f(E.opacity,J.opacity);
 b.uniform3f(E.color,J.color.r,J.color.g,J.color.b);c.setBlending(J.blending,J.blendEquation,J.blendSrc,J.blendDst);c.setTexture(J.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 b.uniform3f(E.color,J.color.r,J.color.g,J.color.b);c.setBlending(J.blending,J.blendEquation,J.blendSrc,J.blendDst);c.setTexture(J.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
-THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var m,o,k,p,r,n,q,s,u,w=[];p=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);m=0;for(o=i.__lights.length;m<o;m++){k=i.__lights[m];if(k.castShadow)if(k instanceof THREE.DirectionalLight&&k.shadowCascade)for(r=0;r<k.shadowCascadeCount;r++){var t;if(k.shadowCascadeArray[r])t=k.shadowCascadeArray[r];
-else{u=k;q=r;t=new THREE.DirectionalLight;t.isVirtual=true;t.onlyShadow=true;t.castShadow=true;t.shadowCameraNear=u.shadowCameraNear;t.shadowCameraFar=u.shadowCameraFar;t.shadowCameraLeft=u.shadowCameraLeft;t.shadowCameraRight=u.shadowCameraRight;t.shadowCameraBottom=u.shadowCameraBottom;t.shadowCameraTop=u.shadowCameraTop;t.shadowCameraVisible=u.shadowCameraVisible;t.shadowDarkness=u.shadowDarkness;t.shadowBias=u.shadowCascadeBias[q];t.shadowMapWidth=u.shadowCascadeWidth[q];t.shadowMapHeight=u.shadowCascadeHeight[q];
-t.pointsWorld=[];t.pointsFrustum=[];s=t.pointsWorld;n=t.pointsFrustum;for(var x=0;x<8;x++){s[x]=new THREE.Vector3;n[x]=new THREE.Vector3}s=u.shadowCascadeNearZ[q];u=u.shadowCascadeFarZ[q];n[0].set(-1,-1,s);n[1].set(1,-1,s);n[2].set(-1,1,s);n[3].set(1,1,s);n[4].set(-1,-1,u);n[5].set(1,-1,u);n[6].set(-1,1,u);n[7].set(1,1,u);t.originalCamera=j;n=new THREE.Gyroscope;n.position=k.shadowCascadeOffset;n.add(t);n.add(t.target);j.add(n);k.shadowCascadeArray[r]=t;console.log("Created virtualLight",t)}q=k;s=
-r;u=q.shadowCascadeArray[s];u.position.copy(q.position);u.target.position.copy(q.target.position);u.lookAt(u.target);u.shadowCameraVisible=q.shadowCameraVisible;u.shadowDarkness=q.shadowDarkness;u.shadowBias=q.shadowCascadeBias[s];n=q.shadowCascadeNearZ[s];q=q.shadowCascadeFarZ[s];u=u.pointsFrustum;u[0].z=n;u[1].z=n;u[2].z=n;u[3].z=n;u[4].z=q;u[5].z=q;u[6].z=q;u[7].z=q;w[p]=t;p++}else{w[p]=k;p++}}m=0;for(o=w.length;m<o;m++){k=w[m];if(!k.shadowMap){k.shadowMap=new THREE.WebGLRenderTarget(k.shadowMapWidth,
-k.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});k.shadowMapSize=new THREE.Vector2(k.shadowMapWidth,k.shadowMapHeight);k.shadowMatrix=new THREE.Matrix4}if(!k.shadowCamera){if(k instanceof THREE.SpotLight)k.shadowCamera=new THREE.PerspectiveCamera(k.shadowCameraFov,k.shadowMapWidth/k.shadowMapHeight,k.shadowCameraNear,k.shadowCameraFar);else if(k instanceof THREE.DirectionalLight)k.shadowCamera=new THREE.OrthographicCamera(k.shadowCameraLeft,k.shadowCameraRight,
-k.shadowCameraTop,k.shadowCameraBottom,k.shadowCameraNear,k.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(k.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(k.shadowCameraVisible&&!k.cameraHelper){k.cameraHelper=new THREE.CameraHelper(k.shadowCamera);k.shadowCamera.add(k.cameraHelper)}if(k.isVirtual&&t.originalCamera==j){r=j;p=k.shadowCamera;n=k.pointsFrustum;u=k.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=
-0;q<8;q++){s=u[q];s.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,r);p.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}p.left=g.x;p.right=h.x;p.top=h.y;p.bottom=g.y;p.updateProjectionMatrix()}p=k.shadowMap;n=k.shadowMatrix;r=k.shadowCamera;r.position.copy(k.matrixWorld.getPosition());r.lookAt(k.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);
-if(k.cameraHelper)k.cameraHelper.lines.visible=k.shadowCameraVisible;k.shadowCameraVisible&&k.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);f.multiply(r.projectionMatrix,
-r.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(p);b.clear();u=i.__webglObjects;k=0;for(p=u.length;k<p;k++){q=u[k];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}k=0;for(p=u.length;k<p;k++){q=u[k];if(q.render){n=q.object;q=q.buffer;s=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?
-b.renderBufferDirect(r,i.__lights,null,s,q,n):b.renderBuffer(r,i.__lights,null,s,q,n)}}u=i.__webglObjectsImmediate;k=0;for(p=u.length;k<p;k++){q=u[k];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,i.__lights,null,c,n)}}}m=b.getClearColor();o=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,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,k=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(k,p);b.attachShader(k,r);b.linkProgram(k);h=k;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,
+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,l){var o,n,p,r,m,q,s,u,t,v=[];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);o=0;for(n=j.__lights.length;o<n;o++){p=j.__lights[o];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&
+p.shadowCascade)for(m=0;m<p.shadowCascadeCount;m++){var x;if(p.shadowCascadeArray[m])x=p.shadowCascadeArray[m];else{t=p;s=m;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=t.shadowCameraNear;x.shadowCameraFar=t.shadowCameraFar;x.shadowCameraLeft=t.shadowCameraLeft;x.shadowCameraRight=t.shadowCameraRight;x.shadowCameraBottom=t.shadowCameraBottom;x.shadowCameraTop=t.shadowCameraTop;x.shadowCameraVisible=t.shadowCameraVisible;x.shadowDarkness=t.shadowDarkness;
+x.shadowBias=t.shadowCascadeBias[s];x.shadowMapWidth=t.shadowCascadeWidth[s];x.shadowMapHeight=t.shadowCascadeHeight[s];x.pointsWorld=[];x.pointsFrustum=[];u=x.pointsWorld;q=x.pointsFrustum;for(var F=0;F<8;F++){u[F]=new THREE.Vector3;q[F]=new THREE.Vector3}u=t.shadowCascadeNearZ[s];t=t.shadowCascadeFarZ[s];q[0].set(-1,-1,u);q[1].set(1,-1,u);q[2].set(-1,1,u);q[3].set(1,1,u);q[4].set(-1,-1,t);q[5].set(1,-1,t);q[6].set(-1,1,t);q[7].set(1,1,t);x.originalCamera=l;q=new THREE.Gyroscope;q.position=p.shadowCascadeOffset;
+q.add(x);q.add(x.target);l.add(q);p.shadowCascadeArray[m]=x;console.log("Created virtualLight",x)}s=p;u=m;t=s.shadowCascadeArray[u];t.position.copy(s.position);t.target.position.copy(s.target.position);t.lookAt(t.target);t.shadowCameraVisible=s.shadowCameraVisible;t.shadowDarkness=s.shadowDarkness;t.shadowBias=s.shadowCascadeBias[u];q=s.shadowCascadeNearZ[u];s=s.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=q;t[1].z=q;t[2].z=q;t[3].z=q;t[4].z=s;t[5].z=s;t[6].z=s;t[7].z=s;v[r]=x;r++}else{v[r]=p;r++}}o=
+0;for(n=v.length;o<n;o++){p=v[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}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&&x.originalCamera==l){m=l;r=p.shadowCamera;
+q=p.pointsFrustum;t=p.pointsWorld;h.set(Infinity,Infinity,Infinity);i.set(-Infinity,-Infinity,-Infinity);for(s=0;s<8;s++){u=t[s];u.copy(q[s]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,m);r.matrixWorldInverse.multiplyVector3(u);if(u.x<h.x)h.x=u.x;if(u.x>i.x)i.x=u.x;if(u.y<h.y)h.y=u.y;if(u.y>i.y)i.y=u.y;if(u.z<h.z)h.z=u.z;if(u.z>i.z)i.z=u.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;m=p.shadowCamera;m.position.copy(p.matrixWorld.getPosition());
+m.lookAt(p.target.matrixWorld.getPosition());m.updateMatrixWorld();m.matrixWorldInverse.getInverse(m.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(m.projectionMatrix);q.multiplySelf(m.matrixWorldInverse);if(!m._viewMatrixArray)m._viewMatrixArray=new Float32Array(16);if(!m._projectionMatrixArray)m._projectionMatrixArray=new Float32Array(16);m.matrixWorldInverse.flattenToArray(m._viewMatrixArray);
+m.projectionMatrix.flattenToArray(m._projectionMatrixArray);g.multiply(m.projectionMatrix,m.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(r);b.clear();t=j.__webglObjects;p=0;for(r=t.length;p<r;p++){s=t[p];q=s.object;s.render=false;if(q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q))){q._modelViewMatrix.multiply(m.matrixWorldInverse,q.matrixWorld);s.render=true}}p=0;for(r=t.length;p<r;p++){s=t[p];if(s.render){q=s.object;s=s.buffer;u=q.customDepthMaterial?
+q.customDepthMaterial:q.geometry.morphTargets.length?d:q instanceof THREE.SkinnedMesh?e:c;s instanceof THREE.BufferGeometry?b.renderBufferDirect(m,j.__lights,null,u,s,q):b.renderBuffer(m,j.__lights,null,u,s,q)}}t=j.__webglObjectsImmediate;p=0;for(r=t.length;p<r;p++){s=t[p];q=s.object;if(q.visible&&q.castShadow){q._modelViewMatrix.multiply(m.matrixWorldInverse,q.matrixWorld);b.renderImmediateObject(m,j.__lights,null,c,q)}}}o=b.getClearColor();n=b.getClearAlpha();a.clearColor(o.r,o.g,o.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,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=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");
 "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,n=d.length;if(n){var q=i,s=j,u=r/p,p=p*0.5,w=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 x,F=[],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(s.useScreenCoordinates,1);
-b.uniform3f(s.screenPosition,(x.position.x-p)/p,(w-x.position.y)/w,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?r:1);F[0]=e*u*x.scale.x;F[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,F);if(x.mergeWith3D&&!t){b.enable(b.DEPTH_TEST);t=true}else if(!x.mergeWith3D&&t){b.disable(b.DEPTH_TEST);t=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)}}};
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,m=d.length;if(m){var q=i,s=j,u=r/p,p=p*0.5,t=r*0.5,v=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.uniformMatrix4fv(s.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var x,F=[],q=0;q<m;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<m;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(s.useScreenCoordinates,1);
+b.uniform3f(s.screenPosition,(x.position.x-p)/p,(t-x.position.y)/t,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?r:1);F[0]=e*u*x.scale.x;F[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,F);if(x.mergeWith3D&&!v){b.enable(b.DEPTH_TEST);v=true}else if(!x.mergeWith3D&&v){b.disable(b.DEPTH_TEST);v=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.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=
 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,o,k,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];k=m.object;m.render=false;if(k.visible&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||e.contains(k))){k._modelViewMatrix.multiply(h.matrixWorldInverse,k.matrixWorld);m.render=true}}i=0;for(j=p.length;i<j;i++){m=p[i];if(m.render){k=m.object;m=m.buffer;b.setObjectFaces(k);o=k.customDepthMaterial?k.customDepthMaterial:k.geometry.morphTargets.length?d:c;m instanceof
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,m,k):b.renderBuffer(h,g.__lights,null,o,m,k)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){m=p[i];k=m.object;if(k.visible&&k.castShadow){k._modelViewMatrix.multiply(h.matrixWorldInverse,k.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,k)}}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 i,j,l,o,n,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(j=p.length;i<j;i++){l=p[i];if(l.render){n=l.object;l=l.buffer;b.setObjectFaces(n);o=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;l instanceof
+THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,l,n):b.renderBuffer(h,g.__lights,null,o,l,n)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);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}"},
 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}"}};
 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}",
 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}",

+ 121 - 120
build/custom/ThreeExtras.js

@@ -1,30 +1,30 @@
 // ThreeExtras.js - http://github.com/mrdoob/three.js
 // ThreeExtras.js - http://github.com/mrdoob/three.js
 'use strict';THREE.ColorUtils={adjustHSV:function(b,a,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,e);e.h=THREE.Math.clamp(e.h+a,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);b.setHSV(e.h,e.s,e.v)},rgbToHsv:function(b,a){var c=b.r,d=b.g,e=b.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;0>c&&(c+=1);1<c&&(c-=1)}void 0===a&&(a={h:0,s:0,v:0});a.h=c;a.s=g;a.v=f;return a}};
 'use strict';THREE.ColorUtils={adjustHSV:function(b,a,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,e);e.h=THREE.Math.clamp(e.h+a,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);b.setHSV(e.h,e.s,e.v)},rgbToHsv:function(b,a){var c=b.r,d=b.g,e=b.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;0>c&&(c+=1);1<c&&(c-=1)}void 0===a&&(a={h:0,s:0,v:0});a.h=c;a.s=g;a.v=f;return a}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(b,a){for(var c,d,e=b.vertices.length,f=a instanceof THREE.Mesh?a.geometry:a,g=b.vertices,h=f.vertices,i=b.faces,j=f.faces,l=b.faceVertexUvs[0],n=f.faceVertexUvs[0],k={},m=0;m<b.materials.length;m++)k[b.materials[m].id]=m;a instanceof THREE.Mesh&&(a.matrixAutoUpdate&&a.updateMatrix(),c=a.matrix,d=new THREE.Matrix4,d.extractRotation(c,a.scale));for(var m=0,o=h.length;m<o;m++){var p=h[m].clone();c&&c.multiplyVector3(p);g.push(p)}m=0;for(o=j.length;m<o;m++){var g=j[m],
-r,s,t=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(p=t.length;h<p;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(p=v.length;h<p;h++)s=v[h],r.vertexColors.push(s.clone());void 0!==g.materialIndex&&(h=f.materials[g.materialIndex],p=h.id,v=k[p],void 0===v&&(v=b.materials.length,
-k[p]=v,b.materials.push(h)),r.materialIndex=v);r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}m=0;for(o=n.length;m<o;m++){c=n[m];d=[];h=0;for(p=c.length;h<p;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(b){var a=new THREE.Geometry,c,d=b.vertices,e=b.faces,f=b.faceVertexUvs[0];b.materials&&(a.materials=b.materials.slice());b=0;for(c=d.length;b<c;b++)a.vertices.push(d[b].clone());b=0;for(c=e.length;b<c;b++)a.faces.push(e[b].clone());b=0;for(c=f.length;b<
+THREE.GeometryUtils={merge:function(b,a){for(var c,d,e=b.vertices.length,f=a instanceof THREE.Mesh?a.geometry:a,g=b.vertices,h=f.vertices,i=b.faces,j=f.faces,l=b.faceVertexUvs[0],m=f.faceVertexUvs[0],n={},k=0;k<b.materials.length;k++)n[b.materials[k].id]=k;a instanceof THREE.Mesh&&(a.matrixAutoUpdate&&a.updateMatrix(),c=a.matrix,d=new THREE.Matrix4,d.extractRotation(c,a.scale));for(var k=0,o=h.length;k<o;k++){var q=h[k].clone();c&&c.multiplyVector3(q);g.push(q)}k=0;for(o=j.length;k<o;k++){var g=j[k],
+p,s,u=g.vertexNormals,t=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));p.normal.copy(g.normal);d&&d.multiplyVector3(p.normal);h=0;for(q=u.length;h<q;h++)s=u[h].clone(),d&&d.multiplyVector3(s),p.vertexNormals.push(s);p.color.copy(g.color);h=0;for(q=t.length;h<q;h++)s=t[h],p.vertexColors.push(s.clone());void 0!==g.materialIndex&&(h=f.materials[g.materialIndex],q=h.id,t=n[q],void 0===t&&(t=b.materials.length,
+n[q]=t,b.materials.push(h)),p.materialIndex=t);p.centroid.copy(g.centroid);c&&c.multiplyVector3(p.centroid);i.push(p)}k=0;for(o=m.length;k<o;k++){c=m[k];d=[];h=0;for(q=c.length;h<q;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(b){var a=new THREE.Geometry,c,d=b.vertices,e=b.faces,f=b.faceVertexUvs[0];b.materials&&(a.materials=b.materials.slice());b=0;for(c=d.length;b<c;b++)a.vertices.push(d[b].clone());b=0;for(c=e.length;b<c;b++)a.faces.push(e[b].clone());b=0;for(c=f.length;b<
 c;b++){for(var d=f[b],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));a.faceVertexUvs[0].push(e)}return a},randomPointInTriangle:function(b,a,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(b);g.multiplyScalar(d);h.copy(a);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(b,a,c){var d,e,f;if(b instanceof THREE.Face3)return d=
 c;b++){for(var d=f[b],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));a.faceVertexUvs[0].push(e)}return a},randomPointInTriangle:function(b,a,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(b);g.multiplyScalar(d);h.copy(a);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(b,a,c){var d,e,f;if(b instanceof THREE.Face3)return d=
 a.vertices[b.a],e=a.vertices[b.b],f=a.vertices[b.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(b instanceof THREE.Face4){d=a.vertices[b.a];e=a.vertices[b.b];f=a.vertices[b.c];var a=a.vertices[b.d],g;c?b._area1&&b._area2?(c=b._area1,g=b._area2):(c=THREE.GeometryUtils.triangleArea(d,e,a),g=THREE.GeometryUtils.triangleArea(e,f,a),b._area1=c,b._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,a),g=THREE.GeometryUtils.triangleArea(e,f,a));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,
 a.vertices[b.a],e=a.vertices[b.b],f=a.vertices[b.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(b instanceof THREE.Face4){d=a.vertices[b.a];e=a.vertices[b.b];f=a.vertices[b.c];var a=a.vertices[b.d],g;c?b._area1&&b._area2?(c=b._area1,g=b._area2):(c=THREE.GeometryUtils.triangleArea(d,e,a),g=THREE.GeometryUtils.triangleArea(e,f,a),b._area1=c,b._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,a),g=THREE.GeometryUtils.triangleArea(e,f,a));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,
-e,a):THREE.GeometryUtils.randomPointInTriangle(e,f,a)}},randomPointsInGeometry:function(b,a){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=b.faces,g=b.vertices,h=f.length,i=0,j=[],l,n,k,m;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?(l=g[d.a],n=g[d.b],k=g[d.c],d._area=THREE.GeometryUtils.triangleArea(l,n,k)):d instanceof THREE.Face4&&(l=g[d.a],n=g[d.b],k=g[d.c],m=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(l,
-n,m),d._area2=THREE.GeometryUtils.triangleArea(n,k,m),d._area=d._area1+d._area2),i+=d._area,j[e]=i;d=[];for(e=0;e<a;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],b,!0);return d},triangleArea:function(b,a,c){var d,e=THREE.GeometryUtils.__v1;e.sub(b,a);d=e.length();e.sub(b,c);b=e.length();e.sub(a,c);c=e.length();a=0.5*(d+b+c);return Math.sqrt(a*(a-d)*(a-b)*(a-c))},center:function(b){b.computeBoundingBox();var a=b.boundingBox,c=new THREE.Vector3;c.add(a.min,
+e,a):THREE.GeometryUtils.randomPointInTriangle(e,f,a)}},randomPointsInGeometry:function(b,a){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=b.faces,g=b.vertices,h=f.length,i=0,j=[],l,m,n,k;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?(l=g[d.a],m=g[d.b],n=g[d.c],d._area=THREE.GeometryUtils.triangleArea(l,m,n)):d instanceof THREE.Face4&&(l=g[d.a],m=g[d.b],n=g[d.c],k=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(l,
+m,k),d._area2=THREE.GeometryUtils.triangleArea(m,n,k),d._area=d._area1+d._area2),i+=d._area,j[e]=i;d=[];for(e=0;e<a;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],b,!0);return d},triangleArea:function(b,a,c){var d,e=THREE.GeometryUtils.__v1;e.sub(b,a);d=e.length();e.sub(b,c);b=e.length();e.sub(a,c);c=e.length();a=0.5*(d+b+c);return Math.sqrt(a*(a-d)*(a-b)*(a-c))},center:function(b){b.computeBoundingBox();var a=b.boundingBox,c=new THREE.Vector3;c.add(a.min,
 a.max);c.multiplyScalar(-0.5);b.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));b.computeBoundingBox();return c},normalizeUVs:function(b){for(var b=b.faceVertexUvs[0],a=0,c=b.length;a<c;a++)for(var d=b[a],e=0,f=d.length;e<f;e++)if(1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v)d[e].v-=Math.floor(d[e].v)},triangulateQuads:function(b){var a,c,d,e,f=[],g=[],h=[];a=0;for(c=b.faceUvs.length;a<c;a++)g[a]=[];a=0;for(c=b.faceVertexUvs.length;a<c;a++)h[a]=[];a=0;for(c=b.faces.length;a<c;a++)if(d=
 a.max);c.multiplyScalar(-0.5);b.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));b.computeBoundingBox();return c},normalizeUVs:function(b){for(var b=b.faceVertexUvs[0],a=0,c=b.length;a<c;a++)for(var d=b[a],e=0,f=d.length;e<f;e++)if(1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v)d[e].v-=Math.floor(d[e].v)},triangulateQuads:function(b){var a,c,d,e,f=[],g=[],h=[];a=0;for(c=b.faceUvs.length;a<c;a++)g[a]=[];a=0;for(c=b.faceVertexUvs.length;a<c;a++)h[a]=[];a=0;for(c=b.faces.length;a<c;a++)if(d=
-b.faces[a],d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,l=d.d,n=new THREE.Face3,k=new THREE.Face3;n.color.copy(d.color);k.color.copy(d.color);n.materialIndex=d.materialIndex;k.materialIndex=d.materialIndex;n.a=e;n.b=i;n.c=l;k.a=i;k.b=j;k.c=l;4===d.vertexColors.length&&(n.vertexColors[0]=d.vertexColors[0].clone(),n.vertexColors[1]=d.vertexColors[1].clone(),n.vertexColors[2]=d.vertexColors[3].clone(),k.vertexColors[0]=d.vertexColors[1].clone(),k.vertexColors[1]=d.vertexColors[2].clone(),k.vertexColors[2]=
-d.vertexColors[3].clone());f.push(n,k);d=0;for(e=b.faceVertexUvs.length;d<e;d++)b.faceVertexUvs[d].length&&(n=b.faceVertexUvs[d][a],i=n[1],j=n[2],l=n[3],n=[n[0].clone(),i.clone(),l.clone()],i=[i.clone(),j.clone(),l.clone()],h[d].push(n,i));d=0;for(e=b.faceUvs.length;d<e;d++)b.faceUvs[d].length&&(i=b.faceUvs[d][a],g[d].push(i,i))}else{f.push(d);d=0;for(e=b.faceUvs.length;d<e;d++)g[d].push(b.faceUvs[d]);d=0;for(e=b.faceVertexUvs.length;d<e;d++)h[d].push(b.faceVertexUvs[d])}b.faces=f;b.faceUvs=g;b.faceVertexUvs=
+b.faces[a],d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,l=d.d,m=new THREE.Face3,n=new THREE.Face3;m.color.copy(d.color);n.color.copy(d.color);m.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;m.a=e;m.b=i;m.c=l;n.a=i;n.b=j;n.c=l;4===d.vertexColors.length&&(m.vertexColors[0]=d.vertexColors[0].clone(),m.vertexColors[1]=d.vertexColors[1].clone(),m.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(m,n);d=0;for(e=b.faceVertexUvs.length;d<e;d++)b.faceVertexUvs[d].length&&(m=b.faceVertexUvs[d][a],i=m[1],j=m[2],l=m[3],m=[m[0].clone(),i.clone(),l.clone()],i=[i.clone(),j.clone(),l.clone()],h[d].push(m,i));d=0;for(e=b.faceUvs.length;d<e;d++)b.faceUvs[d].length&&(i=b.faceUvs[d][a],g[d].push(i,i))}else{f.push(d);d=0;for(e=b.faceUvs.length;d<e;d++)g[d].push(b.faceUvs[d]);d=0;for(e=b.faceVertexUvs.length;d<e;d++)h[d].push(b.faceVertexUvs[d])}b.faces=f;b.faceUvs=g;b.faceVertexUvs=
 h;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals();b.hasTangents&&b.computeTangents()},explode:function(b){for(var a=[],c=0,d=b.faces.length;c<d;c++){var e=a.length,f=b.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=b.vertices[g],h=b.vertices[h],i=b.vertices[i],j=b.vertices[f.d];a.push(g.clone());a.push(h.clone());a.push(i.clone());a.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=b.vertices[g],h=b.vertices[h],i=b.vertices[i],a.push(g.clone()),
 h;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals();b.hasTangents&&b.computeTangents()},explode:function(b){for(var a=[],c=0,d=b.faces.length;c<d;c++){var e=a.length,f=b.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=b.vertices[g],h=b.vertices[h],i=b.vertices[i],j=b.vertices[f.d];a.push(g.clone());a.push(h.clone());a.push(i.clone());a.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=b.vertices[g],h=b.vertices[h],i=b.vertices[i],a.push(g.clone()),
-a.push(h.clone()),a.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}b.vertices=a;delete b.__tmpVertices},tessellate:function(b,a){var c,d,e,f,g,h,i,j,l,n,k,m,o,p,r,s,t,v,q,x=[],z=[];c=0;for(d=b.faceVertexUvs.length;c<d;c++)z[c]=[];c=0;for(d=b.faces.length;c<d;c++)if(e=b.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=b.vertices[f],l=b.vertices[g],n=b.vertices[h],m=j.distanceTo(l),o=l.distanceTo(n),k=j.distanceTo(n),m>a||o>a||k>a){i=b.vertices.length;v=e.clone();q=e.clone();m>=o&&m>=k?(j=j.clone(),
-j.lerpSelf(l,0.5),v.a=f,v.b=i,v.c=h,q.a=i,q.b=g,q.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),v.vertexNormals[1].copy(f),q.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),v.vertexColors[1].copy(f),q.vertexColors[0].copy(f)),e=0):o>=m&&o>=k?(j=l.clone(),j.lerpSelf(n,0.5),v.a=f,v.b=g,v.c=i,q.a=i,q.b=h,q.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],
-0.5),v.vertexNormals[2].copy(f),q.vertexNormals[0].copy(f),q.vertexNormals[1].copy(e.vertexNormals[2]),q.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),q.vertexColors[0].copy(f),q.vertexColors[1].copy(e.vertexColors[2]),q.vertexColors[2].copy(e.vertexColors[0])),e=1):(j=j.clone(),j.lerpSelf(n,0.5),v.a=f,v.b=g,v.c=i,q.a=i,q.b=g,q.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),
-f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),q.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),q.vertexColors[0].copy(f)),e=2);x.push(v,q);b.vertices.push(j);f=0;for(g=b.faceVertexUvs.length;f<g;f++)b.faceVertexUvs[f].length&&(j=b.faceVertexUvs[f][c],q=j[0],h=j[1],v=j[2],0===e?(l=q.clone(),l.lerpSelf(h,0.5),j=[q.clone(),l.clone(),v.clone()],h=[l.clone(),h.clone(),v.clone()]):1===e?(l=h.clone(),
-l.lerpSelf(v,0.5),j=[q.clone(),h.clone(),l.clone()],h=[l.clone(),v.clone(),q.clone()]):(l=q.clone(),l.lerpSelf(v,0.5),j=[q.clone(),h.clone(),l.clone()],h=[l.clone(),h.clone(),v.clone()]),z[f].push(j,h))}else{x.push(e);f=0;for(g=b.faceVertexUvs.length;f<g;f++)z[f].push(b.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=b.vertices[f],l=b.vertices[g],n=b.vertices[h],k=b.vertices[i],m=j.distanceTo(l),o=l.distanceTo(n),p=n.distanceTo(k),r=j.distanceTo(k),m>a||o>a||p>a||r>a){s=b.vertices.length;t=
-b.vertices.length+1;v=e.clone();q=e.clone();m>=o&&m>=p&&m>=r||p>=o&&p>=m&&p>=r?(m=j.clone(),m.lerpSelf(l,0.5),l=n.clone(),l.lerpSelf(k,0.5),v.a=f,v.b=s,v.c=t,v.d=i,q.a=s,q.b=g,q.c=h,q.d=t,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),v.vertexNormals[1].copy(f),v.vertexNormals[2].copy(g),q.vertexNormals[0].copy(f),q.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),
-f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),v.vertexColors[1].copy(f),v.vertexColors[2].copy(g),q.vertexColors[0].copy(f),q.vertexColors[3].copy(g)),e=0):(m=l.clone(),m.lerpSelf(n,0.5),l=k.clone(),l.lerpSelf(j,0.5),v.a=f,v.b=g,v.c=s,v.d=t,q.a=t,q.b=s,q.c=h,q.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),v.vertexNormals[2].copy(f),v.vertexNormals[3].copy(g),
-q.vertexNormals[0].copy(g),q.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),v.vertexColors[2].copy(f),v.vertexColors[3].copy(g),q.vertexColors[0].copy(g),q.vertexColors[1].copy(f)),e=1);x.push(v,q);b.vertices.push(m,l);f=0;for(g=b.faceVertexUvs.length;f<g;f++)b.faceVertexUvs[f].length&&(j=b.faceVertexUvs[f][c],q=j[0],h=j[1],v=j[2],j=j[3],0===e?(l=q.clone(),l.lerpSelf(h,
-0.5),n=v.clone(),n.lerpSelf(j,0.5),q=[q.clone(),l.clone(),n.clone(),j.clone()],h=[l.clone(),h.clone(),v.clone(),n.clone()]):(l=h.clone(),l.lerpSelf(v,0.5),n=j.clone(),n.lerpSelf(q,0.5),q=[q.clone(),h.clone(),l.clone(),n.clone()],h=[n.clone(),l.clone(),v.clone(),j.clone()]),z[f].push(q,h))}else{x.push(e);f=0;for(g=b.faceVertexUvs.length;f<g;f++)z[f].push(b.faceVertexUvs[f][c])}b.faces=x;b.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+a.push(h.clone()),a.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}b.vertices=a;delete b.__tmpVertices},tessellate:function(b,a){var c,d,e,f,g,h,i,j,l,m,n,k,o,q,p,s,u,t,r,v=[],z=[];c=0;for(d=b.faceVertexUvs.length;c<d;c++)z[c]=[];c=0;for(d=b.faces.length;c<d;c++)if(e=b.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=b.vertices[f],l=b.vertices[g],m=b.vertices[h],k=j.distanceTo(l),o=l.distanceTo(m),n=j.distanceTo(m),k>a||o>a||n>a){i=b.vertices.length;t=e.clone();r=e.clone();k>=o&&k>=n?(j=j.clone(),
+j.lerpSelf(l,0.5),t.a=f,t.b=i,t.c=h,r.a=i,r.b=g,r.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),t.vertexNormals[1].copy(f),r.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),t.vertexColors[1].copy(f),r.vertexColors[0].copy(f)),e=0):o>=k&&o>=n?(j=l.clone(),j.lerpSelf(m,0.5),t.a=f,t.b=g,t.c=i,r.a=i,r.b=h,r.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],
+0.5),t.vertexNormals[2].copy(f),r.vertexNormals[0].copy(f),r.vertexNormals[1].copy(e.vertexNormals[2]),r.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),t.vertexColors[2].copy(f),r.vertexColors[0].copy(f),r.vertexColors[1].copy(e.vertexColors[2]),r.vertexColors[2].copy(e.vertexColors[0])),e=1):(j=j.clone(),j.lerpSelf(m,0.5),t.a=f,t.b=g,t.c=i,r.a=i,r.b=g,r.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),
+f.lerpSelf(e.vertexNormals[2],0.5),t.vertexNormals[2].copy(f),r.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),t.vertexColors[2].copy(f),r.vertexColors[0].copy(f)),e=2);v.push(t,r);b.vertices.push(j);f=0;for(g=b.faceVertexUvs.length;f<g;f++)b.faceVertexUvs[f].length&&(j=b.faceVertexUvs[f][c],r=j[0],h=j[1],t=j[2],0===e?(l=r.clone(),l.lerpSelf(h,0.5),j=[r.clone(),l.clone(),t.clone()],h=[l.clone(),h.clone(),t.clone()]):1===e?(l=h.clone(),
+l.lerpSelf(t,0.5),j=[r.clone(),h.clone(),l.clone()],h=[l.clone(),t.clone(),r.clone()]):(l=r.clone(),l.lerpSelf(t,0.5),j=[r.clone(),h.clone(),l.clone()],h=[l.clone(),h.clone(),t.clone()]),z[f].push(j,h))}else{v.push(e);f=0;for(g=b.faceVertexUvs.length;f<g;f++)z[f].push(b.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=b.vertices[f],l=b.vertices[g],m=b.vertices[h],n=b.vertices[i],k=j.distanceTo(l),o=l.distanceTo(m),q=m.distanceTo(n),p=j.distanceTo(n),k>a||o>a||q>a||p>a){s=b.vertices.length;u=
+b.vertices.length+1;t=e.clone();r=e.clone();k>=o&&k>=q&&k>=p||q>=o&&q>=k&&q>=p?(k=j.clone(),k.lerpSelf(l,0.5),l=m.clone(),l.lerpSelf(n,0.5),t.a=f,t.b=s,t.c=u,t.d=i,r.a=s,r.b=g,r.c=h,r.d=u,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),t.vertexNormals[1].copy(f),t.vertexNormals[2].copy(g),r.vertexNormals[0].copy(f),r.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),
+f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),t.vertexColors[1].copy(f),t.vertexColors[2].copy(g),r.vertexColors[0].copy(f),r.vertexColors[3].copy(g)),e=0):(k=l.clone(),k.lerpSelf(m,0.5),l=n.clone(),l.lerpSelf(j,0.5),t.a=f,t.b=g,t.c=s,t.d=u,r.a=u,r.b=s,r.c=h,r.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),t.vertexNormals[2].copy(f),t.vertexNormals[3].copy(g),
+r.vertexNormals[0].copy(g),r.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),t.vertexColors[2].copy(f),t.vertexColors[3].copy(g),r.vertexColors[0].copy(g),r.vertexColors[1].copy(f)),e=1);v.push(t,r);b.vertices.push(k,l);f=0;for(g=b.faceVertexUvs.length;f<g;f++)b.faceVertexUvs[f].length&&(j=b.faceVertexUvs[f][c],r=j[0],h=j[1],t=j[2],j=j[3],0===e?(l=r.clone(),l.lerpSelf(h,
+0.5),m=t.clone(),m.lerpSelf(j,0.5),r=[r.clone(),l.clone(),m.clone(),j.clone()],h=[l.clone(),h.clone(),t.clone(),m.clone()]):(l=h.clone(),l.lerpSelf(t,0.5),m=j.clone(),m.lerpSelf(r,0.5),r=[r.clone(),h.clone(),l.clone(),m.clone()],h=[m.clone(),l.clone(),t.clone(),j.clone()]),z[f].push(r,h))}else{v.push(e);f=0;for(g=b.faceVertexUvs.length;f<g;f++)z[f].push(b.faceVertexUvs[f][c])}b.faces=v;b.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(b,a,c,d){var e=new THREE.Texture(void 0,a),a=new THREE.ImageLoader;a.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=!0;c&&c(e)});a.addEventListener("error",function(a){d&&d(a.message)});a.crossOrigin=this.crossOrigin;a.load(b);return e},loadTextureCube:function(b,a,c){var d,e=[],f=new THREE.Texture(e,a);f.flipY=!1;a=e.loadCount=0;for(d=b.length;a<d;++a)e[a]=new Image,e[a].onload=function(){e.loadCount+=1;6===e.loadCount&&
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(b,a,c,d){var e=new THREE.Texture(void 0,a),a=new THREE.ImageLoader;a.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=!0;c&&c(e)});a.addEventListener("error",function(a){d&&d(a.message)});a.crossOrigin=this.crossOrigin;a.load(b);return e},loadTextureCube:function(b,a,c){var d,e=[],f=new THREE.Texture(e,a);f.flipY=!1;a=e.loadCount=0;for(d=b.length;a<d;++a)e[a]=new Image,e[a].onload=function(){e.loadCount+=1;6===e.loadCount&&
-(f.needsUpdate=!0,c&&c())},e[a].crossOrigin=this.crossOrigin,e[a].src=b[a];return f},getNormalMap:function(b,a){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]},a=a|1,d=b.width,e=b.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(b,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var n=0;n<e;n++){var k=0>n-1?0:n-1,m=n+1>e-1?e-1:n+1,o=0>l-1?0:l-1,p=l+1>d-1?d-
-1:l+1,r=[],s=[0,0,h[4*(n*d+l)]/255*a];r.push([-1,0,h[4*(n*d+o)]/255*a]);r.push([-1,-1,h[4*(k*d+o)]/255*a]);r.push([0,-1,h[4*(k*d+l)]/255*a]);r.push([1,-1,h[4*(k*d+p)]/255*a]);r.push([1,0,h[4*(n*d+p)]/255*a]);r.push([1,1,h[4*(m*d+p)]/255*a]);r.push([0,1,h[4*(m*d+l)]/255*a]);r.push([-1,1,h[4*(m*d+o)]/255*a]);k=[];o=r.length;for(m=0;m<o;m++){var p=r[m],t=r[(m+1)%o],p=[p[0]-s[0],p[1]-s[1],p[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];k.push(c([p[1]*t[2]-p[2]*t[1],p[2]*t[0]-p[0]*t[2],p[0]*t[1]-p[1]*t[0]]))}r=
-[0,0,0];for(m=0;m<k.length;m++)r[0]+=k[m][0],r[1]+=k[m][1],r[2]+=k[m][2];r[0]/=k.length;r[1]/=k.length;r[2]/=k.length;s=4*(n*d+l);j[s]=255*((r[0]+1)/2)|0;j[s+1]=255*((r[1]+1)/2)|0;j[s+2]=255*r[2]|0;j[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(b,a,c){for(var d=b*a,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;b=new THREE.DataTexture(e,b,a,THREE.RGBFormat);b.needsUpdate=!0;return b}};
+(f.needsUpdate=!0,c&&c())},e[a].crossOrigin=this.crossOrigin,e[a].src=b[a];return f},getNormalMap:function(b,a){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]},a=a|1,d=b.width,e=b.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(b,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var m=0;m<e;m++){var n=0>m-1?0:m-1,k=m+1>e-1?e-1:m+1,o=0>l-1?0:l-1,q=l+1>d-1?d-
+1:l+1,p=[],s=[0,0,h[4*(m*d+l)]/255*a];p.push([-1,0,h[4*(m*d+o)]/255*a]);p.push([-1,-1,h[4*(n*d+o)]/255*a]);p.push([0,-1,h[4*(n*d+l)]/255*a]);p.push([1,-1,h[4*(n*d+q)]/255*a]);p.push([1,0,h[4*(m*d+q)]/255*a]);p.push([1,1,h[4*(k*d+q)]/255*a]);p.push([0,1,h[4*(k*d+l)]/255*a]);p.push([-1,1,h[4*(k*d+o)]/255*a]);n=[];o=p.length;for(k=0;k<o;k++){var q=p[k],u=p[(k+1)%o],q=[q[0]-s[0],q[1]-s[1],q[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];n.push(c([q[1]*u[2]-q[2]*u[1],q[2]*u[0]-q[0]*u[2],q[0]*u[1]-q[1]*u[0]]))}p=
+[0,0,0];for(k=0;k<n.length;k++)p[0]+=n[k][0],p[1]+=n[k][1],p[2]+=n[k][2];p[0]/=n.length;p[1]/=n.length;p[2]/=n.length;s=4*(m*d+l);j[s]=255*((p[0]+1)/2)|0;j[s+1]=255*((p[1]+1)/2)|0;j[s+2]=255*p[2]|0;j[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(b,a,c){for(var d=b*a,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;b=new THREE.DataTexture(e,b,a,THREE.RGBFormat);b.needsUpdate=!0;return b}};
 THREE.SceneUtils={showHierarchy:function(b,a){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=a})},traverseHierarchy:function(b,a){var c,d,e=b.children.length;for(d=0;d<e;d++)c=b.children[d],a(c),THREE.SceneUtils.traverseHierarchy(c,a)},createMultiMaterialObject:function(b,a){var c,d=a.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(b,a[c]);e.add(f)}return e},cloneObject:function(b){var a;b instanceof THREE.MorphAnimMesh?(a=new THREE.MorphAnimMesh(b.geometry,b.material),
 THREE.SceneUtils={showHierarchy:function(b,a){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=a})},traverseHierarchy:function(b,a){var c,d,e=b.children.length;for(d=0;d<e;d++)c=b.children[d],a(c),THREE.SceneUtils.traverseHierarchy(c,a)},createMultiMaterialObject:function(b,a){var c,d=a.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(b,a[c]);e.add(f)}return e},cloneObject:function(b){var a;b instanceof THREE.MorphAnimMesh?(a=new THREE.MorphAnimMesh(b.geometry,b.material),
 a.duration=b.duration,a.mirroredLoop=b.mirroredLoop,a.time=b.time,a.lastKeyframe=b.lastKeyframe,a.currentKeyframe=b.currentKeyframe,a.direction=b.direction,a.directionBackwards=b.directionBackwards):b instanceof THREE.SkinnedMesh?a=new THREE.SkinnedMesh(b.geometry,b.material):b instanceof THREE.Mesh?a=new THREE.Mesh(b.geometry,b.material):b instanceof THREE.Line?a=new THREE.Line(b.geometry,b.material,b.type):b instanceof THREE.Ribbon?a=new THREE.Ribbon(b.geometry,b.material):b instanceof THREE.ParticleSystem?
 a.duration=b.duration,a.mirroredLoop=b.mirroredLoop,a.time=b.time,a.lastKeyframe=b.lastKeyframe,a.currentKeyframe=b.currentKeyframe,a.direction=b.direction,a.directionBackwards=b.directionBackwards):b instanceof THREE.SkinnedMesh?a=new THREE.SkinnedMesh(b.geometry,b.material):b instanceof THREE.Mesh?a=new THREE.Mesh(b.geometry,b.material):b instanceof THREE.Line?a=new THREE.Line(b.geometry,b.material,b.type):b instanceof THREE.Ribbon?a=new THREE.Ribbon(b.geometry,b.material):b instanceof THREE.ParticleSystem?
 (a=new THREE.ParticleSystem(b.geometry,b.material),a.sortParticles=b.sortParticles):b instanceof THREE.Particle?a=new THREE.Particle(b.material):b instanceof THREE.Sprite?(a=new THREE.Sprite({}),a.color.copy(b.color),a.map=b.map,a.blending=b.blending,a.useScreenCoordinates=b.useScreenCoordinates,a.mergeWith3D=b.mergeWith3D,a.affectedByDistance=b.affectedByDistance,a.scaleByViewport=b.scaleByViewport,a.alignment=b.alignment,a.rotation3d.copy(b.rotation3d),a.rotation=b.rotation,a.opacity=b.opacity,
 (a=new THREE.ParticleSystem(b.geometry,b.material),a.sortParticles=b.sortParticles):b instanceof THREE.Particle?a=new THREE.Particle(b.material):b instanceof THREE.Sprite?(a=new THREE.Sprite({}),a.color.copy(b.color),a.map=b.map,a.blending=b.blending,a.useScreenCoordinates=b.useScreenCoordinates,a.mergeWith3D=b.mergeWith3D,a.affectedByDistance=b.affectedByDistance,a.scaleByViewport=b.scaleByViewport,a.alignment=b.alignment,a.rotation3d.copy(b.rotation3d),a.rotation=b.rotation,a.opacity=b.opacity,
@@ -41,20 +41,20 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvWorldPosition = mPosition.xyz;\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvWorldPosition = mPosition.xyz;\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
 THREE.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(b){var a=b.familyName.toLowerCase();this.faces[a]=this.faces[a]||{};this.faces[a][b.cssFontWeight]=this.faces[a][b.cssFontWeight]||{};this.faces[a][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[a][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var a=this.getFace(),c=this.size/a.resolution,d=
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var a=b.familyName.toLowerCase();this.faces[a]=this.faces[a]||{};this.faces[a][b.cssFontWeight]=this.faces[a][b.cssFontWeight]||{};this.faces[a][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[a][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var a=this.getFace(),c=this.size/a.resolution,d=
-0,e=(""+b).split(""),f=e.length,g=[],b=0;b<f;b++){var h=new THREE.Path,h=this.extractGlyphPoints(e[b],a,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(b,a,c,d,e){var f=[],g,h,i,j,l,n,k,m,o,p,r,s=a.glyphs[b]||a.glyphs["?"];if(s){if(s.o){a=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=a.length;for(b=0;b<j;){i=a[b++];switch(i){case "m":i=a[b++]*c+d;l=a[b++]*c;e.moveTo(i,l);break;case "l":i=a[b++]*c+d;l=a[b++]*c;e.lineTo(i,l);break;case "q":i=a[b++]*
-c+d;l=a[b++]*c;m=a[b++]*c+d;o=a[b++]*c;e.quadraticCurveTo(m,o,i,l);if(g=f[f.length-1]){n=g.x;k=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h;THREE.Shape.Utils.b2(t,n,m,i);THREE.Shape.Utils.b2(t,k,o,l)}}break;case "b":i=a[b++]*c+d;l=a[b++]*c;m=a[b++]*c+d;o=a[b++]*-c;p=a[b++]*c+d;r=a[b++]*-c;e.bezierCurveTo(i,l,m,o,p,r);if(g=f[f.length-1]){n=g.x;k=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;THREE.Shape.Utils.b3(t,n,m,p,i);THREE.Shape.Utils.b3(t,k,o,r,l)}}}}}return{offset:s.ha*c,path:e}}}};
+0,e=(""+b).split(""),f=e.length,g=[],b=0;b<f;b++){var h=new THREE.Path,h=this.extractGlyphPoints(e[b],a,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(b,a,c,d,e){var f=[],g,h,i,j,l,m,n,k,o,q,p,s=a.glyphs[b]||a.glyphs["?"];if(s){if(s.o){a=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=a.length;for(b=0;b<j;){i=a[b++];switch(i){case "m":i=a[b++]*c+d;l=a[b++]*c;e.moveTo(i,l);break;case "l":i=a[b++]*c+d;l=a[b++]*c;e.lineTo(i,l);break;case "q":i=a[b++]*
+c+d;l=a[b++]*c;k=a[b++]*c+d;o=a[b++]*c;e.quadraticCurveTo(k,o,i,l);if(g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,m,k,i);THREE.Shape.Utils.b2(u,n,o,l)}}break;case "b":i=a[b++]*c+d;l=a[b++]*c;k=a[b++]*c+d;o=a[b++]*-c;q=a[b++]*c+d;p=a[b++]*-c;e.bezierCurveTo(i,l,k,o,q,p);if(g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,m,k,q,i);THREE.Shape.Utils.b3(u,n,o,p,l)}}}}}return{offset:s.ha*c,path:e}}}};
 THREE.FontUtils.generateShapes=function(b,a){var a=a||{},c=a.curveSegments!==void 0?a.curveSegments:4,d=a.font!==void 0?a.font:"helvetiker",e=a.weight!==void 0?a.weight:"normal",f=a.style!==void 0?a.style:"normal";THREE.FontUtils.size=a.size!==void 0?a.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(b).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
 THREE.FontUtils.generateShapes=function(b,a){var a=a||{},c=a.curveSegments!==void 0?a.curveSegments:4,d=a.font!==void 0?a.font:"helvetiker",e=a.weight!==void 0?a.weight:"normal",f=a.style!==void 0?a.style:"normal";THREE.FontUtils.size=a.size!==void 0?a.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(b).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
-(function(b){var a=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};b.Triangulate=function(b,d){var e=b.length;if(e<3)return null;var f=[],g=[],h=[],i,j,l;if(a(b)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var n=2*e;for(j=e-1;e>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var k;a:{k=b;var m=i,o=j,p=l,r=e,s=g,t=void 0,v=void 0,q=void 0,x=void 0,z=void 0,
-A=void 0,w=void 0,u=void 0,C=void 0,v=k[s[m]].x,q=k[s[m]].y,x=k[s[o]].x,z=k[s[o]].y,A=k[s[p]].x,w=k[s[p]].y;if(1.0E-10>(x-v)*(w-q)-(z-q)*(A-v))k=false;else{for(t=0;t<r;t++)if(!(t==m||t==o||t==p)){var u=k[s[t]].x,C=k[s[t]].y,B=void 0,E=void 0,G=void 0,L=void 0,H=void 0,D=void 0,K=void 0,F=void 0,O=void 0,I=void 0,M=void 0,J=void 0,B=G=H=void 0,B=A-x,E=w-z,G=v-A,L=q-w,H=x-v,D=z-q,K=u-v,F=C-q,O=u-x,I=C-z,M=u-A,J=C-w,B=B*I-E*O,H=H*F-D*K,G=G*J-L*M;if(B>=0&&G>=0&&H>=0){k=false;break a}}k=true}}if(k){f.push([b[g[i]],
-b[g[j]],b[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;n=2*e}}return d?h:f};b.Triangulate.area=a;return b})(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(b){var a=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};b.Triangulate=function(b,d){var e=b.length;if(e<3)return null;var f=[],g=[],h=[],i,j,l;if(a(b)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var m=2*e;for(j=e-1;e>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{n=b;var k=i,o=j,q=l,p=e,s=g,u=void 0,t=void 0,r=void 0,v=void 0,z=void 0,
+A=void 0,x=void 0,w=void 0,C=void 0,t=n[s[k]].x,r=n[s[k]].y,v=n[s[o]].x,z=n[s[o]].y,A=n[s[q]].x,x=n[s[q]].y;if(1.0E-10>(v-t)*(x-r)-(z-r)*(A-t))n=false;else{for(u=0;u<p;u++)if(!(u==k||u==o||u==q)){var w=n[s[u]].x,C=n[s[u]].y,B=void 0,E=void 0,G=void 0,L=void 0,H=void 0,D=void 0,K=void 0,F=void 0,O=void 0,I=void 0,M=void 0,J=void 0,B=G=H=void 0,B=A-v,E=x-z,G=t-A,L=r-x,H=v-t,D=z-r,K=w-t,F=C-r,O=w-v,I=C-z,M=w-A,J=C-x,B=B*I-E*O,H=H*F-D*K,G=G*J-L*M;if(B>=0&&G>=0&&H>=0){n=false;break a}}n=true}}if(n){f.push([b[g[i]],
+b[g[j]],b[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;m=2*e}}return d?h:f};b.Triangulate.area=a;return b})(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(b){var a,c;if(this.attributes.position)a=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(a!==void 0){b.multiplyVector3Array(a);this.verticesNeedUpdate=true}if(c!==void 0){a=new THREE.Matrix4;a.extractRotation(b);a.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(b){var a,c;if(this.attributes.position)a=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(a!==void 0){b.multiplyVector3Array(a);this.verticesNeedUpdate=true}if(c!==void 0){a=new THREE.Matrix4;a.extractRotation(b);a.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 b=this.attributes.position.array;if(b)for(var a=this.boundingBox,c,d,e,f=0,g=b.length;f<g;f=f+3){c=b[f];d=b[f+1];e=b[f+2];if(c<a.min.x)a.min.x=c;else if(c>a.max.x)a.max.x=c;if(d<a.min.y)a.min.y=d;else if(d>a.max.y)a.max.y=d;if(e<a.min.z)a.min.z=e;else if(e>a.max.z)a.max.z=e}if(b===void 0||b.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
 Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var b=this.attributes.position.array;if(b)for(var a=this.boundingBox,c,d,e,f=0,g=b.length;f<g;f=f+3){c=b[f];d=b[f+1];e=b[f+2];if(c<a.min.x)a.min.x=c;else if(c>a.max.x)a.max.x=c;if(d<a.min.y)a.min.y=d;else if(d>a.max.y)a.max.y=d;if(e<a.min.z)a.min.z=e;else if(e>a.max.z)a.max.z=e}if(b===void 0||b.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 b=this.attributes.position.array;if(b){for(var a,c=0,d,e,f=0,g=b.length;f<g;f=f+3){a=b[f];d=b[f+1];e=b[f+2];a=Math.sqrt(a*a+d*d+e*e);a>c&&(c=a)}this.boundingSphere.radius=c}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var b,a,c,d;b=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(b),numItems:b};else{b=0;for(a=this.attributes.normal.array.length;b<a;b++)this.attributes.normal.array[b]=
 {radius:0};var b=this.attributes.position.array;if(b){for(var a,c=0,d,e,f=0,g=b.length;f<g;f=f+3){a=b[f];d=b[f+1];e=b[f+2];a=Math.sqrt(a*a+d*d+e*e);a>c&&(c=a)}this.boundingSphere.radius=c}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var b,a,c,d;b=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(b),numItems:b};else{b=0;for(a=this.attributes.normal.array.length;b<a;b++)this.attributes.normal.array[b]=
-0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,n,k,m,o=new THREE.Vector3,p=new THREE.Vector3,r=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){a=e[c].start;i=e[c].count;var v=e[c].index;b=a;for(a=a+i;b<a;b=b+3){i=v+f[b];j=v+f[b+1];l=v+f[b+2];n=g[i*3];k=g[i*3+1];m=g[i*3+2];o.set(n,k,m);n=g[j*3];k=g[j*3+1];m=g[j*3+2];p.set(n,k,m);n=g[l*3];k=g[l*3+1];m=g[l*3+2];r.set(n,k,m);s.sub(r,p);t.sub(o,
-p);s.crossSelf(t);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[l*3]=h[l*3]+s.x;h[l*3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z}}b=0;for(a=h.length;b<a;b=b+3){n=h[b];k=h[b+1];m=h[b+2];c=1/Math.sqrt(n*n+k*k+m*m);h[b]=h[b]*c;h[b+1]=h[b+1]*c;h[b+2]=h[b+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function b(a,b,c){n=d[a*3];k=d[a*3+1];m=d[a*3+2];o=d[b*3];p=d[b*3+1];r=d[b*3+2];s=d[c*3];t=d[c*3+1];v=d[c*3+2];q=
-f[a*2];x=f[a*2+1];z=f[b*2];A=f[b*2+1];w=f[c*2];u=f[c*2+1];C=o-n;B=s-n;E=p-k;G=t-k;L=r-m;H=v-m;D=z-q;K=w-q;F=A-x;O=u-x;I=1/(D*O-K*F);M.set((O*C-F*B)*I,(O*E-F*G)*I,(O*L-F*H)*I);J.set((D*B-K*C)*I,(D*G-K*E)*I,(D*H-K*L)*I);j[a].addSelf(M);j[b].addSelf(M);j[c].addSelf(M);l[a].addSelf(J);l[b].addSelf(J);l[c].addSelf(J)}function a(a){U.x=e[a*3];U.y=e[a*3+1];U.z=e[a*3+2];X.copy(U);W=j[a];V.copy(W);V.subSelf(U.multiplyScalar(U.dot(W))).normalize();Y.cross(X,W);Z=Y.dot(l[a]);$=Z<0?-1:1;i[a*4]=V.x;i[a*4+1]=V.y;
+0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,m,n,k,o=new THREE.Vector3,q=new THREE.Vector3,p=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){a=e[c].start;i=e[c].count;var t=e[c].index;b=a;for(a=a+i;b<a;b=b+3){i=t+f[b];j=t+f[b+1];l=t+f[b+2];m=g[i*3];n=g[i*3+1];k=g[i*3+2];o.set(m,n,k);m=g[j*3];n=g[j*3+1];k=g[j*3+2];q.set(m,n,k);m=g[l*3];n=g[l*3+1];k=g[l*3+2];p.set(m,n,k);s.sub(p,q);u.sub(o,
+q);s.crossSelf(u);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[l*3]=h[l*3]+s.x;h[l*3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z}}b=0;for(a=h.length;b<a;b=b+3){m=h[b];n=h[b+1];k=h[b+2];c=1/Math.sqrt(m*m+n*n+k*k);h[b]=h[b]*c;h[b+1]=h[b+1]*c;h[b+2]=h[b+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function b(a,b,c){m=d[a*3];n=d[a*3+1];k=d[a*3+2];o=d[b*3];q=d[b*3+1];p=d[b*3+2];s=d[c*3];u=d[c*3+1];t=d[c*3+2];r=
+f[a*2];v=f[a*2+1];z=f[b*2];A=f[b*2+1];x=f[c*2];w=f[c*2+1];C=o-m;B=s-m;E=q-n;G=u-n;L=p-k;H=t-k;D=z-r;K=x-r;F=A-v;O=w-v;I=1/(D*O-K*F);M.set((O*C-F*B)*I,(O*E-F*G)*I,(O*L-F*H)*I);J.set((D*B-K*C)*I,(D*G-K*E)*I,(D*H-K*L)*I);j[a].addSelf(M);j[b].addSelf(M);j[c].addSelf(M);l[a].addSelf(J);l[b].addSelf(J);l[c].addSelf(J)}function a(a){U.x=e[a*3];U.y=e[a*3+1];U.z=e[a*3+2];X.copy(U);W=j[a];V.copy(W);V.subSelf(U.multiplyScalar(U.dot(W))).normalize();Y.cross(X,W);Z=Y.dot(l[a]);$=Z<0?-1:1;i[a*4]=V.x;i[a*4+1]=V.y;
 i[a*4+2]=V.z;i[a*4+3]=$}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),
 i[a*4+2]=V.z;i[a*4+3]=$}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=[],l=[],h=0;h<g;h++){j[h]=new THREE.Vector3;l[h]=new THREE.Vector3}var n,k,m,o,p,r,s,t,v,q,x,z,A,w,u,C,B,E,G,L,H,D,K,F,O,I,M=new THREE.Vector3,J=new THREE.Vector3,N,y,Q,P,R,S=this.offsets,h=0;for(y=S.length;h<y;++h){N=S[h].start;Q=S[h].count;var T=S[h].index,g=N;for(N=N+Q;g<N;g=g+3){Q=T+c[g];P=T+c[g+1];R=T+c[g+2];b(Q,P,R)}}var V=new THREE.Vector3,Y=new THREE.Vector3,U=new THREE.Vector3,X=new THREE.Vector3,$,W,Z,h=0;for(y=S.length;h<y;++h){N=S[h].start;
+numItems:h}}for(var i=this.attributes.tangent.array,j=[],l=[],h=0;h<g;h++){j[h]=new THREE.Vector3;l[h]=new THREE.Vector3}var m,n,k,o,q,p,s,u,t,r,v,z,A,x,w,C,B,E,G,L,H,D,K,F,O,I,M=new THREE.Vector3,J=new THREE.Vector3,N,y,Q,P,R,S=this.offsets,h=0;for(y=S.length;h<y;++h){N=S[h].start;Q=S[h].count;var T=S[h].index,g=N;for(N=N+Q;g<N;g=g+3){Q=T+c[g];P=T+c[g+1];R=T+c[g+2];b(Q,P,R)}}var V=new THREE.Vector3,Y=new THREE.Vector3,U=new THREE.Vector3,X=new THREE.Vector3,$,W,Z,h=0;for(y=S.length;h<y;++h){N=S[h].start;
 Q=S[h].count;T=S[h].index;g=N;for(N=N+Q;g<N;g=g+3){Q=T+c[g];P=T+c[g+1];R=T+c[g+2];a(Q);a(P);a(R)}}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(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var a,c=[];for(a=0;a<=b;a++)c.push(this.getPoint(a/b));return c};
 Q=S[h].count;T=S[h].index;g=N;for(N=N+Q;g<N;g=g+3){Q=T+c[g];P=T+c[g+1];R=T+c[g+2];a(Q);a(P);a(R)}}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(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var a,c=[];for(a=0;a<=b;a++)c.push(this.getPoint(a/b));return c};
 THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var a,c=[];for(a=0;a<=b;a++)c.push(this.getPointAt(a/b));return c};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};
 THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var a,c=[];for(a=0;a<=b;a++)c.push(this.getPointAt(a/b));return c};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};
 THREE.Curve.prototype.getLengths=function(b){b||(b=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var a=[],c,d=this.getPoint(0),e,f=0;a.push(0);for(e=1;e<=b;e++){c=this.getPoint(e/b);f=f+c.distanceTo(d);a.push(f);d=c}return this.cacheArcLengths=a};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};
 THREE.Curve.prototype.getLengths=function(b){b||(b=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var a=[],c,d=this.getPoint(0),e,f=0;a.push(0);for(e=1;e<=b;e++){c=this.getPoint(e/b);f=f+c.distanceTo(d);a.push(f);d=c}return this.cacheArcLengths=a};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};
@@ -89,16 +89,16 @@ THREE.Path.prototype.bezierCurveTo=function(b,a,c,d,e,f){var g=Array.prototype.s
 THREE.Path.prototype.splineThru=function(b){var a=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,b);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:a})};THREE.Path.prototype.ellipse=function(b,a,c,d,e,f,g){var h=this.actions[this.actions.length-1];this.absellipse(h.x+b,h.y+a,c,d,e,f,g)};
 THREE.Path.prototype.splineThru=function(b){var a=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,b);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:a})};THREE.Path.prototype.ellipse=function(b,a,c,d,e,f,g){var h=this.actions[this.actions.length-1];this.absellipse(h.x+b,h.y+a,c,d,e,f,g)};
 THREE.Path.prototype.arc=function(b,a,c,d,e,f){var g=this.actions[this.actions.length-1];this.absarc(g.x+b,g.y+a,c,d,e,f)};THREE.Path.prototype.absellipse=function(b,a,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(b,a,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(b,a,c,d,e,f){this.absellipse(b,a,c,c,d,e,f)};
 THREE.Path.prototype.arc=function(b,a,c,d,e,f){var g=this.actions[this.actions.length-1];this.absarc(g.x+b,g.y+a,c,d,e,f)};THREE.Path.prototype.absellipse=function(b,a,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(b,a,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(b,a,c,d,e,f){this.absellipse(b,a,c,c,d,e,f)};
 THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var a=[],c=0;c<b;c++)a.push(this.getPoint(c/b));return a};
 THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var a=[],c=0;c<b;c++)a.push(this.getPoint(c/b));return a};
-THREE.Path.prototype.getPoints=function(b,a){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(b,a)}var b=b||12,c=[],d,e,f,g,h,i,j,l,n,k,m,o,p;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];n=f[0];k=f[1];if(c.length>0){g=c[c.length-1];
-m=g.x;o=g.y}else{g=this.actions[d-1].args;m=g[g.length-2];o=g[g.length-1]}for(f=1;f<=b;f++){p=f/b;g=THREE.Shape.Utils.b2(p,m,n,h);p=THREE.Shape.Utils.b2(p,o,k,i);c.push(new THREE.Vector2(g,p))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];k=f[1];j=f[2];l=f[3];if(c.length>0){g=c[c.length-1];m=g.x;o=g.y}else{g=this.actions[d-1].args;m=g[g.length-2];o=g[g.length-1]}for(f=1;f<=b;f++){p=f/b;g=THREE.Shape.Utils.b3(p,m,n,j,h);p=THREE.Shape.Utils.b3(p,o,k,l,i);c.push(new THREE.Vector2(g,
-p))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=b*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];k=f[2];j=f[3];g=f[4];n=!!f[5];m=g-j;o=b*2;for(f=1;f<=o;f++){p=f/o;n||(p=1-p);p=j+p*m;g=h+k*Math.cos(p);p=i+k*Math.sin(p);c.push(new THREE.Vector2(g,p))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];k=f[2];l=f[3];j=f[4];g=f[5];
-n=!!f[6];m=g-j;o=b*2;for(f=1;f<=o;f++){p=f/o;n||(p=1-p);p=j+p*m;g=h+k*Math.cos(p);p=i+l*Math.sin(p);c.push(new THREE.Vector2(g,p))}}}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);a&&c.push(c[0]);return c};
+THREE.Path.prototype.getPoints=function(b,a){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(b,a)}var b=b||12,c=[],d,e,f,g,h,i,j,l,m,n,k,o,q;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];m=f[0];n=f[1];if(c.length>0){g=c[c.length-1];
+k=g.x;o=g.y}else{g=this.actions[d-1].args;k=g[g.length-2];o=g[g.length-1]}for(f=1;f<=b;f++){q=f/b;g=THREE.Shape.Utils.b2(q,k,m,h);q=THREE.Shape.Utils.b2(q,o,n,i);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];m=f[0];n=f[1];j=f[2];l=f[3];if(c.length>0){g=c[c.length-1];k=g.x;o=g.y}else{g=this.actions[d-1].args;k=g[g.length-2];o=g[g.length-1]}for(f=1;f<=b;f++){q=f/b;g=THREE.Shape.Utils.b3(q,k,m,j,h);q=THREE.Shape.Utils.b3(q,o,n,l,i);c.push(new THREE.Vector2(g,
+q))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;q=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=b*f[0].length;q=q.concat(f[0]);q=new THREE.SplineCurve(q);for(f=1;f<=g;f++)c.push(q.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];n=f[2];j=f[3];g=f[4];m=!!f[5];k=g-j;o=b*2;for(f=1;f<=o;f++){q=f/o;m||(q=1-q);q=j+q*k;g=h+n*Math.cos(q);q=i+n*Math.sin(q);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];n=f[2];l=f[3];j=f[4];g=f[5];
+m=!!f[6];k=g-j;o=b*2;for(f=1;f<=o;f++){q=f/o;m||(q=1-q);q=j+q*k;g=h+n*Math.cos(q);q=i+l*Math.sin(q);c.push(new THREE.Vector2(g,q))}}}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);a&&c.push(c[0]);return c};
 THREE.Path.prototype.toShapes=function(){var b,a,c,d,e=[],f=new THREE.Path;b=0;for(a=this.actions.length;b<a;b++){c=this.actions[b];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=[];b=!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(b){g=new THREE.Shape;b=0;for(a=e.length;b<
 THREE.Path.prototype.toShapes=function(){var b,a,c,d,e=[],f=new THREE.Path;b=0;for(a=this.actions.length;b<a;b++){c=this.actions[b];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=[];b=!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(b){g=new THREE.Shape;b=0;for(a=e.length;b<
 a;b++){f=e[b];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{b=0;for(a=e.length;b<a;b++){f=e[b];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);
 a;b++){f=e[b];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{b=0;for(a=e.length;b<a;b++){f=e[b];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(b){return new THREE.ExtrudeGeometry(this,b)};THREE.Shape.prototype.getPointsHoles=function(b){var a,c=this.holes.length,d=[];for(a=0;a<c;a++)d[a]=this.holes[a].getTransformedPoints(b,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var a,c=this.holes.length,d=[];for(a=0;a<c;a++)d[a]=this.holes[a].getTransformedSpacedPoints(b,this.bends);return d};
 THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};THREE.Shape.prototype.getPointsHoles=function(b){var a,c=this.holes.length,d=[];for(a=0;a<c;a++)d[a]=this.holes[a].getTransformedPoints(b,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var a,c=this.holes.length,d=[];for(a=0;a<c;a++)d[a]=this.holes[a].getTransformedSpacedPoints(b,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};THREE.Shape.prototype.extractPoints=function(b){return this.useSpacedPoints?this.extractAllSpacedPoints(b):this.extractAllPoints(b)};THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
 THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};THREE.Shape.prototype.extractPoints=function(b){return this.useSpacedPoints?this.extractAllSpacedPoints(b):this.extractAllPoints(b)};THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
-THREE.Shape.Utils={removeHoles:function(b,a){var c=b.concat(),d=c.concat(),e,f,g,h,i,j,l,n,k,m,o=[];for(i=0;i<a.length;i++){j=a[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){k=j[e];m=[];for(n=0;n<c.length;n++){l=c[n];l=k.distanceToSquared(l);m.push(l);if(l<f){f=l;g=e;h=n}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var p=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(p);var r=[j[g],j[f],c[h]];k=THREE.FontUtils.Triangulate.area(r);m=h;l=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;p=[j[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(p);r=[j[g],j[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);if(n+k>p+r){h=m;g=l;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}n=c.slice(0,h);k=c.slice(h);m=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];o.push([j[g],c[h],c[e]]);o.push(f);c=n.concat(m).concat(l).concat(k)}return{shape:c,
+THREE.Shape.Utils={removeHoles:function(b,a){var c=b.concat(),d=c.concat(),e,f,g,h,i,j,l,m,n,k,o=[];for(i=0;i<a.length;i++){j=a[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){n=j[e];k=[];for(m=0;m<c.length;m++){l=c[m];l=n.distanceToSquared(l);k.push(l);if(l<f){f=l;g=e;h=m}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var q=[j[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(q);var p=[j[g],j[f],c[h]];n=THREE.FontUtils.Triangulate.area(p);k=h;l=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;q=[j[g],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(q);p=[j[g],j[f],c[h]];p=THREE.FontUtils.Triangulate.area(p);if(m+n>q+p){h=k;g=l;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}m=c.slice(0,h);n=c.slice(h);k=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];o.push([j[g],c[h],c[e]]);o.push(f);c=m.concat(k).concat(l).concat(n)}return{shape:c,
 isolatedPts:o,allpoints:d}},triangulateShape:function(b,a){var c=THREE.Shape.Utils.removeHoles(b,a),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)},
 isolatedPts:o,allpoints:d}},triangulateShape:function(b,a){var c=THREE.Shape.Utils.removeHoles(b,a),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)},
 isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0},b2p0:function(b,a){var c=1-b;return c*c*a},b2p1:function(b,a){return 2*(1-b)*b*a},b2p2:function(b,a){return b*b*a},b2:function(b,a,c,d){return this.b2p0(b,a)+this.b2p1(b,c)+this.b2p2(b,d)},b3p0:function(b,a){var c=1-b;return c*c*c*a},b3p1:function(b,a){var c=1-b;return 3*c*c*b*a},b3p2:function(b,a){return 3*(1-b)*b*b*a},b3p3:function(b,a){return b*b*b*a},b3:function(b,a,c,d,e){return this.b3p0(b,a)+this.b3p1(b,c)+this.b3p2(b,d)+
 isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0},b2p0:function(b,a){var c=1-b;return c*c*a},b2p1:function(b,a){return 2*(1-b)*b*a},b2p2:function(b,a){return b*b*a},b2:function(b,a,c,d){return this.b2p0(b,a)+this.b2p1(b,c)+this.b2p2(b,d)},b3p0:function(b,a){var c=1-b;return c*c*c*a},b3p1:function(b,a){var c=1-b;return 3*c*c*b*a},b3p2:function(b,a){return 3*(1-b)*b*b*a},b3p3:function(b,a){return b*b*b*a},b3:function(b,a,c,d,e){return this.b3p0(b,a)+this.b3p1(b,c)+this.b3p2(b,d)+
 this.b3p3(b,e)}};
 this.b3p3(b,e)}};
@@ -111,11 +111,11 @@ THREE.Animation.prototype.play=function(b,a){if(!this.isPlaying){this.isPlaying=
 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)};
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0){this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0){this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var a=["pos","rot","scl"],c,d,e,f,g,h,i,j,l=this.data.JIT.hierarchy,n,k;k=this.currentTime=this.currentTime+b*this.timeScale;n=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,o=this.hierarchy.length;m<o;m++){b=this.hierarchy[m];i=b.animationCache;if(this.JITCompile&&l[m][j]!==void 0)if(b instanceof THREE.Bone){b.skinMatrix=l[m][j];b.matrixAutoUpdate=
-false;b.matrixWorldNeedsUpdate=false}else{b.matrix=l[m][j];b.matrixAutoUpdate=false;b.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var p=0;p<3;p++){c=a[p];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=k){if(n<k)if(this.loop){g=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<n;){g=h;h=this.getNextKeyWith(c,m,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
-m,h.index+1)}while(h.time<n)}i.prevKey[c]=g;i.nextKey[c]=h}b.matrixAutoUpdate=true;b.matrixWorldNeedsUpdate=true;d=(n-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m);d=d<0?0:1}if(c==="pos"){c=b.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",m,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",m,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);b.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,b.quaternion,d);else if(c==="scl"){c=b.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(m=0;m<this.hierarchy.length;m++)l[m][j]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var a=["pos","rot","scl"],c,d,e,f,g,h,i,j,l=this.data.JIT.hierarchy,m,n;n=this.currentTime=this.currentTime+b*this.timeScale;m=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,o=this.hierarchy.length;k<o;k++){b=this.hierarchy[k];i=b.animationCache;if(this.JITCompile&&l[k][j]!==void 0)if(b instanceof THREE.Bone){b.skinMatrix=l[k][j];b.matrixAutoUpdate=
+false;b.matrixWorldNeedsUpdate=false}else{b.matrix=l[k][j];b.matrixAutoUpdate=false;b.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var q=0;q<3;q++){c=a[q];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(m<n)if(this.loop){g=this.data.hierarchy[k].keys[0];for(h=this.getNextKeyWith(c,k,1);h.time<m;){g=h;h=this.getNextKeyWith(c,k,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
+k,h.index+1)}while(h.time<m)}i.prevKey[c]=g;i.nextKey[c]=h}b.matrixAutoUpdate=true;b.matrixWorldNeedsUpdate=true;d=(m-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 "+k);d=d<0?0:1}if(c==="pos"){c=b.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",k,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",k,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);b.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,b.quaternion,d);else if(c==="scl"){c=b.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(k=0;k<this.hierarchy.length;k++)l[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(b,a){var c=[],d=[],e,f,g,h,i,j;e=(b.length-1)*a;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>b.length-2?f:f+1;c[3]=f>b.length-3?f:f+2;f=b[c[0]];h=b[c[1]];i=b[c[2]];j=b[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(b,a){var c=[],d=[],e,f,g,h,i,j;e=(b.length-1)*a;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>b.length-2?f:f+1;c[3]=f>b.length-3?f:f+2;f=b[c[0]];h=b[c[1]];i=b[c[2]];j=b[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.interpolate=function(b,a,c,d,e,f,g){b=(c-b)*0.5;d=(d-a)*0.5;return(2*(a-c)+b+d)*g+(-3*(a-c)-2*b-d)*f+b*e+a};THREE.Animation.prototype.getNextKeyWith=function(b,a,c){for(var d=this.data.hierarchy[a].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][b]!==void 0)return d[c];return this.data.hierarchy[a].keys[0]};
 THREE.Animation.prototype.interpolate=function(b,a,c,d,e,f,g){b=(c-b)*0.5;d=(d-a)*0.5;return(2*(a-c)+b+d)*g+(-3*(a-c)-2*b-d)*f+b*e+a};THREE.Animation.prototype.getNextKeyWith=function(b,a,c){for(var d=this.data.hierarchy[a].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][b]!==void 0)return d[c];return this.data.hierarchy[a].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,a,c){for(var d=this.data.hierarchy[a].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][b]!==void 0)return d[c];return this.data.hierarchy[a].keys[d.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,a,c){for(var d=this.data.hierarchy[a].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][b]!==void 0)return d[c];return this.data.hierarchy[a].keys[d.length-1]};
@@ -125,13 +125,13 @@ THREE.KeyFrameAnimation.prototype.play=function(b,a){if(!this.isPlaying){this.is
 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};
 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 b=0;b<this.data.hierarchy.length;b++){var a=this.hierarchy[b],c=this.data.hierarchy[b];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(a instanceof THREE.Bone){d.copy(a.skinMatrix);a.skinMatrix=d}else{d.copy(a.matrix);a.matrix=d}delete c.animationCache}}};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.data.hierarchy.length;b++){var a=this.hierarchy[b],c=this.data.hierarchy[b];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(a instanceof THREE.Bone){d.copy(a.skinMatrix);a.skinMatrix=d}else{d.copy(a.matrix);a.matrix=d}delete c.animationCache}}};
 THREE.KeyFrameAnimation.prototype.update=function(b){if(this.isPlaying){var a,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+b*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 b=0,j=this.hierarchy.length;b<j;b++){var l=this.data.hierarchy[b].keys,f=this.data.hierarchy[b].sids;d=l.length-1;e=
 THREE.KeyFrameAnimation.prototype.update=function(b){if(this.isPlaying){var a,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+b*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 b=0,j=this.hierarchy.length;b<j;b++){var l=this.data.hierarchy[b].keys,f=this.data.hierarchy[b].sids;d=l.length-1;e=
-this.hierarchy[b];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,b,d))&&h.apply(g)}this.data.hierarchy[b].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){b=0;for(j=this.hierarchy.length;b<j;b++){d=this.hierarchy[b];a=this.data.hierarchy[b];var l=a.keys,n=a.animationCache;if(this.JITCompile&&f[b][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[b][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[b][e];d.matrixWorldNeedsUpdate=
-true}else if(l.length){if(this.JITCompile&&n)d instanceof THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix;a=n.prevKey;c=n.nextKey;if(a&&c){if(c.time<=h){if(i&&this.loop){a=l[0];for(c=l[1];c.time<g;){a=c;c=l[a.index+1]}}else if(!i)for(var k=l.length-1;c.time<g&&c.index!==k;){a=c;c=l[a.index+1]}n.prevKey=a;n.nextKey=c}c.time>=g?a.interpolate(c,g):a.interpolate(c,c.time)}this.data.hierarchy[b].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
+this.hierarchy[b];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,b,d))&&h.apply(g)}this.data.hierarchy[b].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){b=0;for(j=this.hierarchy.length;b<j;b++){d=this.hierarchy[b];a=this.data.hierarchy[b];var l=a.keys,m=a.animationCache;if(this.JITCompile&&f[b][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[b][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[b][e];d.matrixWorldNeedsUpdate=
+true}else if(l.length){if(this.JITCompile&&m)d instanceof THREE.Bone?d.skinMatrix=m.originalMatrix:d.matrix=m.originalMatrix;a=m.prevKey;c=m.nextKey;if(a&&c){if(c.time<=h){if(i&&this.loop){a=l[0];for(c=l[1];c.time<g;){a=c;c=l[a.index+1]}}else if(!i)for(var n=l.length-1;c.time<g&&c.index!==n;){a=c;c=l[a.index+1]}m.prevKey=a;m.nextKey=c}c.time>=g?a.interpolate(c,g):a.interpolate(c,c.time)}this.data.hierarchy[b].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
 for(b=0;b<this.hierarchy.length;b++)f[b][e]=this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix.clone():this.hierarchy[b].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(b,a,c){a=this.data.hierarchy[a].keys;for(c=c%a.length;c<a.length;c++)if(a[c].hasTarget(b))return a[c];return a[0]};
 for(b=0;b<this.hierarchy.length;b++)f[b][e]=this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix.clone():this.hierarchy[b].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(b,a,c){a=this.data.hierarchy[a].keys;for(c=c%a.length;c<a.length;c++)if(a[c].hasTarget(b))return a[c];return a[0]};
 THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(b,a,c){a=this.data.hierarchy[a].keys;for(c=c>=0?c:c+a.length;c>=0;c--)if(a[c].hasTarget(b))return a[c];return a[a.length-1]};
 THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(b,a,c){a=this.data.hierarchy[a].keys;for(c=c>=0?c:c+a.length;c>=0;c--)if(a[c].hasTarget(b))return a[c];return a[a.length-1]};
 THREE.CubeCamera=function(b,a,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,b,a);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,b,a);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,b,a);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,b,a);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
 THREE.CubeCamera=function(b,a,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,b,a);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,b,a);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,b,a);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,b,a);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
-1,b,a);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,b,a);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,k=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=k;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(b,a,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-b/2;this.right=b/2;this.top=a/2;this.bottom=-a/2;this.cameraO=new THREE.OrthographicCamera(b/-2,b/2,a/2,a/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,b/a,d,e);this.zoom=1;this.toPerspective()};
+1,b,a);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,b,a);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(b,a,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-b/2;this.right=b/2;this.top=a/2;this.bottom=-a/2;this.cameraO=new THREE.OrthographicCamera(b/-2,b/2,a/2,a/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,b/a,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=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 b=this.cameraP.aspect,a=(this.cameraP.near+this.cameraP.far)/2,a=Math.tan(this.fov/2)*a,b=2*a*b/2,a=a/this.zoom,b=b/this.zoom;this.cameraO.left=-b;this.cameraO.right=b;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPerspectiveMode=false;this.inOrthographicMode=true};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var b=this.cameraP.aspect,a=(this.cameraP.near+this.cameraP.far)/2,a=Math.tan(this.fov/2)*a,b=2*a*b/2,a=a/this.zoom,b=b/this.zoom;this.cameraO.left=-b;this.cameraO.right=b;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPerspectiveMode=false;this.inOrthographicMode=true};
 THREE.CombinedCamera.prototype.setSize=function(b,a){this.cameraP.aspect=b/a;this.left=-b/2;this.right=b/2;this.top=a/2;this.bottom=-a/2};THREE.CombinedCamera.prototype.setFov=function(b){this.fov=b;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){if(this.inPerspectiveMode)this.toPerspective();else{this.toPerspective();this.toOrthographic()}};
 THREE.CombinedCamera.prototype.setSize=function(b,a){this.cameraP.aspect=b/a;this.left=-b/2;this.right=b/2;this.top=a/2;this.bottom=-a/2};THREE.CombinedCamera.prototype.setFov=function(b){this.fov=b;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){if(this.inPerspectiveMode)this.toPerspective();else{this.toPerspective();this.toOrthographic()}};
@@ -147,14 +147,14 @@ this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object
 this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*a*b;this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,
 this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*a*b;this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,
 0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",
 0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",
 c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()};
 c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()};
-THREE.PathControls=function(b,a){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,s=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++){s=d*h.chunks[f]/h.total;b.keys[f]={time:s,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
+THREE.PathControls=function(b,a){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,s=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++){s=d*h.chunks[f]/h.total;b.keys[f]={time:s,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return e}this.object=b;this.domElement=a!==void 0?a:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return e}this.object=b;this.domElement=a!==void 0?a:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
 this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
 this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
 document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=
 document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=
 a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};
 a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};
 this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),
 this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),
 b=new THREE.MeshLambertMaterial({color:65280}),c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
 b=new THREE.MeshLambertMaterial({color:65280}),c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++){c=new THREE.Mesh(g,h);c.position.copy(b.points[m]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
+this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),k=0;k<b.points.length;k++){c=new THREE.Mesh(g,h);c.position.copy(b.points[k]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),false)};this.handleResize()};THREE.PathControlsIdCounter=0;
 this.onMouseMove),false)};this.handleResize()};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.domElement=a!==void 0?a:document;a&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
 THREE.FlyControls=function(b,a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=b;this.domElement=a!==void 0?a:document;a&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
 new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
@@ -165,55 +165,55 @@ 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.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",
 -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()};
 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(b,a){this.object=b;this.domElement=a!==void 0?a: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,l=0,n=0,k=0,m=0,o=0;this.handleResize=function(){m=window.innerWidth/2;o=window.innerHeight/2};this.update=
-function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*n);this.rotateVertically(b*k)}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*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
+THREE.RollControls=function(b,a){this.object=b;this.domElement=a!==void 0?a: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,l=0,m=0,n=0,k=0,o=0;this.handleResize=function(){k=window.innerWidth/2;o=window.innerHeight/2};this.update=
+function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*m);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*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
 d.set(0,1,0);c.cross(d,e).normalize();d.cross(e,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
 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]*
 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-
 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()},
 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){n=(a.clientX-m)/window.innerWidth;k=(a.clientY-o)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
+false);this.domElement.addEventListener("mousemove",function(a){m=(a.clientX-k)/window.innerWidth;n=(a.clientY-o)/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:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65: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:l=0;break;case 70:l=0}},false);this.handleResize()};
 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:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65: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:l=0;break;case 70:l=0}},false);this.handleResize()};
 THREE.TrackballControls=function(b,a){THREE.EventTarget.call(this);var c=this;this.object=b;this.domElement=a!==void 0?a: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=
 THREE.TrackballControls=function(b,a){THREE.EventTarget.call(this);var c=this;this.object=b;this.domElement=a!==void 0?a: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,l=new THREE.Vector2,n=new THREE.Vector2,k=new THREE.Vector2,m={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,i=new THREE.Vector3,j=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2,n=new THREE.Vector2,k={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};
 b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};
 this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=l:j.y=j.y+(l.y-j.y)*
 this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=l:j.y=j.y+(l.y-j.y)*
-this.dynamicDampingFactor}};this.panCamera=function(){var a=k.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?n=k:n.addSelf(a.sub(k,n).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);
-g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceToSquared(c.object.position)>0){c.dispatchEvent(m);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=l=c.getMouseOnScreen(a.clientX,a.clientY);n=k=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(k=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=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(n=k=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.dynamicDampingFactor}};this.panCamera=function(){var a=n.clone().subSelf(m);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?m=n:m.addSelf(a.sub(n,m).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(k);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=l=c.getMouseOnScreen(a.clientX,a.clientY);m=n=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
+a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?j=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=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()};
 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(b,a){var c,d,e;function f(){return 2*Math.PI/60/60*i.autoRotateSpeed}function g(a){a.preventDefault();if(q===c){n.set(a.clientX,a.clientY);k.sub(n,l);i.rotateLeft(2*Math.PI*k.x/j*i.userRotateSpeed);i.rotateUp(2*Math.PI*k.y/j*i.userRotateSpeed);l.copy(n)}else if(q===d){o.set(a.clientX,a.clientY);p.sub(o,m);p.y>0?i.zoomIn():i.zoomOut();m.copy(o)}}function h(){if(i.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
-q=e}}THREE.EventTarget.call(this);this.object=b;this.domElement=a!==void 0?a: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,l=new THREE.Vector2,n=new THREE.Vector2,k=new THREE.Vector2,m=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2,r=0,s=0,t=1,v=new THREE.Vector3;e=-1;c=0;d=1;var q=e,x={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());r=r-a};this.rotateDown=function(a){a===void 0&&(a=f());r=r+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));t=t/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));t=t*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+r,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(t);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);r=s=0;t=1;if(v.distanceTo(this.object.position)>0){this.dispatchEvent(x);v.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){q=c;l.set(a.clientX,a.clientY)}else if(a.button===1){q=d;m.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.CubeGeometry=function(b,a,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,l){var m,n=d||1,o=e||1,p=h/2,r=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){m="y";o=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";n=f||1}var t=n+1,v=o+1,I=h/n,M=i/o,J=new THREE.Vector3;J[m]=k>0?1:-1;for(h=0;h<v;h++)for(i=0;i<t;i++){var N=new THREE.Vector3;N[a]=(i*I-p)*c;N[b]=(h*M-r)*g;N[m]=k;j.vertices.push(N)}for(h=0;h<o;h++)for(i=0;i<n;i++){a=new THREE.Face4(i+
-t*h+s,i+t*(h+1)+s,i+1+t*(h+1)+s,i+1+t*h+s);a.normal.copy(J);a.vertexNormals.push(J.clone(),J.clone(),J.clone(),J.clone());a.materialIndex=l;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/n,1-h/o),new THREE.UV(i/n,1-(h+1)/o),new THREE.UV((i+1)/n,1-(h+1)/o),new THREE.UV((i+1)/n,1-h/o)])}}THREE.Geometry.call(this);var j=this,l=b/2,n=a/2,k=c/2,m,o,p,r,s,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(g)}m=0;r=1;o=2;s=3;p=4;t=
-5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,a,l,m);this.sides.nx&&i("z","y",1,-1,c,a,-l,r);this.sides.py&&i("x","z",1,1,b,c,n,o);this.sides.ny&&i("x","z",1,-1,b,c,-n,s);this.sides.pz&&i("x","y",1,-1,b,a,k,p);this.sides.nz&&i("x","y",-1,-1,b,a,-k,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.CylinderGeometry=function(b,a,c,d,e,f){THREE.Geometry.call(this);var b=b!==void 0?b:20,a=a!==void 0?a:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var n=[],k=[],m=i/e,o=m*(a-b)+b;for(h=0;h<=d;h++){var p=h/d,r=new THREE.Vector3;r.x=o*Math.sin(p*Math.PI*2);r.y=-m*c+g;r.z=o*Math.cos(p*Math.PI*2);this.vertices.push(r);n.push(this.vertices.length-1);k.push(new THREE.UV(p,m))}j.push(n);l.push(k)}c=(a-b)/c;for(h=0;h<d;h++){if(b!==0){n=this.vertices[j[0][h]].clone();k=this.vertices[j[0][h+
-1]].clone()}else{n=this.vertices[j[1][h]].clone();k=this.vertices[j[1][h+1]].clone()}n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();k.setY(Math.sqrt(k.x*k.x+k.z*k.z)*c).normalize();for(i=0;i<e;i++){var m=j[i][h],o=j[i+1][h],p=j[i+1][h+1],r=j[i][h+1],s=n.clone(),t=n.clone(),v=k.clone(),q=k.clone(),x=l[i][h].clone(),z=l[i+1][h].clone(),A=l[i+1][h+1].clone(),w=l[i][h+1].clone();this.faces.push(new THREE.Face4(m,o,p,r,[s,t,v,q]));this.faceVertexUvs[0].push([x,z,A,w])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,
-g,0));for(h=0;h<d;h++){m=j[0][h];o=j[0][h+1];p=this.vertices.length-1;s=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);v=new THREE.Vector3(0,1,0);x=l[0][h].clone();z=l[0][h+1].clone();A=new THREE.UV(z.u,0);this.faces.push(new THREE.Face3(m,o,p,[s,t,v]));this.faceVertexUvs[0].push([x,z,A])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){m=j[i][h+1];o=j[i][h];p=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);v=new THREE.Vector3(0,-1,0);
-x=l[i][h+1].clone();z=l[i][h].clone();A=new THREE.UV(z.u,1);this.faces.push(new THREE.Face3(m,o,p,[s,t,v]));this.faceVertexUvs[0].push([x,z,A])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(b,a){if(typeof b!=="undefined"){THREE.Geometry.call(this);b=b instanceof Array?b:[b];this.shapebb=b[b.length-1].getBoundingBox();this.addShapeList(b,a);this.computeCentroids();this.computeFaceNormals()}};
+THREE.OrbitControls=function(b,a){var c,d,e;function f(){return 2*Math.PI/60/60*i.autoRotateSpeed}function g(a){a.preventDefault();if(r===c){m.set(a.clientX,a.clientY);n.sub(m,l);i.rotateLeft(2*Math.PI*n.x/j*i.userRotateSpeed);i.rotateUp(2*Math.PI*n.y/j*i.userRotateSpeed);l.copy(m)}else if(r===d){o.set(a.clientX,a.clientY);q.sub(o,k);q.y>0?i.zoomIn():i.zoomOut();k.copy(o)}}function h(){if(i.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
+r=e}}THREE.EventTarget.call(this);this.object=b;this.domElement=a!==void 0?a: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,l=new THREE.Vector2,m=new THREE.Vector2,n=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,q=new THREE.Vector2,p=0,s=0,u=1,t=new THREE.Vector3;e=-1;c=0;d=1;var r=e,v={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());p=p-a};this.rotateDown=function(a){a===void 0&&(a=f());p=p+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));u=u/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));u=u*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+p,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(u);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);p=s=0;u=1;if(t.distanceTo(this.object.position)>0){this.dispatchEvent(v);t.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){r=c;l.set(a.clientX,a.clientY)}else if(a.button===1){r=d;k.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.CubeGeometry=function(b,a,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,n){var m,l=d||1,o=e||1,q=h/2,p=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){m="y";o=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";l=f||1}var t=l+1,u=o+1,I=h/l,M=i/o,J=new THREE.Vector3;J[m]=k>0?1:-1;for(h=0;h<u;h++)for(i=0;i<t;i++){var N=new THREE.Vector3;N[a]=(i*I-q)*c;N[b]=(h*M-p)*g;N[m]=k;j.vertices.push(N)}for(h=0;h<o;h++)for(i=0;i<l;i++){a=new THREE.Face4(i+
+t*h+s,i+t*(h+1)+s,i+1+t*(h+1)+s,i+1+t*h+s);a.normal.copy(J);a.vertexNormals.push(J.clone(),J.clone(),J.clone(),J.clone());a.materialIndex=n;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/l,1-h/o),new THREE.UV(i/l,1-(h+1)/o),new THREE.UV((i+1)/l,1-(h+1)/o),new THREE.UV((i+1)/l,1-h/o)])}}THREE.Geometry.call(this);var j=this,l=b/2,m=a/2,n=c/2,k,o,q,p,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(k=0;k<6;k++)this.materials.push(g)}k=0;p=1;o=2;s=3;q=4;u=
+5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,a,l,k);this.sides.nx&&i("z","y",1,-1,c,a,-l,p);this.sides.py&&i("x","z",1,1,b,c,m,o);this.sides.ny&&i("x","z",1,-1,b,c,-m,s);this.sides.pz&&i("x","y",1,-1,b,a,n,q);this.sides.nz&&i("x","y",-1,-1,b,a,-n,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.CylinderGeometry=function(b,a,c,d,e,f){THREE.Geometry.call(this);var b=b!==void 0?b:20,a=a!==void 0?a:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],k=i/e,o=k*(a-b)+b;for(h=0;h<=d;h++){var q=h/d,p=new THREE.Vector3;p.x=o*Math.sin(q*Math.PI*2);p.y=-k*c+g;p.z=o*Math.cos(q*Math.PI*2);this.vertices.push(p);m.push(this.vertices.length-1);n.push(new THREE.UV(q,k))}j.push(m);l.push(n)}c=(a-b)/c;for(h=0;h<d;h++){if(b!==0){m=this.vertices[j[0][h]].clone();n=this.vertices[j[0][h+
+1]].clone()}else{m=this.vertices[j[1][h]].clone();n=this.vertices[j[1][h+1]].clone()}m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var k=j[i][h],o=j[i+1][h],q=j[i+1][h+1],p=j[i][h+1],s=m.clone(),u=m.clone(),t=n.clone(),r=n.clone(),v=l[i][h].clone(),z=l[i+1][h].clone(),A=l[i+1][h+1].clone(),x=l[i][h+1].clone();this.faces.push(new THREE.Face4(k,o,q,p,[s,u,t,r]));this.faceVertexUvs[0].push([v,z,A,x])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,
+g,0));for(h=0;h<d;h++){k=j[0][h];o=j[0][h+1];q=this.vertices.length-1;s=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);v=l[0][h].clone();z=l[0][h+1].clone();A=new THREE.UV(z.u,0);this.faces.push(new THREE.Face3(k,o,q,[s,u,t]));this.faceVertexUvs[0].push([v,z,A])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){k=j[i][h+1];o=j[i][h];q=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);
+v=l[i][h+1].clone();z=l[i][h].clone();A=new THREE.UV(z.u,1);this.faces.push(new THREE.Face3(k,o,q,[s,u,t]));this.faceVertexUvs[0].push([v,z,A])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(b,a){if(typeof b!=="undefined"){THREE.Geometry.call(this);b=b instanceof Array?b:[b];this.shapebb=b[b.length-1].getBoundingBox();this.addShapeList(b,a);this.computeCentroids();this.computeFaceNormals()}};
 THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(b,a){for(var c=b.length,d=0;d<c;d++)this.addShape(b[d],a)};
 THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(b,a){for(var c=b.length,d=0;d<c;d++)this.addShape(b[d],a)};
 THREE.ExtrudeGeometry.prototype.addShape=function(b,a){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();
 THREE.ExtrudeGeometry.prototype.addShape=function(b,a){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);a=new THREE.Vector2(a,c)}else a=d.multiplyScalar(g).addSelf(h).subSelf(a).clone();return a}function e(c,d){var e,f;for(y=c.length;--y>=0;){e=y;f=y-1;f<0&&
 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);a=new THREE.Vector2(a,c)}else a=d.multiplyScalar(g).addSelf(h).subSelf(a).clone();return a}function e(c,d){var e,f;for(y=c.length;--y>=0;){e=y;f=y-1;f<0&&
-(f=c.length-1);for(var g=0,h=k+l*2,g=0;g<h;g++){var i=M*g,j=M*(g+1),m=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,q=h,r=e,s=f,m=m+E,i=i+E,n=n+E,j=j+E;B.faces.push(new THREE.Face4(m,i,n,j,null,null,t));m=v.generateSideWallUV(B,b,o,a,m,i,n,j,p,q,r,s);B.faceVertexUvs[0].push(m)}}}function f(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+E;d=d+E;e=e+E;B.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?v.generateBottomUV(B,b,a,c,d,e):v.generateTopUV(B,b,a,c,d,e);B.faceVertexUvs[0].push(c)}
-var h=a.amount!==void 0?a.amount:100,i=a.bevelThickness!==void 0?a.bevelThickness:6,j=a.bevelSize!==void 0?a.bevelSize:i-2,l=a.bevelSegments!==void 0?a.bevelSegments:3,n=a.bevelEnabled!==void 0?a.bevelEnabled:true,k=a.steps!==void 0?a.steps:1,m=a.bendPath,o=a.extrudePath,p,r=false,s=a.material,t=a.extrudeMaterial,v=a.UVGenerator!==void 0?a.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,q,x,z,A;if(o){p=o.getSpacedPoints(k);r=true;n=false;q=a.frames!==void 0?a.frames:new THREE.TubeGeometry.FrenetFrames(o,
-k,false);x=new THREE.Vector3;z=new THREE.Vector3;A=new THREE.Vector3}if(!n)j=i=l=0;var w,u,C,B=this,E=this.vertices.length;m&&b.addWrapPath(m);var o=b.extractPoints(),m=o.shape,G=o.holes;if(o=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();u=0;for(C=G.length;u<C;u++){w=G[u];THREE.Shape.Utils.isClockWise(w)&&(G[u]=w.reverse())}o=false}var L=THREE.Shape.Utils.triangulateShape(m,G),H=m;u=0;for(C=G.length;u<C;u++){w=G[u];m=m.concat(w)}var D,K,F,O,I,M=m.length,J,N=L.length,o=[],y=0;F=H.length;D=F-1;for(K=
-y+1;y<F;y++,D++,K++){D===F&&(D=0);K===F&&(K=0);o[y]=d(H[y],H[D],H[K])}var Q=[],P,R=o.concat();u=0;for(C=G.length;u<C;u++){w=G[u];P=[];y=0;F=w.length;D=F-1;for(K=y+1;y<F;y++,D++,K++){D===F&&(D=0);K===F&&(K=0);P[y]=d(w[y],w[D],w[K])}Q.push(P);R=R.concat(P)}for(D=0;D<l;D++){F=D/l;O=i*(1-F);K=j*Math.sin(F*Math.PI/2);y=0;for(F=H.length;y<F;y++){I=c(H[y],o[y],K);f(I.x,I.y,-O)}u=0;for(C=G.length;u<C;u++){w=G[u];P=Q[u];y=0;for(F=w.length;y<F;y++){I=c(w[y],P[y],K);f(I.x,I.y,-O)}}}K=j;for(y=0;y<M;y++){I=n?
-c(m[y],R[y],K):m[y];if(r){z.copy(q.normals[0]).multiplyScalar(I.x);x.copy(q.binormals[0]).multiplyScalar(I.y);A.copy(p[0]).addSelf(z).addSelf(x);f(A.x,A.y,A.z)}else f(I.x,I.y,0)}for(F=1;F<=k;F++)for(y=0;y<M;y++){I=n?c(m[y],R[y],K):m[y];if(r){z.copy(q.normals[F]).multiplyScalar(I.x);x.copy(q.binormals[F]).multiplyScalar(I.y);A.copy(p[F]).addSelf(z).addSelf(x);f(A.x,A.y,A.z)}else f(I.x,I.y,h/k*F)}for(D=l-1;D>=0;D--){F=D/l;O=i*(1-F);K=j*Math.sin(F*Math.PI/2);y=0;for(F=H.length;y<F;y++){I=c(H[y],o[y],
-K);f(I.x,I.y,h+O)}u=0;for(C=G.length;u<C;u++){w=G[u];P=Q[u];y=0;for(F=w.length;y<F;y++){I=c(w[y],P[y],K);r?f(I.x,I.y+p[k-1].y,p[k-1].x+O):f(I.x,I.y,h+O)}}}(function(){if(n){var a;a=M*0;for(y=0;y<N;y++){J=L[y];g(J[2]+a,J[1]+a,J[0]+a,true)}a=k+l*2;a=M*a;for(y=0;y<N;y++){J=L[y];g(J[0]+a,J[1]+a,J[2]+a,false)}}else{for(y=0;y<N;y++){J=L[y];g(J[2],J[1],J[0],true)}for(y=0;y<N;y++){J=L[y];g(J[0]+M*k,J[1]+M*k,J[2]+M*k,false)}}})();(function(){var a=0;e(H,a);a=a+H.length;u=0;for(C=G.length;u<C;u++){w=G[u];e(w,
-a);a=a+w.length}})()};
+(f=c.length-1);for(var g=0,h=n+l*2,g=0;g<h;g++){var i=M*g,j=M*(g+1),k=d+e+i,i=d+f+i,m=d+f+j,j=d+e+j,o=c,q=g,p=h,s=e,r=f,k=k+E,i=i+E,m=m+E,j=j+E;B.faces.push(new THREE.Face4(k,i,m,j,null,null,u));k=t.generateSideWallUV(B,b,o,a,k,i,m,j,q,p,s,r);B.faceVertexUvs[0].push(k)}}}function f(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+E;d=d+E;e=e+E;B.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?t.generateBottomUV(B,b,a,c,d,e):t.generateTopUV(B,b,a,c,d,e);B.faceVertexUvs[0].push(c)}
+var h=a.amount!==void 0?a.amount:100,i=a.bevelThickness!==void 0?a.bevelThickness:6,j=a.bevelSize!==void 0?a.bevelSize:i-2,l=a.bevelSegments!==void 0?a.bevelSegments:3,m=a.bevelEnabled!==void 0?a.bevelEnabled:true,n=a.steps!==void 0?a.steps:1,k=a.bendPath,o=a.extrudePath,q,p=false,s=a.material,u=a.extrudeMaterial,t=a.UVGenerator!==void 0?a.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,r,v,z,A;if(o){q=o.getSpacedPoints(n);p=true;m=false;r=a.frames!==void 0?a.frames:new THREE.TubeGeometry.FrenetFrames(o,
+n,false);v=new THREE.Vector3;z=new THREE.Vector3;A=new THREE.Vector3}if(!m)j=i=l=0;var x,w,C,B=this,E=this.vertices.length;k&&b.addWrapPath(k);var o=b.extractPoints(),k=o.shape,G=o.holes;if(o=!THREE.Shape.Utils.isClockWise(k)){k=k.reverse();w=0;for(C=G.length;w<C;w++){x=G[w];THREE.Shape.Utils.isClockWise(x)&&(G[w]=x.reverse())}o=false}var L=THREE.Shape.Utils.triangulateShape(k,G),H=k;w=0;for(C=G.length;w<C;w++){x=G[w];k=k.concat(x)}var D,K,F,O,I,M=k.length,J,N=L.length,o=[],y=0;F=H.length;D=F-1;for(K=
+y+1;y<F;y++,D++,K++){D===F&&(D=0);K===F&&(K=0);o[y]=d(H[y],H[D],H[K])}var Q=[],P,R=o.concat();w=0;for(C=G.length;w<C;w++){x=G[w];P=[];y=0;F=x.length;D=F-1;for(K=y+1;y<F;y++,D++,K++){D===F&&(D=0);K===F&&(K=0);P[y]=d(x[y],x[D],x[K])}Q.push(P);R=R.concat(P)}for(D=0;D<l;D++){F=D/l;O=i*(1-F);K=j*Math.sin(F*Math.PI/2);y=0;for(F=H.length;y<F;y++){I=c(H[y],o[y],K);f(I.x,I.y,-O)}w=0;for(C=G.length;w<C;w++){x=G[w];P=Q[w];y=0;for(F=x.length;y<F;y++){I=c(x[y],P[y],K);f(I.x,I.y,-O)}}}K=j;for(y=0;y<M;y++){I=m?
+c(k[y],R[y],K):k[y];if(p){z.copy(r.normals[0]).multiplyScalar(I.x);v.copy(r.binormals[0]).multiplyScalar(I.y);A.copy(q[0]).addSelf(z).addSelf(v);f(A.x,A.y,A.z)}else f(I.x,I.y,0)}for(F=1;F<=n;F++)for(y=0;y<M;y++){I=m?c(k[y],R[y],K):k[y];if(p){z.copy(r.normals[F]).multiplyScalar(I.x);v.copy(r.binormals[F]).multiplyScalar(I.y);A.copy(q[F]).addSelf(z).addSelf(v);f(A.x,A.y,A.z)}else f(I.x,I.y,h/n*F)}for(D=l-1;D>=0;D--){F=D/l;O=i*(1-F);K=j*Math.sin(F*Math.PI/2);y=0;for(F=H.length;y<F;y++){I=c(H[y],o[y],
+K);f(I.x,I.y,h+O)}w=0;for(C=G.length;w<C;w++){x=G[w];P=Q[w];y=0;for(F=x.length;y<F;y++){I=c(x[y],P[y],K);p?f(I.x,I.y+q[n-1].y,q[n-1].x+O):f(I.x,I.y,h+O)}}}(function(){if(m){var a;a=M*0;for(y=0;y<N;y++){J=L[y];g(J[2]+a,J[1]+a,J[0]+a,true)}a=n+l*2;a=M*a;for(y=0;y<N;y++){J=L[y];g(J[0]+a,J[1]+a,J[2]+a,false)}}else{for(y=0;y<N;y++){J=L[y];g(J[2],J[1],J[0],true)}for(y=0;y<N;y++){J=L[y];g(J[0]+M*n,J[1]+M*n,J[2]+M*n,false)}}})();(function(){var a=0;e(H,a);a=a+H.length;w=0;for(C=G.length;w<C;w++){x=G[w];e(x,
+a);a=a+x.length}})()};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(b,a,c,d,e,f){a=b.vertices[e].x;e=b.vertices[e].y;c=b.vertices[f].x;f=b.vertices[f].y;return[new THREE.UV(b.vertices[d].x,1-b.vertices[d].y),new THREE.UV(a,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(b,a,c,d,e,f){return this.generateTopUV(b,a,c,d,e,f)},generateSideWallUV:function(b,a,c,d,e,f,g,h){var a=b.vertices[e].x,c=b.vertices[e].y,e=b.vertices[e].z,d=b.vertices[f].x,i=b.vertices[f].y,f=b.vertices[f].z,j=b.vertices[g].x,l=
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(b,a,c,d,e,f){a=b.vertices[e].x;e=b.vertices[e].y;c=b.vertices[f].x;f=b.vertices[f].y;return[new THREE.UV(b.vertices[d].x,1-b.vertices[d].y),new THREE.UV(a,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(b,a,c,d,e,f){return this.generateTopUV(b,a,c,d,e,f)},generateSideWallUV:function(b,a,c,d,e,f,g,h){var a=b.vertices[e].x,c=b.vertices[e].y,e=b.vertices[e].z,d=b.vertices[f].x,i=b.vertices[f].y,f=b.vertices[f].z,j=b.vertices[g].x,l=
-b.vertices[g].y,g=b.vertices[g].z,n=b.vertices[h].x,k=b.vertices[h].y,b=b.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(a,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(n,b)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(k,b)]}};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;
+b.vertices[g].y,g=b.vertices[g].z,m=b.vertices[h].x,n=b.vertices[h].y,b=b.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(a,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(m,b)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(n,b)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.LatheGeometry=function(b,a,c){THREE.Geometry.call(this);for(var a=a||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/a),f=0;f<b.length;f++){d[f]=b[f].clone();this.vertices.push(d[f])}for(var g=a+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<a;c++){d=0;for(e=b.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/a,d/e),new THREE.UV(1-
 THREE.LatheGeometry=function(b,a,c){THREE.Geometry.call(this);for(var a=a||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/a),f=0;f<b.length;f++){d[f]=b[f].clone();this.vertices.push(d[f])}for(var g=a+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<a;c++){d=0;for(e=b.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/a,d/e),new THREE.UV(1-
 (c+1)/a,d/e),new THREE.UV(1-(c+1)/a,(d+1)/e),new THREE.UV(1-c/a,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);
 (c+1)/a,d/e),new THREE.UV(1-(c+1)/a,(d+1)/e),new THREE.UV(1-c/a,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.PlaneGeometry=function(b,a,c,d){THREE.Geometry.call(this);for(var e=b/2,f=a/2,c=c||1,d=d||1,g=c+1,h=d+1,i=b/c,j=a/d,l=new THREE.Vector3(0,1,0),b=0;b<h;b++)for(a=0;a<g;a++)this.vertices.push(new THREE.Vector3(a*i-e,0,b*j-f));for(b=0;b<d;b++)for(a=0;a<c;a++){e=new THREE.Face4(a+g*b,a+g*(b+1),a+1+g*(b+1),a+1+g*b);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(a/c,1-b/d),new THREE.UV(a/c,1-(b+1)/d),new THREE.UV((a+
 THREE.PlaneGeometry=function(b,a,c,d){THREE.Geometry.call(this);for(var e=b/2,f=a/2,c=c||1,d=d||1,g=c+1,h=d+1,i=b/c,j=a/d,l=new THREE.Vector3(0,1,0),b=0;b<h;b++)for(a=0;a<g;a++)this.vertices.push(new THREE.Vector3(a*i-e,0,b*j-f));for(b=0;b<d;b++)for(a=0;a<c;a++){e=new THREE.Face4(a+g*b,a+g*(b+1),a+1+g*(b+1),a+1+g*b);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(a/c,1-b/d),new THREE.UV(a/c,1-(b+1)/d),new THREE.UV((a+
 1)/c,1-(b+1)/d),new THREE.UV((a+1)/c,1-b/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
 1)/c,1-(b+1)/d),new THREE.UV((a+1)/c,1-b/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.SphereGeometry=function(b,a,c,d,e,f,g){THREE.Geometry.call(this);var b=b||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,a=Math.max(3,Math.floor(a)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],l=[];for(i=0;i<=c;i++){var n=[],k=[];for(h=0;h<=a;h++){var m=h/a,o=i/c,p=new THREE.Vector3;p.x=-b*Math.cos(d+m*e)*Math.sin(f+o*g);p.y=b*Math.cos(f+o*g);p.z=b*Math.sin(d+m*e)*Math.sin(f+o*g);this.vertices.push(p);n.push(this.vertices.length-1);k.push(new THREE.UV(m,
-1-o))}j.push(n);l.push(k)}for(i=0;i<c;i++)for(h=0;h<a;h++){var d=j[i][h+1],e=j[i][h],f=j[i+1][h],g=j[i+1][h+1],n=this.vertices[d].clone().normalize(),k=this.vertices[e].clone().normalize(),m=this.vertices[f].clone().normalize(),o=this.vertices[g].clone().normalize(),p=l[i][h+1].clone(),r=l[i][h].clone(),s=l[i+1][h].clone(),t=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==b){this.faces.push(new THREE.Face3(d,f,g,[n,m,o]));this.faceVertexUvs[0].push([p,s,t])}else if(Math.abs(this.vertices[f].y)==
-b){this.faces.push(new THREE.Face3(d,e,f,[n,k,m]));this.faceVertexUvs[0].push([p,r,s])}else{this.faces.push(new THREE.Face4(d,e,f,g,[n,k,m,o]));this.faceVertexUvs[0].push([p,r,s,t])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.SphereGeometry=function(b,a,c,d,e,f,g){THREE.Geometry.call(this);var b=b||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,a=Math.max(3,Math.floor(a)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],l=[];for(i=0;i<=c;i++){var m=[],n=[];for(h=0;h<=a;h++){var k=h/a,o=i/c,q=new THREE.Vector3;q.x=-b*Math.cos(d+k*e)*Math.sin(f+o*g);q.y=b*Math.cos(f+o*g);q.z=b*Math.sin(d+k*e)*Math.sin(f+o*g);this.vertices.push(q);m.push(this.vertices.length-1);n.push(new THREE.UV(k,
+1-o))}j.push(m);l.push(n)}for(i=0;i<c;i++)for(h=0;h<a;h++){var d=j[i][h+1],e=j[i][h],f=j[i+1][h],g=j[i+1][h+1],m=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),k=this.vertices[f].clone().normalize(),o=this.vertices[g].clone().normalize(),q=l[i][h+1].clone(),p=l[i][h].clone(),s=l[i+1][h].clone(),u=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==b){this.faces.push(new THREE.Face3(d,f,g,[m,k,o]));this.faceVertexUvs[0].push([q,s,u])}else if(Math.abs(this.vertices[f].y)==
+b){this.faces.push(new THREE.Face3(d,e,f,[m,n,k]));this.faceVertexUvs[0].push([q,p,s])}else{this.faces.push(new THREE.Face4(d,e,f,g,[m,n,k,o]));this.faceVertexUvs[0].push([q,p,s,u])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.TextGeometry=function(b,a){var c=THREE.FontUtils.generateShapes(b,a);a.amount=a.height!==void 0?a.height:50;if(a.bevelThickness===void 0)a.bevelThickness=10;if(a.bevelSize===void 0)a.bevelSize=8;if(a.bevelEnabled===void 0)a.bevelEnabled=false;if(a.bend){var d=c[c.length-1].getBoundingBox().maxX;a.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,a)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);
 THREE.TextGeometry=function(b,a){var c=THREE.FontUtils.generateShapes(b,a);a.amount=a.height!==void 0?a.height:50;if(a.bevelThickness===void 0)a.bevelThickness=10;if(a.bevelSize===void 0)a.bevelSize=8;if(a.bevelEnabled===void 0)a.bevelEnabled=false;if(a.bend){var d=c[c.length-1].getBoundingBox().maxX;a.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,a)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);
 THREE.TorusGeometry=function(b,a,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=a||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;b=[];a=[];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=
 THREE.TorusGeometry=function(b,a,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=a||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;b=[];a=[];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);b.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));a.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,[a[e],a[f],a[g],a[h]]);i.normal.addSelf(a[e]);i.normal.addSelf(a[f]);i.normal.addSelf(a[g]);i.normal.addSelf(a[h]);i.normal.normalize();this.faces.push(i);
 this.tube*Math.sin(g);this.vertices.push(h);b.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));a.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,[a[e],a[f],a[g],a[h]]);i.normal.addSelf(a[e]);i.normal.addSelf(a[f]);i.normal.addSelf(a[g]);i.normal.addSelf(a[h]);i.normal.normalize();this.faces.push(i);
@@ -222,20 +222,20 @@ THREE.TorusKnotGeometry=function(b,a,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Ma
 Array(this.segmentsT);for(a=0;a<this.segmentsT;++a){var i=b/this.segmentsR*2*this.p*Math.PI,g=a/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[b][a]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}}for(b=0;b<
 Array(this.segmentsT);for(a=0;a<this.segmentsT;++a){var i=b/this.segmentsR*2*this.p*Math.PI,g=a/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[b][a]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}}for(b=0;b<
 this.segmentsR;++b)for(a=0;a<this.segmentsT;++a){var e=(b+1)%this.segmentsR,f=(a+1)%this.segmentsT,c=this.grid[b][a],d=this.grid[e][a],e=this.grid[e][f],f=this.grid[b][f],g=new THREE.UV(b/this.segmentsR,a/this.segmentsT),i=new THREE.UV((b+1)/this.segmentsR,a/this.segmentsT),j=new THREE.UV((b+1)/this.segmentsR,(a+1)/this.segmentsT),l=new THREE.UV(b/this.segmentsR,(a+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,j,l])}this.computeCentroids();this.computeFaceNormals();
 this.segmentsR;++b)for(a=0;a<this.segmentsT;++a){var e=(b+1)%this.segmentsR,f=(a+1)%this.segmentsT,c=this.grid[b][a],d=this.grid[e][a],e=this.grid[e][f],f=this.grid[b][f],g=new THREE.UV(b/this.segmentsR,a/this.segmentsT),i=new THREE.UV((b+1)/this.segmentsR,a/this.segmentsT),j=new THREE.UV((b+1)/this.segmentsR,(a+1)/this.segmentsT),l=new THREE.UV(b/this.segmentsR,(a+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,j,l])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.TubeGeometry=function(b,a,c,d,e,f){THREE.Geometry.call(this);this.path=b;this.segments=a||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,l,n=new THREE.Vector3,k,m,o,a=new THREE.TubeGeometry.FrenetFrames(b,a,e);k=a.tangents;m=a.normals;o=a.binormals;this.tangents=k;this.normals=m;this.binormals=o;for(a=0;a<f;a++){this.grid[a]=[];d=a/(f-1);l=b.getPointAt(d);d=k[a];g=m[a];h=o[a];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
-l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);n.copy(l);n.x=n.x+(j*g.x+i*h.x);n.y=n.y+(j*g.y+i*h.y);n.z=n.z+(j*g.z+i*h.z);this.grid[a][d]=this.vertices.push(new THREE.Vector3(n.x,n.y,n.z))-1}}for(a=0;a<this.segments;a++)for(d=0;d<this.segmentsRadius;d++){f=e?(a+1)%this.segments:a+1;n=(d+1)%this.segmentsRadius;
-b=this.grid[a][d];c=this.grid[f][d];f=this.grid[f][n];n=this.grid[a][n];k=new THREE.UV(a/this.segments,d/this.segmentsRadius);m=new THREE.UV((a+1)/this.segments,d/this.segmentsRadius);o=new THREE.UV((a+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(a/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(b,c,f,n));this.faceVertexUvs[0].push([k,m,o,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.TubeGeometry.FrenetFrames=function(b,a,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,a=a+1,j,l,n;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<a;j++){l=j/(a-1);e[j]=b.getTangentAt(l);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;b=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);n=Math.abs(e[0].z);if(j<=b){b=j;d.set(1,0,0)}if(l<=b){b=l;d.set(0,1,0)}n<=b&&d.set(0,0,1);h.cross(e[0],d).normalize();
+THREE.TubeGeometry=function(b,a,c,d,e,f){THREE.Geometry.call(this);this.path=b;this.segments=a||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,l,m=new THREE.Vector3,n,k,o,a=new THREE.TubeGeometry.FrenetFrames(b,a,e);n=a.tangents;k=a.normals;o=a.binormals;this.tangents=n;this.normals=k;this.binormals=o;for(a=0;a<f;a++){this.grid[a]=[];d=a/(f-1);l=b.getPointAt(d);d=n[a];g=k[a];h=o[a];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);m.copy(l);m.x=m.x+(j*g.x+i*h.x);m.y=m.y+(j*g.y+i*h.y);m.z=m.z+(j*g.z+i*h.z);this.grid[a][d]=this.vertices.push(new THREE.Vector3(m.x,m.y,m.z))-1}}for(a=0;a<this.segments;a++)for(d=0;d<this.segmentsRadius;d++){f=e?(a+1)%this.segments:a+1;m=(d+1)%this.segmentsRadius;
+b=this.grid[a][d];c=this.grid[f][d];f=this.grid[f][m];m=this.grid[a][m];n=new THREE.UV(a/this.segments,d/this.segmentsRadius);k=new THREE.UV((a+1)/this.segments,d/this.segmentsRadius);o=new THREE.UV((a+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(a/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(b,c,f,m));this.faceVertexUvs[0].push([n,k,o,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.TubeGeometry.FrenetFrames=function(b,a,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,a=a+1,j,l,m;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<a;j++){l=j/(a-1);e[j]=b.getTangentAt(l);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;b=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);m=Math.abs(e[0].z);if(j<=b){b=j;d.set(1,0,0)}if(l<=b){b=l;d.set(0,1,0)}m<=b&&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<a;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[a-1]));d=d/(a-1);e[0].dot(h.cross(f[0],f[a-1]))>0&&(d=-d);for(j=1;j<a;j++){i.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
 f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(j=1;j<a;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[a-1]));d=d/(a-1);e[0].dot(h.cross(f[0],f[a-1]))>0&&(d=-d);for(j=1;j<a;j++){i.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
 THREE.PolyhedronGeometry=function(b,a,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
 THREE.PolyhedronGeometry=function(b,a,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
-i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){n[a.index]||(n[a.index]=[]);n[b.index]||(n[b.index]=[]);var c=n[a.index][b.index];c===void 0&&(n[a.index][b.index]=n[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
-for(var c=c||1,d=d||0,i=this,j=0,l=b.length;j<l;j++)e(new THREE.Vector3(b[j][0],b[j][1],b[j][2]));for(var n=[],b=this.vertices,j=0,l=a.length;j<l;j++)f(b[a[j][0]],b[a[j][1]],b[a[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
+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){m[a.index]||(m[a.index]=[]);m[b.index]||(m[b.index]=[]);var c=m[a.index][b.index];c===void 0&&(m[a.index][b.index]=m[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,l=b.length;j<l;j++)e(new THREE.Vector3(b[j][0],b[j][1],b[j][2]));for(var m=[],b=this.vertices,j=0,l=a.length;j<l;j++)f(b[a[j][0]],b[a[j][1]],b[a[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.IcosahedronGeometry=function(b,a){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]],b,a)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.IcosahedronGeometry=function(b,a){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]],b,a)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.OctahedronGeometry=function(b,a){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]],b,a)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(b,a){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]],b,a)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.OctahedronGeometry=function(b,a){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]],b,a)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(b,a){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]],b,a)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.ParametricGeometry=function(b,a,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,l,n=a+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=a;i++){j=i/a;j=b(j,l);e.push(j)}}var k,m,o,p;for(h=0;h<c;h++)for(i=0;i<a;i++){b=h*n+i;e=h*n+i+1;l=(h+1)*n+i;j=(h+1)*n+i+1;k=new THREE.UV(i/a,h/c);m=new THREE.UV((i+1)/a,h/c);o=new THREE.UV(i/a,(h+1)/c);p=new THREE.UV((i+1)/a,(h+1)/c);if(d){f.push(new THREE.Face3(b,e,l));f.push(new THREE.Face3(e,j,l));g.push([k,
-m,o]);g.push([m,p,o])}else{f.push(new THREE.Face4(b,e,j,l));g.push([k,m,p,o])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.ConvexGeometry=function(b){function a(a){var d=b[a].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=b[h[0]],s;s=j;var t=b[h[1]],v=b[h[2]],q=new THREE.Vector3,x=new THREE.Vector3;q.sub(v,t);x.sub(s,t);q.crossSelf(x);q.isZero()||q.normalize();s=q;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(t=0;t<f.length;t++)if(f[t][0]===j[1]&&f[t][1]===j[0]){f[t]=f[f.length-1];f.pop();s=false;break}s&&f.push(j)}e[g]=
-e[e.length-1];e.pop()}else g++}for(t=0;t<f.length;t++)e.push([f[t][0],f[t][1],a])}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<b.length;f++)a(f);for(var g=0,h=Array(b.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(b[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]));
+THREE.ParametricGeometry=function(b,a,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,l,m=a+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=a;i++){j=i/a;j=b(j,l);e.push(j)}}var n,k,o,q;for(h=0;h<c;h++)for(i=0;i<a;i++){b=h*m+i;e=h*m+i+1;l=(h+1)*m+i;j=(h+1)*m+i+1;n=new THREE.UV(i/a,h/c);k=new THREE.UV((i+1)/a,h/c);o=new THREE.UV(i/a,(h+1)/c);q=new THREE.UV((i+1)/a,(h+1)/c);if(d){f.push(new THREE.Face3(b,e,l));f.push(new THREE.Face3(e,j,l));g.push([n,
+k,o]);g.push([k,q,o])}else{f.push(new THREE.Face4(b,e,j,l));g.push([n,k,q,o])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.ConvexGeometry=function(b){function a(a){var d=b[a].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=b[h[0]],s;s=j;var u=b[h[1]],t=b[h[2]],r=new THREE.Vector3,v=new THREE.Vector3;r.sub(t,u);v.sub(s,u);r.crossSelf(v);r.isZero()||r.normalize();s=r;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(u=0;u<f.length;u++)if(f[u][0]===j[1]&&f[u][1]===j[0]){f[u]=f[f.length-1];f.pop();s=false;break}s&&f.push(j)}e[g]=
+e[e.length-1];e.pop()}else g++}for(u=0;u<f.length;u++)e.push([f[u][0],f[u][1],a])}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<b.length;f++)a(f);for(var g=0,h=Array(b.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(b[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);
 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);
 THREE.AxisHelper=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3);b.vertices.push(new THREE.Vector3(0,100,0));var a=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(a,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 THREE.AxisHelper=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3);b.vertices.push(new THREE.Vector3(0,100,0));var a=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(a,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(a,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(a,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);
 c=new THREE.Mesh(a,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(a,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);
@@ -248,15 +248,15 @@ this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);
 THREE.CameraHelper.prototype.update=function(){function b(b,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);b=a.pointMap[b];if(b!==void 0){d=0;for(e=b.length;d<e;d++)a.lineGeometry.vertices[b[d]].copy(THREE.CameraHelper.__v)}}var a=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
 THREE.CameraHelper.prototype.update=function(){function b(b,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);b=a.pointMap[b];if(b!==void 0){d=0;for(e=b.length;d<e;d++)a.lineGeometry.vertices[b[d]].copy(THREE.CameraHelper.__v)}}var a=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
 1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.modify=function(b){for(var a=this.subdivisions;a-- >0;)this.smooth(b)};
 THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.modify=function(b){for(var a=this.subdivisions;a-- >0;)this.smooth(b)};
-THREE.SubdivisionModifier.prototype.smooth=function(b){function a(){k.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(b,c,d,e,g,h,i){var j=new THREE.Face4(b,c,d,e,null,g.color,g.materialIndex);if(k.useOldVertexColors){j.vertexColors=[];for(var m,o,p,q=0;q<4;q++){p=h[q];m=new THREE.Color;m.setRGB(0,0,0);for(var r=0;r<p.length;r++){o=g.vertexColors[p[r]-1];m.r=m.r+o.r;m.g=m.g+o.g;m.b=m.b+o.b}m.r=m.r/p.length;m.g=m.g/p.length;m.b=m.b/
-p.length;j.vertexColors[q]=m}}l.push(j);if(k.supportUVs){g=[f(b,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?n.push(g):a("d :( ",e+":"+i):a("c :( ",d+":"+i):a("b :( ",c+":"+i):a("a :( ",b+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(b,d){var e=b+":"+d,f=t[e];if(!f){b>=v&&b<v+o.length?a("face pt"):a("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
-b){G[a]===void 0&&(G[a]=[]);G[a].push(b)}function i(a,b,c){L[a]===void 0&&(L[a]={});L[a][b]=c}var j=[],l=[],n=[],k=this,m=b.vertices,o=b.faces,j=m.concat(),p=[],r={},s={},t={},v=m.length,q,x,z,A,w,u=b.faceVertexUvs[0],C;a("originalFaces, uvs, originalVerticesLength",o.length,u.length,v);if(k.supportUVs){q=0;for(x=u.length;q<x;q++){z=0;for(A=u[q].length;z<A;z++){C=o[q]["abcd".charAt(z)];g(C,q,u[q][z])}}}if(u.length==0)k.supportUVs=false;q=0;for(w in t)q++;if(!q){k.supportUVs=false;a("no uvs")}a("-- Original Faces + Vertices UVs completed",
-t,"vs",u.length);q=0;for(x=o.length;q<x;q++){w=o[q];p.push(w.centroid);j.push(w.centroid);if(k.supportUVs){u=new THREE.UV;if(w instanceof THREE.Face3){u.u=f(w.a,q).u+f(w.b,q).u+f(w.c,q).u;u.v=f(w.a,q).v+f(w.b,q).v+f(w.c,q).v;u.u=u.u/3;u.v=u.v/3}else if(w instanceof THREE.Face4){u.u=f(w.a,q).u+f(w.b,q).u+f(w.c,q).u+f(w.d,q).u;u.v=f(w.a,q).v+f(w.b,q).v+f(w.c,q).v+f(w.d,q).v;u.u=u.u/4;u.v=u.v/4}g(v+q,"",u)}}a("-- added UVs for new Faces",t);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
-var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(b);C=0;var B,E,G={},L={};for(q in x){u=x[q];B=q.split("_");E=B[0];B=B[1];h(E,[E,B]);h(B,[E,B]);z=0;for(A=u.length;z<A;z++){w=u[z];i(E,w,q);i(B,w,q)}u.length<2&&(s[q]=true)}a("vertexEdgeMap",G,"vertexFaceMap",L);for(q in x){u=
-x[q];w=u[0];A=u[1];B=q.split("_");E=B[0];B=B[1];u=new THREE.Vector3;if(s[q]){u.addSelf(m[E]);u.addSelf(m[B]);u.multiplyScalar(0.5)}else{u.addSelf(p[w]);u.addSelf(p[A]);u.addSelf(m[E]);u.addSelf(m[B]);u.multiplyScalar(0.25)}r[q]=v+o.length+C;j.push(u);C++;if(k.supportUVs){u=new THREE.UV;u.u=f(E,w).u+f(B,w).u;u.v=f(E,w).v+f(B,w).v;u.u=u.u/2;u.v=u.v/2;g(r[q],w,u);if(!s[q]){u=new THREE.UV;u.u=f(E,A).u+f(B,A).u;u.v=f(E,A).v+f(B,A).v;u.u=u.u/2;u.v=u.v/2;g(r[q],A,u)}}}a("-- Step 2 done");var H,D;A=["123",
-"12","2","23"];B=["123","23","3","31"];var K=["123","31","1","12"],F=["1234","12","2","23"],O=["1234","23","3","34"],I=["1234","34","4","41"],M=["1234","41","1","12"];q=0;for(x=p.length;q<x;q++){w=o[q];u=v+q;if(w instanceof THREE.Face3){C=e(w.a,w.b);E=e(w.b,w.c);H=e(w.c,w.a);d(u,r[C],w.b,r[E],w,A,q);d(u,r[E],w.c,r[H],w,B,q);d(u,r[H],w.a,r[C],w,K,q)}else if(w instanceof THREE.Face4){C=e(w.a,w.b);E=e(w.b,w.c);H=e(w.c,w.d);D=e(w.d,w.a);d(u,r[C],w.b,r[E],w,F,q);d(u,r[E],w.c,r[H],w,O,q);d(u,r[H],w.d,r[D],
-w,I,q);d(u,r[D],w.a,r[C],w,M,q)}else a("face should be a face!",w)}r=new THREE.Vector3;w=new THREE.Vector3;q=0;for(x=m.length;q<x;q++)if(G[q]!==void 0){r.set(0,0,0);w.set(0,0,0);E=new THREE.Vector3(0,0,0);u=0;for(z in L[q]){r.addSelf(p[z]);u++}A=0;C=G[q].length;for(z=0;z<C;z++)s[e(G[q][z][0],G[q][z][1])]&&A++;if(A!=2){r.divideScalar(u);for(z=0;z<C;z++){u=G[q][z];u=m[u[0]].clone().addSelf(m[u[1]]).divideScalar(2);w.addSelf(u)}w.divideScalar(C);E.addSelf(m[q]);E.multiplyScalar(C-3);E.addSelf(r);E.addSelf(w.multiplyScalar(2));
-E.divideScalar(C);j[q]=E}}b.vertices=j;b.faces=l;b.faceVertexUvs[0]=n;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
+THREE.SubdivisionModifier.prototype.smooth=function(b){function a(){n.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(b,c,d,e,g,h,i){var j=new THREE.Face4(b,c,d,e,null,g.color,g.materialIndex);if(n.useOldVertexColors){j.vertexColors=[];for(var k,o,p,q=0;q<4;q++){p=h[q];k=new THREE.Color;k.setRGB(0,0,0);for(var r=0;r<p.length;r++){o=g.vertexColors[p[r]-1];k.r=k.r+o.r;k.g=k.g+o.g;k.b=k.b+o.b}k.r=k.r/p.length;k.g=k.g/p.length;k.b=k.b/
+p.length;j.vertexColors[q]=k}}l.push(j);if(n.supportUVs){g=[f(b,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?m.push(g):a("d :( ",e+":"+i):a("c :( ",d+":"+i):a("b :( ",c+":"+i):a("a :( ",b+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(b,d){var e=b+":"+d,f=u[e];if(!f){b>=t&&b<t+o.length?a("face pt"):a("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in u?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,u[e]):u[e]=d}function h(a,
+b){G[a]===void 0&&(G[a]=[]);G[a].push(b)}function i(a,b,c){L[a]===void 0&&(L[a]={});L[a][b]=c}var j=[],l=[],m=[],n=this,k=b.vertices,o=b.faces,j=k.concat(),q=[],p={},s={},u={},t=k.length,r,v,z,A,x,w=b.faceVertexUvs[0],C;a("originalFaces, uvs, originalVerticesLength",o.length,w.length,t);if(n.supportUVs){r=0;for(v=w.length;r<v;r++){z=0;for(A=w[r].length;z<A;z++){C=o[r]["abcd".charAt(z)];g(C,r,w[r][z])}}}if(w.length==0)n.supportUVs=false;r=0;for(x in u)r++;if(!r){n.supportUVs=false;a("no uvs")}a("-- Original Faces + Vertices UVs completed",
+u,"vs",w.length);r=0;for(v=o.length;r<v;r++){x=o[r];q.push(x.centroid);j.push(x.centroid);if(n.supportUVs){w=new THREE.UV;if(x instanceof THREE.Face3){w.u=f(x.a,r).u+f(x.b,r).u+f(x.c,r).u;w.v=f(x.a,r).v+f(x.b,r).v+f(x.c,r).v;w.u=w.u/3;w.v=w.v/3}else if(x instanceof THREE.Face4){w.u=f(x.a,r).u+f(x.b,r).u+f(x.c,r).u+f(x.d,r).u;w.v=f(x.a,r).v+f(x.b,r).v+f(x.c,r).v+f(x.d,r).v;w.u=w.u/4;w.v=w.v/4}g(t+r,"",w)}}a("-- added UVs for new Faces",u);v=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}(b);C=0;var B,E,G={},L={};for(r in v){w=v[r];B=r.split("_");E=B[0];B=B[1];h(E,[E,B]);h(B,[E,B]);z=0;for(A=w.length;z<A;z++){x=w[z];i(E,x,r);i(B,x,r)}w.length<2&&(s[r]=true)}a("vertexEdgeMap",G,"vertexFaceMap",L);for(r in v){w=
+v[r];x=w[0];A=w[1];B=r.split("_");E=B[0];B=B[1];w=new THREE.Vector3;if(s[r]){w.addSelf(k[E]);w.addSelf(k[B]);w.multiplyScalar(0.5)}else{w.addSelf(q[x]);w.addSelf(q[A]);w.addSelf(k[E]);w.addSelf(k[B]);w.multiplyScalar(0.25)}p[r]=t+o.length+C;j.push(w);C++;if(n.supportUVs){w=new THREE.UV;w.u=f(E,x).u+f(B,x).u;w.v=f(E,x).v+f(B,x).v;w.u=w.u/2;w.v=w.v/2;g(p[r],x,w);if(!s[r]){w=new THREE.UV;w.u=f(E,A).u+f(B,A).u;w.v=f(E,A).v+f(B,A).v;w.u=w.u/2;w.v=w.v/2;g(p[r],A,w)}}}a("-- Step 2 done");var H,D;A=["123",
+"12","2","23"];B=["123","23","3","31"];var K=["123","31","1","12"],F=["1234","12","2","23"],O=["1234","23","3","34"],I=["1234","34","4","41"],M=["1234","41","1","12"];r=0;for(v=q.length;r<v;r++){x=o[r];w=t+r;if(x instanceof THREE.Face3){C=e(x.a,x.b);E=e(x.b,x.c);H=e(x.c,x.a);d(w,p[C],x.b,p[E],x,A,r);d(w,p[E],x.c,p[H],x,B,r);d(w,p[H],x.a,p[C],x,K,r)}else if(x instanceof THREE.Face4){C=e(x.a,x.b);E=e(x.b,x.c);H=e(x.c,x.d);D=e(x.d,x.a);d(w,p[C],x.b,p[E],x,F,r);d(w,p[E],x.c,p[H],x,O,r);d(w,p[H],x.d,p[D],
+x,I,r);d(w,p[D],x.a,p[C],x,M,r)}else a("face should be a face!",x)}p=new THREE.Vector3;x=new THREE.Vector3;r=0;for(v=k.length;r<v;r++)if(G[r]!==void 0){p.set(0,0,0);x.set(0,0,0);E=new THREE.Vector3(0,0,0);w=0;for(z in L[r]){p.addSelf(q[z]);w++}A=0;C=G[r].length;for(z=0;z<C;z++)s[e(G[r][z][0],G[r][z][1])]&&A++;if(A!=2){p.divideScalar(w);for(z=0;z<C;z++){w=G[r][z];w=k[w[0]].clone().addSelf(k[w[1]]).divideScalar(2);x.addSelf(w)}x.divideScalar(C);E.addSelf(k[r]);E.multiplyScalar(C-3);E.addSelf(p);E.addSelf(x.multiplyScalar(2));
+E.divideScalar(C);j[r]=E}}b.vertices=j;b.faces=l;b.faceVertexUvs[0]=m;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare=function(b,a,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;b!==void 0&&this.add(b,a,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare=function(b,a,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;b!==void 0&&this.add(b,a,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare.prototype.add=function(b,a,c,d,e,f){a===void 0&&(a=-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:b,size:a,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.add=function(b,a,c,d,e,f){a===void 0&&(a=-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:b,size:a,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var b,a=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(b=0;b<a;b++){c=this.lensFlares[b];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.LensFlare.prototype.updateLensFlares=function(){var b,a=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(b=0;b<a;b++){c=this.lensFlares[b];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}};
@@ -268,37 +268,38 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(b,a){var c=this.ani
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(b){var a=-1;if(b=this.animationsMap[b])a=b.duration;return a};THREE.MorphBlendMesh.prototype.playAnimation=function(b){var a=this.animationsMap[b];if(a){a.time=0;a.active=true}else console.warn("animation["+b+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(b){if(b=this.animationsMap[b])b.active=false};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(b){var a=-1;if(b=this.animationsMap[b])a=b.duration;return a};THREE.MorphBlendMesh.prototype.playAnimation=function(b){var a=this.animationsMap[b];if(a){a.time=0;a.active=true}else console.warn("animation["+b+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(b){if(b=this.animationsMap[b])b.active=false};
 THREE.MorphBlendMesh.prototype.update=function(b){for(var a=0,c=this.animationsList.length;a<c;a++){var d=this.animationsList[a];if(d.active){var e=d.duration/d.length;d.time=d.time+d.direction*b;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/
 THREE.MorphBlendMesh.prototype.update=function(b){for(var a=0,c=this.animationsList.length;a<c;a++){var d=this.animationsList[a];if(d.active){var e=d.duration/d.length;d.time=d.time+d.direction*b;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}}};
 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 b(b){var c=a.createProgram(),d=a.createShader(a.FRAGMENT_SHADER),e=a.createShader(a.VERTEX_SHADER);a.shaderSource(d,b.fragmentShader);a.shaderSource(e,b.vertexShader);a.compileShader(d);a.compileShader(e);a.attachShader(c,d);a.attachShader(c,e);a.linkProgram(c);return c}var a,c,d,e,f,g,h,i,j,l,n,k,m;this.init=function(o){a=o.context;c=o;d=new Float32Array(16);e=new Uint16Array(6);o=0;d[o++]=-1;d[o++]=-1;d[o++]=0;d[o++]=0;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=
+THREE.LensFlarePlugin=function(){function b(b){var c=a.createProgram(),d=a.createShader(a.FRAGMENT_SHADER),e=a.createShader(a.VERTEX_SHADER);a.shaderSource(d,b.fragmentShader);a.shaderSource(e,b.vertexShader);a.compileShader(d);a.compileShader(e);a.attachShader(c,d);a.attachShader(c,e);a.linkProgram(c);return c}var a,c,d,e,f,g,h,i,j,l,m,n,k;this.init=function(o){a=o.context;c=o;d=new Float32Array(16);e=new Uint16Array(6);o=0;d[o++]=-1;d[o++]=-1;d[o++]=0;d[o++]=0;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=
 0;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=0;d[o++]=1;o=0;e[o++]=0;e[o++]=1;e[o++]=2;e[o++]=0;e[o++]=2;e[o++]=3;f=a.createBuffer();g=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,f);a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,g);a.bufferData(a.ELEMENT_ARRAY_BUFFER,e,a.STATIC_DRAW);h=a.createTexture();i=a.createTexture();a.bindTexture(a.TEXTURE_2D,h);a.texImage2D(a.TEXTURE_2D,0,a.RGB,16,16,0,a.RGB,a.UNSIGNED_BYTE,null);a.texParameteri(a.TEXTURE_2D,
 0;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=0;d[o++]=1;o=0;e[o++]=0;e[o++]=1;e[o++]=2;e[o++]=0;e[o++]=2;e[o++]=3;f=a.createBuffer();g=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,f);a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,g);a.bufferData(a.ELEMENT_ARRAY_BUFFER,e,a.STATIC_DRAW);h=a.createTexture();i=a.createTexture();a.bindTexture(a.TEXTURE_2D,h);a.texImage2D(a.TEXTURE_2D,0,a.RGB,16,16,0,a.RGB,a.UNSIGNED_BYTE,null);a.texParameteri(a.TEXTURE_2D,
 a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.bindTexture(a.TEXTURE_2D,i);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,16,16,0,a.RGBA,a.UNSIGNED_BYTE,null);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST);
 a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.bindTexture(a.TEXTURE_2D,i);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,16,16,0,a.RGBA,a.UNSIGNED_BYTE,null);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST);
-a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);if(a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;l=b(THREE.ShaderFlares.lensFlare)}else{j=true;l=b(THREE.ShaderFlares.lensFlareVertexTexture)}n={};k={};n.vertex=a.getAttribLocation(l,"position");n.uv=a.getAttribLocation(l,"uv");k.renderType=a.getUniformLocation(l,"renderType");k.map=a.getUniformLocation(l,"map");k.occlusionMap=a.getUniformLocation(l,"occlusionMap");k.opacity=a.getUniformLocation(l,"opacity");k.color=a.getUniformLocation(l,
-"color");k.scale=a.getUniformLocation(l,"scale");k.rotation=a.getUniformLocation(l,"rotation");k.screenPosition=a.getUniformLocation(l,"screenPosition");m=false};this.render=function(b,d,e,s){var b=b.__webglFlares,t=b.length;if(t){var v=new THREE.Vector3,q=s/e,x=e*0.5,z=s*0.5,A=16/s,w=new THREE.Vector2(A*q,A),u=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),B=k,A=n;a.useProgram(l);if(!m){a.enableVertexAttribArray(n.vertex);a.enableVertexAttribArray(n.uv);m=true}a.uniform1i(B.occlusionMap,0);a.uniform1i(B.map,
-1);a.bindBuffer(a.ARRAY_BUFFER,f);a.vertexAttribPointer(A.vertex,2,a.FLOAT,false,16,0);a.vertexAttribPointer(A.uv,2,a.FLOAT,false,16,8);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,g);a.disable(a.CULL_FACE);a.depthMask(false);var E,G,L,H,D;for(E=0;E<t;E++){A=16/s;w.set(A*q,A);H=b[E];v.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);u.copy(v);C.x=u.x*x+x;C.y=u.y*z+z;if(j||C.x>0&&C.x<e&&C.y>0&&
-C.y<s){a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,h);a.copyTexImage2D(a.TEXTURE_2D,0,a.RGB,C.x-8,C.y-8,16,16,0);a.uniform1i(B.renderType,0);a.uniform2f(B.scale,w.x,w.y);a.uniform3f(B.screenPosition,u.x,u.y,u.z);a.disable(a.BLEND);a.enable(a.DEPTH_TEST);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,i);a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,C.x-8,C.y-8,16,16,0);a.uniform1i(B.renderType,1);a.disable(a.DEPTH_TEST);a.activeTexture(a.TEXTURE1);
-a.bindTexture(a.TEXTURE_2D,h);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);H.positionScreen.copy(u);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();a.uniform1i(B.renderType,2);a.enable(a.BLEND);G=0;for(L=H.lensFlares.length;G<L;G++){D=H.lensFlares[G];if(D.opacity>0.0010&&D.scale>0.0010){u.x=D.x;u.y=D.y;u.z=D.z;A=D.size*D.scale/s;w.x=A*q;w.y=A;a.uniform3f(B.screenPosition,u.x,u.y,u.z);a.uniform2f(B.scale,w.x,w.y);a.uniform1f(B.rotation,D.rotation);a.uniform1f(B.opacity,D.opacity);
+a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);if(a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;l=b(THREE.ShaderFlares.lensFlare)}else{j=true;l=b(THREE.ShaderFlares.lensFlareVertexTexture)}m={};n={};m.vertex=a.getAttribLocation(l,"position");m.uv=a.getAttribLocation(l,"uv");n.renderType=a.getUniformLocation(l,"renderType");n.map=a.getUniformLocation(l,"map");n.occlusionMap=a.getUniformLocation(l,"occlusionMap");n.opacity=a.getUniformLocation(l,"opacity");n.color=a.getUniformLocation(l,
+"color");n.scale=a.getUniformLocation(l,"scale");n.rotation=a.getUniformLocation(l,"rotation");n.screenPosition=a.getUniformLocation(l,"screenPosition");k=false};this.render=function(b,d,e,s){var b=b.__webglFlares,u=b.length;if(u){var t=new THREE.Vector3,r=s/e,v=e*0.5,z=s*0.5,A=16/s,x=new THREE.Vector2(A*r,A),w=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),B=n,A=m;a.useProgram(l);if(!k){a.enableVertexAttribArray(m.vertex);a.enableVertexAttribArray(m.uv);k=true}a.uniform1i(B.occlusionMap,0);a.uniform1i(B.map,
+1);a.bindBuffer(a.ARRAY_BUFFER,f);a.vertexAttribPointer(A.vertex,2,a.FLOAT,false,16,0);a.vertexAttribPointer(A.uv,2,a.FLOAT,false,16,8);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,g);a.disable(a.CULL_FACE);a.depthMask(false);var E,G,L,H,D;for(E=0;E<u;E++){A=16/s;x.set(A*r,A);H=b[E];t.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);w.copy(t);C.x=w.x*v+v;C.y=w.y*z+z;if(j||C.x>0&&C.x<e&&C.y>0&&
+C.y<s){a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,h);a.copyTexImage2D(a.TEXTURE_2D,0,a.RGB,C.x-8,C.y-8,16,16,0);a.uniform1i(B.renderType,0);a.uniform2f(B.scale,x.x,x.y);a.uniform3f(B.screenPosition,w.x,w.y,w.z);a.disable(a.BLEND);a.enable(a.DEPTH_TEST);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,i);a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,C.x-8,C.y-8,16,16,0);a.uniform1i(B.renderType,1);a.disable(a.DEPTH_TEST);a.activeTexture(a.TEXTURE1);
+a.bindTexture(a.TEXTURE_2D,h);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0);H.positionScreen.copy(w);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();a.uniform1i(B.renderType,2);a.enable(a.BLEND);G=0;for(L=H.lensFlares.length;G<L;G++){D=H.lensFlares[G];if(D.opacity>0.0010&&D.scale>0.0010){w.x=D.x;w.y=D.y;w.z=D.z;A=D.size*D.scale/s;x.x=A*r;x.y=A;a.uniform3f(B.screenPosition,w.x,w.y,w.z);a.uniform2f(B.scale,x.x,x.y);a.uniform1f(B.rotation,D.rotation);a.uniform1f(B.opacity,D.opacity);
 a.uniform3f(B.color,D.color.r,D.color.g,D.color.b);c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst);c.setTexture(D.texture,1);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0)}}}}a.enable(a.CULL_FACE);a.enable(a.DEPTH_TEST);a.depthMask(true)}}};
 a.uniform3f(B.color,D.color.r,D.color.g,D.color.b);c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst);c.setTexture(D.texture,1);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0)}}}}a.enable(a.CULL_FACE);a.enable(a.DEPTH_TEST);a.depthMask(true)}}};
-THREE.ShadowMapPlugin=function(){var b,a,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){b=e.context;a=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(b,c){a.shadowMapEnabled&&a.shadowMapAutoUpdate&&this.update(b,c)};this.update=function(i,j){var l,n,k,m,o,p,r,s,t,v=[];m=0;b.clearColor(1,1,1,1);b.disable(b.BLEND);b.enable(b.CULL_FACE);a.shadowMapCullFrontFaces?b.cullFace(b.FRONT):b.cullFace(b.BACK);a.setDepthTest(true);l=0;for(n=i.__lights.length;l<n;l++){k=i.__lights[l];if(k.castShadow)if(k instanceof THREE.DirectionalLight&&k.shadowCascade)for(o=0;o<k.shadowCascadeCount;o++){var q;if(k.shadowCascadeArray[o])q=k.shadowCascadeArray[o];
-else{t=k;r=o;q=new THREE.DirectionalLight;q.isVirtual=true;q.onlyShadow=true;q.castShadow=true;q.shadowCameraNear=t.shadowCameraNear;q.shadowCameraFar=t.shadowCameraFar;q.shadowCameraLeft=t.shadowCameraLeft;q.shadowCameraRight=t.shadowCameraRight;q.shadowCameraBottom=t.shadowCameraBottom;q.shadowCameraTop=t.shadowCameraTop;q.shadowCameraVisible=t.shadowCameraVisible;q.shadowDarkness=t.shadowDarkness;q.shadowBias=t.shadowCascadeBias[r];q.shadowMapWidth=t.shadowCascadeWidth[r];q.shadowMapHeight=t.shadowCascadeHeight[r];
-q.pointsWorld=[];q.pointsFrustum=[];s=q.pointsWorld;p=q.pointsFrustum;for(var x=0;x<8;x++){s[x]=new THREE.Vector3;p[x]=new THREE.Vector3}s=t.shadowCascadeNearZ[r];t=t.shadowCascadeFarZ[r];p[0].set(-1,-1,s);p[1].set(1,-1,s);p[2].set(-1,1,s);p[3].set(1,1,s);p[4].set(-1,-1,t);p[5].set(1,-1,t);p[6].set(-1,1,t);p[7].set(1,1,t);q.originalCamera=j;p=new THREE.Gyroscope;p.position=k.shadowCascadeOffset;p.add(q);p.add(q.target);j.add(p);k.shadowCascadeArray[o]=q;console.log("Created virtualLight",q)}r=k;s=
-o;t=r.shadowCascadeArray[s];t.position.copy(r.position);t.target.position.copy(r.target.position);t.lookAt(t.target);t.shadowCameraVisible=r.shadowCameraVisible;t.shadowDarkness=r.shadowDarkness;t.shadowBias=r.shadowCascadeBias[s];p=r.shadowCascadeNearZ[s];r=r.shadowCascadeFarZ[s];t=t.pointsFrustum;t[0].z=p;t[1].z=p;t[2].z=p;t[3].z=p;t[4].z=r;t[5].z=r;t[6].z=r;t[7].z=r;v[m]=q;m++}else{v[m]=k;m++}}l=0;for(n=v.length;l<n;l++){k=v[l];if(!k.shadowMap){k.shadowMap=new THREE.WebGLRenderTarget(k.shadowMapWidth,
-k.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});k.shadowMapSize=new THREE.Vector2(k.shadowMapWidth,k.shadowMapHeight);k.shadowMatrix=new THREE.Matrix4}if(!k.shadowCamera){if(k instanceof THREE.SpotLight)k.shadowCamera=new THREE.PerspectiveCamera(k.shadowCameraFov,k.shadowMapWidth/k.shadowMapHeight,k.shadowCameraNear,k.shadowCameraFar);else if(k instanceof THREE.DirectionalLight)k.shadowCamera=new THREE.OrthographicCamera(k.shadowCameraLeft,k.shadowCameraRight,
-k.shadowCameraTop,k.shadowCameraBottom,k.shadowCameraNear,k.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(k.shadowCamera);a.autoUpdateScene&&i.updateMatrixWorld()}if(k.shadowCameraVisible&&!k.cameraHelper){k.cameraHelper=new THREE.CameraHelper(k.shadowCamera);k.shadowCamera.add(k.cameraHelper)}if(k.isVirtual&&q.originalCamera==j){o=j;m=k.shadowCamera;p=k.pointsFrustum;t=k.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=
-0;r<8;r++){s=t[r];s.copy(p[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,o);m.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}m.left=g.x;m.right=h.x;m.top=h.y;m.bottom=g.y;m.updateProjectionMatrix()}m=k.shadowMap;p=k.shadowMatrix;o=k.shadowCamera;o.position.copy(k.matrixWorld.getPosition());o.lookAt(k.target.matrixWorld.getPosition());o.updateMatrixWorld();o.matrixWorldInverse.getInverse(o.matrixWorld);
-if(k.cameraHelper)k.cameraHelper.lines.visible=k.shadowCameraVisible;k.shadowCameraVisible&&k.cameraHelper.update();p.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);p.multiplySelf(o.projectionMatrix);p.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);f.multiply(o.projectionMatrix,
-o.matrixWorldInverse);e.setFromMatrix(f);a.setRenderTarget(m);a.clear();t=i.__webglObjects;k=0;for(m=t.length;k<m;k++){r=t[k];p=r.object;r.render=false;if(p.visible&&p.castShadow&&(!(p instanceof THREE.Mesh)||!p.frustumCulled||e.contains(p))){p._modelViewMatrix.multiply(o.matrixWorldInverse,p.matrixWorld);r.render=true}}k=0;for(m=t.length;k<m;k++){r=t[k];if(r.render){p=r.object;r=r.buffer;s=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?d:c;r instanceof THREE.BufferGeometry?
-a.renderBufferDirect(o,i.__lights,null,s,r,p):a.renderBuffer(o,i.__lights,null,s,r,p)}}t=i.__webglObjectsImmediate;k=0;for(m=t.length;k<m;k++){r=t[k];p=r.object;if(p.visible&&p.castShadow){p._modelViewMatrix.multiply(o.matrixWorldInverse,p.matrixWorld);a.renderImmediateObject(o,i.__lights,null,c,p)}}}l=a.getClearColor();n=a.getClearAlpha();b.clearColor(l.r,l.g,l.b,n);b.enable(b.BLEND);a.shadowMapCullFrontFaces&&b.cullFace(b.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
+THREE.ShadowMapPlugin=function(){var b,a,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,i=new THREE.Vector3;this.init=function(f){b=f.context;a=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(b,c){a.shadowMapEnabled&&a.shadowMapAutoUpdate&&this.update(b,c)};this.update=function(j,l){var m,n,k,o,q,p,s,u,t,r=[];o=0;b.clearColor(1,1,1,1);b.disable(b.BLEND);b.enable(b.CULL_FACE);a.shadowMapCullFrontFaces?b.cullFace(b.FRONT):b.cullFace(b.BACK);a.setDepthTest(true);m=0;for(n=j.__lights.length;m<n;m++){k=j.__lights[m];if(k.castShadow)if(k instanceof THREE.DirectionalLight&&
+k.shadowCascade)for(q=0;q<k.shadowCascadeCount;q++){var v;if(k.shadowCascadeArray[q])v=k.shadowCascadeArray[q];else{t=k;s=q;v=new THREE.DirectionalLight;v.isVirtual=true;v.onlyShadow=true;v.castShadow=true;v.shadowCameraNear=t.shadowCameraNear;v.shadowCameraFar=t.shadowCameraFar;v.shadowCameraLeft=t.shadowCameraLeft;v.shadowCameraRight=t.shadowCameraRight;v.shadowCameraBottom=t.shadowCameraBottom;v.shadowCameraTop=t.shadowCameraTop;v.shadowCameraVisible=t.shadowCameraVisible;v.shadowDarkness=t.shadowDarkness;
+v.shadowBias=t.shadowCascadeBias[s];v.shadowMapWidth=t.shadowCascadeWidth[s];v.shadowMapHeight=t.shadowCascadeHeight[s];v.pointsWorld=[];v.pointsFrustum=[];u=v.pointsWorld;p=v.pointsFrustum;for(var z=0;z<8;z++){u[z]=new THREE.Vector3;p[z]=new THREE.Vector3}u=t.shadowCascadeNearZ[s];t=t.shadowCascadeFarZ[s];p[0].set(-1,-1,u);p[1].set(1,-1,u);p[2].set(-1,1,u);p[3].set(1,1,u);p[4].set(-1,-1,t);p[5].set(1,-1,t);p[6].set(-1,1,t);p[7].set(1,1,t);v.originalCamera=l;p=new THREE.Gyroscope;p.position=k.shadowCascadeOffset;
+p.add(v);p.add(v.target);l.add(p);k.shadowCascadeArray[q]=v;console.log("Created virtualLight",v)}s=k;u=q;t=s.shadowCascadeArray[u];t.position.copy(s.position);t.target.position.copy(s.target.position);t.lookAt(t.target);t.shadowCameraVisible=s.shadowCameraVisible;t.shadowDarkness=s.shadowDarkness;t.shadowBias=s.shadowCascadeBias[u];p=s.shadowCascadeNearZ[u];s=s.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=p;t[1].z=p;t[2].z=p;t[3].z=p;t[4].z=s;t[5].z=s;t[6].z=s;t[7].z=s;r[o]=v;o++}else{r[o]=k;o++}}m=
+0;for(n=r.length;m<n;m++){k=r[m];if(!k.shadowMap){k.shadowMap=new THREE.WebGLRenderTarget(k.shadowMapWidth,k.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});k.shadowMapSize=new THREE.Vector2(k.shadowMapWidth,k.shadowMapHeight);k.shadowMatrix=new THREE.Matrix4}if(!k.shadowCamera){if(k instanceof THREE.SpotLight)k.shadowCamera=new THREE.PerspectiveCamera(k.shadowCameraFov,k.shadowMapWidth/k.shadowMapHeight,k.shadowCameraNear,k.shadowCameraFar);else if(k instanceof
+THREE.DirectionalLight)k.shadowCamera=new THREE.OrthographicCamera(k.shadowCameraLeft,k.shadowCameraRight,k.shadowCameraTop,k.shadowCameraBottom,k.shadowCameraNear,k.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(k.shadowCamera);a.autoUpdateScene&&j.updateMatrixWorld()}if(k.shadowCameraVisible&&!k.cameraHelper){k.cameraHelper=new THREE.CameraHelper(k.shadowCamera);k.shadowCamera.add(k.cameraHelper)}if(k.isVirtual&&v.originalCamera==l){q=l;o=k.shadowCamera;
+p=k.pointsFrustum;t=k.pointsWorld;h.set(Infinity,Infinity,Infinity);i.set(-Infinity,-Infinity,-Infinity);for(s=0;s<8;s++){u=t[s];u.copy(p[s]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,q);o.matrixWorldInverse.multiplyVector3(u);if(u.x<h.x)h.x=u.x;if(u.x>i.x)i.x=u.x;if(u.y<h.y)h.y=u.y;if(u.y>i.y)i.y=u.y;if(u.z<h.z)h.z=u.z;if(u.z>i.z)i.z=u.z}o.left=h.x;o.right=i.x;o.top=i.y;o.bottom=h.y;o.updateProjectionMatrix()}o=k.shadowMap;p=k.shadowMatrix;q=k.shadowCamera;q.position.copy(k.matrixWorld.getPosition());
+q.lookAt(k.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(k.cameraHelper)k.cameraHelper.lines.visible=k.shadowCameraVisible;k.shadowCameraVisible&&k.cameraHelper.update();p.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);p.multiplySelf(q.projectionMatrix);p.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);
+q.projectionMatrix.flattenToArray(q._projectionMatrixArray);g.multiply(q.projectionMatrix,q.matrixWorldInverse);f.setFromMatrix(g);a.setRenderTarget(o);a.clear();t=j.__webglObjects;k=0;for(o=t.length;k<o;k++){s=t[k];p=s.object;s.render=false;if(p.visible&&p.castShadow&&(!(p instanceof THREE.Mesh)||!p.frustumCulled||f.contains(p))){p._modelViewMatrix.multiply(q.matrixWorldInverse,p.matrixWorld);s.render=true}}k=0;for(o=t.length;k<o;k++){s=t[k];if(s.render){p=s.object;s=s.buffer;u=p.customDepthMaterial?
+p.customDepthMaterial:p.geometry.morphTargets.length?d:p instanceof THREE.SkinnedMesh?e:c;s instanceof THREE.BufferGeometry?a.renderBufferDirect(q,j.__lights,null,u,s,p):a.renderBuffer(q,j.__lights,null,u,s,p)}}t=j.__webglObjectsImmediate;k=0;for(o=t.length;k<o;k++){s=t[k];p=s.object;if(p.visible&&p.castShadow){p._modelViewMatrix.multiply(q.matrixWorldInverse,p.matrixWorld);a.renderImmediateObject(q,j.__lights,null,c,p)}}}m=a.getClearColor();n=a.getClearAlpha();b.clearColor(m.r,m.g,m.b,n);b.enable(b.BLEND);
+a.shadowMapCullFrontFaces&&b.cullFace(b.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
 THREE.SpritePlugin=function(){function b(a,b){return b.z-a.z}var a,c,d,e,f,g,h,i,j,l;this.init=function(b){a=b.context;c=b;d=new Float32Array(16);e=new Uint16Array(6);b=0;d[b++]=-1;d[b++]=-1;d[b++]=0;d[b++]=0;d[b++]=1;d[b++]=-1;d[b++]=1;d[b++]=0;d[b++]=1;d[b++]=1;d[b++]=1;d[b++]=1;d[b++]=-1;d[b++]=1;d[b++]=0;d[b++]=1;b=0;e[b++]=0;e[b++]=1;e[b++]=2;e[b++]=0;e[b++]=2;e[b++]=3;f=a.createBuffer();g=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,f);a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,
 THREE.SpritePlugin=function(){function b(a,b){return b.z-a.z}var a,c,d,e,f,g,h,i,j,l;this.init=function(b){a=b.context;c=b;d=new Float32Array(16);e=new Uint16Array(6);b=0;d[b++]=-1;d[b++]=-1;d[b++]=0;d[b++]=0;d[b++]=1;d[b++]=-1;d[b++]=1;d[b++]=0;d[b++]=1;d[b++]=1;d[b++]=1;d[b++]=1;d[b++]=-1;d[b++]=1;d[b++]=0;d[b++]=1;b=0;e[b++]=0;e[b++]=1;e[b++]=2;e[b++]=0;e[b++]=2;e[b++]=3;f=a.createBuffer();g=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,f);a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,
-g);a.bufferData(a.ELEMENT_ARRAY_BUFFER,e,a.STATIC_DRAW);var b=THREE.ShaderSprite.sprite,k=a.createProgram(),m=a.createShader(a.FRAGMENT_SHADER),o=a.createShader(a.VERTEX_SHADER);a.shaderSource(m,b.fragmentShader);a.shaderSource(o,b.vertexShader);a.compileShader(m);a.compileShader(o);a.attachShader(k,m);a.attachShader(k,o);a.linkProgram(k);h=k;i={};j={};i.position=a.getAttribLocation(h,"position");i.uv=a.getAttribLocation(h,"uv");j.uvOffset=a.getUniformLocation(h,"uvOffset");j.uvScale=a.getUniformLocation(h,
+g);a.bufferData(a.ELEMENT_ARRAY_BUFFER,e,a.STATIC_DRAW);var b=THREE.ShaderSprite.sprite,n=a.createProgram(),k=a.createShader(a.FRAGMENT_SHADER),o=a.createShader(a.VERTEX_SHADER);a.shaderSource(k,b.fragmentShader);a.shaderSource(o,b.vertexShader);a.compileShader(k);a.compileShader(o);a.attachShader(n,k);a.attachShader(n,o);a.linkProgram(n);h=n;i={};j={};i.position=a.getAttribLocation(h,"position");i.uv=a.getAttribLocation(h,"uv");j.uvOffset=a.getUniformLocation(h,"uvOffset");j.uvScale=a.getUniformLocation(h,
 "uvScale");j.rotation=a.getUniformLocation(h,"rotation");j.scale=a.getUniformLocation(h,"scale");j.alignment=a.getUniformLocation(h,"alignment");j.color=a.getUniformLocation(h,"color");j.map=a.getUniformLocation(h,"map");j.opacity=a.getUniformLocation(h,"opacity");j.useScreenCoordinates=a.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=a.getUniformLocation(h,"affectedByDistance");j.screenPosition=a.getUniformLocation(h,"screenPosition");j.modelViewMatrix=a.getUniformLocation(h,"modelViewMatrix");
 "uvScale");j.rotation=a.getUniformLocation(h,"rotation");j.scale=a.getUniformLocation(h,"scale");j.alignment=a.getUniformLocation(h,"alignment");j.color=a.getUniformLocation(h,"color");j.map=a.getUniformLocation(h,"map");j.opacity=a.getUniformLocation(h,"opacity");j.useScreenCoordinates=a.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=a.getUniformLocation(h,"affectedByDistance");j.screenPosition=a.getUniformLocation(h,"screenPosition");j.modelViewMatrix=a.getUniformLocation(h,"modelViewMatrix");
-j.projectionMatrix=a.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,m,o){var d=d.__webglSprites,p=d.length;if(p){var r=i,s=j,t=o/m,m=m*0.5,v=o*0.5,q=true;a.useProgram(h);if(!l){a.enableVertexAttribArray(r.position);a.enableVertexAttribArray(r.uv);l=true}a.disable(a.CULL_FACE);a.enable(a.BLEND);a.depthMask(true);a.bindBuffer(a.ARRAY_BUFFER,f);a.vertexAttribPointer(r.position,2,a.FLOAT,false,16,0);a.vertexAttribPointer(r.uv,2,a.FLOAT,false,16,8);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,
-g);a.uniformMatrix4fv(s.projectionMatrix,false,e._projectionMatrixArray);a.activeTexture(a.TEXTURE0);a.uniform1i(s.map,0);for(var x,z=[],r=0;r<p;r++){x=d[r];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(b);for(r=0;r<p;r++){x=d[r];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){a.uniform1i(s.useScreenCoordinates,1);
-a.uniform3f(s.screenPosition,(x.position.x-m)/m,(v-x.position.y)/v,Math.max(0,Math.min(1,x.position.z)))}else{a.uniform1i(s.useScreenCoordinates,0);a.uniform1i(s.affectedByDistance,x.affectedByDistance?1:0);a.uniformMatrix4fv(s.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?o:1);z[0]=e*t*x.scale.x;z[1]=e*x.scale.y;a.uniform2f(s.uvScale,x.uvScale.x,x.uvScale.y);a.uniform2f(s.uvOffset,x.uvOffset.x,x.uvOffset.y);a.uniform2f(s.alignment,x.alignment.x,x.alignment.y);
-a.uniform1f(s.opacity,x.opacity);a.uniform3f(s.color,x.color.r,x.color.g,x.color.b);a.uniform1f(s.rotation,x.rotation);a.uniform2fv(s.scale,z);if(x.mergeWith3D&&!q){a.enable(a.DEPTH_TEST);q=true}else if(!x.mergeWith3D&&q){a.disable(a.DEPTH_TEST);q=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0)}}a.enable(a.CULL_FACE);a.enable(a.DEPTH_TEST);a.depthMask(true)}}};
+j.projectionMatrix=a.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,k,o){var d=d.__webglSprites,q=d.length;if(q){var p=i,s=j,u=o/k,k=k*0.5,t=o*0.5,r=true;a.useProgram(h);if(!l){a.enableVertexAttribArray(p.position);a.enableVertexAttribArray(p.uv);l=true}a.disable(a.CULL_FACE);a.enable(a.BLEND);a.depthMask(true);a.bindBuffer(a.ARRAY_BUFFER,f);a.vertexAttribPointer(p.position,2,a.FLOAT,false,16,0);a.vertexAttribPointer(p.uv,2,a.FLOAT,false,16,8);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,
+g);a.uniformMatrix4fv(s.projectionMatrix,false,e._projectionMatrixArray);a.activeTexture(a.TEXTURE0);a.uniform1i(s.map,0);for(var v,z=[],p=0;p<q;p++){v=d[p];if(v.visible&&v.opacity!==0)if(v.useScreenCoordinates)v.z=-v.position.z;else{v._modelViewMatrix.multiply(e.matrixWorldInverse,v.matrixWorld);v.z=-v._modelViewMatrix.elements[14]}}d.sort(b);for(p=0;p<q;p++){v=d[p];if(v.visible&&v.opacity!==0&&v.map&&v.map.image&&v.map.image.width){if(v.useScreenCoordinates){a.uniform1i(s.useScreenCoordinates,1);
+a.uniform3f(s.screenPosition,(v.position.x-k)/k,(t-v.position.y)/t,Math.max(0,Math.min(1,v.position.z)))}else{a.uniform1i(s.useScreenCoordinates,0);a.uniform1i(s.affectedByDistance,v.affectedByDistance?1:0);a.uniformMatrix4fv(s.modelViewMatrix,false,v._modelViewMatrix.elements)}e=v.map.image.width/(v.scaleByViewport?o:1);z[0]=e*u*v.scale.x;z[1]=e*v.scale.y;a.uniform2f(s.uvScale,v.uvScale.x,v.uvScale.y);a.uniform2f(s.uvOffset,v.uvOffset.x,v.uvOffset.y);a.uniform2f(s.alignment,v.alignment.x,v.alignment.y);
+a.uniform1f(s.opacity,v.opacity);a.uniform3f(s.color,v.color.r,v.color.g,v.color.b);a.uniform1f(s.rotation,v.rotation);a.uniform2fv(s.scale,z);if(v.mergeWith3D&&!r){a.enable(a.DEPTH_TEST);r=true}else if(!v.mergeWith3D&&r){a.disable(a.DEPTH_TEST);r=false}c.setBlending(v.blending,v.blendEquation,v.blendSrc,v.blendDst);c.setTexture(v.map,0);a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0)}}a.enable(a.CULL_FACE);a.enable(a.DEPTH_TEST);a.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var b,a,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){b=e.context;a=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=
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var b,a,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){b=e.context;a=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,l,n,k,m;b.clearColor(1,1,1,1);b.disable(b.BLEND);a.setDepthTest(true);a.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);a.setRenderTarget(this.renderTarget);a.clear();m=g.__webglObjects;i=0;for(j=m.length;i<j;i++){l=m[i];k=l.object;l.render=false;if(k.visible&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||e.contains(k))){k._modelViewMatrix.multiply(h.matrixWorldInverse,k.matrixWorld);l.render=true}}i=0;for(j=m.length;i<j;i++){l=m[i];if(l.render){k=l.object;l=l.buffer;a.setObjectFaces(k);n=k.customDepthMaterial?k.customDepthMaterial:k.geometry.morphTargets.length?d:c;l instanceof
-THREE.BufferGeometry?a.renderBufferDirect(h,g.__lights,null,n,l,k):a.renderBuffer(h,g.__lights,null,n,l,k)}}m=g.__webglObjectsImmediate;i=0;for(j=m.length;i<j;i++){l=m[i];k=l.object;if(k.visible&&k.castShadow){k._modelViewMatrix.multiply(h.matrixWorldInverse,k.matrixWorld);a.renderImmediateObject(h,g.__lights,null,c,k)}}i=a.getClearColor();j=a.getClearAlpha();b.clearColor(i.r,i.g,i.b,j);b.enable(b.BLEND)}};
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,l,m,n,k;b.clearColor(1,1,1,1);b.disable(b.BLEND);a.setDepthTest(true);a.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);a.setRenderTarget(this.renderTarget);a.clear();k=g.__webglObjects;i=0;for(j=k.length;i<j;i++){l=k[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(j=k.length;i<j;i++){l=k[i];if(l.render){n=l.object;l=l.buffer;a.setObjectFaces(n);m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;l instanceof
+THREE.BufferGeometry?a.renderBufferDirect(h,g.__lights,null,m,l,n):a.renderBuffer(h,g.__lights,null,m,l,n)}}k=g.__webglObjectsImmediate;i=0;for(j=k.length;i<j;i++){l=k[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);a.renderImmediateObject(h,g.__lights,null,c,n)}}i=a.getClearColor();j=a.getClearAlpha();b.clearColor(i.r,i.g,i.b,j);b.enable(b.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}"},
 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}"}};
 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}",
 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}",

+ 232 - 231
build/custom/ThreeWebGL.js

@@ -16,55 +16,55 @@ 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=
 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())},
 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,
 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],h=d[8],j=d[1],m=d[5],l=d[9],i=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(-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(h,d);this.z=Math.atan2(j,m)}else{this.y=Math.atan2(-i,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(o));if(Math.abs(o)<0.99999){this.y=Math.atan2(-i,d);this.z=Math.atan2(-e,m)}else{this.y=0;this.z=Math.atan2(h,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(i));if(Math.abs(i)<0.99999){this.x=Math.atan2(o,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(-i,
-f)}else{this.x=0;this.y=Math.atan2(i,d)}}else if(b==="XZY"){this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(o,m);this.y=Math.atan2(h,f)}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,f=a.y*a.y,e=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-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),h+d-f-e)}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,f=d[0],e=d[4],h=d[8],j=d[1],l=d[5],k=d[9],i=d[2],n=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(-e,f)}else{this.x=Math.atan2(j,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(j,l)}else{this.y=Math.atan2(-i,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(n));if(Math.abs(n)<0.99999){this.y=Math.atan2(-i,d);this.z=Math.atan2(-e,l)}else{this.y=0;this.z=Math.atan2(h,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(i));if(Math.abs(i)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(j,f)}else{this.x=0;this.z=Math.atan2(-e,l)}}else if(b==="YZX"){this.z=Math.asin(c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(-k,l);this.y=Math.atan2(-i,
+f)}else{this.x=0;this.y=Math.atan2(i,d)}}else if(b==="XZY"){this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(n,l);this.y=Math.atan2(h,f)}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,f=a.y*a.y,e=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-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),h+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),h-d-f+e);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-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),h-d-f+e);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-d+f-e)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),h-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),h+d-f-e)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 "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-f+e);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-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),h-d-f+e);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-d+f-e)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),h-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),h+d-f-e)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 a.y),h-d+f-e);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+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),h-d+f-e);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+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=
 a.y),h-d+f-e);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+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),h-d+f-e);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+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=
 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};
 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=
 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())},
 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=
 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],h=a[1],j=a[5],m=a[9];c=a[2];b=a[6];var l=a[10];if(Math.abs(d-h)<0.01&&Math.abs(e-c)<0.01&&Math.abs(m-b)<0.01){if(Math.abs(d+h)<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+h)/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)+(h-d)*(h-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-m)/a;this.y=(e-c)/a;this.z=(h-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],h=a[1],j=a[5],l=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-h)<0.01&&Math.abs(e-c)<0.01&&Math.abs(l-b)<0.01){if(Math.abs(d+h)<0.1&&Math.abs(e+c)<0.1&&Math.abs(l+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+h)/4;e=(e+c)/4;l=(l+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=l/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=e/d;c=l/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(e-c)*(e-c)+(h-d)*(h-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-l)/a;this.y=(e-c)/a;this.z=(h-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.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],h=c[4],j=c[5],m=c[6],l=c[7],i=c[8],o=c[9],k=c[10],s=c[11],r=c[12],n=c[13],q=c[14],c=c[15];b[0].set(e-a,l-h,s-i,c-r);b[1].set(e+a,l+h,s+i,c+r);b[2].set(e+d,l+j,s+o,c+n);b[3].set(e-d,l-j,s-o,c-n);b[4].set(e-f,l-m,s-k,c-q);b[5].set(e+f,l+m,s+k,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],f=c[2],e=c[3],h=c[4],j=c[5],l=c[6],k=c[7],i=c[8],n=c[9],m=c[10],q=c[11],u=c[12],o=c[13],r=c[14],c=c[15];b[0].set(e-a,k-h,q-i,c-u);b[1].set(e+a,k+h,q+i,c+u);b[2].set(e+d,k+j,q+n,c+o);b[3].set(e-d,k-j,q-n,c-o);b[4].set(e-f,k-l,q-m,c-r);b[5].set(e+f,k+l,q+m,c+r);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.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,h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,k=new THREE.Vector3,s=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,p,v,C,B=function(a,b,c){r.sub(c,a);p=r.dot(b);v=n.add(a,q.copy(b).multiplyScalar(p));
-return C=c.distanceTo(v)},u,J,z,N,E,H,G,R,U=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);u=r.dot(r);J=r.dot(n);z=r.dot(q);N=n.dot(n);E=n.dot(q);H=1/(u*N-J*J);G=(N*z-J*E)*H;R=(u*E-J*z)*H;return G>=0&&R>=0&&G+R<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,r=a.children.length;n<r;n++)Array.prototype.push.apply(d,this.intersectObject(a.children[n],b));if(a instanceof THREE.Particle){C=B(this.origin,this.direction,a.matrixWorld.getPosition());
-if(C>a.scale.x)return[];c={distance:C,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));C=B(this.origin,this.direction,a.matrixWorld.getPosition());if(C>n)return d;var q,p,v=a.geometry,u=v.vertices,z;a.matrixRotationWorld.extractRotation(a.matrixWorld);n=0;for(r=v.faces.length;n<
-r;n++){c=v.faces[n];m.copy(this.origin);l.copy(this.direction);z=a.matrixWorld;i=z.multiplyVector3(i.copy(c.centroid)).subSelf(m);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));q=l.dot(o);if(!(Math.abs(q)<T)){p=o.dot(i)/q;if(!(p<0)&&(a.doubleSided||(a.flipSided?q>0:q<0))){k.add(m,l.multiplyScalar(p));C=m.distanceTo(k);if(!(C<this.near)&&!(C>this.far))if(c instanceof THREE.Face3){f=z.multiplyVector3(f.copy(u[c.a]));e=z.multiplyVector3(e.copy(u[c.b]));h=z.multiplyVector3(h.copy(u[c.c]));
-if(U(k,f,e,h)){c={distance:C,point:k.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=z.multiplyVector3(f.copy(u[c.a]));e=z.multiplyVector3(e.copy(u[c.b]));h=z.multiplyVector3(h.copy(u[c.c]));j=z.multiplyVector3(j.copy(u[c.d]));if(U(k,f,e,j)||U(k,e,h,j)){c={distance:C,point:k.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(s);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(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 f=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,i=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3,q=function(a,b){return a.distance-b.distance},u=new THREE.Vector3,o=new THREE.Vector3,r=new THREE.Vector3,p,v,x,F=function(a,b,c){u.sub(c,a);p=u.dot(b);v=o.add(a,r.copy(b).multiplyScalar(p));
+return x=c.distanceTo(v)},s,I,A,N,D,H,G,R,U=function(a,b,c,d){u.sub(d,b);o.sub(c,b);r.sub(a,b);s=u.dot(u);I=u.dot(o);A=u.dot(r);N=o.dot(o);D=o.dot(r);H=1/(s*N-I*I);G=(N*A-I*D)*H;R=(s*D-I*A)*H;return G>=0&&R>=0&&G+R<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,u=a.children.length;o<u;o++)Array.prototype.push.apply(d,this.intersectObject(a.children[o],b));if(a instanceof THREE.Particle){x=F(this.origin,this.direction,a.matrixWorld.getPosition());
+if(x>a.scale.x)return[];c={distance:x,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));x=F(this.origin,this.direction,a.matrixWorld.getPosition());if(x>o)return d;var r,p,s=a.geometry,v=s.vertices,A;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(u=s.faces.length;o<
+u;o++){c=s.faces[o];l.copy(this.origin);k.copy(this.direction);A=a.matrixWorld;i=A.multiplyVector3(i.copy(c.centroid)).subSelf(l);n=a.matrixRotationWorld.multiplyVector3(n.copy(c.normal));r=k.dot(n);if(!(Math.abs(r)<T)){p=n.dot(i)/r;if(!(p<0)&&(a.doubleSided||(a.flipSided?r>0:r<0))){m.add(l,k.multiplyScalar(p));x=l.distanceTo(m);if(!(x<this.near)&&!(x>this.far))if(c instanceof THREE.Face3){f=A.multiplyVector3(f.copy(v[c.a]));e=A.multiplyVector3(e.copy(v[c.b]));h=A.multiplyVector3(h.copy(v[c.c]));
+if(U(m,f,e,h)){c={distance:x,point:m.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=A.multiplyVector3(f.copy(v[c.a]));e=A.multiplyVector3(e.copy(v[c.b]));h=A.multiplyVector3(h.copy(v[c.c]));j=A.multiplyVector3(j.copy(v[c.d]));if(U(m,f,e,j)||U(m,e,h,j)){c={distance:x,point:m.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(q);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(q);
 return c}};
 return c}};
-THREE.Rectangle=function(){function a(){e=d-b;h=f-c}var b=0,c=0,d=0,f=0,e=0,h=0,j=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,h,i,o){j=false;b=e;c=h;d=i;f=o;a()};this.addPoint=function(e,h){if(j===true){j=false;b=e;c=h;d=e;f=h}else{b=b<e?b:e;c=c<h?c:
-h;d=d>e?d:e;f=f>h?f:h}a()};this.add3Points=function(e,h,i,o,k,s){if(j===true){j=false;b=e<i?e<k?e:k:i<k?i:k;c=h<o?h<s?h:s:o<s?o:s;d=e>i?e>k?e:k:i>k?i:k;f=h>o?h>s?h:s:o>s?o:s}else{b=e<i?e<k?e<b?e:b:k<b?k:b:i<k?i<b?i:b:k<b?k:b;c=h<o?h<s?h<c?h:c:s<c?s:c:o<s?o<c?o:c:s<c?s:c;d=e>i?e>k?e>d?e:d:k>d?k:d:i>k?i>d?i:d:k>d?k:d;f=h>o?h>s?h>f?h:f:s>f?s:f:o>s?o>f?o:f:s>f?s: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();
+THREE.Rectangle=function(){function a(){e=d-b;h=f-c}var b=0,c=0,d=0,f=0,e=0,h=0,j=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,h,i,n){j=false;b=e;c=h;d=i;f=n;a()};this.addPoint=function(e,h){if(j===true){j=false;b=e;c=h;d=e;f=h}else{b=b<e?b:e;c=c<h?c:
+h;d=d>e?d:e;f=f>h?f:h}a()};this.add3Points=function(e,h,i,n,m,q){if(j===true){j=false;b=e<i?e<m?e:m:i<m?i:m;c=h<n?h<q?h:q:n<q?n:q;d=e>i?e>m?e:m:i>m?i:m;f=h>n?h>q?h:q:n>q?n:q}else{b=e<i?e<m?e<b?e:b:m<b?m:b:i<m?i<b?i:b:m<b?m:b;c=h<n?h<q?h<c?h:c:q<c?q:c:n<q?n<c?n:c:q<c?q:c;d=e>i?e>m?e>d?e:d:m>d?m:d:i>m?i>d?i:d:m>d?m:d;f=h>n?h>q?h>f?h:f:q>f?q:f:n>q?n>f?n:f:q>f?q: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}};
 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.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],h=-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,i=this.elements;i[0]=b*a;i[1]=b*c;i[2]=b*d;i[3]=b*f;i[4]=b*e;i[5]=b*h;i[6]=b*j;i[7]=b*m;i[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,h,j,m,l,i,o,k,s,r,n){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,h||0,j||0,m||0,l||0,i!==void 0?i:1,o||0,k||0,s||0,r||0,n!==void 0?n:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,h,j,m,l,i,o,k,s,r,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=f;q[5]=e;q[9]=h;q[13]=j;q[2]=m;q[6]=l;q[10]=i;q[14]=o;q[3]=k;q[7]=s;q[11]=r;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,
-f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x=h.x+1.0E-4;f.cross(c,h).normalize()}e.cross(h,f);d[0]=f.x;d[4]=e.x;d[8]=h.x;d[1]=f.y;d[5]=e.y;d[9]=h.y;d[2]=f.z;d[6]=e.z;d[10]=h.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],h=c[4],j=c[8],m=c[12],l=c[1],i=c[5],o=c[9],k=c[13],s=c[2],r=c[6],n=c[10],q=c[14],p=c[3],v=c[7],C=c[11],c=c[15],B=d[0],u=d[4],
-J=d[8],z=d[12],N=d[1],E=d[5],H=d[9],G=d[13],R=d[2],U=d[6],T=d[10],y=d[14],K=d[3],V=d[7],F=d[11],d=d[15];f[0]=e*B+h*N+j*R+m*K;f[4]=e*u+h*E+j*U+m*V;f[8]=e*J+h*H+j*T+m*F;f[12]=e*z+h*G+j*y+m*d;f[1]=l*B+i*N+o*R+k*K;f[5]=l*u+i*E+o*U+k*V;f[9]=l*J+i*H+o*T+k*F;f[13]=l*z+i*G+o*y+k*d;f[2]=s*B+r*N+n*R+q*K;f[6]=s*u+r*E+n*U+q*V;f[10]=s*J+r*H+n*T+q*F;f[14]=s*z+r*G+n*y+q*d;f[3]=p*B+v*N+C*R+c*K;f[7]=p*u+v*E+C*U+c*V;f[11]=p*J+v*H+C*T+c*F;f[15]=p*z+v*G+C*y+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],h=-b[6]*b[0]+b[2]*b[4],j=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]*f+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*f;i[4]=b*e;i[5]=b*h;i[6]=b*j;i[7]=b*l;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,f,e,h,j,l,k,i,n,m,q,u,o){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,h||0,j||0,l||0,k||0,i!==void 0?i:1,n||0,m||0,q||0,u||0,o!==void 0?o:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,h,j,l,k,i,n,m,q,u,o){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=f;r[5]=e;r[9]=h;r[13]=j;r[2]=l;r[6]=k;r[10]=i;r[14]=n;r[3]=m;r[7]=q;r[11]=u;r[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,
+f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x=h.x+1.0E-4;f.cross(c,h).normalize()}e.cross(h,f);d[0]=f.x;d[4]=e.x;d[8]=h.x;d[1]=f.y;d[5]=e.y;d[9]=h.y;d[2]=f.z;d[6]=e.z;d[10]=h.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],h=c[4],j=c[8],l=c[12],k=c[1],i=c[5],n=c[9],m=c[13],q=c[2],u=c[6],o=c[10],r=c[14],p=c[3],v=c[7],x=c[11],c=c[15],F=d[0],s=d[4],
+I=d[8],A=d[12],N=d[1],D=d[5],H=d[9],G=d[13],R=d[2],U=d[6],T=d[10],z=d[14],K=d[3],V=d[7],E=d[11],d=d[15];f[0]=e*F+h*N+j*R+l*K;f[4]=e*s+h*D+j*U+l*V;f[8]=e*I+h*H+j*T+l*E;f[12]=e*A+h*G+j*z+l*d;f[1]=k*F+i*N+n*R+m*K;f[5]=k*s+i*D+n*U+m*V;f[9]=k*I+i*H+n*T+m*E;f[13]=k*A+i*G+n*z+m*d;f[2]=q*F+u*N+o*R+r*K;f[6]=q*s+u*D+o*U+r*V;f[10]=q*I+u*H+o*T+r*E;f[14]=q*A+u*G+o*z+r*d;f[3]=p*F+v*N+x*R+c*K;f[7]=p*s+v*D+x*U+c*V;f[11]=p*I+v*H+x*T+c*E;f[15]=p*A+v*G+x*z+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 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,
 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]*
 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],h=a[5],j=a[9],m=a[13],l=a[2],i=a[6],o=a[10],k=a[14],s=a[3],r=a[7],n=a[11],a=a[15];return f*j*i*s-d*m*i*s-f*h*o*s+c*m*o*s+d*h*k*s-c*j*k*s-f*j*l*r+d*m*l*r+f*e*o*r-b*m*o*r-d*e*k*r+b*j*k*r+f*h*l*n-c*m*l*n-f*e*i*n+b*m*i*n+c*e*k*n-b*h*k*n-d*h*l*a+c*j*l*a+d*e*i*a-b*j*i*a-c*e*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;
+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],h=a[5],j=a[9],l=a[13],k=a[2],i=a[6],n=a[10],m=a[14],q=a[3],u=a[7],o=a[11],a=a[15];return f*j*i*q-d*l*i*q-f*h*n*q+c*l*n*q+d*h*m*q-c*j*m*q-f*j*k*u+d*l*k*u+f*e*n*u-b*l*n*u-d*e*m*u+b*j*m*u+f*h*k*o-c*l*k*o-f*e*i*o+b*l*i*o+c*e*m*o-b*h*m*o-d*h*k*a+c*j*k*a+d*e*i*a-b*j*i*a-c*e*n*a+b*h*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]=
 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],
 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],h=c[12],j=c[1],m=c[5],l=c[9],i=c[13],o=c[2],k=c[6],s=c[10],r=c[14],n=c[3],q=c[7],p=c[11],c=c[15];b[0]=l*r*q-i*s*q+i*k*p-m*r*p-l*k*c+m*s*c;b[4]=h*s*q-e*r*q-h*k*p+f*r*p+e*k*c-f*s*c;b[8]=e*i*q-h*l*q+h*m*p-f*i*p-e*m*c+f*l*c;b[12]=h*l*k-e*i*k-h*m*s+f*i*s+e*m*r-f*l*r;b[1]=i*s*n-l*r*n-i*o*p+j*r*p+l*o*c-j*s*c;b[5]=e*r*n-h*s*n+h*o*p-d*r*p-e*o*c+d*s*c;b[9]=h*l*n-e*i*n-h*j*p+d*i*p+e*j*c-d*l*c;b[13]=e*i*o-h*l*o+h*j*s-d*
-i*s-e*j*r+d*l*r;b[2]=m*r*n-i*k*n+i*o*q-j*r*q-m*o*c+j*k*c;b[6]=h*k*n-f*r*n-h*o*q+d*r*q+f*o*c-d*k*c;b[10]=f*i*n-h*m*n+h*j*q-d*i*q-f*j*c+d*m*c;b[14]=h*m*o-f*i*o-h*j*k+d*i*k+f*j*r-d*m*r;b[3]=l*k*n-m*s*n-l*o*q+j*s*q+m*o*p-j*k*p;b[7]=f*s*n-e*k*n+e*o*q-d*s*q-f*o*p+d*k*p;b[11]=e*m*n-f*l*n-e*j*q+d*l*q+f*j*p-d*m*p;b[15]=f*l*o-e*m*o+e*j*k-d*l*k-f*j*s+d*m*s;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,h=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=h*m,i=h*e,o=d*m,k=d*e;c[0]=j*m;c[4]=-j*e;c[8]=f;c[1]=i+o*f;c[5]=l-k*f;c[9]=-d*j;c[2]=k-l*f;c[6]=o+i*f;c[10]=h*j}else if(b==="YXZ"){l=j*m;i=j*e;o=f*m;k=f*e;c[0]=l+k*d;c[4]=o*d-i;c[8]=h*f;c[1]=h*e;c[5]=h*m;c[9]=-d;c[2]=i*d-o;c[6]=k+l*d;c[10]=h*j}else if(b==="ZXY"){l=j*m;i=j*e;o=f*m;k=f*e;c[0]=l-k*d;c[4]=-h*e;c[8]=o+i*d;c[1]=i+o*d;c[5]=h*m;c[9]=k-l*d;c[2]=-h*f;c[6]=d;c[10]=h*j}else if(b==="ZYX"){l=h*m;i=h*e;o=d*m;
-k=d*e;c[0]=j*m;c[4]=o*f-i;c[8]=l*f+k;c[1]=j*e;c[5]=k*f+l;c[9]=i*f-o;c[2]=-f;c[6]=d*j;c[10]=h*j}else if(b==="YZX"){l=h*j;i=h*f;o=d*j;k=d*f;c[0]=j*m;c[4]=k-l*e;c[8]=o*e+i;c[1]=e;c[5]=h*m;c[9]=-d*m;c[2]=-f*m;c[6]=i*e+o;c[10]=l-k*e}else if(b==="XZY"){l=h*j;i=h*f;o=d*j;k=d*f;c[0]=j*m;c[4]=-e;c[8]=f*m;c[1]=l*e+k;c[5]=h*m;c[9]=i*e-o;c[2]=o*e-i;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,h=c+c,j=d+d,m=f+f,a=c*h,l=c*j,c=c*m,i=d*j,d=d*
-m,f=f*m,h=e*h,j=e*j,e=e*m;b[0]=1-(i+f);b[4]=l-e;b[8]=c+j;b[1]=l+e;b[5]=1-(a+f);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,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,h=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],h=c[12],j=c[1],l=c[5],k=c[9],i=c[13],n=c[2],m=c[6],q=c[10],u=c[14],o=c[3],r=c[7],p=c[11],c=c[15];b[0]=k*u*r-i*q*r+i*m*p-l*u*p-k*m*c+l*q*c;b[4]=h*q*r-e*u*r-h*m*p+f*u*p+e*m*c-f*q*c;b[8]=e*i*r-h*k*r+h*l*p-f*i*p-e*l*c+f*k*c;b[12]=h*k*m-e*i*m-h*l*q+f*i*q+e*l*u-f*k*u;b[1]=i*q*o-k*u*o-i*n*p+j*u*p+k*n*c-j*q*c;b[5]=e*u*o-h*q*o+h*n*p-d*u*p-e*n*c+d*q*c;b[9]=h*k*o-e*i*o-h*j*p+d*i*p+e*j*c-d*k*c;b[13]=e*i*n-h*k*n+h*j*q-d*
+i*q-e*j*u+d*k*u;b[2]=l*u*o-i*m*o+i*n*r-j*u*r-l*n*c+j*m*c;b[6]=h*m*o-f*u*o-h*n*r+d*u*r+f*n*c-d*m*c;b[10]=f*i*o-h*l*o+h*j*r-d*i*r-f*j*c+d*l*c;b[14]=h*l*n-f*i*n-h*j*m+d*i*m+f*j*u-d*l*u;b[3]=k*m*o-l*q*o-k*n*r+j*q*r+l*n*p-j*m*p;b[7]=f*q*o-e*m*o+e*n*r-d*q*r-f*n*p+d*m*p;b[11]=e*l*o-f*k*o-e*j*r+d*k*r+f*j*p-d*l*p;b[15]=f*k*n-e*l*n+e*j*m-d*k*m-f*j*q+d*l*q;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,h=Math.cos(d),d=Math.sin(d),
+j=Math.cos(f),f=Math.sin(f),l=Math.cos(e),e=Math.sin(e);if(b===void 0||b==="XYZ"){var k=h*l,i=h*e,n=d*l,m=d*e;c[0]=j*l;c[4]=-j*e;c[8]=f;c[1]=i+n*f;c[5]=k-m*f;c[9]=-d*j;c[2]=m-k*f;c[6]=n+i*f;c[10]=h*j}else if(b==="YXZ"){k=j*l;i=j*e;n=f*l;m=f*e;c[0]=k+m*d;c[4]=n*d-i;c[8]=h*f;c[1]=h*e;c[5]=h*l;c[9]=-d;c[2]=i*d-n;c[6]=m+k*d;c[10]=h*j}else if(b==="ZXY"){k=j*l;i=j*e;n=f*l;m=f*e;c[0]=k-m*d;c[4]=-h*e;c[8]=n+i*d;c[1]=i+n*d;c[5]=h*l;c[9]=m-k*d;c[2]=-h*f;c[6]=d;c[10]=h*j}else if(b==="ZYX"){k=h*l;i=h*e;n=d*l;
+m=d*e;c[0]=j*l;c[4]=n*f-i;c[8]=k*f+m;c[1]=j*e;c[5]=m*f+k;c[9]=i*f-n;c[2]=-f;c[6]=d*j;c[10]=h*j}else if(b==="YZX"){k=h*j;i=h*f;n=d*j;m=d*f;c[0]=j*l;c[4]=m-k*e;c[8]=n*e+i;c[1]=e;c[5]=h*l;c[9]=-d*l;c[2]=-f*l;c[6]=i*e+n;c[10]=k-m*e}else if(b==="XZY"){k=h*j;i=h*f;n=d*j;m=d*f;c[0]=j*l;c[4]=-e;c[8]=f*l;c[1]=k*e+m;c[5]=h*l;c[9]=i*e-n;c[2]=n*e-i;c[6]=d*l;c[10]=m*e+k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,h=c+c,j=d+d,l=f+f,a=c*h,k=c*j,c=c*l,i=d*j,d=d*
+l,f=f*l,h=e*h,j=e*j,e=e*l;b[0]=1-(i+f);b[4]=k-e;b[8]=c+j;b[1]=k+e;b[5]=1-(a+f);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,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,h=THREE.Matrix4.__v3;f.set(d[0],d[1],d[2]);e.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=f.length();c.y=e.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]/
 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=f.length();c.y=e.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(),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.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],h=b[8],j=b[9],m=b[10],l=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*f+a*m;b[7]=i*e+a*l;b[8]=i*h-a*c;b[9]=i*j-a*d;b[10]=i*m-a*f;b[11]=i*l-a*e;return this},rotateY:function(a){var b=
-this.elements,c=b[0],d=b[1],f=b[2],e=b[3],h=b[8],j=b[9],m=b[10],l=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*f-a*m;b[3]=i*e-a*l;b[8]=i*h+a*c;b[9]=i*j+a*d;b[10]=i*m+a*f;b[11]=i*l+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],h=b[4],j=b[5],m=b[6],l=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*f+a*m;b[3]=i*e+a*l;b[4]=i*h-a*c;b[5]=i*j-a*d;b[6]=i*m-a*f;b[7]=i*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,h=Math.sqrt(d*d+f*f+e*e),d=d/h,f=f/h,e=e/h,h=d*d,j=f*f,m=e*e,l=Math.cos(b),i=Math.sin(b),o=1-l,k=d*f*o,s=d*e*o,o=f*e*o,d=d*i,r=f*i,i=e*i,e=h+(1-h)*l,h=k+i,f=s-r,k=k-i,j=j+(1-j)*l,i=o+d,s=s+r,o=o-d,m=m+(1-m)*l,l=c[0],d=c[1],r=c[2],n=c[3],q=c[4],p=c[5],v=c[6],C=c[7],B=c[8],u=c[9],J=c[10],z=c[11];c[0]=e*l+h*q+f*B;c[1]=e*d+h*
-p+f*u;c[2]=e*r+h*v+f*J;c[3]=e*n+h*C+f*z;c[4]=k*l+j*q+i*B;c[5]=k*d+j*p+i*u;c[6]=k*r+j*v+i*J;c[7]=k*n+j*C+i*z;c[8]=s*l+o*q+m*B;c[9]=s*d+o*p+m*u;c[10]=s*r+o*v+m*J;c[11]=s*n+o*C+m*z;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],h=b[8],j=b[9],l=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*f+a*l;b[7]=i*e+a*k;b[8]=i*h-a*c;b[9]=i*j-a*d;b[10]=i*l-a*f;b[11]=i*k-a*e;return this},rotateY:function(a){var b=
+this.elements,c=b[0],d=b[1],f=b[2],e=b[3],h=b[8],j=b[9],l=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*f-a*l;b[3]=i*e-a*k;b[8]=i*h+a*c;b[9]=i*j+a*d;b[10]=i*l+a*f;b[11]=i*k+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],h=b[4],j=b[5],l=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*f+a*l;b[3]=i*e+a*k;b[4]=i*h-a*c;b[5]=i*j-a*d;b[6]=i*l-a*f;b[7]=i*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,h=Math.sqrt(d*d+f*f+e*e),d=d/h,f=f/h,e=e/h,h=d*d,j=f*f,l=e*e,k=Math.cos(b),i=Math.sin(b),n=1-k,m=d*f*n,q=d*e*n,n=f*e*n,d=d*i,u=f*i,i=e*i,e=h+(1-h)*k,h=m+i,f=q-u,m=m-i,j=j+(1-j)*k,i=n+d,q=q+u,n=n-d,l=l+(1-l)*k,k=c[0],d=c[1],u=c[2],o=c[3],r=c[4],p=c[5],v=c[6],x=c[7],F=c[8],s=c[9],I=c[10],A=c[11];c[0]=e*k+h*r+f*F;c[1]=e*d+h*
+p+f*s;c[2]=e*u+h*v+f*I;c[3]=e*o+h*x+f*A;c[4]=m*k+j*r+i*F;c[5]=m*d+j*p+i*s;c[6]=m*u+j*v+i*I;c[7]=m*o+j*x+i*A;c[8]=q*k+n*r+l*F;c[9]=q*d+n*p+l*s;c[10]=q*u+n*v+l*I;c[11]=q*o+n*x+l*A;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);
 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,h=a.y,j=a.z,m=f*e,l=f*h;this.set(m*e+c,m*h-d*j,m*j+d*h,0,m*h+d*j,l*h+c,l*j-d*e,0,m*j-d*h,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 h=this.elements;h[0]=2*f/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*f/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(e+f)/(e-f);h[14]=-2*e*f/(e-f);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),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,e){var h=this.elements,j=b-a,m=c-d,l=e-f;h[0]=2/j;h[4]=0;h[8]=0;h[12]=-((b+a)/j);h[1]=0;h[5]=2/m;h[9]=0;h[13]=-((c+d)/m);h[2]=0;h[6]=0;h[10]=-2/l;h[14]=-((e+f)/l);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),f=1-c,e=a.x,h=a.y,j=a.z,l=f*e,k=f*h;this.set(l*e+c,l*h-d*j,l*j+d*h,0,l*h+d*j,k*h+c,k*j-d*e,0,l*j-d*h,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 h=this.elements;h[0]=2*f/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*f/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(e+f)/(e-f);h[14]=-2*e*f/(e-f);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),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,e){var h=this.elements,j=b-a,l=c-d,k=e-f;h[0]=2/j;h[4]=0;h[8]=0;h[12]=-((b+a)/j);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]=-((e+f)/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;
 a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
 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};
@@ -73,26 +73,26 @@ this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.s
 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);
 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.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)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 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)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a;if(e===h.length){a=new THREE.RenderableObject;h.push(a)}else a=h[e];e++;return a}function b(){var a;if(m===l.length){a=new THREE.RenderableVertex;l.push(a)}else a=l[m];m++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,j=-b.z+b.w;if(e>=0&&h>=0&&f>=0&&j>=0)return true;if(e<0&&h<0||f<0&&j<0)return false;e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h)));f<0?c=Math.max(c,f/(f-j)):j<0&&(d=Math.min(d,
-f/(f-j)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,e,h=[],j,m,l=[],i,o,k=[],s,r=[],n,q,p=[],v,C,B=[],u={objects:[],sprites:[],lights:[],elements:[]},J=new THREE.Vector3,z=new THREE.Vector4,N=new THREE.Matrix4,E=new THREE.Matrix4,H=new THREE.Frustum,G=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);N.multiply(b.projectionMatrix,b.matrixWorldInverse);N.multiplyVector3(a);return a};this.unprojectVector=
-function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);N.multiply(b.matrixWorld,b.projectionMatrixInverse);N.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;u.objects.length=0;u.sprites.length=0;u.lights.length=0;var h=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof
-THREE.Line)&&(b.frustumCulled===false||H.contains(b)===true)){J.copy(b.matrixWorld.getPosition());N.multiplyVector3(J);f=a();f.object=b;f.z=J.z;u.objects.push(f)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){J.copy(b.matrixWorld.getPosition());N.multiplyVector3(J);f=a();f.object=b;f.z=J.z;u.sprites.push(f)}else b instanceof THREE.Light&&u.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d===true&&u.objects.sort(c);return u};this.projectScene=function(a,
-e,h){var f=e.near,J=e.far,F=false,$,fa,I,ra,S,ba,aa,va,L,qa,xa,Aa,Pa,ja,Ba;C=q=s=o=0;u.elements.length=0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);N.multiply(e.projectionMatrix,e.matrixWorldInverse);H.setFromMatrix(N);u=this.projectGraph(a,false);a=0;for($=u.objects.length;a<$;a++){L=u.objects[a].object;qa=L.matrixWorld;m=0;if(L instanceof THREE.Mesh){xa=L.geometry;
-Aa=L.geometry.materials;ra=xa.vertices;Pa=xa.faces;ja=xa.faceVertexUvs;xa=L.matrixRotationWorld.extractRotation(qa);fa=0;for(I=ra.length;fa<I;fa++){j=b();j.positionWorld.copy(ra[fa]);qa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);N.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>f&&j.positionScreen.z<J}ra=0;for(fa=Pa.length;ra<fa;ra++){I=Pa[ra];
-if(I instanceof THREE.Face3){S=l[I.a];ba=l[I.b];aa=l[I.c];if(S.visible===true&&ba.visible===true&&aa.visible===true){F=(aa.positionScreen.x-S.positionScreen.x)*(ba.positionScreen.y-S.positionScreen.y)-(aa.positionScreen.y-S.positionScreen.y)*(ba.positionScreen.x-S.positionScreen.x)<0;if(L.doubleSided===true||F!==L.flipSided){va=void 0;if(o===k.length){va=new THREE.RenderableFace3;k.push(va)}else va=k[o];o++;i=va;i.v1.copy(S);i.v2.copy(ba);i.v3.copy(aa)}else continue}else continue}else if(I instanceof
-THREE.Face4){S=l[I.a];ba=l[I.b];aa=l[I.c];va=l[I.d];if(S.visible===true&&ba.visible===true&&aa.visible===true&&va.visible===true){F=(va.positionScreen.x-S.positionScreen.x)*(ba.positionScreen.y-S.positionScreen.y)-(va.positionScreen.y-S.positionScreen.y)*(ba.positionScreen.x-S.positionScreen.x)<0||(ba.positionScreen.x-aa.positionScreen.x)*(va.positionScreen.y-aa.positionScreen.y)-(ba.positionScreen.y-aa.positionScreen.y)*(va.positionScreen.x-aa.positionScreen.x)<0;if(L.doubleSided===true||F!==L.flipSided){Ba=
-void 0;if(s===r.length){Ba=new THREE.RenderableFace4;r.push(Ba)}else Ba=r[s];s++;i=Ba;i.v1.copy(S);i.v2.copy(ba);i.v3.copy(aa);i.v4.copy(va)}else continue}else continue}i.normalWorld.copy(I.normal);F===false&&(L.flipSided===true||L.doubleSided===true)&&i.normalWorld.negate();xa.multiplyVector3(i.normalWorld);i.centroidWorld.copy(I.centroid);qa.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);N.multiplyVector3(i.centroidScreen);aa=I.vertexNormals;S=0;for(ba=aa.length;S<ba;S++){va=
-i.vertexNormalsWorld[S];va.copy(aa[S]);F===false&&(L.flipSided===true||L.doubleSided===true)&&va.negate();xa.multiplyVector3(va)}S=0;for(ba=ja.length;S<ba;S++){Ba=ja[S][ra];if(Ba!==void 0){aa=0;for(va=Ba.length;aa<va;aa++)i.uvs[S][aa]=Ba[aa]}}i.material=L.material;i.faceMaterial=I.materialIndex!==null?Aa[I.materialIndex]:null;i.z=i.centroidScreen.z;u.elements.push(i)}}else if(L instanceof THREE.Line){E.multiply(N,qa);ra=L.geometry.vertices;S=b();S.positionScreen.copy(ra[0]);E.multiplyVector4(S.positionScreen);
-qa=L.type===THREE.LinePieces?2:1;fa=1;for(I=ra.length;fa<I;fa++){S=b();S.positionScreen.copy(ra[fa]);E.multiplyVector4(S.positionScreen);if(!((fa+1)%qa>0)){ba=l[m-2];G.copy(S.positionScreen);R.copy(ba.positionScreen);if(d(G,R)===true){G.multiplyScalar(1/G.w);R.multiplyScalar(1/R.w);Aa=void 0;if(q===p.length){Aa=new THREE.RenderableLine;p.push(Aa)}else Aa=p[q];q++;n=Aa;n.v1.positionScreen.copy(G);n.v2.positionScreen.copy(R);n.z=Math.max(G.z,R.z);n.material=L.material;u.elements.push(n)}}}}}a=0;for($=
-u.sprites.length;a<$;a++){L=u.sprites[a].object;qa=L.matrixWorld;if(L instanceof THREE.Particle){z.set(qa.elements[12],qa.elements[13],qa.elements[14],1);N.multiplyVector4(z);z.z=z.z/z.w;if(z.z>0&&z.z<1){f=void 0;if(C===B.length){f=new THREE.RenderableParticle;B.push(f)}else f=B[C];C++;v=f;v.x=z.x/z.w;v.y=z.y/z.w;v.z=z.z;v.rotation=L.rotation.z;v.scale.x=L.scale.x*Math.abs(v.x-(z.x+e.projectionMatrix.elements[0])/(z.w+e.projectionMatrix.elements[12]));v.scale.y=L.scale.y*Math.abs(v.y-(z.y+e.projectionMatrix.elements[5])/
-(z.w+e.projectionMatrix.elements[13]));v.material=L.material;u.elements.push(v)}}}h&&u.elements.sort(c);return u}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+THREE.Projector=function(){function a(){var a;if(e===h.length){a=new THREE.RenderableObject;h.push(a)}else a=h[e];e++;return a}function b(){var a;if(l===k.length){a=new THREE.RenderableVertex;k.push(a)}else a=k[l];l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,j=-b.z+b.w;if(e>=0&&h>=0&&f>=0&&j>=0)return true;if(e<0&&h<0||f<0&&j<0)return false;e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h)));f<0?c=Math.max(c,f/(f-j)):j<0&&(d=Math.min(d,
+f/(f-j)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,e,h=[],j,l,k=[],i,n,m=[],q,u=[],o,r,p=[],v,x,F=[],s={objects:[],sprites:[],lights:[],elements:[]},I=new THREE.Vector3,A=new THREE.Vector4,N=new THREE.Matrix4,D=new THREE.Matrix4,H=new THREE.Frustum,G=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);N.multiply(b.projectionMatrix,b.matrixWorldInverse);N.multiplyVector3(a);return a};this.unprojectVector=
+function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);N.multiply(b.matrixWorld,b.projectionMatrixInverse);N.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var h=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof
+THREE.Line)&&(b.frustumCulled===false||H.contains(b)===true)){I.copy(b.matrixWorld.getPosition());N.multiplyVector3(I);f=a();f.object=b;f.z=I.z;s.objects.push(f)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){I.copy(b.matrixWorld.getPosition());N.multiplyVector3(I);f=a();f.object=b;f.z=I.z;s.sprites.push(f)}else b instanceof THREE.Light&&s.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d===true&&s.objects.sort(c);return s};this.projectScene=function(a,
+e,h){var f=e.near,I=e.far,E=false,$,fa,J,ra,S,ba,aa,va,L,qa,xa,Aa,Pa,ja,Ba;x=r=q=n=0;s.elements.length=0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);N.multiply(e.projectionMatrix,e.matrixWorldInverse);H.setFromMatrix(N);s=this.projectGraph(a,false);a=0;for($=s.objects.length;a<$;a++){L=s.objects[a].object;qa=L.matrixWorld;l=0;if(L instanceof THREE.Mesh){xa=L.geometry;
+Aa=L.geometry.materials;ra=xa.vertices;Pa=xa.faces;ja=xa.faceVertexUvs;xa=L.matrixRotationWorld.extractRotation(qa);fa=0;for(J=ra.length;fa<J;fa++){j=b();j.positionWorld.copy(ra[fa]);qa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);N.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>f&&j.positionScreen.z<I}ra=0;for(fa=Pa.length;ra<fa;ra++){J=Pa[ra];
+if(J instanceof THREE.Face3){S=k[J.a];ba=k[J.b];aa=k[J.c];if(S.visible===true&&ba.visible===true&&aa.visible===true){E=(aa.positionScreen.x-S.positionScreen.x)*(ba.positionScreen.y-S.positionScreen.y)-(aa.positionScreen.y-S.positionScreen.y)*(ba.positionScreen.x-S.positionScreen.x)<0;if(L.doubleSided===true||E!==L.flipSided){va=void 0;if(n===m.length){va=new THREE.RenderableFace3;m.push(va)}else va=m[n];n++;i=va;i.v1.copy(S);i.v2.copy(ba);i.v3.copy(aa)}else continue}else continue}else if(J instanceof
+THREE.Face4){S=k[J.a];ba=k[J.b];aa=k[J.c];va=k[J.d];if(S.visible===true&&ba.visible===true&&aa.visible===true&&va.visible===true){E=(va.positionScreen.x-S.positionScreen.x)*(ba.positionScreen.y-S.positionScreen.y)-(va.positionScreen.y-S.positionScreen.y)*(ba.positionScreen.x-S.positionScreen.x)<0||(ba.positionScreen.x-aa.positionScreen.x)*(va.positionScreen.y-aa.positionScreen.y)-(ba.positionScreen.y-aa.positionScreen.y)*(va.positionScreen.x-aa.positionScreen.x)<0;if(L.doubleSided===true||E!==L.flipSided){Ba=
+void 0;if(q===u.length){Ba=new THREE.RenderableFace4;u.push(Ba)}else Ba=u[q];q++;i=Ba;i.v1.copy(S);i.v2.copy(ba);i.v3.copy(aa);i.v4.copy(va)}else continue}else continue}i.normalWorld.copy(J.normal);E===false&&(L.flipSided===true||L.doubleSided===true)&&i.normalWorld.negate();xa.multiplyVector3(i.normalWorld);i.centroidWorld.copy(J.centroid);qa.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);N.multiplyVector3(i.centroidScreen);aa=J.vertexNormals;S=0;for(ba=aa.length;S<ba;S++){va=
+i.vertexNormalsWorld[S];va.copy(aa[S]);E===false&&(L.flipSided===true||L.doubleSided===true)&&va.negate();xa.multiplyVector3(va)}S=0;for(ba=ja.length;S<ba;S++){Ba=ja[S][ra];if(Ba!==void 0){aa=0;for(va=Ba.length;aa<va;aa++)i.uvs[S][aa]=Ba[aa]}}i.material=L.material;i.faceMaterial=J.materialIndex!==null?Aa[J.materialIndex]:null;i.z=i.centroidScreen.z;s.elements.push(i)}}else if(L instanceof THREE.Line){D.multiply(N,qa);ra=L.geometry.vertices;S=b();S.positionScreen.copy(ra[0]);D.multiplyVector4(S.positionScreen);
+qa=L.type===THREE.LinePieces?2:1;fa=1;for(J=ra.length;fa<J;fa++){S=b();S.positionScreen.copy(ra[fa]);D.multiplyVector4(S.positionScreen);if(!((fa+1)%qa>0)){ba=k[l-2];G.copy(S.positionScreen);R.copy(ba.positionScreen);if(d(G,R)===true){G.multiplyScalar(1/G.w);R.multiplyScalar(1/R.w);Aa=void 0;if(r===p.length){Aa=new THREE.RenderableLine;p.push(Aa)}else Aa=p[r];r++;o=Aa;o.v1.positionScreen.copy(G);o.v2.positionScreen.copy(R);o.z=Math.max(G.z,R.z);o.material=L.material;s.elements.push(o)}}}}}a=0;for($=
+s.sprites.length;a<$;a++){L=s.sprites[a].object;qa=L.matrixWorld;if(L instanceof THREE.Particle){A.set(qa.elements[12],qa.elements[13],qa.elements[14],1);N.multiplyVector4(A);A.z=A.z/A.w;if(A.z>0&&A.z<1){f=void 0;if(x===F.length){f=new THREE.RenderableParticle;F.push(f)}else f=F[x];x++;v=f;v.x=A.x/A.w;v.y=A.y/A.w;v.z=A.z;v.rotation=L.rotation.z;v.scale.x=L.scale.x*Math.abs(v.x-(A.x+e.projectionMatrix.elements[0])/(A.w+e.projectionMatrix.elements[12]));v.scale.y=L.scale.y*Math.abs(v.y-(A.y+e.projectionMatrix.elements[5])/
+(A.w+e.projectionMatrix.elements[13]));v.material=L.material;s.elements.push(v)}}}h&&s.elements.sort(c);return s}};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),h=Math.sin(a.y/2),j=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=e*d*f+c*h*j;this.y=c*h*f-e*d*j;this.z=c*d*j+e*h*f;this.w=c*d*f-e*h*j}else if(b==="YXZ"){this.x=e*d*f+c*h*j;this.y=c*h*f-e*d*j;this.z=
 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),h=Math.sin(a.y/2),j=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=e*d*f+c*h*j;this.y=c*h*f-e*d*j;this.z=c*d*j+e*h*f;this.w=c*d*f-e*h*j}else if(b==="YXZ"){this.x=e*d*f+c*h*j;this.y=c*h*f-e*d*j;this.z=
 c*d*j-e*h*f;this.w=c*d*f+e*h*j}else if(b==="ZXY"){this.x=e*d*f-c*h*j;this.y=c*h*f+e*d*j;this.z=c*d*j+e*h*f;this.w=c*d*f-e*h*j}else if(b==="ZYX"){this.x=e*d*f-c*h*j;this.y=c*h*f+e*d*j;this.z=c*d*j-e*h*f;this.w=c*d*f+e*h*j}else if(b==="YZX"){this.x=e*d*f+c*h*j;this.y=c*h*f+e*d*j;this.z=c*d*j-e*h*f;this.w=c*d*f-e*h*j}else if(b==="XZY"){this.x=e*d*f-c*h*j;this.y=c*h*f-e*d*j;this.z=c*d*j+e*h*f;this.w=c*d*f+e*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*
 c*d*j-e*h*f;this.w=c*d*f+e*h*j}else if(b==="ZXY"){this.x=e*d*f-c*h*j;this.y=c*h*f+e*d*j;this.z=c*d*j+e*h*f;this.w=c*d*f-e*h*j}else if(b==="ZYX"){this.x=e*d*f-c*h*j;this.y=c*h*f+e*d*j;this.z=c*d*j-e*h*f;this.w=c*d*f+e*h*j}else if(b==="YZX"){this.x=e*d*f+c*h*j;this.y=c*h*f+e*d*j;this.z=c*d*j-e*h*f;this.w=c*d*f-e*h*j}else if(b==="XZY"){this.x=e*d*f-c*h*j;this.y=c*h*f-e*d*j;this.z=c*d*j+e*h*f;this.w=c*d*f+e*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],f=b[1],e=b[5],h=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-h)*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-h)/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=(h+m)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
-(d+j)/c;this.y=(h+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=
+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],h=b[9],j=b[2],l=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=(l-h)*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=(l-h)/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=(h+l)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
+(d+j)/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){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,h=a.y,j=a.z,a=a.w;this.x=b*a+f*e+c*j-d*h;this.y=c*a+f*h+d*e-b*j;this.z=d*a+f*j+b*h-c*e;this.w=f*a-b*e-c*h-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,
 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,h=a.y,j=a.z,a=a.w;this.x=b*a+f*e+c*j-d*h;this.y=c*a+f*h+d*e-b*j;this.z=d*a+f*j+b*h-c*e;this.w=f*a-b*e-c*h-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,
-e=this.x,h=this.y,j=this.z,m=this.w,l=m*c+h*f-j*d,i=m*d+j*c-e*f,o=m*f+e*d-h*c,c=-e*c-h*d-j*f;b.x=l*m+c*-e+i*-j-o*-h;b.y=i*m+c*-h+o*-e-l*-j;b.z=o*m+c*-j+l*-h-i*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,h=e*a.w+c*a.x+d*a.y+f*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=e;this.x=c;this.y=d;this.z=f;return this}var j=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.0010){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}h=Math.sin((1-b)*j)/m;j=Math.sin(b*j)/m;this.w=e*h+this.w*j;this.x=c*h+this.x*j;this.y=d*h+this.y*j;this.z=f*h+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+e=this.x,h=this.y,j=this.z,l=this.w,k=l*c+h*f-j*d,i=l*d+j*c-e*f,n=l*f+e*d-h*c,c=-e*c-h*d-j*f;b.x=k*l+c*-e+i*-j-n*-h;b.y=i*l+c*-h+n*-e-k*-j;b.z=n*l+c*-j+k*-h-i*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,h=e*a.w+c*a.x+d*a.y+f*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=e;this.x=c;this.y=d;this.z=f;return this}var j=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.0010){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}h=Math.sin((1-b)*j)/l;j=Math.sin(b*j)/l;this.w=e*h+this.w*j;this.x=c*h+this.x*j;this.y=d*h+this.y*j;this.z=f*h+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.0010){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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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.0010){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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.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();
 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,16 +106,16 @@ 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;
 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?
 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=
 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 h=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};h.push(m);j.push(l)}}h=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=h.faceNormals[c];l=h.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,S){j=a.vertices[b];m=a.vertices[c];
-l=a.vertices[d];i=h[e];o=h[f];k=h[S];s=m.x-j.x;r=l.x-j.x;n=m.y-j.y;q=l.y-j.y;p=m.z-j.z;v=l.z-j.z;C=o.u-i.u;B=k.u-i.u;u=o.v-i.v;J=k.v-i.v;z=1/(C*J-B*u);G.set((J*s-u*r)*z,(J*n-u*q)*z,(J*p-u*v)*z);R.set((C*r-B*s)*z,(C*q-B*n)*z,(C*v-B*p)*z);E[b].addSelf(G);E[c].addSelf(G);E[d].addSelf(G);H[b].addSelf(R);H[c].addSelf(R);H[d].addSelf(R)}var b,c,d,f,e,h,j,m,l,i,o,k,s,r,n,q,p,v,C,B,u,J,z,N,E=[],H=[],G=new THREE.Vector3,R=new THREE.Vector3,U=new THREE.Vector3,T=new THREE.Vector3,y=new THREE.Vector3;b=0;for(c=
-this.vertices.length;b<c;b++){E[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];h=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 K=["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++){y.copy(e.vertexNormals[d]);f=e[K[d]];N=E[f];U.copy(N);U.subSelf(y.multiplyScalar(y.dot(N))).normalize();
+[];var h=this.morphNormals[a].faceNormals,j=this.morphNormals[a].vertexNormals,l,k;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];l=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};h.push(l);j.push(k)}}h=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];
+l=h.faceNormals[c];k=h.vertexNormals[c];l.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,S){j=a.vertices[b];l=a.vertices[c];
+k=a.vertices[d];i=h[e];n=h[f];m=h[S];q=l.x-j.x;u=k.x-j.x;o=l.y-j.y;r=k.y-j.y;p=l.z-j.z;v=k.z-j.z;x=n.u-i.u;F=m.u-i.u;s=n.v-i.v;I=m.v-i.v;A=1/(x*I-F*s);G.set((I*q-s*u)*A,(I*o-s*r)*A,(I*p-s*v)*A);R.set((x*u-F*q)*A,(x*r-F*o)*A,(x*v-F*p)*A);D[b].addSelf(G);D[c].addSelf(G);D[d].addSelf(G);H[b].addSelf(R);H[c].addSelf(R);H[d].addSelf(R)}var b,c,d,f,e,h,j,l,k,i,n,m,q,u,o,r,p,v,x,F,s,I,A,N,D=[],H=[],G=new THREE.Vector3,R=new THREE.Vector3,U=new THREE.Vector3,T=new THREE.Vector3,z=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){D[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];h=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 K=["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++){z.copy(e.vertexNormals[d]);f=e[K[d]];N=D[f];U.copy(N);U.subSelf(z.multiplyScalar(z.dot(N))).normalize();
 T.cross(e.vertexNormals[d],N);f=T.dot(H[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(U.x,U.y,U.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=
 T.cross(e.vertexNormals[d],N);f=T.dot(H[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(U.x,U.y,U.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,h,j,m;e=0;for(h=this.vertices.length;e<h;e++){d=this.vertices[e];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,f=Math.pow(10,4),e,h,j,l;e=0;for(h=this.vertices.length;e<h;e++){d=this.vertices[e];d=
 [Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=e;b.push(this.vertices[e]);c[e]=b.length-1}else c[e]=c[a[d]]}e=0;for(h=this.faces.length;e<h;e++){a=this.faces[e];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}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(f=3;f>0;f--)if(d.indexOf(a["abcd"[f]])!==f){d.splice(f,1);this.faces[e]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);
 [Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=e;b.push(this.vertices[e]);c[e]=b.length-1}else c[e]=c[a[d]]}e=0;for(h=this.faces.length;e<h;e++){a=this.faces[e];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}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(f=3;f>0;f--)if(d.indexOf(a["abcd"[f]])!==f){d.splice(f,1);this.faces[e]=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++)(m=this.faceVertexUvs[d][e])&&m.splice(f,1);this.faces[e].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,h,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*h+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,e,h,j,m,l,i,o,k;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;e=Math.floor(f);h=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>this.points.length-2?this.points.length-1:e+1;c[3]=e>this.points.length-3?this.points.length-1:
-e+2;l=this.points[c[0]];i=this.points[c[1]];o=this.points[c[2]];k=this.points[c[3]];j=h*h;m=h*j;d.x=b(l.x,i.x,o.x,k.x,h,j,m);d.y=b(l.y,i.y,o.y,k.y,h,j,m);d.z=b(l.z,i.z,o.z,k.z,h,j,m);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,e=b=b=0,h=new THREE.Vector3,f=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=
+d=0;for(j=this.faceVertexUvs.length;d<j;d++)(l=this.faceVertexUvs[d][e])&&l.splice(f,1);this.faces[e].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,d,e,h,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*h+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,e,h,j,l,k,i,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;e=Math.floor(f);h=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>this.points.length-2?this.points.length-1:e+1;c[3]=e>this.points.length-3?this.points.length-1:
+e+2;k=this.points[c[0]];i=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];j=h*h;l=h*j;d.x=b(k.x,i.x,n.x,m.x,h,j,l);d.y=b(k.y,i.y,n.y,m.y,h,j,l);d.z=b(k.z,i.z,n.z,m.z,h,j,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,e=b=b=0,h=new THREE.Vector3,f=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);f.copy(d);i=i+f.distanceTo(h);h.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){j[b]=i;e=b}}j[j.length]=i;return{chunks:j,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,h,f,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];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<f-1;c++){d=e+c*(1/f)*(h-e);d=this.getPoint(d);
 a/c;d=this.getPoint(b);f.copy(d);i=i+f.distanceTo(h);h.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){j[b]=i;e=b}}j[j.length]=i;return{chunks:j,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,h,f,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];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<f-1;c++){d=e+c*(1/f)*(h-e);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)};
 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)};
 THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e: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.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e: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)};
@@ -131,62 +131,62 @@ this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.protot
 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/
 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=
 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,h,j){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
 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,h,j){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);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}h&&a[c].offset.set(h[0],h[1]);if(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[c].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[c].wrapT=e[j[1]]}f(a[c],b+"/"+d)}function h(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,wireframe:a.wireframe};
-if(a.shading){var i=a.shading.toLowerCase();i==="phong"?m="MeshPhongMaterial":i==="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.vertexColors!==void 0)if(a.vertexColors=="face")l.vertexColors=THREE.FaceColors;else if(a.vertexColors)l.vertexColors=THREE.VertexColors;
-if(a.colorDiffuse)l.color=h(a.colorDiffuse);else if(a.DbgColor)l.color=a.DbgColor;if(a.colorSpecular)l.specular=h(a.colorSpecular);if(a.colorAmbient)l.ambient=h(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.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;i=THREE.UniformsUtils.clone(m.uniforms);i.tNormal.texture=l.normalMap;if(a.mapNormalFactor)i.uNormalScale.value=a.mapNormalFactor;if(l.map){i.tDiffuse.texture=l.map;i.enableDiffuse.value=true}if(l.specularMap){i.tSpecular.texture=l.specularMap;i.enableSpecular.value=true}if(l.lightMap){i.tAO.texture=l.lightMap;
-i.enableAO.value=true}i.uDiffuseColor.value.setHex(l.color);i.uSpecularColor.value.setHex(l.specular);i.uAmbientColor.value.setHex(l.ambient);i.uShininess.value=l.shininess;if(l.opacity!==void 0)i.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:i,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)};
+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}h&&a[c].offset.set(h[0],h[1]);if(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[c].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[c].wrapT=e[j[1]]}f(a[c],b+"/"+d)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,l="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
+if(a.shading){var i=a.shading.toLowerCase();i==="phong"?l="MeshPhongMaterial":i==="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.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&&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.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){l=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(l.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:l.fragmentShader,vertexShader:l.vertexShader,uniforms:i,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),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
 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 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,f,d,e)}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.loadAjaxJSON=function(a,b,c,d,f,e){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,f,d,e)}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,f){var e=new XMLHttpRequest,h=c+"/"+a.buffers,j=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+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"))};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,h=c+"/"+a.buffers,j=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+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",h,true);e.responseType="arraybuffer";e.send(null)};
 e.open("GET",h,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,i,o,k,s,r,n,q,p,v,C,B;function u(a){return a%4?4-a%4:0}function J(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function N(b,c){var d,e,f,h,j,i,k,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];h=m[d*3+2];j=V[e*2];e=V[e*2+1];i=V[f*2];k=V[f*2+1];f=V[h*2];l=V[h*2+1];h=T.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(i,k));o.push(new THREE.UV(f,
-l));h.push(o)}}function E(b,c){var d,e,f,h,j,i,k,l,m,o,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];h=n[d*4+2];j=n[d*4+3];i=V[e*2];e=V[e*2+1];k=V[f*2];m=V[f*2+1];l=V[h*2];o=V[h*2+1];h=V[j*2];f=V[j*2+1];j=T.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(k,m));q.push(new THREE.UV(l,o));q.push(new THREE.UV(h,f));j.push(q)}}function H(b,c,d){for(var e,f,h,j,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];h=c[d*3+2];j=i[d];
-T.faces.push(new THREE.Face3(e,f,h,null,null,j))}}function G(b,c,d){for(var e,f,h,j,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];h=c[d*4+2];j=c[d*4+3];i=k[d];T.faces.push(new THREE.Face4(e,f,h,j,null,null,i))}}function R(b,c,d,e){for(var f,h,j,i,k,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];h=c[e*3+1];j=c[e*3+2];k=d[e*3];l=d[e*3+1];m=d[e*3+2];i=o[e];var n=K[l*3],q=K[l*3+1];l=K[l*3+2];var r=K[m*3],
-p=K[m*3+1];m=K[m*3+2];T.faces.push(new THREE.Face3(f,h,j,[new THREE.Vector3(K[k*3],K[k*3+1],K[k*3+2]),new THREE.Vector3(n,q,l),new THREE.Vector3(r,p,m)],null,i))}}function U(b,c,d,e){for(var f,h,j,i,k,l,m,o,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];h=c[e*4+1];j=c[e*4+2];i=c[e*4+3];l=d[e*4];m=d[e*4+1];o=d[e*4+2];n=d[e*4+3];k=q[e];var r=K[m*3],p=K[m*3+1];m=K[m*3+2];var s=K[o*3],v=K[o*3+1];o=K[o*3+2];var u=K[n*3],y=K[n*3+1];n=K[n*3+2];T.faces.push(new THREE.Face4(f,
-h,j,i,[new THREE.Vector3(K[l*3],K[l*3+1],K[l*3+2]),new THREE.Vector3(r,p,m),new THREE.Vector3(s,v,o),new THREE.Vector3(u,y,n)],null,k))}}var T=this,y=0,K=[],V=[],F,$,fa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(T,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,y,12);c=J(a,y+12);J(a,y+13);J(a,y+14);J(a,y+15);f=J(a,y+16);m=J(a,y+17);l=J(a,y+18);i=J(a,y+19);o=z(a,y+20);k=z(a,y+20+4);s=z(a,y+20+8);b=z(a,y+20+12);
-r=z(a,y+20+16);n=z(a,y+20+20);q=z(a,y+20+24);p=z(a,y+20+28);v=z(a,y+20+32);C=z(a,y+20+36);B=z(a,y+20+40);y=y+c;c=f*3+i;fa=f*4+i;F=b*c;$=r*(c+m*3);f=n*(c+l*3);i=q*(c+m*3+l*3);c=p*fa;m=v*(fa+m*4);l=C*(fa+l*4);y=y+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];T.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(y);y=y+function(b){if(k){var b=new Int8Array(a,b,k*3),c,d,e,f;for(c=0;c<k;c++){d=b[c*3];e=b[c*3+1];f=b[c*
-3+2];K.push(d/127,e/127,f/127)}}return k*3*Int8Array.BYTES_PER_ELEMENT}(y);y=y+u(k*3);y=y+function(b){if(s){var b=new Float32Array(a,b,s*2),c,d,e;for(c=0;c<s;c++){d=b[c*2];e=b[c*2+1];V.push(d,e)}}return s*2*Float32Array.BYTES_PER_ELEMENT}(y);F=y+F+u(b*2);$=F+$+u(r*2);f=$+f+u(n*2);i=f+i+u(q*2);c=i+c+u(p*2);m=c+m+u(v*2);l=m+l+u(C*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;H(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);N(n,b)}})($);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*
-3,c=b+q*Uint32Array.BYTES_PER_ELEMENT*3;R(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);N(q,c)}})(f);(function(a){if(C){var b=a+C*Uint32Array.BYTES_PER_ELEMENT*4;G(C,a,b+C*Uint32Array.BYTES_PER_ELEMENT*4);E(C,b)}})(m);(function(a){if(B){var b=a+B*Uint32Array.BYTES_PER_ELEMENT*4,c=b+B*Uint32Array.BYTES_PER_ELEMENT*4;U(B,a,b,c+B*Uint32Array.BYTES_PER_ELEMENT*4);E(B,c)}})(l);b&&H(b,y,y+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;R(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(F);p&&G(p,i,i+p*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;U(v,a,b,b+v*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.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,l,k,i,n,m,q,u,o,r,p,v,x,F;function s(a){return a%4?4-a%4:0}function I(a,b){return(new Uint8Array(a,b,1))[0]}function A(a,b){return(new Uint32Array(a,b,1))[0]}function N(b,c){var d,e,f,h,j,i,k,n,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];h=l[d*3+2];j=V[e*2];e=V[e*2+1];i=V[f*2];k=V[f*2+1];f=V[h*2];n=V[h*2+1];h=T.faceVertexUvs[0];var m=[];m.push(new THREE.UV(j,e));m.push(new THREE.UV(i,k));m.push(new THREE.UV(f,
+n));h.push(m)}}function D(b,c){var d,e,f,h,j,i,k,l,n,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];h=o[d*4+2];j=o[d*4+3];i=V[e*2];e=V[e*2+1];k=V[f*2];n=V[f*2+1];l=V[h*2];m=V[h*2+1];h=V[j*2];f=V[j*2+1];j=T.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(k,n));q.push(new THREE.UV(l,m));q.push(new THREE.UV(h,f));j.push(q)}}function H(b,c,d){for(var e,f,h,j,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];h=c[d*3+2];j=i[d];
+T.faces.push(new THREE.Face3(e,f,h,null,null,j))}}function G(b,c,d){for(var e,f,h,j,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];h=c[d*4+2];j=c[d*4+3];i=k[d];T.faces.push(new THREE.Face4(e,f,h,j,null,null,i))}}function R(b,c,d,e){for(var f,h,j,i,k,l,n,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];h=c[e*3+1];j=c[e*3+2];k=d[e*3];l=d[e*3+1];n=d[e*3+2];i=m[e];var o=K[l*3],q=K[l*3+1];l=K[l*3+2];var r=K[n*3],
+p=K[n*3+1];n=K[n*3+2];T.faces.push(new THREE.Face3(f,h,j,[new THREE.Vector3(K[k*3],K[k*3+1],K[k*3+2]),new THREE.Vector3(o,q,l),new THREE.Vector3(r,p,n)],null,i))}}function U(b,c,d,e){for(var f,h,j,i,k,l,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];h=c[e*4+1];j=c[e*4+2];i=c[e*4+3];l=d[e*4];n=d[e*4+1];m=d[e*4+2];o=d[e*4+3];k=q[e];var r=K[n*3],p=K[n*3+1];n=K[n*3+2];var u=K[m*3],s=K[m*3+1];m=K[m*3+2];var v=K[o*3],x=K[o*3+1];o=K[o*3+2];T.faces.push(new THREE.Face4(f,
+h,j,i,[new THREE.Vector3(K[l*3],K[l*3+1],K[l*3+2]),new THREE.Vector3(r,p,n),new THREE.Vector3(u,s,m),new THREE.Vector3(v,x,o)],null,k))}}var T=this,z=0,K=[],V=[],E,$,fa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(T,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,z,12);c=I(a,z+12);I(a,z+13);I(a,z+14);I(a,z+15);f=I(a,z+16);l=I(a,z+17);k=I(a,z+18);i=I(a,z+19);n=A(a,z+20);m=A(a,z+20+4);q=A(a,z+20+8);b=A(a,z+20+12);
+u=A(a,z+20+16);o=A(a,z+20+20);r=A(a,z+20+24);p=A(a,z+20+28);v=A(a,z+20+32);x=A(a,z+20+36);F=A(a,z+20+40);z=z+c;c=f*3+i;fa=f*4+i;E=b*c;$=u*(c+l*3);f=o*(c+k*3);i=r*(c+l*3+k*3);c=p*fa;l=v*(fa+l*4);k=x*(fa+k*4);z=z+function(b){var b=new Float32Array(a,b,n*3),c,d,e,f;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];T.vertices.push(new THREE.Vector3(d,e,f))}return n*3*Float32Array.BYTES_PER_ELEMENT}(z);z=z+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*
+3+2];K.push(d/127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(z);z=z+s(m*3);z=z+function(b){if(q){var b=new Float32Array(a,b,q*2),c,d,e;for(c=0;c<q;c++){d=b[c*2];e=b[c*2+1];V.push(d,e)}}return q*2*Float32Array.BYTES_PER_ELEMENT}(z);E=z+E+s(b*2);$=E+$+s(u*2);f=$+f+s(o*2);i=f+i+s(r*2);c=i+c+s(p*2);l=c+l+s(v*2);k=l+k+s(x*2);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*3;H(o,a,b+o*Uint32Array.BYTES_PER_ELEMENT*3);N(o,b)}})($);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*
+3,c=b+r*Uint32Array.BYTES_PER_ELEMENT*3;R(r,a,b,c+r*Uint32Array.BYTES_PER_ELEMENT*3);N(r,c)}})(f);(function(a){if(x){var b=a+x*Uint32Array.BYTES_PER_ELEMENT*4;G(x,a,b+x*Uint32Array.BYTES_PER_ELEMENT*4);D(x,b)}})(l);(function(a){if(F){var b=a+F*Uint32Array.BYTES_PER_ELEMENT*4,c=b+F*Uint32Array.BYTES_PER_ELEMENT*4;U(F,a,b,c+F*Uint32Array.BYTES_PER_ELEMENT*4);D(F,c)}})(k);b&&H(b,z,z+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*3;R(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*
+3)}})(E);p&&G(p,i,i+p*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;U(v,a,b,b+v*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){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},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.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},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.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.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,h=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){h===0&&(h=e.getResponseHeader("Content-Length"));
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,h=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){h===0&&(h=e.getResponseHeader("Content-Length"));
 f({total:h,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(h=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)};
 f({total:h,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(h=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,i,o,k,s,r,n,q,p,v,C,B=a.faces;o=a.vertices;var u=a.normals,J=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}l=0;for(i=o.length;l<i;){k=new THREE.Vector3;k.x=o[l++]*b;k.y=o[l++]*b;k.z=o[l++]*b;d.vertices.push(k)}l=0;for(i=B.length;l<i;){b=B[l++];o=b&1;m=b&2;c=b&
-4;f=b&8;s=b&16;k=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=B[l++];q.b=B[l++];q.c=B[l++];q.d=B[l++];o=4}else{q=new THREE.Face3;q.a=B[l++];q.b=B[l++];q.c=B[l++];o=3}if(m){m=B[l++];q.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<z;c++){p=a.uvs[c];r=B[l++];C=p[r*2];r=p[r*2+1];d.faceUvs[c][m]=new THREE.UV(C,r)}if(f)for(c=0;c<z;c++){p=a.uvs[c];v=[];for(f=0;f<o;f++){r=B[l++];C=p[r*2];r=p[r*2+1];v[f]=new THREE.UV(C,r)}d.faceVertexUvs[c][m]=v}if(s){s=B[l++]*3;f=new THREE.Vector3;f.x=u[s++];f.y=u[s++];
-f.z=u[s];q.normal=f}if(k)for(c=0;c<o;c++){s=B[l++]*3;f=new THREE.Vector3;f.x=u[s++];f.y=u[s++];f.z=u[s];q.vertexNormals.push(f)}if(n){k=B[l++];k=new THREE.Color(J[k]);q.color=k}if(b)for(c=0;c<o;c++){k=B[l++];k=new THREE.Color(J[k]);q.vertexColors.push(k)}d.faces.push(q)}})(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,i,o;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];i=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;m=0;for(l=o.length;m<l;m=m+3){var k=new THREE.Vector3;k.x=o[m]*b;k.y=o[m+1]*b;k.z=o[m+2]*b;i.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;i=a.morphColors[c].colors;b=0;for(m=i.length;b<m;b=b+3){o=new THREE.Color(16755200);o.setRGB(i[b],i[b+1],i[b+2]);l.push(o)}}}})(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,l,k,i,n,m,q,u,o,r,p,v,x,F=a.faces;n=a.vertices;var s=a.normals,I=a.colors,A=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&A++;for(c=0;c<A;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(i=n.length;k<i;){m=new THREE.Vector3;m.x=n[k++]*b;m.y=n[k++]*b;m.z=n[k++]*b;d.vertices.push(m)}k=0;for(i=F.length;k<i;){b=F[k++];n=b&1;l=b&2;c=b&
+4;f=b&8;q=b&16;m=b&32;o=b&64;b=b&128;if(n){r=new THREE.Face4;r.a=F[k++];r.b=F[k++];r.c=F[k++];r.d=F[k++];n=4}else{r=new THREE.Face3;r.a=F[k++];r.b=F[k++];r.c=F[k++];n=3}if(l){l=F[k++];r.materialIndex=l}l=d.faces.length;if(c)for(c=0;c<A;c++){p=a.uvs[c];u=F[k++];x=p[u*2];u=p[u*2+1];d.faceUvs[c][l]=new THREE.UV(x,u)}if(f)for(c=0;c<A;c++){p=a.uvs[c];v=[];for(f=0;f<n;f++){u=F[k++];x=p[u*2];u=p[u*2+1];v[f]=new THREE.UV(x,u)}d.faceVertexUvs[c][l]=v}if(q){q=F[k++]*3;f=new THREE.Vector3;f.x=s[q++];f.y=s[q++];
+f.z=s[q];r.normal=f}if(m)for(c=0;c<n;c++){q=F[k++]*3;f=new THREE.Vector3;f.x=s[q++];f.y=s[q++];f.z=s[q];r.vertexNormals.push(f)}if(o){m=F[k++];m=new THREE.Color(I[m]);r.color=m}if(b)for(c=0;c<n;c++){m=F[k++];m=new THREE.Color(I[m]);r.vertexColors.push(m)}d.faces.push(r)}})(f);(function(){var b,c,f,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];l=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,l,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){f=a.skinIndices[b];l=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,l,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,l,k,i,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=[];i=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;l=0;for(k=n.length;l<k;l=l+3){var m=new THREE.Vector3;m.x=n[l]*b;m.y=n[l+1]*b;m.z=n[l+2]*b;i.push(m)}}}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;i=a.morphColors[c].colors;b=0;for(l=i.length;b<l;b=b+3){n=new THREE.Color(16755200);n.setRGB(i[b],i[b+1],i[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",
 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 h=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,h,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}h&&a[d].offset.set(h[0],h[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 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)},i=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},o="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:h.wireframe};if(h.shading){var s=h.shading.toLowerCase();s==="phong"?o="MeshPhongMaterial":s==="basic"&&(o="MeshBasicMaterial")}if(h.blending!==void 0&&THREE[h.blending]!==void 0)k.blending=
-THREE[h.blending];if(h.transparent!==void 0||h.opacity<1)k.transparent=h.transparent;if(h.depthTest!==void 0)k.depthTest=h.depthTest;if(h.depthWrite!==void 0)k.depthWrite=h.depthWrite;if(h.vertexColors!==void 0)if(h.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(h.vertexColors)k.vertexColors=THREE.VertexColors;if(h.colorDiffuse)k.color=i(h.colorDiffuse);else if(h.DbgColor)k.color=h.DbgColor;if(h.colorSpecular)k.specular=i(h.colorSpecular);if(h.colorAmbient)k.ambient=i(h.colorAmbient);
-if(h.transparency)k.opacity=h.transparency;if(h.specularCoef)k.shininess=h.specularCoef;h.mapDiffuse&&l(k,"map",h.mapDiffuse,h.mapDiffuseRepeat,h.mapDiffuseOffset,h.mapDiffuseWrap);h.mapLight&&l(k,"lightMap",h.mapLight,h.mapLightRepeat,h.mapLightOffset,h.mapLightWrap);h.mapNormal&&l(k,"normalMap",h.mapNormal,h.mapNormalRepeat,h.mapNormalOffset,h.mapNormalWrap);h.mapSpecular&&l(k,"specularMap",h.mapSpecular,h.mapSpecularRepeat,h.mapSpecularOffset,h.mapSpecularWrap);if(h.mapNormal){l=THREE.ShaderUtils.lib.normal;
-i=THREE.UniformsUtils.clone(l.uniforms);i.tNormal.texture=k.normalMap;if(h.mapNormalFactor)i.uNormalScale.value=h.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:l.fragmentShader,vertexShader:l.vertexShader,uniforms:i,lights:true,fog:true})}else k=new THREE[o](k);if(h.DbgName!==void 0)k.name=h.DbgName;d.materials[e]=k}}var h=a.faces,r=a.vertices,k=a.normals,l=a.colors,i=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&i++;for(e=0;e<i;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}o=0;for(s=r.length;o<s;){var n=new THREE.Vector3;n.x=r[o++]*f;n.y=r[o++]*f;n.z=r[o++]*f;d.vertices.push(n)}o=0;for(s=h.length;o<
-s;){var q=h[o++],p=q&2,e=q&4,v=q&8,C=q&16,r=q&32,B=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 u=4}else{q=new THREE.Face3;q.a=h[o++];q.b=h[o++];q.c=h[o++];u=3}if(p){p=h[o++];q.materialIndex=p}var J=d.faces.length;if(e)for(e=0;e<i;e++){var z=a.uvs[e],p=h[o++],N=z[p*2],p=z[p*2+1];d.faceUvs[e][J]=new THREE.UV(N,p)}if(v)for(e=0;e<i;e++){for(var z=a.uvs[e],v=[],E=0;E<u;E++){p=h[o++];N=z[p*2];p=z[p*2+1];v[E]=new THREE.UV(N,p)}d.faceVertexUvs[e][J]=v}if(C){C=h[o++]*
-3;p=new THREE.Vector3;p.x=k[C++];p.y=k[C++];p.z=k[C];q.normal=p}if(r)for(e=0;e<u;e++){C=h[o++]*3;p=new THREE.Vector3;p.x=k[C++];p.y=k[C++];p.z=k[C];q.vertexNormals.push(p)}if(B){r=h[o++];q.color=new THREE.Color(l[r])}if(n)for(e=0;e<u;e++){r=h[o++];q.vertexColors.push(new THREE.Color(l[r]))}d.faces.push(q)}if(a.skinWeights){e=0;for(h=a.skinWeights.length;e<h;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(h=a.skinIndices.length;e<h;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(h=a.morphTargets.length;e<h;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;p=0;for(i=l.length;p<i;p=p+3){n=new THREE.Vector3;n.x=l[p]*f;n.y=l[p+1]*f;n.z=l[p+2]*f;k.push(n)}}}if(a.morphColors){e=0;for(h=a.morphColors.length;e<h;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(i=l.length;k<i;k=k+3){o=new THREE.Color(16755200);o.setRGB(l[k],l[k+1],l[k+2]);f.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(){}};
+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 h=a.materials[e],j=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,e,f,h,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}h&&a[d].offset.set(h[0],h[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 k=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!j(a.width)||!j(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+"/"+e);b&&b.add(a)},i=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},n="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:h.wireframe};if(h.shading){var q=h.shading.toLowerCase();q==="phong"?n="MeshPhongMaterial":q==="basic"&&(n="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;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.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[n](m);if(h.DbgName!==void 0)m.name=h.DbgName;d.materials[e]=m}}var h=a.faces,u=a.vertices,m=a.normals,k=a.colors,i=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&i++;for(e=0;e<i;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(q=u.length;n<q;){var o=new THREE.Vector3;o.x=u[n++]*f;o.y=u[n++]*f;o.z=u[n++]*f;d.vertices.push(o)}n=0;for(q=h.length;n<
+q;){var r=h[n++],p=r&2,e=r&4,v=r&8,x=r&16,u=r&32,F=r&64,o=r&128;if(r&1){r=new THREE.Face4;r.a=h[n++];r.b=h[n++];r.c=h[n++];r.d=h[n++];var s=4}else{r=new THREE.Face3;r.a=h[n++];r.b=h[n++];r.c=h[n++];s=3}if(p){p=h[n++];r.materialIndex=p}var I=d.faces.length;if(e)for(e=0;e<i;e++){var A=a.uvs[e],p=h[n++],N=A[p*2],p=A[p*2+1];d.faceUvs[e][I]=new THREE.UV(N,p)}if(v)for(e=0;e<i;e++){for(var A=a.uvs[e],v=[],D=0;D<s;D++){p=h[n++];N=A[p*2];p=A[p*2+1];v[D]=new THREE.UV(N,p)}d.faceVertexUvs[e][I]=v}if(x){x=h[n++]*
+3;p=new THREE.Vector3;p.x=m[x++];p.y=m[x++];p.z=m[x];r.normal=p}if(u)for(e=0;e<s;e++){x=h[n++]*3;p=new THREE.Vector3;p.x=m[x++];p.y=m[x++];p.z=m[x];r.vertexNormals.push(p)}if(F){u=h[n++];r.color=new THREE.Color(k[u])}if(o)for(e=0;e<s;e++){u=h[n++];r.vertexColors.push(new THREE.Color(k[u]))}d.faces.push(r)}if(a.skinWeights){e=0;for(h=a.skinWeights.length;e<h;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(h=a.skinIndices.length;e<h;e=e+
+2){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],m,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(h=a.morphTargets.length;e<h;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];m=d.morphTargets[e].vertices;k=a.morphTargets[e].vertices;p=0;for(i=k.length;p<i;p=p+3){o=new THREE.Vector3;o.x=k[p]*f;o.y=k[p+1]*f;o.z=k[p+2]*f;m.push(o)}}}if(a.morphColors){e=0;for(h=a.morphColors.length;e<h;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;m=0;for(i=k.length;m<i;m=m+3){n=new THREE.Color(16755200);n.setRGB(k[m],k[m+1],k[m+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.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.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(){var a;for(k in y.objects)if(!I.objects[k]){p=y.objects[k];if(p.geometry!==void 0){if(G=I.geometries[p.geometry]){a=false;R=I.materials[p.materials[0]];(a=R instanceof THREE.ShaderMaterial)&&G.computeTangents();u=p.position;J=p.rotation;z=p.quaternion;N=p.scale;v=p.matrix;z=0;p.materials.length==0&&(R=new THREE.MeshFaceMaterial);p.materials.length>1&&(R=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(G,R);a.name=k;if(v){a.matrixAutoUpdate=false;a.matrix.set(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13],v[14],v[15])}else{a.position.set(u[0],u[1],u[2]);if(z){a.quaternion.set(z[0],z[1],z[2],z[3]);a.useQuaternion=true}else a.rotation.set(J[0],J[1],J[2]);a.scale.set(N[0],N[1],N[2])}a.visible=p.visible;a.doubleSided=p.doubleSided;a.castShadow=p.castShadow;a.receiveShadow=p.receiveShadow;I.scene.add(a);I.objects[k]=a}}else{u=p.position;J=p.rotation;z=p.quaternion;
-N=p.scale;z=0;a=new THREE.Object3D;a.name=k;a.position.set(u[0],u[1],u[2]);if(z){a.quaternion.set(z[0],z[1],z[2],z[3]);a.useQuaternion=true}else a.rotation.set(J[0],J[1],J[2]);a.scale.set(N[0],N[1],N[2]);a.visible=p.visible!==void 0?p.visible:false;I.scene.add(a);I.objects[k]=a;I.empties[k]=a}}}function e(a){return function(b){I.geometries[a]=b;f();V=V-1;m.onLoadComplete();j()}}function h(a){return function(b){I.geometries[a]=b}}function j(){m.callbackProgress({totalModels:$,totalTextures:fa,loadedModels:$-
-V,loadedTextures:fa-F},I);m.onLoadProgress();V===0&&F===0&&b(I)}var m=this,l=THREE.Loader.prototype.extractUrlBase(c),i,o,k,s,r,n,q,p,v,C,B,u,J,z,N,E,H,G,R,U,T,y,K,V,F,$,fa,I;y=a;c=new THREE.BinaryLoader;K=new THREE.JSONLoader;F=V=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(y.transform){a=y.transform.position;C=y.transform.rotation;E=y.transform.scale;a&&I.scene.position.set(a[0],a[1],a[2]);C&&I.scene.rotation.set(C[0],C[1],
-C[2]);E&&I.scene.scale.set(E[0],E[1],E[2]);if(a||C||E){I.scene.updateMatrix();I.scene.updateMatrixWorld()}}a=function(a){return function(){F=F-a;j();m.onLoadComplete()}};for(r in y.cameras){E=y.cameras[r];E.type==="perspective"?U=new THREE.PerspectiveCamera(E.fov,E.aspect,E.near,E.far):E.type==="ortho"&&(U=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far));u=E.position;C=E.target;E=E.up;U.position.set(u[0],u[1],u[2]);U.target=new THREE.Vector3(C[0],C[1],C[2]);E&&U.up.set(E[0],
-E[1],E[2]);I.cameras[r]=U}for(s in y.lights){C=y.lights[s];r=C.color!==void 0?C.color:16777215;U=C.intensity!==void 0?C.intensity:1;if(C.type==="directional"){u=C.direction;B=new THREE.DirectionalLight(r,U);B.position.set(u[0],u[1],u[2]);B.position.normalize()}else if(C.type==="point"){u=C.position;B=C.distance;B=new THREE.PointLight(r,U,B);B.position.set(u[0],u[1],u[2])}else C.type==="ambient"&&(B=new THREE.AmbientLight(r));I.scene.add(B);I.lights[s]=B}for(n in y.fogs){s=y.fogs[n];s.type==="linear"?
-T=new THREE.Fog(0,s.near,s.far):s.type==="exp2"&&(T=new THREE.FogExp2(0,s.density));E=s.color;T.color.setRGB(E[0],E[1],E[2]);I.fogs[n]=T}if(I.cameras&&y.defaults.camera)I.currentCamera=I.cameras[y.defaults.camera];if(I.fogs&&y.defaults.fog)I.scene.fog=I.fogs[y.defaults.fog];E=y.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(E[0],E[1],E[2]);I.bgColorAlpha=y.defaults.bgalpha;for(i in y.geometries){n=y.geometries[i];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){V=V+1;m.onLoadStart()}}$=V;
-for(i in y.geometries){n=y.geometries[i];if(n.type==="cube"){G=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);I.geometries[i]=G}else if(n.type==="plane"){G=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);I.geometries[i]=G}else if(n.type==="sphere"){G=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);I.geometries[i]=G}else if(n.type==="cylinder"){G=new THREE.CylinderGeometry(n.topRad,
-n.botRad,n.height,n.radSegs,n.heightSegs);I.geometries[i]=G}else if(n.type==="torus"){G=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);I.geometries[i]=G}else if(n.type==="icosahedron"){G=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);I.geometries[i]=G}else if(n.type==="bin_mesh")c.load(d(n.url,y.urlBaseType),e(i));else if(n.type==="ascii_mesh")K.load(d(n.url,y.urlBaseType),e(i));else if(n.type==="embedded_mesh"){n=y.embeds[n.id];n.metadata=y.metadata;n&&K.createModel(n,h(i),
-"")}}for(q in y.textures){i=y.textures[q];if(i.url instanceof Array){F=F+i.url.length;for(n=0;n<i.url.length;n++)m.onLoadStart()}else{F=F+1;m.onLoadStart()}}fa=F;for(q in y.textures){i=y.textures[q];if(i.mapping!==void 0&&THREE[i.mapping]!==void 0)i.mapping=new THREE[i.mapping];if(i.url instanceof Array){n=i.url.length;T=[];for(c=0;c<n;c++)T[c]=d(i.url[c],y.urlBaseType);n=THREE.ImageUtils.loadTextureCube(T,i.mapping,a(n))}else{n=THREE.ImageUtils.loadTexture(d(i.url,y.urlBaseType),i.mapping,a(1));
-if(THREE[i.minFilter]!==void 0)n.minFilter=THREE[i.minFilter];if(THREE[i.magFilter]!==void 0)n.magFilter=THREE[i.magFilter];if(i.repeat){n.repeat.set(i.repeat[0],i.repeat[1]);if(i.repeat[0]!==1)n.wrapS=THREE.RepeatWrapping;if(i.repeat[1]!==1)n.wrapT=THREE.RepeatWrapping}i.offset&&n.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)n.wrapS=T[i.wrap[0]];if(T[i.wrap[1]]!==void 0)n.wrapT=T[i.wrap[1]]}}I.textures[q]=
-n}for(o in y.materials){v=y.materials[o];for(H in v.parameters)if(H==="envMap"||H==="map"||H==="lightMap")v.parameters[H]=I.textures[v.parameters[H]];else if(H==="shading")v.parameters[H]=v.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H==="blending")v.parameters[H]=v.parameters[H]in THREE?THREE[v.parameters[H]]:THREE.NormalBlending;else if(H==="combine")v.parameters[H]=v.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==="vertexColors")if(v.parameters[H]==
-"face")v.parameters[H]=THREE.FaceColors;else if(v.parameters[H])v.parameters[H]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=true;if(v.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);i=v.parameters.color;n=v.parameters.specular;T=v.parameters.ambient;c=v.parameters.shininess;a.tNormal.texture=I.textures[v.parameters.normalMap];if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;
-if(v.parameters.map){a.tDiffuse.texture=v.parameters.map;a.enableDiffuse.value=true}if(v.parameters.lightMap){a.tAO.texture=v.parameters.lightMap;a.enableAO.value=true}if(v.parameters.specularMap){a.tSpecular.texture=I.textures[v.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(T);a.uShininess.value=c;if(v.parameters.opacity)a.uOpacity.value=v.parameters.opacity;R=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,
-vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else R=new THREE[v.type](v.parameters);I.materials[o]=R}f();m.callbackSync(I);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(){var a;for(m in z.objects)if(!J.objects[m]){p=z.objects[m];if(p.geometry!==void 0){if(G=J.geometries[p.geometry]){a=false;R=J.materials[p.materials[0]];(a=R instanceof THREE.ShaderMaterial)&&G.computeTangents();s=p.position;I=p.rotation;A=p.quaternion;N=p.scale;v=p.matrix;A=0;p.materials.length==0&&(R=new THREE.MeshFaceMaterial);p.materials.length>1&&(R=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(G,R);a.name=m;if(v){a.matrixAutoUpdate=false;a.matrix.set(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13],v[14],v[15])}else{a.position.set(s[0],s[1],s[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(I[0],I[1],I[2]);a.scale.set(N[0],N[1],N[2])}a.visible=p.visible;a.doubleSided=p.doubleSided;a.castShadow=p.castShadow;a.receiveShadow=p.receiveShadow;J.scene.add(a);J.objects[m]=a}}else{s=p.position;I=p.rotation;A=p.quaternion;
+N=p.scale;A=0;a=new THREE.Object3D;a.name=m;a.position.set(s[0],s[1],s[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(I[0],I[1],I[2]);a.scale.set(N[0],N[1],N[2]);a.visible=p.visible!==void 0?p.visible:false;J.scene.add(a);J.objects[m]=a;J.empties[m]=a}}}function e(a){return function(b){J.geometries[a]=b;f();V=V-1;l.onLoadComplete();j()}}function h(a){return function(b){J.geometries[a]=b}}function j(){l.callbackProgress({totalModels:$,totalTextures:fa,loadedModels:$-
+V,loadedTextures:fa-E},J);l.onLoadProgress();V===0&&E===0&&b(J)}var l=this,k=THREE.Loader.prototype.extractUrlBase(c),i,n,m,q,u,o,r,p,v,x,F,s,I,A,N,D,H,G,R,U,T,z,K,V,E,$,fa,J;z=a;c=new THREE.BinaryLoader;K=new THREE.JSONLoader;E=V=0;J={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(z.transform){a=z.transform.position;x=z.transform.rotation;D=z.transform.scale;a&&J.scene.position.set(a[0],a[1],a[2]);x&&J.scene.rotation.set(x[0],x[1],
+x[2]);D&&J.scene.scale.set(D[0],D[1],D[2]);if(a||x||D){J.scene.updateMatrix();J.scene.updateMatrixWorld()}}a=function(a){return function(){E=E-a;j();l.onLoadComplete()}};for(u in z.cameras){D=z.cameras[u];D.type==="perspective"?U=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type==="ortho"&&(U=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far));s=D.position;x=D.target;D=D.up;U.position.set(s[0],s[1],s[2]);U.target=new THREE.Vector3(x[0],x[1],x[2]);D&&U.up.set(D[0],
+D[1],D[2]);J.cameras[u]=U}for(q in z.lights){x=z.lights[q];u=x.color!==void 0?x.color:16777215;U=x.intensity!==void 0?x.intensity:1;if(x.type==="directional"){s=x.direction;F=new THREE.DirectionalLight(u,U);F.position.set(s[0],s[1],s[2]);F.position.normalize()}else if(x.type==="point"){s=x.position;F=x.distance;F=new THREE.PointLight(u,U,F);F.position.set(s[0],s[1],s[2])}else x.type==="ambient"&&(F=new THREE.AmbientLight(u));J.scene.add(F);J.lights[q]=F}for(o in z.fogs){q=z.fogs[o];q.type==="linear"?
+T=new THREE.Fog(0,q.near,q.far):q.type==="exp2"&&(T=new THREE.FogExp2(0,q.density));D=q.color;T.color.setRGB(D[0],D[1],D[2]);J.fogs[o]=T}if(J.cameras&&z.defaults.camera)J.currentCamera=J.cameras[z.defaults.camera];if(J.fogs&&z.defaults.fog)J.scene.fog=J.fogs[z.defaults.fog];D=z.defaults.bgcolor;J.bgColor=new THREE.Color;J.bgColor.setRGB(D[0],D[1],D[2]);J.bgColorAlpha=z.defaults.bgalpha;for(i in z.geometries){o=z.geometries[i];if(o.type=="bin_mesh"||o.type=="ascii_mesh"){V=V+1;l.onLoadStart()}}$=V;
+for(i in z.geometries){o=z.geometries[i];if(o.type==="cube"){G=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);J.geometries[i]=G}else if(o.type==="plane"){G=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);J.geometries[i]=G}else if(o.type==="sphere"){G=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight);J.geometries[i]=G}else if(o.type==="cylinder"){G=new THREE.CylinderGeometry(o.topRad,
+o.botRad,o.height,o.radSegs,o.heightSegs);J.geometries[i]=G}else if(o.type==="torus"){G=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);J.geometries[i]=G}else if(o.type==="icosahedron"){G=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);J.geometries[i]=G}else if(o.type==="bin_mesh")c.load(d(o.url,z.urlBaseType),e(i));else if(o.type==="ascii_mesh")K.load(d(o.url,z.urlBaseType),e(i));else if(o.type==="embedded_mesh"){o=z.embeds[o.id];o.metadata=z.metadata;o&&K.createModel(o,h(i),
+"")}}for(r in z.textures){i=z.textures[r];if(i.url instanceof Array){E=E+i.url.length;for(o=0;o<i.url.length;o++)l.onLoadStart()}else{E=E+1;l.onLoadStart()}}fa=E;for(r in z.textures){i=z.textures[r];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],z.urlBaseType);o=THREE.ImageUtils.loadTextureCube(T,i.mapping,a(o))}else{o=THREE.ImageUtils.loadTexture(d(i.url,z.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]]}}J.textures[r]=
+o}for(n in z.materials){v=z.materials[n];for(H in v.parameters)if(H==="envMap"||H==="map"||H==="lightMap")v.parameters[H]=J.textures[v.parameters[H]];else if(H==="shading")v.parameters[H]=v.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H==="blending")v.parameters[H]=v.parameters[H]in THREE?THREE[v.parameters[H]]:THREE.NormalBlending;else if(H==="combine")v.parameters[H]=v.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==="vertexColors")if(v.parameters[H]==
+"face")v.parameters[H]=THREE.FaceColors;else if(v.parameters[H])v.parameters[H]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=true;if(v.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);i=v.parameters.color;o=v.parameters.specular;T=v.parameters.ambient;c=v.parameters.shininess;a.tNormal.texture=J.textures[v.parameters.normalMap];if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;
+if(v.parameters.map){a.tDiffuse.texture=v.parameters.map;a.enableDiffuse.value=true}if(v.parameters.lightMap){a.tAO.texture=v.parameters.lightMap;a.enableAO.value=true}if(v.parameters.specularMap){a.tSpecular.texture=J.textures[v.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(v.parameters.opacity)a.uOpacity.value=v.parameters.opacity;R=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,
+vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else R=new THREE[v.type](v.parameters);J.materials[n]=R}f();l.callbackSync(J);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.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(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
 a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.needsUpdate=this.visible=true};THREE.MaterialCount=0;
 a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.needsUpdate=this.visible=true};THREE.MaterialCount=0;
@@ -206,7 +206,7 @@ THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=
 a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
 a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.Texture=function(a,b,c,d,f,e,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=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e:THREE.LinearMipMapLinearFilter;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,1);this.generateMipmaps=
 THREE.Texture=function(a,b,c,d,f,e,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=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e:THREE.LinearMipMapLinearFilter;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,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);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,f,e,h,j,m,l){THREE.Texture.call(this,null,e,h,j,m,l,d,f);this.image={data:a,width:b,height:c}};
+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);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,f,e,h,j,l,k){THREE.Texture.call(this,null,e,h,j,l,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.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.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.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);
@@ -265,141 +265,141 @@ THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk
 "}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",
 "}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",
 THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
 THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
-THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
+THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+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 h=1;f.type==="v2"?h=2:f.type==="v3"?h=3:f.type==="v4"?h=4:f.type==="c"&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=g.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var h=1;f.type==="v2"?h=2:f.type==="v3"?h=3:f.type==="v4"?h=4:f.type==="c"&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=g.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 f(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function e(a,b,c){var d,e,f,h,i=a.vertices;h=i.length;
 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 f(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function e(a,b,c){var d,e,f,h,i=a.vertices;h=i.length;
-var j=a.colors,k=j.length,l=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,n=a.verticesNeedUpdate,q=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){Lb.copy(Mb);Lb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){e=i[d];pb.copy(e);Lb.multiplyVector3(pb);o[d]=[pb.z,d]}o.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){e=i[o[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=j[o[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];
-if(i.boundTo===void 0||i.boundTo==="vertices"){f=0;e=i.value.length;if(i.size===1)for(d=0;d<e;d++){h=o[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<e;d++){h=o[d][1];h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===3)if(i.type==="c")for(d=0;d<e;d++){h=o[d][1];h=i.value[h];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=o[d][1];h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=o[d][1];
-h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}else{if(n)for(d=0;d<h;d++){e=i[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(q)for(d=0;d<k;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(k=r.length;j<k;j++){i=r[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){e=i.value.length;f=0;if(i.size===1)for(d=0;d<e;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===
-3)if(i.type==="c")for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}if(n||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,l,b)}if(q||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,
-m,b)}if(r){j=0;for(k=r.length;j<k;j++){i=r[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 m(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){aa=I=null;S=ba=qa=L=Qa=Ba=xa=-1;Wa=true;a[d].render(b,c,uc,vc);aa=I=null;S=ba=qa=L=Qa=Ba=xa=-1;Wa=true}}function l(a,b,c,d,f,g,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 m=j;m!==b;m=
-m+l){i=a[m];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);v(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,f,g,i,k,j):F.renderBuffer(d,f,g,i,k,j)}}}function i(a,b,c,d,f,g,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;g&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);v(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,f,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function k(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function s(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 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&&F.deallocateMaterial(d);F.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);var e=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==I){g.useProgram(h);I=h;e=true}if(d.id!==S){S=d.id;e=true}if(e||a!==aa){g.uniformMatrix4fv(i.projectionMatrix,
-false,a._projectionMatrixArray);a!==aa&&(aa=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(Wa){for(var k,l=0,m=0,o=0,n,q,r,p=fc,s=p.directional.colors,v=p.directional.positions,u=p.point.colors,y=p.point.positions,C=p.point.distances,E=p.spot.colors,J=p.spot.positions,K=p.spot.distances,
-H=p.spot.directions,G=p.spot.angles,R=p.spot.exponents,T=0,V=0,U=0,L=r=0,c=L=0,e=b.length;c<e;c++){k=b[c];if(!k.onlyShadow&&k.visible){n=k.color;q=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(F.gammaInput){l=l+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{l=l+n.r;m=m+n.g;o=o+n.b}else if(k instanceof THREE.DirectionalLight){r=T*3;if(F.gammaInput){s[r]=n.r*n.r*q*q;s[r+1]=n.g*n.g*q*q;s[r+2]=n.b*n.b*q*q}else{s[r]=n.r*q;s[r+1]=n.g*q;s[r+2]=n.b*q}Ha.copy(k.matrixWorld.getPosition());Ha.subSelf(k.target.matrixWorld.getPosition());
-Ha.normalize();v[r]=Ha.x;v[r+1]=Ha.y;v[r+2]=Ha.z;T=T+1}else if(k instanceof THREE.PointLight){L=V*3;if(F.gammaInput){u[L]=n.r*n.r*q*q;u[L+1]=n.g*n.g*q*q;u[L+2]=n.b*n.b*q*q}else{u[L]=n.r*q;u[L+1]=n.g*q;u[L+2]=n.b*q}n=k.matrixWorld.getPosition();y[L]=n.x;y[L+1]=n.y;y[L+2]=n.z;C[V]=r;V=V+1}else if(k instanceof THREE.SpotLight){L=U*3;if(F.gammaInput){E[L]=n.r*n.r*q*q;E[L+1]=n.g*n.g*q*q;E[L+2]=n.b*n.b*q*q}else{E[L]=n.r*q;E[L+1]=n.g*q;E[L+2]=n.b*q}n=k.matrixWorld.getPosition();J[L]=n.x;J[L+1]=n.y;J[L+2]=
-n.z;K[U]=r;Ha.copy(n);Ha.subSelf(k.target.matrixWorld.getPosition());Ha.normalize();H[L]=Ha.x;H[L+1]=Ha.y;H[L+2]=Ha.z;G[U]=Math.cos(k.angle);R[U]=k.exponent;U=U+1}}}c=T*3;for(e=s.length;c<e;c++)s[c]=0;c=V*3;for(e=u.length;c<e;c++)u[c]=0;c=U*3;for(e=E.length;c<e;c++)E[c]=0;p.directional.length=T;p.point.length=V;p.spot.length=U;p.ambient[0]=l;p.ambient[1]=m;p.ambient[2]=o;Wa=false}c=fc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
+var j=a.colors,k=j.length,n=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,o=a.verticesNeedUpdate,q=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){Lb.copy(Mb);Lb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){e=i[d];pb.copy(e);Lb.multiplyVector3(pb);m[d]=[pb.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){e=i[m[d][1]];f=d*3;n[f]=e.x;n[f+1]=e.y;n[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=j[m[d][1]];l[f]=e.r;l[f+1]=e.g;l[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];
+if(i.boundTo===void 0||i.boundTo==="vertices"){f=0;e=i.value.length;if(i.size===1)for(d=0;d<e;d++){h=m[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<e;d++){h=m[d][1];h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===3)if(i.type==="c")for(d=0;d<e;d++){h=m[d][1];h=i.value[h];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=m[d][1];h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=m[d][1];
+h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}else{if(o)for(d=0;d<h;d++){e=i[d];f=d*3;n[f]=e.x;n[f+1]=e.y;n[f+2]=e.z}if(q)for(d=0;d<k;d++){e=j[d];f=d*3;l[f]=e.r;l[f+1]=e.g;l[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){e=i.value.length;f=0;if(i.size===1)for(d=0;d<e;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===
+3)if(i.type==="c")for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}if(o||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,n,b)}if(q||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,
+l,b)}if(r){j=0;for(k=r.length;j<k;j++){i=r[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 l(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){aa=J=null;S=ba=qa=L=Qa=Ba=xa=-1;Wa=true;a[d].render(b,c,uc,vc);aa=J=null;S=ba=qa=L=Qa=Ba=xa=-1;Wa=true}}function k(a,b,c,d,f,g,e,h){var i,j,k,n;if(b){j=a.length-1;n=b=-1}else{j=0;b=a.length;n=1}for(var l=j;l!==b;l=
+l+n){i=a[l];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&E.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);v(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(j);k instanceof THREE.BufferGeometry?E.renderBufferDirect(d,f,g,i,k,j):E.renderBuffer(d,f,g,i,k,j)}}}function i(a,b,c,d,f,g,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;g&&E.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);v(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}E.renderImmediateObject(c,d,f,h,i)}}}function n(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 q(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 r(a,b,c,d,f){if(d.needsUpdate){d.program&&E.deallocateMaterial(d);E.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);var e=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==J){g.useProgram(h);J=h;e=true}if(d.id!==S){S=d.id;e=true}if(e||a!==aa){g.uniformMatrix4fv(i.projectionMatrix,
+false,a._projectionMatrixArray);a!==aa&&(aa=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(Wa){for(var k,n=0,l=0,m=0,o,q,r,p=fc,u=p.directional.colors,s=p.directional.positions,v=p.point.colors,x=p.point.positions,z=p.point.distances,D=p.spot.colors,I=p.spot.positions,K=p.spot.distances,
+H=p.spot.directions,G=p.spot.angles,R=p.spot.exponents,T=0,V=0,U=0,L=r=0,c=L=0,e=b.length;c<e;c++){k=b[c];if(!k.onlyShadow&&k.visible){o=k.color;q=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(E.gammaInput){n=n+o.r*o.r;l=l+o.g*o.g;m=m+o.b*o.b}else{n=n+o.r;l=l+o.g;m=m+o.b}else if(k instanceof THREE.DirectionalLight){r=T*3;if(E.gammaInput){u[r]=o.r*o.r*q*q;u[r+1]=o.g*o.g*q*q;u[r+2]=o.b*o.b*q*q}else{u[r]=o.r*q;u[r+1]=o.g*q;u[r+2]=o.b*q}Ha.copy(k.matrixWorld.getPosition());Ha.subSelf(k.target.matrixWorld.getPosition());
+Ha.normalize();s[r]=Ha.x;s[r+1]=Ha.y;s[r+2]=Ha.z;T=T+1}else if(k instanceof THREE.PointLight){L=V*3;if(E.gammaInput){v[L]=o.r*o.r*q*q;v[L+1]=o.g*o.g*q*q;v[L+2]=o.b*o.b*q*q}else{v[L]=o.r*q;v[L+1]=o.g*q;v[L+2]=o.b*q}o=k.matrixWorld.getPosition();x[L]=o.x;x[L+1]=o.y;x[L+2]=o.z;z[V]=r;V=V+1}else if(k instanceof THREE.SpotLight){L=U*3;if(E.gammaInput){D[L]=o.r*o.r*q*q;D[L+1]=o.g*o.g*q*q;D[L+2]=o.b*o.b*q*q}else{D[L]=o.r*q;D[L+1]=o.g*q;D[L+2]=o.b*q}o=k.matrixWorld.getPosition();I[L]=o.x;I[L+1]=o.y;I[L+2]=
+o.z;K[U]=r;Ha.copy(o);Ha.subSelf(k.target.matrixWorld.getPosition());Ha.normalize();H[L]=Ha.x;H[L+1]=Ha.y;H[L+2]=Ha.z;G[U]=Math.cos(k.angle);R[U]=k.exponent;U=U+1}}}c=T*3;for(e=u.length;c<e;c++)u[c]=0;c=V*3;for(e=v.length;c<e;c++)v[c]=0;c=U*3;for(e=D.length;c<e;c++)D[c]=0;p.directional.length=T;p.point.length=V;p.spot.length=U;p.ambient[0]=n;p.ambient[1]=l;p.ambient[2]=m;Wa=false}c=fc;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=
 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;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;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=N.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.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(F.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){e=c=0;for(k=b.length;e<k;e++){l=b[e];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){j.shadowMap.texture[c]=l.shadowMap;j.shadowMapSize.value[c]=l.shadowMapSize;j.shadowMatrix.value[c]=l.shadowMatrix;j.shadowDarkness.value[c]=l.shadowDarkness;j.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(l=h.uniforms[b[j][1]]){e=b[j][0];m=e.type;k=e.value;
-if(m==="i")g.uniform1i(l,k);else if(m==="f")g.uniform1f(l,k);else if(m==="v2")g.uniform2f(l,k.x,k.y);else if(m==="v3")g.uniform3f(l,k.x,k.y,k.z);else if(m==="v4")g.uniform4f(l,k.x,k.y,k.z,k.w);else if(m==="c")g.uniform3f(l,k.r,k.g,k.b);else if(m==="fv1")g.uniform1fv(l,k);else if(m==="fv")g.uniform3fv(l,k);else if(m==="v2v"){if(e._array===void 0)e._array=new Float32Array(2*k.length);m=0;for(o=k.length;m<o;m++){p=m*2;e._array[p]=k[m].x;e._array[p+1]=k[m].y}g.uniform2fv(l,e._array)}else if(m==="v3v"){if(e._array===
-void 0)e._array=new Float32Array(3*k.length);m=0;for(o=k.length;m<o;m++){p=m*3;e._array[p]=k[m].x;e._array[p+1]=k[m].y;e._array[p+2]=k[m].z}g.uniform3fv(l,e._array)}else if(m==="v4v"){if(e._array===void 0)e._array=new Float32Array(4*k.length);m=0;for(o=k.length;m<o;m++){p=m*4;e._array[p]=k[m].x;e._array[p+1]=k[m].y;e._array[p+2]=k[m].z;e._array[p+3]=k[m].w}g.uniform4fv(l,e._array)}else if(m==="m4"){if(e._array===void 0)e._array=new Float32Array(16);k.flattenToArray(e._array);g.uniformMatrix4fv(l,
-false,e._array)}else if(m==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*k.length);m=0;for(o=k.length;m<o;m++)k[m].flattenToArrayOffset(e._array,m*16);g.uniformMatrix4fv(l,false,e._array)}else if(m==="t"){g.uniform1i(l,k);if(l=e.texture)if(l.image instanceof Array&&l.image.length===6){e=l;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);
-g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,e.flipY);k=[];for(l=0;l<6;l++){m=k;o=l;if(F.autoScaleCubemaps){p=e.image[l];v=Mc;if(!(p.width<=v&&p.height<=v)){u=Math.max(p.width,p.height);s=Math.floor(p.width*v/u);v=Math.floor(p.height*v/u);u=document.createElement("canvas");u.width=s;u.height=v;u.getContext("2d").drawImage(p,0,0,p.width,p.height,0,0,s,v);p=u}}else p=e.image[l];m[o]=p}l=k[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;o=z(e.format);p=z(e.type);B(g.TEXTURE_CUBE_MAP,e,m);for(l=0;l<6;l++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+
-l,0,o,o,p,k[l]);e.generateMipmaps&&m&&g.generateMipmap(g.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){e=l;g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.__webglTexture)}else F.setTexture(l,k)}else if(m==="tv"){if(e._array===void 0){e._array=[];m=0;for(o=e.texture.length;m<o;m++)e._array[m]=k+m}g.uniform1iv(l,e._array);
-m=0;for(o=e.texture.length;m<o;m++)(l=e.texture[m])&&F.setTexture(l,e._array[m])}}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);d.skinning&&g.uniformMatrix4fv(i.boneGlobalMatrices,
+d.opacity;E.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;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=N.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(E.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(E.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){e=c=0;for(k=b.length;e<k;e++){n=b[e];if(n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight&&!n.shadowCascade)){j.shadowMap.texture[c]=n.shadowMap;j.shadowMapSize.value[c]=n.shadowMapSize;j.shadowMatrix.value[c]=n.shadowMatrix;j.shadowDarkness.value[c]=n.shadowDarkness;j.shadowBias.value[c]=n.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(n=h.uniforms[b[j][1]]){e=b[j][0];l=e.type;k=e.value;
+if(l==="i")g.uniform1i(n,k);else if(l==="f")g.uniform1f(n,k);else if(l==="v2")g.uniform2f(n,k.x,k.y);else if(l==="v3")g.uniform3f(n,k.x,k.y,k.z);else if(l==="v4")g.uniform4f(n,k.x,k.y,k.z,k.w);else if(l==="c")g.uniform3f(n,k.r,k.g,k.b);else if(l==="fv1")g.uniform1fv(n,k);else if(l==="fv")g.uniform3fv(n,k);else if(l==="v2v"){if(e._array===void 0)e._array=new Float32Array(2*k.length);l=0;for(m=k.length;l<m;l++){p=l*2;e._array[p]=k[l].x;e._array[p+1]=k[l].y}g.uniform2fv(n,e._array)}else if(l==="v3v"){if(e._array===
+void 0)e._array=new Float32Array(3*k.length);l=0;for(m=k.length;l<m;l++){p=l*3;e._array[p]=k[l].x;e._array[p+1]=k[l].y;e._array[p+2]=k[l].z}g.uniform3fv(n,e._array)}else if(l==="v4v"){if(e._array===void 0)e._array=new Float32Array(4*k.length);l=0;for(m=k.length;l<m;l++){p=l*4;e._array[p]=k[l].x;e._array[p+1]=k[l].y;e._array[p+2]=k[l].z;e._array[p+3]=k[l].w}g.uniform4fv(n,e._array)}else if(l==="m4"){if(e._array===void 0)e._array=new Float32Array(16);k.flattenToArray(e._array);g.uniformMatrix4fv(n,
+false,e._array)}else if(l==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*k.length);l=0;for(m=k.length;l<m;l++)k[l].flattenToArrayOffset(e._array,l*16);g.uniformMatrix4fv(n,false,e._array)}else if(l==="t"){g.uniform1i(n,k);if(n=e.texture)if(n.image instanceof Array&&n.image.length===6){e=n;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);
+g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,e.flipY);k=[];for(n=0;n<6;n++){l=k;m=n;if(E.autoScaleCubemaps){p=e.image[n];s=Mc;if(!(p.width<=s&&p.height<=s)){v=Math.max(p.width,p.height);u=Math.floor(p.width*s/v);s=Math.floor(p.height*s/v);v=document.createElement("canvas");v.width=u;v.height=s;v.getContext("2d").drawImage(p,0,0,p.width,p.height,0,0,u,s);p=v}}else p=e.image[n];l[m]=p}n=k[0];l=(n.width&n.width-1)===0&&(n.height&n.height-1)===0;m=A(e.format);p=A(e.type);F(g.TEXTURE_CUBE_MAP,e,l);for(n=0;n<6;n++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+
+n,0,m,m,p,k[n]);e.generateMipmaps&&l&&g.generateMipmap(g.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(n instanceof THREE.WebGLRenderTargetCube){e=n;g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.__webglTexture)}else E.setTexture(n,k)}else if(l==="tv"){if(e._array===void 0){e._array=[];l=0;for(m=e.texture.length;l<m;l++)e._array[l]=k+l}g.uniform1iv(n,e._array);
+l=0;for(m=e.texture.length;l<m;l++)(n=e.texture[l])&&E.setTexture(n,e._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);d.skinning&&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.objectMatrix!==null&&g.uniformMatrix4fv(i.objectMatrix,false,f.matrixWorld.elements);return h}function p(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function v(a,b,c){if(Va!==a){a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);
 false,f.boneMatrices)}g.uniformMatrix4fv(i.modelViewMatrix,false,f._modelViewMatrix.elements);i.normalMatrix&&g.uniformMatrix3fv(i.normalMatrix,false,f._normalMatrix.elements);i.objectMatrix!==null&&g.uniformMatrix4fv(i.objectMatrix,false,f.matrixWorld.elements);return h}function p(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function v(a,b,c){if(Va!==a){a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);
-Va=a}if(a&&(ob!==b||Kb!==c)){g.polygonOffset(b,c);ob=b;Kb=c}}function C(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(b);return null}return c}function B(a,b,c){if(c){g.texParameteri(a,g.TEXTURE_WRAP_S,z(b.wrapS));g.texParameteri(a,g.TEXTURE_WRAP_T,z(b.wrapT));g.texParameteri(a,g.TEXTURE_MAG_FILTER,
-z(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,z(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,J(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,J(b.minFilter))}}function u(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,g.RENDERBUFFER,a)}else g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height)}function J(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?g.NEAREST:g.LINEAR}function z(a){return a===THREE.RepeatWrapping?g.REPEAT:a===THREE.ClampToEdgeWrapping?
+Va=a}if(a&&(ob!==b||Kb!==c)){g.polygonOffset(b,c);ob=b;Kb=c}}function x(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(b);return null}return c}function F(a,b,c){if(c){g.texParameteri(a,g.TEXTURE_WRAP_S,A(b.wrapS));g.texParameteri(a,g.TEXTURE_WRAP_T,A(b.wrapT));g.texParameteri(a,g.TEXTURE_MAG_FILTER,
+A(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,A(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,I(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,I(b.minFilter))}}function s(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,g.RENDERBUFFER,a)}else g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height)}function I(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?g.NEAREST:g.LINEAR}function A(a){return a===THREE.RepeatWrapping?g.REPEAT:a===THREE.ClampToEdgeWrapping?
 g.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?g.MIRRORED_REPEAT:a===THREE.NearestFilter?g.NEAREST:a===THREE.NearestMipMapNearestFilter?g.NEAREST_MIPMAP_NEAREST:a===THREE.NearestMipMapLinearFilter?g.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?g.LINEAR:a===THREE.LinearMipMapNearestFilter?g.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?g.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?g.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?g.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?
 g.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?g.MIRRORED_REPEAT:a===THREE.NearestFilter?g.NEAREST:a===THREE.NearestMipMapNearestFilter?g.NEAREST_MIPMAP_NEAREST:a===THREE.NearestMipMapLinearFilter?g.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?g.LINEAR:a===THREE.LinearMipMapNearestFilter?g.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?g.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?g.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?g.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?
 g.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?g.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?g.BYTE:a===THREE.ShortType?g.SHORT:a===THREE.UnsignedShortType?g.UNSIGNED_SHORT:a===THREE.IntType?g.INT:a===THREE.UnsignedIntType?g.UNSIGNED_INT:a===THREE.FloatType?g.FLOAT:a===THREE.AlphaFormat?g.ALPHA:a===THREE.RGBFormat?g.RGB:a===THREE.RGBAFormat?g.RGBA:a===THREE.LuminanceFormat?g.LUMINANCE:a===THREE.LuminanceAlphaFormat?g.LUMINANCE_ALPHA:a===THREE.AddEquation?g.FUNC_ADD:a===THREE.SubtractEquation?
 g.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?g.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?g.BYTE:a===THREE.ShortType?g.SHORT:a===THREE.UnsignedShortType?g.UNSIGNED_SHORT:a===THREE.IntType?g.INT:a===THREE.UnsignedIntType?g.UNSIGNED_INT:a===THREE.FloatType?g.FLOAT:a===THREE.AlphaFormat?g.ALPHA:a===THREE.RGBFormat?g.RGB:a===THREE.RGBAFormat?g.RGBA:a===THREE.LuminanceFormat?g.LUMINANCE:a===THREE.LuminanceAlphaFormat?g.LUMINANCE_ALPHA:a===THREE.AddEquation?g.FUNC_ADD:a===THREE.SubtractEquation?
 g.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?g.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?g.ZERO:a===THREE.OneFactor?g.ONE:a===THREE.SrcColorFactor?g.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?g.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?g.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?g.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?g.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?g.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?g.DST_COLOR:a===THREE.OneMinusDstColorFactor?g.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?
 g.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?g.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?g.ZERO:a===THREE.OneFactor?g.ONE:a===THREE.SrcColorFactor?g.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?g.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?g.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?g.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?g.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?g.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?g.DST_COLOR:a===THREE.OneMinusDstColorFactor?g.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?
-g.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},N=a.canvas!==void 0?a.canvas:document.createElement("canvas"),E=a.precision!==void 0?a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,G=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,R=a.antialias!==void 0?a.antialias:false,U=a.stencil!==void 0?a.stencil:true,T=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,y=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),K=a.clearAlpha!==
+g.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},N=a.canvas!==void 0?a.canvas:document.createElement("canvas"),D=a.precision!==void 0?a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,G=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,R=a.antialias!==void 0?a.antialias:false,U=a.stencil!==void 0?a.stencil:true,T=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,z=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),K=a.clearAlpha!==
 void 0?a.clearAlpha:0,V=a.maxLights!==void 0?a.maxLights:4;this.domElement=N;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=
 void 0?a.clearAlpha:0,V=a.maxLights!==void 0?a.maxLights:4;this.domElement=N;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=
-true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var F=this,$=[],fa=0,I=null,ra=null,S=-1,ba=null,aa=null,va=0,L=-1,qa=-1,xa=-1,Aa=-1,Pa=-1,ja=-1,Ba=-1,Qa=-1,Va=null,ob=null,Kb=null,wb=null,Tb=0,ec=0,Ub=0,gc=0,uc=0,vc=0,Nb=new THREE.Frustum,Mb=new THREE.Matrix4,Lb=new THREE.Matrix4,pb=new THREE.Vector4,Ha=new THREE.Vector3,Wa=true,fc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},
+true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var E=this,$=[],fa=0,J=null,ra=null,S=-1,ba=null,aa=null,va=0,L=-1,qa=-1,xa=-1,Aa=-1,Pa=-1,ja=-1,Ba=-1,Qa=-1,Va=null,ob=null,Kb=null,wb=null,Tb=0,ec=0,Ub=0,gc=0,uc=0,vc=0,Nb=new THREE.Frustum,Mb=new THREE.Matrix4,Lb=new THREE.Matrix4,pb=new THREE.Vector4,Ha=new THREE.Vector3,Wa=true,fc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},
 point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}},g;try{if(!(g=N.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:G,antialias:R,stencil:U,preserveDrawingBuffer:T})))throw"Error creating WebGL context.";}catch(Nc){console.error(Nc)}g.getExtension("OES_texture_float")||console.log("THREE.WebGLRenderer: Float textures not supported.");g.clearColor(0,0,0,1);g.clearDepth(1);g.clearStencil(0);g.enable(g.DEPTH_TEST);
 point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}},g;try{if(!(g=N.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:G,antialias:R,stencil:U,preserveDrawingBuffer:T})))throw"Error creating WebGL context.";}catch(Nc){console.error(Nc)}g.getExtension("OES_texture_float")||console.log("THREE.WebGLRenderer: Float textures not supported.");g.clearColor(0,0,0,1);g.clearDepth(1);g.clearStencil(0);g.enable(g.DEPTH_TEST);
-g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(y.r,y.g,y.b,K);this.context=g;var wc=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var Mc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return g};this.supportsVertexTextures=function(){return wc>0};this.setSize=function(a,b){N.width=a;N.height=b;this.setViewport(0,
-0,N.width,N.height)};this.setViewport=function(a,b,c,d){Tb=a;ec=b;Ub=c;gc=d;g.viewport(Tb,ec,Ub,gc)};this.setScissor=function(a,b,c,d){g.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.setClearColorHex=function(a,b){y.setHex(a);K=b;g.clearColor(y.r,y.g,y.b,K)};this.setClearColor=function(a,b){y.copy(a);K=b;g.clearColor(y.r,y.g,y.b,K)};this.getClearColor=function(){return y};this.getClearAlpha=function(){return K};this.clear=function(a,
+g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(z.r,z.g,z.b,K);this.context=g;var wc=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var Mc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return g};this.supportsVertexTextures=function(){return wc>0};this.setSize=function(a,b){N.width=a;N.height=b;this.setViewport(0,
+0,N.width,N.height)};this.setViewport=function(a,b,c,d){Tb=a;ec=b;Ub=c;gc=d;g.viewport(Tb,ec,Ub,gc)};this.setScissor=function(a,b,c,d){g.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.setClearColorHex=function(a,b){z.setHex(a);K=b;g.clearColor(z.r,z.g,z.b,K)};this.setClearColor=function(a,b){z.copy(a);K=b;g.clearColor(z.r,z.g,z.b,K)};this.getClearColor=function(){return z};this.getClearAlpha=function(){return K};this.clear=function(a,
 b,c){var d=0;if(a===void 0||a)d=d|g.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|g.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|g.STENCIL_BUFFER_BIT;g.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;
 b,c){var d=0;if(a===void 0||a)d=d|g.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|g.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|g.STENCIL_BUFFER_BIT;g.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;
 delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];g.deleteBuffer(c.__webglVertexBuffer);g.deleteBuffer(c.__webglNormalBuffer);g.deleteBuffer(c.__webglTangentBuffer);g.deleteBuffer(c.__webglColorBuffer);g.deleteBuffer(c.__webglUVBuffer);g.deleteBuffer(c.__webglUV2Buffer);g.deleteBuffer(c.__webglSkinVertexABuffer);g.deleteBuffer(c.__webglSkinVertexBBuffer);g.deleteBuffer(c.__webglSkinIndicesBuffer);
 delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];g.deleteBuffer(c.__webglVertexBuffer);g.deleteBuffer(c.__webglNormalBuffer);g.deleteBuffer(c.__webglTangentBuffer);g.deleteBuffer(c.__webglColorBuffer);g.deleteBuffer(c.__webglUVBuffer);g.deleteBuffer(c.__webglUV2Buffer);g.deleteBuffer(c.__webglSkinVertexABuffer);g.deleteBuffer(c.__webglSkinVertexBBuffer);g.deleteBuffer(c.__webglSkinIndicesBuffer);
-g.deleteBuffer(c.__webglSkinWeightsBuffer);g.deleteBuffer(c.__webglFaceBuffer);g.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)g.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)g.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}F.info.memory.geometries--}else if(a instanceof
-THREE.Ribbon){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
-false;g.deleteTexture(a.__webglTexture);F.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=$.length;a<c;a++){d=$[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=$.length;a<c;a++){d=$[a];d.program!==b&&e.push(d)}$=e;g.deleteProgram(b);F.info.memory.programs--}}};this.updateShadowMap=function(a,b){I=null;S=ba=Qa=Ba=xa=-1;Wa=true;qa=L=-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.deleteBuffer(c.__webglSkinWeightsBuffer);g.deleteBuffer(c.__webglFaceBuffer);g.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)g.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)g.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}E.info.memory.geometries--}else if(a instanceof
+THREE.Ribbon){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
+false;g.deleteTexture(a.__webglTexture);E.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=$.length;a<c;a++){d=$[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=$.length;a<c;a++){d=$[a];d.program!==b&&e.push(d)}$=e;g.deleteProgram(b);E.info.memory.programs--}}};this.updateShadowMap=function(a,b){J=null;S=ba=Qa=Ba=xa=-1;Wa=true;qa=L=-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,
 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,m,n,o,q=a.count*3;for(o=0;o<q;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];h=n[o+3];j=n[o+4];l=n[o+5];i=n[o+6];k=n[o+7];m=n[o+8];d=(d+h+i)/3;e=(e+j+k)/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}}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,
+e,f,h,i,j,k,l,n,m,o,q=a.count*3;for(o=0;o<q;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,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=
 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!==ba){ba=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;
+r(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ba){ba=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,
 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);F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+f[d].count;F.info.render.faces=F.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.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!==ba){ba=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer);g.vertexAttribPointer(b.position,
+e.attributes.index.buffer)}g.drawElements(g.TRIANGLES,f[d].count,g.UNSIGNED_SHORT,f[d].start*2);E.info.render.calls++;E.info.render.vertices=E.info.render.vertices+f[d].count;E.info.render.faces=E.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var h,i,c=r(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ba){ba=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,
 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?
+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,n=h.length;for(l=0;l<n;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"+
 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,
 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>=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);
 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,
 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!==wb){g.lineWidth(d);wb=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);
 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!==wb){g.lineWidth(d);wb=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)}F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+e.__webglFaceCount;F.info.render.faces=F.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES;d=d.linewidth;if(d!==wb){g.lineWidth(d);wb=d}g.drawArrays(f,0,e.__webglLineCount);F.info.render.calls++}else if(f instanceof THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);F.info.render.calls++;
-F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,k,n=a.__lights,o=a.fog;S=-1;Wa=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=
-new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Mb.multiply(b.projectionMatrix,b.matrixWorldInverse);Nb.setFromMatrix(Mb);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);k=a.__webglObjects;d=0;for(e=k.length;d<e;d++){f=k[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Nb.contains(j))){p(j,b);var q=f,r=q.object,s=q.buffer,u=void 0,u=u=void 0,u=r.material;if(u instanceof THREE.MeshFaceMaterial){u=s.materialIndex;if(u>=0){u=r.geometry.materials[u];if(u.transparent){q.transparent=u;q.opaque=null}else{q.opaque=u;q.transparent=null}}}else if(u)if(u.transparent){q.transparent=
-u;q.opaque=null}else{q.opaque=u;q.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{pb.copy(j.matrixWorld.getPosition());Mb.multiplyVector3(pb);f.z=pb.z}}}this.sortObjects&&k.sort(h);k=a.__webglObjectsImmediate;d=0;for(e=k.length;d<e;d++){f=k[d];j=f.object;if(j.visible){p(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);v(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);l(a.__webglObjects,false,"",b,n,o,true,d);i(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);l(a.__webglObjects,true,"opaque",b,n,o,false);i(a.__webglObjectsImmediate,"opaque",b,n,o,false);l(a.__webglObjects,false,"transparent",b,n,o,true);i(a.__webglObjectsImmediate,"transparent",b,n,o,true)}m(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);ba=
--1;F.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,Nb):e.render(function(a){F.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,l=void 0,m=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){l=
-h.geometry;if(l instanceof THREE.Geometry){if(l.geometryGroups===void 0){var q=l,p=void 0,u=void 0,v=void 0,y=void 0,z=void 0,B=void 0,C=void 0,E={},I=q.morphTargets.length,J=q.morphNormals.length;q.geometryGroups={};p=0;for(u=q.faces.length;p<u;p++){v=q.faces[p];y=v.materialIndex;B=y!==void 0?y:-1;E[B]===void 0&&(E[B]={hash:B,counter:0});C=E[B].hash+"_"+E[B].counter;q.geometryGroups[C]===void 0&&(q.geometryGroups[C]={faces3:[],faces4:[],materialIndex:y,vertices:0,numMorphTargets:I,numMorphNormals:J});
-z=v instanceof THREE.Face3?3:4;if(q.geometryGroups[C].vertices+z>65535){E[B].counter=E[B].counter+1;C=E[B].hash+"_"+E[B].counter;q.geometryGroups[C]===void 0&&(q.geometryGroups[C]={faces3:[],faces4:[],materialIndex:y,vertices:0,numMorphTargets:I,numMorphNormals:J})}v instanceof THREE.Face3?q.geometryGroups[C].faces3.push(p):q.geometryGroups[C].faces4.push(p);q.geometryGroups[C].vertices=q.geometryGroups[C].vertices+z}q.geometryGroupsList=[];var K=void 0;for(K in q.geometryGroups){q.geometryGroups[K].id=
-va++;q.geometryGroupsList.push(q.geometryGroups[K])}}for(j in l.geometryGroups){m=l.geometryGroups[j];if(!m.__webglVertexBuffer){var H=m;H.__webglVertexBuffer=g.createBuffer();H.__webglNormalBuffer=g.createBuffer();H.__webglTangentBuffer=g.createBuffer();H.__webglColorBuffer=g.createBuffer();H.__webglUVBuffer=g.createBuffer();H.__webglUV2Buffer=g.createBuffer();H.__webglSkinVertexABuffer=g.createBuffer();H.__webglSkinVertexBBuffer=g.createBuffer();H.__webglSkinIndicesBuffer=g.createBuffer();H.__webglSkinWeightsBuffer=
-g.createBuffer();H.__webglFaceBuffer=g.createBuffer();H.__webglLineBuffer=g.createBuffer();var L=void 0,N=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];L=0;for(N=H.numMorphTargets;L<N;L++)H.__webglMorphTargetsBuffers.push(g.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];L=0;for(N=H.numMorphNormals;L<N;L++)H.__webglMorphNormalsBuffers.push(g.createBuffer())}F.info.memory.geometries++;var G=m,S=h,T=S.geometry,U=G.faces3,V=G.faces4,R=U.length*3+V.length*4,aa=U.length*
+g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)}E.info.render.calls++;E.info.render.vertices=E.info.render.vertices+e.__webglFaceCount;E.info.render.faces=E.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!==wb){g.lineWidth(d);wb=d}g.drawArrays(f,0,e.__webglLineCount);E.info.render.calls++}else if(f instanceof THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);E.info.render.calls++;
+E.info.render.points=E.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);E.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,n,m=a.__lights,o=a.fog;S=-1;Wa=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=
+new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Mb.multiply(b.projectionMatrix,b.matrixWorldInverse);Nb.setFromMatrix(Mb);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
+this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(e=n.length;d<e;d++){f=n[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Nb.contains(j))){p(j,b);var q=f,r=q.object,u=q.buffer,s=void 0,s=s=void 0,s=r.material;if(s instanceof THREE.MeshFaceMaterial){s=u.materialIndex;if(s>=0){s=r.geometry.materials[s];if(s.transparent){q.transparent=s;q.opaque=null}else{q.opaque=s;q.transparent=null}}}else if(s)if(s.transparent){q.transparent=
+s;q.opaque=null}else{q.opaque=s;q.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{pb.copy(j.matrixWorld.getPosition());Mb.multiplyVector3(pb);f.z=pb.z}}}this.sortObjects&&n.sort(h);n=a.__webglObjectsImmediate;d=0;for(e=n.length;d<e;d++){f=n[d];j=f.object;if(j.visible){p(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);v(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)}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=r(a,b,c,d,e);ba=
+-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,Nb):e.render(function(a){E.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 p=k,r=void 0,s=void 0,v=void 0,x=void 0,A=void 0,z=void 0,D=void 0,F={},I=p.morphTargets.length,J=p.morphNormals.length;p.geometryGroups={};r=0;for(s=p.faces.length;r<s;r++){v=p.faces[r];x=v.materialIndex;z=x!==void 0?x:-1;F[z]===void 0&&(F[z]={hash:z,counter:0});D=F[z].hash+"_"+F[z].counter;p.geometryGroups[D]===void 0&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:I,numMorphNormals:J});
+A=v instanceof THREE.Face3?3:4;if(p.geometryGroups[D].vertices+A>65535){F[z].counter=F[z].counter+1;D=F[z].hash+"_"+F[z].counter;p.geometryGroups[D]===void 0&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:I,numMorphNormals:J})}v instanceof THREE.Face3?p.geometryGroups[D].faces3.push(r):p.geometryGroups[D].faces4.push(r);p.geometryGroups[D].vertices=p.geometryGroups[D].vertices+A}p.geometryGroupsList=[];var K=void 0;for(K in p.geometryGroups){p.geometryGroups[K].id=
+va++;p.geometryGroupsList.push(p.geometryGroups[K])}}for(j in k.geometryGroups){l=k.geometryGroups[j];if(!l.__webglVertexBuffer){var H=l;H.__webglVertexBuffer=g.createBuffer();H.__webglNormalBuffer=g.createBuffer();H.__webglTangentBuffer=g.createBuffer();H.__webglColorBuffer=g.createBuffer();H.__webglUVBuffer=g.createBuffer();H.__webglUV2Buffer=g.createBuffer();H.__webglSkinVertexABuffer=g.createBuffer();H.__webglSkinVertexBBuffer=g.createBuffer();H.__webglSkinIndicesBuffer=g.createBuffer();H.__webglSkinWeightsBuffer=
+g.createBuffer();H.__webglFaceBuffer=g.createBuffer();H.__webglLineBuffer=g.createBuffer();var L=void 0,N=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];L=0;for(N=H.numMorphTargets;L<N;L++)H.__webglMorphTargetsBuffers.push(g.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];L=0;for(N=H.numMorphNormals;L<N;L++)H.__webglMorphNormalsBuffers.push(g.createBuffer())}E.info.memory.geometries++;var G=l,S=h,T=S.geometry,U=G.faces3,V=G.faces4,R=U.length*3+V.length*4,aa=U.length*
 1+V.length*2,ba=U.length*3+V.length*4,$=c(S,G),fa=f($),qa=d($),xa=$.vertexColors?$.vertexColors:false;G.__vertexArray=new Float32Array(R*3);if(qa)G.__normalArray=new Float32Array(R*3);if(T.hasTangents)G.__tangentArray=new Float32Array(R*4);if(xa)G.__colorArray=new Float32Array(R*3);if(fa){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)G.__uvArray=new Float32Array(R*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)G.__uv2Array=new Float32Array(R*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){G.__skinVertexAArray=
 1+V.length*2,ba=U.length*3+V.length*4,$=c(S,G),fa=f($),qa=d($),xa=$.vertexColors?$.vertexColors:false;G.__vertexArray=new Float32Array(R*3);if(qa)G.__normalArray=new Float32Array(R*3);if(T.hasTangents)G.__tangentArray=new Float32Array(R*4);if(xa)G.__colorArray=new Float32Array(R*3);if(fa){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)G.__uvArray=new Float32Array(R*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)G.__uv2Array=new Float32Array(R*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){G.__skinVertexAArray=
 new Float32Array(R*4);G.__skinVertexBArray=new Float32Array(R*4);G.__skinIndexArray=new Float32Array(R*4);G.__skinWeightArray=new Float32Array(R*4)}G.__faceArray=new Uint16Array(aa*3);G.__lineArray=new Uint16Array(ba*2);var ra=void 0,Kb=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];ra=0;for(Kb=G.numMorphTargets;ra<Kb;ra++)G.__morphTargetsArrays.push(new Float32Array(R*3))}if(G.numMorphNormals){G.__morphNormalsArrays=[];ra=0;for(Kb=G.numMorphNormals;ra<Kb;ra++)G.__morphNormalsArrays.push(new Float32Array(R*
 new Float32Array(R*4);G.__skinVertexBArray=new Float32Array(R*4);G.__skinIndexArray=new Float32Array(R*4);G.__skinWeightArray=new Float32Array(R*4)}G.__faceArray=new Uint16Array(aa*3);G.__lineArray=new Uint16Array(ba*2);var ra=void 0,Kb=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];ra=0;for(Kb=G.numMorphTargets;ra<Kb;ra++)G.__morphTargetsArrays.push(new Float32Array(R*3))}if(G.numMorphNormals){G.__morphNormalsArrays=[];ra=0;for(Kb=G.numMorphNormals;ra<Kb;ra++)G.__morphNormalsArrays.push(new Float32Array(R*
 3))}G.__webglFaceCount=aa*3;G.__webglLineCount=ba*2;if($.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var Ba=void 0;for(Ba in $.attributes){var Aa=$.attributes[Ba],ja={},wb;for(wb in Aa)ja[wb]=Aa[wb];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=true;var Ha=1;ja.type==="v2"?Ha=2:ja.type==="v3"?Ha=3:ja.type==="v4"?Ha=4:ja.type==="c"&&(Ha=3);ja.size=Ha;ja.array=new Float32Array(R*Ha);ja.buffer=g.createBuffer();ja.buffer.belongsToAttribute=
 3))}G.__webglFaceCount=aa*3;G.__webglLineCount=ba*2;if($.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var Ba=void 0;for(Ba in $.attributes){var Aa=$.attributes[Ba],ja={},wb;for(wb in Aa)ja[wb]=Aa[wb];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=true;var Ha=1;ja.type==="v2"?Ha=2:ja.type==="v3"?Ha=3:ja.type==="v4"?Ha=4:ja.type==="c"&&(Ha=3);ja.size=Ha;ja.array=new Float32Array(R*Ha);ja.buffer=g.createBuffer();ja.buffer.belongsToAttribute=
-Ba;Aa.needsUpdate=true;ja.__original=Aa}G.__webglCustomAttributesList.push(ja)}}G.__inittedArrays=true;l.verticesNeedUpdate=true;l.morphTargetsNeedUpdate=true;l.elementsNeedUpdate=true;l.uvsNeedUpdate=true;l.normalsNeedUpdate=true;l.tangentsNeedUpdate=true;l.colorsNeedUpdate=true}}}else if(l instanceof THREE.BufferGeometry){var Tb=l,Pa=void 0,Qa=void 0,Va=void 0;for(Pa in Tb.attributes){Va=Pa==="index"?g.ELEMENT_ARRAY_BUFFER:g.ARRAY_BUFFER;Qa=Tb.attributes[Pa];Qa.buffer=g.createBuffer();g.bindBuffer(Va,
-Qa.buffer);g.bufferData(Va,Qa.array,g.STATIC_DRAW)}}}else if(h instanceof THREE.Ribbon){l=h.geometry;if(!l.__webglVertexBuffer){var pb=l;pb.__webglVertexBuffer=g.createBuffer();pb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var Wa=l,ob=Wa.vertices.length;Wa.__vertexArray=new Float32Array(ob*3);Wa.__colorArray=new Float32Array(ob*3);Wa.__webglVertexCount=ob;l.verticesNeedUpdate=true;l.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){l=h.geometry;if(!l.__webglVertexBuffer){var Mb=
-l;Mb.__webglVertexBuffer=g.createBuffer();Mb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var hc=l,ec=h,Lb=hc.vertices.length;hc.__vertexArray=new Float32Array(Lb*3);hc.__colorArray=new Float32Array(Lb*3);hc.__webglLineCount=Lb;b(hc,ec);l.verticesNeedUpdate=true;l.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){l=h.geometry;if(!l.__webglVertexBuffer){var Ub=l;Ub.__webglVertexBuffer=g.createBuffer();Ub.__webglColorBuffer=g.createBuffer();F.info.geometries++;var Vb=
-l,gc=h,Nb=Vb.vertices.length;Vb.__vertexArray=new Float32Array(Nb*3);Vb.__colorArray=new Float32Array(Nb*3);Vb.__sortArray=[];Vb.__webglParticleCount=Nb;b(Vb,gc);l.verticesNeedUpdate=true;l.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){l=h.geometry;if(l instanceof THREE.BufferGeometry)o(i.__webglObjects,l,h);else for(j in l.geometryGroups){m=l.geometryGroups[j];o(i.__webglObjects,m,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){l=
-h.geometry;o(i.__webglObjects,l,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 Ra=a.__objectsRemoved[0],xc=a;Ra instanceof THREE.Mesh||Ra instanceof THREE.ParticleSystem||Ra instanceof THREE.Ribbon||Ra instanceof
-THREE.Line?r(xc.__webglObjects,Ra):Ra instanceof THREE.Sprite?n(xc.__webglSprites,Ra):Ra instanceof THREE.LensFlare?n(xc.__webglFlares,Ra):(Ra instanceof THREE.ImmediateRenderObject||Ra.immediateRenderCallback)&&r(xc.__webglObjectsImmediate,Ra);Ra.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Oc=0,uc=a.__webglObjects.length;Oc<uc;Oc++){var Xa=a.__webglObjects[Oc].object,W=Xa.geometry,ic=void 0,Wb=void 0,Ka=void 0;if(Xa instanceof THREE.Mesh)if(W instanceof THREE.BufferGeometry){if(W.verticesNeedUpdate||
+Ba;Aa.needsUpdate=true;ja.__original=Aa}G.__webglCustomAttributesList.push(ja)}}G.__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 Tb=k,Pa=void 0,Qa=void 0,Va=void 0;for(Pa in Tb.attributes){Va=Pa==="index"?g.ELEMENT_ARRAY_BUFFER:g.ARRAY_BUFFER;Qa=Tb.attributes[Pa];Qa.buffer=g.createBuffer();g.bindBuffer(Va,
+Qa.buffer);g.bufferData(Va,Qa.array,g.STATIC_DRAW)}}}else if(h instanceof THREE.Ribbon){k=h.geometry;if(!k.__webglVertexBuffer){var pb=k;pb.__webglVertexBuffer=g.createBuffer();pb.__webglColorBuffer=g.createBuffer();E.info.memory.geometries++;var Wa=k,ob=Wa.vertices.length;Wa.__vertexArray=new Float32Array(ob*3);Wa.__colorArray=new Float32Array(ob*3);Wa.__webglVertexCount=ob;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){k=h.geometry;if(!k.__webglVertexBuffer){var Mb=
+k;Mb.__webglVertexBuffer=g.createBuffer();Mb.__webglColorBuffer=g.createBuffer();E.info.memory.geometries++;var hc=k,ec=h,Lb=hc.vertices.length;hc.__vertexArray=new Float32Array(Lb*3);hc.__colorArray=new Float32Array(Lb*3);hc.__webglLineCount=Lb;b(hc,ec);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Ub=k;Ub.__webglVertexBuffer=g.createBuffer();Ub.__webglColorBuffer=g.createBuffer();E.info.geometries++;var Vb=
+k,gc=h,Nb=Vb.vertices.length;Vb.__vertexArray=new Float32Array(Nb*3);Vb.__colorArray=new Float32Array(Nb*3);Vb.__sortArray=[];Vb.__webglParticleCount=Nb;b(Vb,gc);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)n(i.__webglObjects,k,h);else for(j in k.geometryGroups){l=k.geometryGroups[j];n(i.__webglObjects,l,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=
+h.geometry;n(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 Ra=a.__objectsRemoved[0],xc=a;Ra instanceof THREE.Mesh||Ra instanceof THREE.ParticleSystem||Ra instanceof THREE.Ribbon||Ra instanceof
+THREE.Line?u(xc.__webglObjects,Ra):Ra instanceof THREE.Sprite?o(xc.__webglSprites,Ra):Ra instanceof THREE.LensFlare?o(xc.__webglFlares,Ra):(Ra instanceof THREE.ImmediateRenderObject||Ra.immediateRenderCallback)&&u(xc.__webglObjectsImmediate,Ra);Ra.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Oc=0,uc=a.__webglObjects.length;Oc<uc;Oc++){var Xa=a.__webglObjects[Oc].object,W=Xa.geometry,ic=void 0,Wb=void 0,Ka=void 0;if(Xa instanceof THREE.Mesh)if(W instanceof THREE.BufferGeometry){if(W.verticesNeedUpdate||
 W.elementsNeedUpdate||W.uvsNeedUpdate||W.normalsNeedUpdate||W.colorsNeedUpdate||W.tangentsNeedUpdate){var qb=W,Xb=g.DYNAMIC_DRAW,vc=!W.dynamic,Yb=qb.attributes,Pc=Yb.index,Qc=Yb.position,Rc=Yb.normal,Sc=Yb.uv,Tc=Yb.color,Uc=Yb.tangent;if(qb.elementsNeedUpdate&&Pc!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Pc.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Pc.array,Xb)}if(qb.verticesNeedUpdate&&Qc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Qc.buffer);g.bufferData(g.ARRAY_BUFFER,Qc.array,Xb)}if(qb.normalsNeedUpdate&&
 W.elementsNeedUpdate||W.uvsNeedUpdate||W.normalsNeedUpdate||W.colorsNeedUpdate||W.tangentsNeedUpdate){var qb=W,Xb=g.DYNAMIC_DRAW,vc=!W.dynamic,Yb=qb.attributes,Pc=Yb.index,Qc=Yb.position,Rc=Yb.normal,Sc=Yb.uv,Tc=Yb.color,Uc=Yb.tangent;if(qb.elementsNeedUpdate&&Pc!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Pc.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Pc.array,Xb)}if(qb.verticesNeedUpdate&&Qc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Qc.buffer);g.bufferData(g.ARRAY_BUFFER,Qc.array,Xb)}if(qb.normalsNeedUpdate&&
 Rc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Rc.buffer);g.bufferData(g.ARRAY_BUFFER,Rc.array,Xb)}if(qb.uvsNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,Xb)}if(qb.colorsNeedUpdate&&Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,Xb)}if(qb.tangentsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,Xb)}if(vc){var fc=void 0;for(fc in qb.attributes)delete qb.attributes[fc].array}}W.verticesNeedUpdate=
 Rc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Rc.buffer);g.bufferData(g.ARRAY_BUFFER,Rc.array,Xb)}if(qb.uvsNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,Xb)}if(qb.colorsNeedUpdate&&Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,Xb)}if(qb.tangentsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,Xb)}if(vc){var fc=void 0;for(fc in qb.attributes)delete qb.attributes[fc].array}}W.verticesNeedUpdate=
-false;W.elementsNeedUpdate=false;W.uvsNeedUpdate=false;W.normalsNeedUpdate=false;W.colorsNeedUpdate=false;W.tangentsNeedUpdate=false}else{for(var Vc=0,wc=W.geometryGroupsList.length;Vc<wc;Vc++){ic=W.geometryGroupsList[Vc];Ka=c(Xa,ic);Wb=Ka.attributes&&k(Ka);if(W.verticesNeedUpdate||W.morphTargetsNeedUpdate||W.elementsNeedUpdate||W.uvsNeedUpdate||W.normalsNeedUpdate||W.colorsNeedUpdate||W.tangentsNeedUpdate||Wb){var Y=ic,Mc=Xa,Ma=g.DYNAMIC_DRAW,Nc=!W.dynamic,Ob=Ka;if(Y.__inittedArrays){var dd=d(Ob),
-Wc=Ob.vertexColors?Ob.vertexColors:false,ed=f(Ob),yc=dd===THREE.SmoothShading,x=void 0,M=void 0,Ua=void 0,D=void 0,Zb=void 0,xb=void 0,Ya=void 0,zc=void 0,rb=void 0,$b=void 0,ac=void 0,O=void 0,P=void 0,Q=void 0,ga=void 0,Za=void 0,$a=void 0,ab=void 0,jc=void 0,bb=void 0,cb=void 0,db=void 0,kc=void 0,eb=void 0,fb=void 0,gb=void 0,lc=void 0,hb=void 0,ib=void 0,jb=void 0,mc=void 0,kb=void 0,lb=void 0,mb=void 0,nc=void 0,yb=void 0,zb=void 0,Ab=void 0,Ac=void 0,Bb=void 0,Cb=void 0,Db=void 0,Bc=void 0,
-ca=void 0,fd=void 0,Eb=void 0,bc=void 0,cc=void 0,Ca=void 0,gd=void 0,ya=void 0,za=void 0,Fb=void 0,sb=void 0,sa=0,wa=0,tb=0,ub=0,Sa=0,Ga=0,ha=0,Ia=0,ta=0,A=0,X=0,w=0,Na=void 0,Da=Y.__vertexArray,oc=Y.__uvArray,pc=Y.__uv2Array,Ta=Y.__normalArray,ka=Y.__tangentArray,Ea=Y.__colorArray,la=Y.__skinVertexAArray,ma=Y.__skinVertexBArray,na=Y.__skinIndexArray,oa=Y.__skinWeightArray,Xc=Y.__morphTargetsArrays,Yc=Y.__morphNormalsArrays,Zc=Y.__webglCustomAttributesList,t=void 0,nb=Y.__faceArray,Oa=Y.__lineArray,
-Ja=Mc.geometry,od=Ja.elementsNeedUpdate,hd=Ja.uvsNeedUpdate,pd=Ja.normalsNeedUpdate,qd=Ja.tangentsNeedUpdate,rd=Ja.colorsNeedUpdate,sd=Ja.morphTargetsNeedUpdate,Pb=Ja.vertices,da=Y.faces3,ea=Y.faces4,ua=Ja.faces,$c=Ja.faceVertexUvs[0],ad=Ja.faceVertexUvs[1],Qb=Ja.skinVerticesA,Rb=Ja.skinVerticesB,Sb=Ja.skinIndices,Gb=Ja.skinWeights,Hb=Ja.morphTargets,Cc=Ja.morphNormals;if(Ja.verticesNeedUpdate){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];O=Pb[D.a];P=Pb[D.b];Q=Pb[D.c];Da[wa]=O.x;Da[wa+1]=O.y;Da[wa+2]=
-O.z;Da[wa+3]=P.x;Da[wa+4]=P.y;Da[wa+5]=P.z;Da[wa+6]=Q.x;Da[wa+7]=Q.y;Da[wa+8]=Q.z;wa=wa+9}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];O=Pb[D.a];P=Pb[D.b];Q=Pb[D.c];ga=Pb[D.d];Da[wa]=O.x;Da[wa+1]=O.y;Da[wa+2]=O.z;Da[wa+3]=P.x;Da[wa+4]=P.y;Da[wa+5]=P.z;Da[wa+6]=Q.x;Da[wa+7]=Q.y;Da[wa+8]=Q.z;Da[wa+9]=ga.x;Da[wa+10]=ga.y;Da[wa+11]=ga.z;wa=wa+12}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Da,Ma)}if(sd){Ca=0;for(gd=Hb.length;Ca<gd;Ca++){x=X=0;for(M=da.length;x<M;x++){Fb=
-da[x];D=ua[Fb];O=Hb[Ca].vertices[D.a];P=Hb[Ca].vertices[D.b];Q=Hb[Ca].vertices[D.c];ya=Xc[Ca];ya[X]=O.x;ya[X+1]=O.y;ya[X+2]=O.z;ya[X+3]=P.x;ya[X+4]=P.y;ya[X+5]=P.z;ya[X+6]=Q.x;ya[X+7]=Q.y;ya[X+8]=Q.z;if(Ob.morphNormals){if(yc){sb=Cc[Ca].vertexNormals[Fb];bb=sb.a;cb=sb.b;db=sb.c}else db=cb=bb=Cc[Ca].faceNormals[Fb];za=Yc[Ca];za[X]=bb.x;za[X+1]=bb.y;za[X+2]=bb.z;za[X+3]=cb.x;za[X+4]=cb.y;za[X+5]=cb.z;za[X+6]=db.x;za[X+7]=db.y;za[X+8]=db.z}X=X+9}x=0;for(M=ea.length;x<M;x++){Fb=ea[x];D=ua[Fb];O=Hb[Ca].vertices[D.a];
-P=Hb[Ca].vertices[D.b];Q=Hb[Ca].vertices[D.c];ga=Hb[Ca].vertices[D.d];ya=Xc[Ca];ya[X]=O.x;ya[X+1]=O.y;ya[X+2]=O.z;ya[X+3]=P.x;ya[X+4]=P.y;ya[X+5]=P.z;ya[X+6]=Q.x;ya[X+7]=Q.y;ya[X+8]=Q.z;ya[X+9]=ga.x;ya[X+10]=ga.y;ya[X+11]=ga.z;if(Ob.morphNormals){if(yc){sb=Cc[Ca].vertexNormals[Fb];bb=sb.a;cb=sb.b;db=sb.c;kc=sb.d}else kc=db=cb=bb=Cc[Ca].faceNormals[Fb];za=Yc[Ca];za[X]=bb.x;za[X+1]=bb.y;za[X+2]=bb.z;za[X+3]=cb.x;za[X+4]=cb.y;za[X+5]=cb.z;za[X+6]=db.x;za[X+7]=db.y;za[X+8]=db.z;za[X+9]=kc.x;za[X+10]=
-kc.y;za[X+11]=kc.z}X=X+12}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglMorphTargetsBuffers[Ca]);g.bufferData(g.ARRAY_BUFFER,Xc[Ca],Ma);if(Ob.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglMorphNormalsBuffers[Ca]);g.bufferData(g.ARRAY_BUFFER,Yc[Ca],Ma)}}}if(Gb.length){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];hb=Gb[D.a];ib=Gb[D.b];jb=Gb[D.c];oa[A]=hb.x;oa[A+1]=hb.y;oa[A+2]=hb.z;oa[A+3]=hb.w;oa[A+4]=ib.x;oa[A+5]=ib.y;oa[A+6]=ib.z;oa[A+7]=ib.w;oa[A+8]=jb.x;oa[A+9]=jb.y;oa[A+10]=jb.z;oa[A+11]=jb.w;kb=Sb[D.a];
-lb=Sb[D.b];mb=Sb[D.c];na[A]=kb.x;na[A+1]=kb.y;na[A+2]=kb.z;na[A+3]=kb.w;na[A+4]=lb.x;na[A+5]=lb.y;na[A+6]=lb.z;na[A+7]=lb.w;na[A+8]=mb.x;na[A+9]=mb.y;na[A+10]=mb.z;na[A+11]=mb.w;yb=Qb[D.a];zb=Qb[D.b];Ab=Qb[D.c];la[A]=yb.x;la[A+1]=yb.y;la[A+2]=yb.z;la[A+3]=1;la[A+4]=zb.x;la[A+5]=zb.y;la[A+6]=zb.z;la[A+7]=1;la[A+8]=Ab.x;la[A+9]=Ab.y;la[A+10]=Ab.z;la[A+11]=1;Bb=Rb[D.a];Cb=Rb[D.b];Db=Rb[D.c];ma[A]=Bb.x;ma[A+1]=Bb.y;ma[A+2]=Bb.z;ma[A+3]=1;ma[A+4]=Cb.x;ma[A+5]=Cb.y;ma[A+6]=Cb.z;ma[A+7]=1;ma[A+8]=Db.x;ma[A+
-9]=Db.y;ma[A+10]=Db.z;ma[A+11]=1;A=A+12}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];hb=Gb[D.a];ib=Gb[D.b];jb=Gb[D.c];mc=Gb[D.d];oa[A]=hb.x;oa[A+1]=hb.y;oa[A+2]=hb.z;oa[A+3]=hb.w;oa[A+4]=ib.x;oa[A+5]=ib.y;oa[A+6]=ib.z;oa[A+7]=ib.w;oa[A+8]=jb.x;oa[A+9]=jb.y;oa[A+10]=jb.z;oa[A+11]=jb.w;oa[A+12]=mc.x;oa[A+13]=mc.y;oa[A+14]=mc.z;oa[A+15]=mc.w;kb=Sb[D.a];lb=Sb[D.b];mb=Sb[D.c];nc=Sb[D.d];na[A]=kb.x;na[A+1]=kb.y;na[A+2]=kb.z;na[A+3]=kb.w;na[A+4]=lb.x;na[A+5]=lb.y;na[A+6]=lb.z;na[A+7]=lb.w;na[A+8]=mb.x;na[A+
-9]=mb.y;na[A+10]=mb.z;na[A+11]=mb.w;na[A+12]=nc.x;na[A+13]=nc.y;na[A+14]=nc.z;na[A+15]=nc.w;yb=Qb[D.a];zb=Qb[D.b];Ab=Qb[D.c];Ac=Qb[D.d];la[A]=yb.x;la[A+1]=yb.y;la[A+2]=yb.z;la[A+3]=1;la[A+4]=zb.x;la[A+5]=zb.y;la[A+6]=zb.z;la[A+7]=1;la[A+8]=Ab.x;la[A+9]=Ab.y;la[A+10]=Ab.z;la[A+11]=1;la[A+12]=Ac.x;la[A+13]=Ac.y;la[A+14]=Ac.z;la[A+15]=1;Bb=Rb[D.a];Cb=Rb[D.b];Db=Rb[D.c];Bc=Rb[D.d];ma[A]=Bb.x;ma[A+1]=Bb.y;ma[A+2]=Bb.z;ma[A+3]=1;ma[A+4]=Cb.x;ma[A+5]=Cb.y;ma[A+6]=Cb.z;ma[A+7]=1;ma[A+8]=Db.x;ma[A+9]=Db.y;
-ma[A+10]=Db.z;ma[A+11]=1;ma[A+12]=Bc.x;ma[A+13]=Bc.y;ma[A+14]=Bc.z;ma[A+15]=1;A=A+16}if(A>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinVertexABuffer);g.bufferData(g.ARRAY_BUFFER,la,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinVertexBBuffer);g.bufferData(g.ARRAY_BUFFER,ma,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinIndicesBuffer);g.bufferData(g.ARRAY_BUFFER,na,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinWeightsBuffer);g.bufferData(g.ARRAY_BUFFER,oa,Ma)}}if(rd&&Wc){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];
-Ya=D.vertexColors;zc=D.color;if(Ya.length===3&&Wc===THREE.VertexColors){eb=Ya[0];fb=Ya[1];gb=Ya[2]}else gb=fb=eb=zc;Ea[ta]=eb.r;Ea[ta+1]=eb.g;Ea[ta+2]=eb.b;Ea[ta+3]=fb.r;Ea[ta+4]=fb.g;Ea[ta+5]=fb.b;Ea[ta+6]=gb.r;Ea[ta+7]=gb.g;Ea[ta+8]=gb.b;ta=ta+9}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];Ya=D.vertexColors;zc=D.color;if(Ya.length===4&&Wc===THREE.VertexColors){eb=Ya[0];fb=Ya[1];gb=Ya[2];lc=Ya[3]}else lc=gb=fb=eb=zc;Ea[ta]=eb.r;Ea[ta+1]=eb.g;Ea[ta+2]=eb.b;Ea[ta+3]=fb.r;Ea[ta+4]=fb.g;Ea[ta+5]=fb.b;Ea[ta+
-6]=gb.r;Ea[ta+7]=gb.g;Ea[ta+8]=gb.b;Ea[ta+9]=lc.r;Ea[ta+10]=lc.g;Ea[ta+11]=lc.b;ta=ta+12}if(ta>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Ea,Ma)}}if(qd&&Ja.hasTangents){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];rb=D.vertexTangents;Za=rb[0];$a=rb[1];ab=rb[2];ka[ha]=Za.x;ka[ha+1]=Za.y;ka[ha+2]=Za.z;ka[ha+3]=Za.w;ka[ha+4]=$a.x;ka[ha+5]=$a.y;ka[ha+6]=$a.z;ka[ha+7]=$a.w;ka[ha+8]=ab.x;ka[ha+9]=ab.y;ka[ha+10]=ab.z;ka[ha+11]=ab.w;ha=ha+12}x=0;for(M=ea.length;x<M;x++){D=
-ua[ea[x]];rb=D.vertexTangents;Za=rb[0];$a=rb[1];ab=rb[2];jc=rb[3];ka[ha]=Za.x;ka[ha+1]=Za.y;ka[ha+2]=Za.z;ka[ha+3]=Za.w;ka[ha+4]=$a.x;ka[ha+5]=$a.y;ka[ha+6]=$a.z;ka[ha+7]=$a.w;ka[ha+8]=ab.x;ka[ha+9]=ab.y;ka[ha+10]=ab.z;ka[ha+11]=ab.w;ka[ha+12]=jc.x;ka[ha+13]=jc.y;ka[ha+14]=jc.z;ka[ha+15]=jc.w;ha=ha+16}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,ka,Ma)}if(pd&&dd){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];Zb=D.vertexNormals;xb=D.normal;if(Zb.length===3&&yc)for(ca=
-0;ca<3;ca++){Eb=Zb[ca];Ta[Ga]=Eb.x;Ta[Ga+1]=Eb.y;Ta[Ga+2]=Eb.z;Ga=Ga+3}else for(ca=0;ca<3;ca++){Ta[Ga]=xb.x;Ta[Ga+1]=xb.y;Ta[Ga+2]=xb.z;Ga=Ga+3}}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];Zb=D.vertexNormals;xb=D.normal;if(Zb.length===4&&yc)for(ca=0;ca<4;ca++){Eb=Zb[ca];Ta[Ga]=Eb.x;Ta[Ga+1]=Eb.y;Ta[Ga+2]=Eb.z;Ga=Ga+3}else for(ca=0;ca<4;ca++){Ta[Ga]=xb.x;Ta[Ga+1]=xb.y;Ta[Ga+2]=xb.z;Ga=Ga+3}}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ta,Ma)}if(hd&&$c&&ed){x=0;for(M=
-da.length;x<M;x++){Ua=da[x];D=ua[Ua];$b=$c[Ua];if($b!==void 0)for(ca=0;ca<3;ca++){bc=$b[ca];oc[tb]=bc.u;oc[tb+1]=bc.v;tb=tb+2}}x=0;for(M=ea.length;x<M;x++){Ua=ea[x];D=ua[Ua];$b=$c[Ua];if($b!==void 0)for(ca=0;ca<4;ca++){bc=$b[ca];oc[tb]=bc.u;oc[tb+1]=bc.v;tb=tb+2}}if(tb>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,oc,Ma)}}if(hd&&ad&&ed){x=0;for(M=da.length;x<M;x++){Ua=da[x];D=ua[Ua];ac=ad[Ua];if(ac!==void 0)for(ca=0;ca<3;ca++){cc=ac[ca];pc[ub]=cc.u;pc[ub+1]=cc.v;ub=
-ub+2}}x=0;for(M=ea.length;x<M;x++){Ua=ea[x];D=ua[Ua];ac=ad[Ua];if(ac!==void 0)for(ca=0;ca<4;ca++){cc=ac[ca];pc[ub]=cc.u;pc[ub+1]=cc.v;ub=ub+2}}if(ub>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,pc,Ma)}}if(od){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];nb[Sa]=sa;nb[Sa+1]=sa+1;nb[Sa+2]=sa+2;Sa=Sa+3;Oa[Ia]=sa;Oa[Ia+1]=sa+1;Oa[Ia+2]=sa;Oa[Ia+3]=sa+2;Oa[Ia+4]=sa+1;Oa[Ia+5]=sa+2;Ia=Ia+6;sa=sa+3}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];nb[Sa]=sa;nb[Sa+1]=sa+1;nb[Sa+2]=sa+
+false;W.elementsNeedUpdate=false;W.uvsNeedUpdate=false;W.normalsNeedUpdate=false;W.colorsNeedUpdate=false;W.tangentsNeedUpdate=false}else{for(var Vc=0,wc=W.geometryGroupsList.length;Vc<wc;Vc++){ic=W.geometryGroupsList[Vc];Ka=c(Xa,ic);Wb=Ka.attributes&&m(Ka);if(W.verticesNeedUpdate||W.morphTargetsNeedUpdate||W.elementsNeedUpdate||W.uvsNeedUpdate||W.normalsNeedUpdate||W.colorsNeedUpdate||W.tangentsNeedUpdate||Wb){var Y=ic,Mc=Xa,Ma=g.DYNAMIC_DRAW,Nc=!W.dynamic,Ob=Ka;if(Y.__inittedArrays){var dd=d(Ob),
+Wc=Ob.vertexColors?Ob.vertexColors:false,ed=f(Ob),yc=dd===THREE.SmoothShading,y=void 0,M=void 0,Ua=void 0,C=void 0,Zb=void 0,xb=void 0,Ya=void 0,zc=void 0,rb=void 0,$b=void 0,ac=void 0,O=void 0,P=void 0,Q=void 0,ga=void 0,Za=void 0,$a=void 0,ab=void 0,jc=void 0,bb=void 0,cb=void 0,db=void 0,kc=void 0,eb=void 0,fb=void 0,gb=void 0,lc=void 0,hb=void 0,ib=void 0,jb=void 0,mc=void 0,kb=void 0,lb=void 0,mb=void 0,nc=void 0,yb=void 0,zb=void 0,Ab=void 0,Ac=void 0,Bb=void 0,Cb=void 0,Db=void 0,Bc=void 0,
+ca=void 0,fd=void 0,Eb=void 0,bc=void 0,cc=void 0,Ca=void 0,gd=void 0,ya=void 0,za=void 0,Fb=void 0,sb=void 0,sa=0,wa=0,tb=0,ub=0,Sa=0,Ga=0,ha=0,Ia=0,ta=0,B=0,X=0,w=0,Na=void 0,Da=Y.__vertexArray,oc=Y.__uvArray,pc=Y.__uv2Array,Ta=Y.__normalArray,ka=Y.__tangentArray,Ea=Y.__colorArray,la=Y.__skinVertexAArray,ma=Y.__skinVertexBArray,na=Y.__skinIndexArray,oa=Y.__skinWeightArray,Xc=Y.__morphTargetsArrays,Yc=Y.__morphNormalsArrays,Zc=Y.__webglCustomAttributesList,t=void 0,nb=Y.__faceArray,Oa=Y.__lineArray,
+Ja=Mc.geometry,od=Ja.elementsNeedUpdate,hd=Ja.uvsNeedUpdate,pd=Ja.normalsNeedUpdate,qd=Ja.tangentsNeedUpdate,rd=Ja.colorsNeedUpdate,sd=Ja.morphTargetsNeedUpdate,Pb=Ja.vertices,da=Y.faces3,ea=Y.faces4,ua=Ja.faces,$c=Ja.faceVertexUvs[0],ad=Ja.faceVertexUvs[1],Qb=Ja.skinVerticesA,Rb=Ja.skinVerticesB,Sb=Ja.skinIndices,Gb=Ja.skinWeights,Hb=Ja.morphTargets,Cc=Ja.morphNormals;if(Ja.verticesNeedUpdate){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];O=Pb[C.a];P=Pb[C.b];Q=Pb[C.c];Da[wa]=O.x;Da[wa+1]=O.y;Da[wa+2]=
+O.z;Da[wa+3]=P.x;Da[wa+4]=P.y;Da[wa+5]=P.z;Da[wa+6]=Q.x;Da[wa+7]=Q.y;Da[wa+8]=Q.z;wa=wa+9}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];O=Pb[C.a];P=Pb[C.b];Q=Pb[C.c];ga=Pb[C.d];Da[wa]=O.x;Da[wa+1]=O.y;Da[wa+2]=O.z;Da[wa+3]=P.x;Da[wa+4]=P.y;Da[wa+5]=P.z;Da[wa+6]=Q.x;Da[wa+7]=Q.y;Da[wa+8]=Q.z;Da[wa+9]=ga.x;Da[wa+10]=ga.y;Da[wa+11]=ga.z;wa=wa+12}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Da,Ma)}if(sd){Ca=0;for(gd=Hb.length;Ca<gd;Ca++){y=X=0;for(M=da.length;y<M;y++){Fb=
+da[y];C=ua[Fb];O=Hb[Ca].vertices[C.a];P=Hb[Ca].vertices[C.b];Q=Hb[Ca].vertices[C.c];ya=Xc[Ca];ya[X]=O.x;ya[X+1]=O.y;ya[X+2]=O.z;ya[X+3]=P.x;ya[X+4]=P.y;ya[X+5]=P.z;ya[X+6]=Q.x;ya[X+7]=Q.y;ya[X+8]=Q.z;if(Ob.morphNormals){if(yc){sb=Cc[Ca].vertexNormals[Fb];bb=sb.a;cb=sb.b;db=sb.c}else db=cb=bb=Cc[Ca].faceNormals[Fb];za=Yc[Ca];za[X]=bb.x;za[X+1]=bb.y;za[X+2]=bb.z;za[X+3]=cb.x;za[X+4]=cb.y;za[X+5]=cb.z;za[X+6]=db.x;za[X+7]=db.y;za[X+8]=db.z}X=X+9}y=0;for(M=ea.length;y<M;y++){Fb=ea[y];C=ua[Fb];O=Hb[Ca].vertices[C.a];
+P=Hb[Ca].vertices[C.b];Q=Hb[Ca].vertices[C.c];ga=Hb[Ca].vertices[C.d];ya=Xc[Ca];ya[X]=O.x;ya[X+1]=O.y;ya[X+2]=O.z;ya[X+3]=P.x;ya[X+4]=P.y;ya[X+5]=P.z;ya[X+6]=Q.x;ya[X+7]=Q.y;ya[X+8]=Q.z;ya[X+9]=ga.x;ya[X+10]=ga.y;ya[X+11]=ga.z;if(Ob.morphNormals){if(yc){sb=Cc[Ca].vertexNormals[Fb];bb=sb.a;cb=sb.b;db=sb.c;kc=sb.d}else kc=db=cb=bb=Cc[Ca].faceNormals[Fb];za=Yc[Ca];za[X]=bb.x;za[X+1]=bb.y;za[X+2]=bb.z;za[X+3]=cb.x;za[X+4]=cb.y;za[X+5]=cb.z;za[X+6]=db.x;za[X+7]=db.y;za[X+8]=db.z;za[X+9]=kc.x;za[X+10]=
+kc.y;za[X+11]=kc.z}X=X+12}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglMorphTargetsBuffers[Ca]);g.bufferData(g.ARRAY_BUFFER,Xc[Ca],Ma);if(Ob.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglMorphNormalsBuffers[Ca]);g.bufferData(g.ARRAY_BUFFER,Yc[Ca],Ma)}}}if(Gb.length){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];hb=Gb[C.a];ib=Gb[C.b];jb=Gb[C.c];oa[B]=hb.x;oa[B+1]=hb.y;oa[B+2]=hb.z;oa[B+3]=hb.w;oa[B+4]=ib.x;oa[B+5]=ib.y;oa[B+6]=ib.z;oa[B+7]=ib.w;oa[B+8]=jb.x;oa[B+9]=jb.y;oa[B+10]=jb.z;oa[B+11]=jb.w;kb=Sb[C.a];
+lb=Sb[C.b];mb=Sb[C.c];na[B]=kb.x;na[B+1]=kb.y;na[B+2]=kb.z;na[B+3]=kb.w;na[B+4]=lb.x;na[B+5]=lb.y;na[B+6]=lb.z;na[B+7]=lb.w;na[B+8]=mb.x;na[B+9]=mb.y;na[B+10]=mb.z;na[B+11]=mb.w;yb=Qb[C.a];zb=Qb[C.b];Ab=Qb[C.c];la[B]=yb.x;la[B+1]=yb.y;la[B+2]=yb.z;la[B+3]=1;la[B+4]=zb.x;la[B+5]=zb.y;la[B+6]=zb.z;la[B+7]=1;la[B+8]=Ab.x;la[B+9]=Ab.y;la[B+10]=Ab.z;la[B+11]=1;Bb=Rb[C.a];Cb=Rb[C.b];Db=Rb[C.c];ma[B]=Bb.x;ma[B+1]=Bb.y;ma[B+2]=Bb.z;ma[B+3]=1;ma[B+4]=Cb.x;ma[B+5]=Cb.y;ma[B+6]=Cb.z;ma[B+7]=1;ma[B+8]=Db.x;ma[B+
+9]=Db.y;ma[B+10]=Db.z;ma[B+11]=1;B=B+12}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];hb=Gb[C.a];ib=Gb[C.b];jb=Gb[C.c];mc=Gb[C.d];oa[B]=hb.x;oa[B+1]=hb.y;oa[B+2]=hb.z;oa[B+3]=hb.w;oa[B+4]=ib.x;oa[B+5]=ib.y;oa[B+6]=ib.z;oa[B+7]=ib.w;oa[B+8]=jb.x;oa[B+9]=jb.y;oa[B+10]=jb.z;oa[B+11]=jb.w;oa[B+12]=mc.x;oa[B+13]=mc.y;oa[B+14]=mc.z;oa[B+15]=mc.w;kb=Sb[C.a];lb=Sb[C.b];mb=Sb[C.c];nc=Sb[C.d];na[B]=kb.x;na[B+1]=kb.y;na[B+2]=kb.z;na[B+3]=kb.w;na[B+4]=lb.x;na[B+5]=lb.y;na[B+6]=lb.z;na[B+7]=lb.w;na[B+8]=mb.x;na[B+
+9]=mb.y;na[B+10]=mb.z;na[B+11]=mb.w;na[B+12]=nc.x;na[B+13]=nc.y;na[B+14]=nc.z;na[B+15]=nc.w;yb=Qb[C.a];zb=Qb[C.b];Ab=Qb[C.c];Ac=Qb[C.d];la[B]=yb.x;la[B+1]=yb.y;la[B+2]=yb.z;la[B+3]=1;la[B+4]=zb.x;la[B+5]=zb.y;la[B+6]=zb.z;la[B+7]=1;la[B+8]=Ab.x;la[B+9]=Ab.y;la[B+10]=Ab.z;la[B+11]=1;la[B+12]=Ac.x;la[B+13]=Ac.y;la[B+14]=Ac.z;la[B+15]=1;Bb=Rb[C.a];Cb=Rb[C.b];Db=Rb[C.c];Bc=Rb[C.d];ma[B]=Bb.x;ma[B+1]=Bb.y;ma[B+2]=Bb.z;ma[B+3]=1;ma[B+4]=Cb.x;ma[B+5]=Cb.y;ma[B+6]=Cb.z;ma[B+7]=1;ma[B+8]=Db.x;ma[B+9]=Db.y;
+ma[B+10]=Db.z;ma[B+11]=1;ma[B+12]=Bc.x;ma[B+13]=Bc.y;ma[B+14]=Bc.z;ma[B+15]=1;B=B+16}if(B>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinVertexABuffer);g.bufferData(g.ARRAY_BUFFER,la,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinVertexBBuffer);g.bufferData(g.ARRAY_BUFFER,ma,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinIndicesBuffer);g.bufferData(g.ARRAY_BUFFER,na,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinWeightsBuffer);g.bufferData(g.ARRAY_BUFFER,oa,Ma)}}if(rd&&Wc){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];
+Ya=C.vertexColors;zc=C.color;if(Ya.length===3&&Wc===THREE.VertexColors){eb=Ya[0];fb=Ya[1];gb=Ya[2]}else gb=fb=eb=zc;Ea[ta]=eb.r;Ea[ta+1]=eb.g;Ea[ta+2]=eb.b;Ea[ta+3]=fb.r;Ea[ta+4]=fb.g;Ea[ta+5]=fb.b;Ea[ta+6]=gb.r;Ea[ta+7]=gb.g;Ea[ta+8]=gb.b;ta=ta+9}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];Ya=C.vertexColors;zc=C.color;if(Ya.length===4&&Wc===THREE.VertexColors){eb=Ya[0];fb=Ya[1];gb=Ya[2];lc=Ya[3]}else lc=gb=fb=eb=zc;Ea[ta]=eb.r;Ea[ta+1]=eb.g;Ea[ta+2]=eb.b;Ea[ta+3]=fb.r;Ea[ta+4]=fb.g;Ea[ta+5]=fb.b;Ea[ta+
+6]=gb.r;Ea[ta+7]=gb.g;Ea[ta+8]=gb.b;Ea[ta+9]=lc.r;Ea[ta+10]=lc.g;Ea[ta+11]=lc.b;ta=ta+12}if(ta>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Ea,Ma)}}if(qd&&Ja.hasTangents){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];rb=C.vertexTangents;Za=rb[0];$a=rb[1];ab=rb[2];ka[ha]=Za.x;ka[ha+1]=Za.y;ka[ha+2]=Za.z;ka[ha+3]=Za.w;ka[ha+4]=$a.x;ka[ha+5]=$a.y;ka[ha+6]=$a.z;ka[ha+7]=$a.w;ka[ha+8]=ab.x;ka[ha+9]=ab.y;ka[ha+10]=ab.z;ka[ha+11]=ab.w;ha=ha+12}y=0;for(M=ea.length;y<M;y++){C=
+ua[ea[y]];rb=C.vertexTangents;Za=rb[0];$a=rb[1];ab=rb[2];jc=rb[3];ka[ha]=Za.x;ka[ha+1]=Za.y;ka[ha+2]=Za.z;ka[ha+3]=Za.w;ka[ha+4]=$a.x;ka[ha+5]=$a.y;ka[ha+6]=$a.z;ka[ha+7]=$a.w;ka[ha+8]=ab.x;ka[ha+9]=ab.y;ka[ha+10]=ab.z;ka[ha+11]=ab.w;ka[ha+12]=jc.x;ka[ha+13]=jc.y;ka[ha+14]=jc.z;ka[ha+15]=jc.w;ha=ha+16}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,ka,Ma)}if(pd&&dd){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];Zb=C.vertexNormals;xb=C.normal;if(Zb.length===3&&yc)for(ca=
+0;ca<3;ca++){Eb=Zb[ca];Ta[Ga]=Eb.x;Ta[Ga+1]=Eb.y;Ta[Ga+2]=Eb.z;Ga=Ga+3}else for(ca=0;ca<3;ca++){Ta[Ga]=xb.x;Ta[Ga+1]=xb.y;Ta[Ga+2]=xb.z;Ga=Ga+3}}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];Zb=C.vertexNormals;xb=C.normal;if(Zb.length===4&&yc)for(ca=0;ca<4;ca++){Eb=Zb[ca];Ta[Ga]=Eb.x;Ta[Ga+1]=Eb.y;Ta[Ga+2]=Eb.z;Ga=Ga+3}else for(ca=0;ca<4;ca++){Ta[Ga]=xb.x;Ta[Ga+1]=xb.y;Ta[Ga+2]=xb.z;Ga=Ga+3}}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ta,Ma)}if(hd&&$c&&ed){y=0;for(M=
+da.length;y<M;y++){Ua=da[y];C=ua[Ua];$b=$c[Ua];if($b!==void 0)for(ca=0;ca<3;ca++){bc=$b[ca];oc[tb]=bc.u;oc[tb+1]=bc.v;tb=tb+2}}y=0;for(M=ea.length;y<M;y++){Ua=ea[y];C=ua[Ua];$b=$c[Ua];if($b!==void 0)for(ca=0;ca<4;ca++){bc=$b[ca];oc[tb]=bc.u;oc[tb+1]=bc.v;tb=tb+2}}if(tb>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,oc,Ma)}}if(hd&&ad&&ed){y=0;for(M=da.length;y<M;y++){Ua=da[y];C=ua[Ua];ac=ad[Ua];if(ac!==void 0)for(ca=0;ca<3;ca++){cc=ac[ca];pc[ub]=cc.u;pc[ub+1]=cc.v;ub=
+ub+2}}y=0;for(M=ea.length;y<M;y++){Ua=ea[y];C=ua[Ua];ac=ad[Ua];if(ac!==void 0)for(ca=0;ca<4;ca++){cc=ac[ca];pc[ub]=cc.u;pc[ub+1]=cc.v;ub=ub+2}}if(ub>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,pc,Ma)}}if(od){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];nb[Sa]=sa;nb[Sa+1]=sa+1;nb[Sa+2]=sa+2;Sa=Sa+3;Oa[Ia]=sa;Oa[Ia+1]=sa+1;Oa[Ia+2]=sa;Oa[Ia+3]=sa+2;Oa[Ia+4]=sa+1;Oa[Ia+5]=sa+2;Ia=Ia+6;sa=sa+3}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];nb[Sa]=sa;nb[Sa+1]=sa+1;nb[Sa+2]=sa+
 3;nb[Sa+3]=sa+1;nb[Sa+4]=sa+2;nb[Sa+5]=sa+3;Sa=Sa+6;Oa[Ia]=sa;Oa[Ia+1]=sa+1;Oa[Ia+2]=sa;Oa[Ia+3]=sa+3;Oa[Ia+4]=sa+1;Oa[Ia+5]=sa+2;Oa[Ia+6]=sa+2;Oa[Ia+7]=sa+3;Ia=Ia+8;sa=sa+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Y.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,nb,Ma);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Y.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Oa,Ma)}if(Zc){ca=0;for(fd=Zc.length;ca<fd;ca++){t=Zc[ca];if(t.__original.needsUpdate){w=0;if(t.size===1)if(t.boundTo===void 0||t.boundTo===
 3;nb[Sa+3]=sa+1;nb[Sa+4]=sa+2;nb[Sa+5]=sa+3;Sa=Sa+6;Oa[Ia]=sa;Oa[Ia+1]=sa+1;Oa[Ia+2]=sa;Oa[Ia+3]=sa+3;Oa[Ia+4]=sa+1;Oa[Ia+5]=sa+2;Oa[Ia+6]=sa+2;Oa[Ia+7]=sa+3;Ia=Ia+8;sa=sa+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Y.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,nb,Ma);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Y.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Oa,Ma)}if(Zc){ca=0;for(fd=Zc.length;ca<fd;ca++){t=Zc[ca];if(t.__original.needsUpdate){w=0;if(t.size===1)if(t.boundTo===void 0||t.boundTo===
-"vertices"){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];t.array[w]=t.value[D.a];t.array[w+1]=t.value[D.b];t.array[w+2]=t.value[D.c];w=w+3}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];t.array[w]=t.value[D.a];t.array[w+1]=t.value[D.b];t.array[w+2]=t.value[D.c];t.array[w+3]=t.value[D.d];w=w+4}}else{if(t.boundTo==="faces"){x=0;for(M=da.length;x<M;x++){Na=t.value[da[x]];t.array[w]=Na;t.array[w+1]=Na;t.array[w+2]=Na;w=w+3}x=0;for(M=ea.length;x<M;x++){Na=t.value[ea[x]];t.array[w]=Na;t.array[w+1]=Na;t.array[w+2]=
-Na;t.array[w+3]=Na;w=w+4}}}else if(t.size===2)if(t.boundTo===void 0||t.boundTo==="vertices"){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];O=t.value[D.a];P=t.value[D.b];Q=t.value[D.c];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;w=w+6}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];O=t.value[D.a];P=t.value[D.b];Q=t.value[D.c];ga=t.value[D.d];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;t.array[w+6]=ga.x;
-t.array[w+7]=ga.y;w=w+8}}else{if(t.boundTo==="faces"){x=0;for(M=da.length;x<M;x++){Q=P=O=Na=t.value[da[x]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;w=w+6}x=0;for(M=ea.length;x<M;x++){ga=Q=P=O=Na=t.value[ea[x]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;t.array[w+6]=ga.x;t.array[w+7]=ga.y;w=w+8}}}else if(t.size===3){var Z;Z=t.type==="c"?["r","g","b"]:["x","y","z"];if(t.boundTo===void 0||
-t.boundTo==="vertices"){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];O=t.value[D.a];P=t.value[D.b];Q=t.value[D.c];t.array[w]=O[Z[0]];t.array[w+1]=O[Z[1]];t.array[w+2]=O[Z[2]];t.array[w+3]=P[Z[0]];t.array[w+4]=P[Z[1]];t.array[w+5]=P[Z[2]];t.array[w+6]=Q[Z[0]];t.array[w+7]=Q[Z[1]];t.array[w+8]=Q[Z[2]];w=w+9}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];O=t.value[D.a];P=t.value[D.b];Q=t.value[D.c];ga=t.value[D.d];t.array[w]=O[Z[0]];t.array[w+1]=O[Z[1]];t.array[w+2]=O[Z[2]];t.array[w+3]=P[Z[0]];t.array[w+4]=P[Z[1]];
-t.array[w+5]=P[Z[2]];t.array[w+6]=Q[Z[0]];t.array[w+7]=Q[Z[1]];t.array[w+8]=Q[Z[2]];t.array[w+9]=ga[Z[0]];t.array[w+10]=ga[Z[1]];t.array[w+11]=ga[Z[2]];w=w+12}}else if(t.boundTo==="faces"){x=0;for(M=da.length;x<M;x++){Q=P=O=Na=t.value[da[x]];t.array[w]=O[Z[0]];t.array[w+1]=O[Z[1]];t.array[w+2]=O[Z[2]];t.array[w+3]=P[Z[0]];t.array[w+4]=P[Z[1]];t.array[w+5]=P[Z[2]];t.array[w+6]=Q[Z[0]];t.array[w+7]=Q[Z[1]];t.array[w+8]=Q[Z[2]];w=w+9}x=0;for(M=ea.length;x<M;x++){ga=Q=P=O=Na=t.value[ea[x]];t.array[w]=
-O[Z[0]];t.array[w+1]=O[Z[1]];t.array[w+2]=O[Z[2]];t.array[w+3]=P[Z[0]];t.array[w+4]=P[Z[1]];t.array[w+5]=P[Z[2]];t.array[w+6]=Q[Z[0]];t.array[w+7]=Q[Z[1]];t.array[w+8]=Q[Z[2]];t.array[w+9]=ga[Z[0]];t.array[w+10]=ga[Z[1]];t.array[w+11]=ga[Z[2]];w=w+12}}}else if(t.size===4)if(t.boundTo===void 0||t.boundTo==="vertices"){x=0;for(M=da.length;x<M;x++){D=ua[da[x]];O=t.value[D.a];P=t.value[D.b];Q=t.value[D.c];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=
-P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;w=w+12}x=0;for(M=ea.length;x<M;x++){D=ua[ea[x]];O=t.value[D.a];P=t.value[D.b];Q=t.value[D.c];ga=t.value[D.d];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;t.array[w+12]=ga.x;t.array[w+13]=ga.y;t.array[w+14]=ga.z;t.array[w+15]=ga.w;w=w+
-16}}else if(t.boundTo==="faces"){x=0;for(M=da.length;x<M;x++){Q=P=O=Na=t.value[da[x]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;w=w+12}x=0;for(M=ea.length;x<M;x++){ga=Q=P=O=Na=t.value[ea[x]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;
+"vertices"){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];t.array[w]=t.value[C.a];t.array[w+1]=t.value[C.b];t.array[w+2]=t.value[C.c];w=w+3}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];t.array[w]=t.value[C.a];t.array[w+1]=t.value[C.b];t.array[w+2]=t.value[C.c];t.array[w+3]=t.value[C.d];w=w+4}}else{if(t.boundTo==="faces"){y=0;for(M=da.length;y<M;y++){Na=t.value[da[y]];t.array[w]=Na;t.array[w+1]=Na;t.array[w+2]=Na;w=w+3}y=0;for(M=ea.length;y<M;y++){Na=t.value[ea[y]];t.array[w]=Na;t.array[w+1]=Na;t.array[w+2]=
+Na;t.array[w+3]=Na;w=w+4}}}else if(t.size===2)if(t.boundTo===void 0||t.boundTo==="vertices"){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];O=t.value[C.a];P=t.value[C.b];Q=t.value[C.c];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;w=w+6}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];O=t.value[C.a];P=t.value[C.b];Q=t.value[C.c];ga=t.value[C.d];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;t.array[w+6]=ga.x;
+t.array[w+7]=ga.y;w=w+8}}else{if(t.boundTo==="faces"){y=0;for(M=da.length;y<M;y++){Q=P=O=Na=t.value[da[y]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;w=w+6}y=0;for(M=ea.length;y<M;y++){ga=Q=P=O=Na=t.value[ea[y]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;t.array[w+6]=ga.x;t.array[w+7]=ga.y;w=w+8}}}else if(t.size===3){var Z;Z=t.type==="c"?["r","g","b"]:["x","y","z"];if(t.boundTo===void 0||
+t.boundTo==="vertices"){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];O=t.value[C.a];P=t.value[C.b];Q=t.value[C.c];t.array[w]=O[Z[0]];t.array[w+1]=O[Z[1]];t.array[w+2]=O[Z[2]];t.array[w+3]=P[Z[0]];t.array[w+4]=P[Z[1]];t.array[w+5]=P[Z[2]];t.array[w+6]=Q[Z[0]];t.array[w+7]=Q[Z[1]];t.array[w+8]=Q[Z[2]];w=w+9}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];O=t.value[C.a];P=t.value[C.b];Q=t.value[C.c];ga=t.value[C.d];t.array[w]=O[Z[0]];t.array[w+1]=O[Z[1]];t.array[w+2]=O[Z[2]];t.array[w+3]=P[Z[0]];t.array[w+4]=P[Z[1]];
+t.array[w+5]=P[Z[2]];t.array[w+6]=Q[Z[0]];t.array[w+7]=Q[Z[1]];t.array[w+8]=Q[Z[2]];t.array[w+9]=ga[Z[0]];t.array[w+10]=ga[Z[1]];t.array[w+11]=ga[Z[2]];w=w+12}}else if(t.boundTo==="faces"){y=0;for(M=da.length;y<M;y++){Q=P=O=Na=t.value[da[y]];t.array[w]=O[Z[0]];t.array[w+1]=O[Z[1]];t.array[w+2]=O[Z[2]];t.array[w+3]=P[Z[0]];t.array[w+4]=P[Z[1]];t.array[w+5]=P[Z[2]];t.array[w+6]=Q[Z[0]];t.array[w+7]=Q[Z[1]];t.array[w+8]=Q[Z[2]];w=w+9}y=0;for(M=ea.length;y<M;y++){ga=Q=P=O=Na=t.value[ea[y]];t.array[w]=
+O[Z[0]];t.array[w+1]=O[Z[1]];t.array[w+2]=O[Z[2]];t.array[w+3]=P[Z[0]];t.array[w+4]=P[Z[1]];t.array[w+5]=P[Z[2]];t.array[w+6]=Q[Z[0]];t.array[w+7]=Q[Z[1]];t.array[w+8]=Q[Z[2]];t.array[w+9]=ga[Z[0]];t.array[w+10]=ga[Z[1]];t.array[w+11]=ga[Z[2]];w=w+12}}}else if(t.size===4)if(t.boundTo===void 0||t.boundTo==="vertices"){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];O=t.value[C.a];P=t.value[C.b];Q=t.value[C.c];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=
+P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;w=w+12}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];O=t.value[C.a];P=t.value[C.b];Q=t.value[C.c];ga=t.value[C.d];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;t.array[w+12]=ga.x;t.array[w+13]=ga.y;t.array[w+14]=ga.z;t.array[w+15]=ga.w;w=w+
+16}}else if(t.boundTo==="faces"){y=0;for(M=da.length;y<M;y++){Q=P=O=Na=t.value[da[y]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;w=w+12}y=0;for(M=ea.length;y<M;y++){ga=Q=P=O=Na=t.value[ea[y]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;
 t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;t.array[w+12]=ga.x;t.array[w+13]=ga.y;t.array[w+14]=ga.z;t.array[w+15]=ga.w;w=w+16}}g.bindBuffer(g.ARRAY_BUFFER,t.buffer);g.bufferData(g.ARRAY_BUFFER,t.array,Ma)}}}if(Nc){delete Y.__inittedArrays;delete Y.__colorArray;delete Y.__normalArray;delete Y.__tangentArray;delete Y.__uvArray;delete Y.__uv2Array;delete Y.__faceArray;delete Y.__vertexArray;delete Y.__lineArray;delete Y.__skinVertexAArray;delete Y.__skinVertexBArray;delete Y.__skinIndexArray;
 t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;t.array[w+12]=ga.x;t.array[w+13]=ga.y;t.array[w+14]=ga.z;t.array[w+15]=ga.w;w=w+16}}g.bindBuffer(g.ARRAY_BUFFER,t.buffer);g.bufferData(g.ARRAY_BUFFER,t.array,Ma)}}}if(Nc){delete Y.__inittedArrays;delete Y.__colorArray;delete Y.__normalArray;delete Y.__tangentArray;delete Y.__uvArray;delete Y.__uv2Array;delete Y.__faceArray;delete Y.__vertexArray;delete Y.__lineArray;delete Y.__skinVertexAArray;delete Y.__skinVertexBArray;delete Y.__skinIndexArray;
-delete Y.__skinWeightArray}}}}W.verticesNeedUpdate=false;W.morphTargetsNeedUpdate=false;W.elementsNeedUpdate=false;W.uvsNeedUpdate=false;W.normalsNeedUpdate=false;W.colorsNeedUpdate=false;W.tangentsNeedUpdate=false;Ka.attributes&&s(Ka)}else if(Xa instanceof THREE.Ribbon){if(W.verticesNeedUpdate||W.colorsNeedUpdate){var Ib=W,id=g.DYNAMIC_DRAW,qc=void 0,rc=void 0,Dc=void 0,Jb=void 0,Ec=void 0,jd=Ib.vertices,kd=Ib.colors,td=jd.length,ud=kd.length,Fc=Ib.__vertexArray,Gc=Ib.__colorArray,vd=Ib.colorsNeedUpdate;
-if(Ib.verticesNeedUpdate){for(qc=0;qc<td;qc++){Dc=jd[qc];Jb=qc*3;Fc[Jb]=Dc.x;Fc[Jb+1]=Dc.y;Fc[Jb+2]=Dc.z}g.bindBuffer(g.ARRAY_BUFFER,Ib.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Fc,id)}if(vd){for(rc=0;rc<ud;rc++){Ec=kd[rc];Jb=rc*3;Gc[Jb]=Ec.r;Gc[Jb+1]=Ec.g;Gc[Jb+2]=Ec.b}g.bindBuffer(g.ARRAY_BUFFER,Ib.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Gc,id)}}W.verticesNeedUpdate=false;W.colorsNeedUpdate=false}else if(Xa instanceof THREE.Line){Ka=c(Xa,ic);Wb=Ka.attributes&&k(Ka);if(W.verticesNeedUpdate||
+delete Y.__skinWeightArray}}}}W.verticesNeedUpdate=false;W.morphTargetsNeedUpdate=false;W.elementsNeedUpdate=false;W.uvsNeedUpdate=false;W.normalsNeedUpdate=false;W.colorsNeedUpdate=false;W.tangentsNeedUpdate=false;Ka.attributes&&q(Ka)}else if(Xa instanceof THREE.Ribbon){if(W.verticesNeedUpdate||W.colorsNeedUpdate){var Ib=W,id=g.DYNAMIC_DRAW,qc=void 0,rc=void 0,Dc=void 0,Jb=void 0,Ec=void 0,jd=Ib.vertices,kd=Ib.colors,td=jd.length,ud=kd.length,Fc=Ib.__vertexArray,Gc=Ib.__colorArray,vd=Ib.colorsNeedUpdate;
+if(Ib.verticesNeedUpdate){for(qc=0;qc<td;qc++){Dc=jd[qc];Jb=qc*3;Fc[Jb]=Dc.x;Fc[Jb+1]=Dc.y;Fc[Jb+2]=Dc.z}g.bindBuffer(g.ARRAY_BUFFER,Ib.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Fc,id)}if(vd){for(rc=0;rc<ud;rc++){Ec=kd[rc];Jb=rc*3;Gc[Jb]=Ec.r;Gc[Jb+1]=Ec.g;Gc[Jb+2]=Ec.b}g.bindBuffer(g.ARRAY_BUFFER,Ib.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Gc,id)}}W.verticesNeedUpdate=false;W.colorsNeedUpdate=false}else if(Xa instanceof THREE.Line){Ka=c(Xa,ic);Wb=Ka.attributes&&m(Ka);if(W.verticesNeedUpdate||
 W.colorsNeedUpdate||Wb){var vb=W,bd=g.DYNAMIC_DRAW,sc=void 0,tc=void 0,Hc=void 0,pa=void 0,Ic=void 0,ld=vb.vertices,md=vb.colors,wd=ld.length,xd=md.length,Jc=vb.__vertexArray,Kc=vb.__colorArray,yd=vb.colorsNeedUpdate,cd=vb.__webglCustomAttributesList,Lc=void 0,nd=void 0,Fa=void 0,dc=void 0,La=void 0,ia=void 0;if(vb.verticesNeedUpdate){for(sc=0;sc<wd;sc++){Hc=ld[sc];pa=sc*3;Jc[pa]=Hc.x;Jc[pa+1]=Hc.y;Jc[pa+2]=Hc.z}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Jc,bd)}if(yd){for(tc=
 W.colorsNeedUpdate||Wb){var vb=W,bd=g.DYNAMIC_DRAW,sc=void 0,tc=void 0,Hc=void 0,pa=void 0,Ic=void 0,ld=vb.vertices,md=vb.colors,wd=ld.length,xd=md.length,Jc=vb.__vertexArray,Kc=vb.__colorArray,yd=vb.colorsNeedUpdate,cd=vb.__webglCustomAttributesList,Lc=void 0,nd=void 0,Fa=void 0,dc=void 0,La=void 0,ia=void 0;if(vb.verticesNeedUpdate){for(sc=0;sc<wd;sc++){Hc=ld[sc];pa=sc*3;Jc[pa]=Hc.x;Jc[pa+1]=Hc.y;Jc[pa+2]=Hc.z}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Jc,bd)}if(yd){for(tc=
 0;tc<xd;tc++){Ic=md[tc];pa=tc*3;Kc[pa]=Ic.r;Kc[pa+1]=Ic.g;Kc[pa+2]=Ic.b}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Kc,bd)}if(cd){Lc=0;for(nd=cd.length;Lc<nd;Lc++){ia=cd[Lc];if(ia.needsUpdate&&(ia.boundTo===void 0||ia.boundTo==="vertices")){pa=0;dc=ia.value.length;if(ia.size===1)for(Fa=0;Fa<dc;Fa++)ia.array[Fa]=ia.value[Fa];else if(ia.size===2)for(Fa=0;Fa<dc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;pa=pa+2}else if(ia.size===3)if(ia.type==="c")for(Fa=
 0;tc<xd;tc++){Ic=md[tc];pa=tc*3;Kc[pa]=Ic.r;Kc[pa+1]=Ic.g;Kc[pa+2]=Ic.b}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Kc,bd)}if(cd){Lc=0;for(nd=cd.length;Lc<nd;Lc++){ia=cd[Lc];if(ia.needsUpdate&&(ia.boundTo===void 0||ia.boundTo==="vertices")){pa=0;dc=ia.value.length;if(ia.size===1)for(Fa=0;Fa<dc;Fa++)ia.array[Fa]=ia.value[Fa];else if(ia.size===2)for(Fa=0;Fa<dc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;pa=pa+2}else if(ia.size===3)if(ia.type==="c")for(Fa=
-0;Fa<dc;Fa++){La=ia.value[Fa];ia.array[pa]=La.r;ia.array[pa+1]=La.g;ia.array[pa+2]=La.b;pa=pa+3}else for(Fa=0;Fa<dc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;ia.array[pa+2]=La.z;pa=pa+3}else if(ia.size===4)for(Fa=0;Fa<dc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;ia.array[pa+2]=La.z;ia.array[pa+3]=La.w;pa=pa+4}g.bindBuffer(g.ARRAY_BUFFER,ia.buffer);g.bufferData(g.ARRAY_BUFFER,ia.array,bd)}}}}W.verticesNeedUpdate=false;W.colorsNeedUpdate=false;Ka.attributes&&s(Ka)}else if(Xa instanceof
-THREE.ParticleSystem){Ka=c(Xa,ic);Wb=Ka.attributes&&k(Ka);(W.verticesNeedUpdate||W.colorsNeedUpdate||Xa.sortParticles||Wb)&&e(W,g.DYNAMIC_DRAW,Xa);W.verticesNeedUpdate=false;W.colorsNeedUpdate=false;Ka.attributes&&s(Ka)}}};this.initMaterial=function(a,b,c,d){var e,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h=
-"phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,l,m,n;j=m=n=i=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&i++}}if(n+i+m<=V){k=m;l=n;m=i}else{k=Math.ceil(V*m/(n+m));m=
-l=V-k}var o=0,i=0;for(n=b.length;i<n;i++){j=b[i];if(j.castShadow){j instanceof THREE.SpotLight&&o++;j instanceof THREE.DirectionalLight&&!j.shadowCascade&&o++}}var q=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)q=d.bones.length;var p;a:{j=a.fragmentShader;n=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:q,morphTargets:a.morphTargets,
-morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(h)d.push(h);else{d.push(j);d.push(n)}for(r in c){d.push(r);
-d.push(c[r])}h=d.join();r=0;for(d=$.length;r<d;r++){k=$[r];if(k.code===h){k.usedTimes++;p=k.program;break a}}r=g.createProgram();d=["precision "+E+" float;",wc>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
+0;Fa<dc;Fa++){La=ia.value[Fa];ia.array[pa]=La.r;ia.array[pa+1]=La.g;ia.array[pa+2]=La.b;pa=pa+3}else for(Fa=0;Fa<dc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;ia.array[pa+2]=La.z;pa=pa+3}else if(ia.size===4)for(Fa=0;Fa<dc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;ia.array[pa+2]=La.z;ia.array[pa+3]=La.w;pa=pa+4}g.bindBuffer(g.ARRAY_BUFFER,ia.buffer);g.bufferData(g.ARRAY_BUFFER,ia.array,bd)}}}}W.verticesNeedUpdate=false;W.colorsNeedUpdate=false;Ka.attributes&&q(Ka)}else if(Xa instanceof
+THREE.ParticleSystem){Ka=c(Xa,ic);Wb=Ka.attributes&&m(Ka);(W.verticesNeedUpdate||W.colorsNeedUpdate||Xa.sortParticles||Wb)&&e(W,g.DYNAMIC_DRAW,Xa);W.verticesNeedUpdate=false;W.colorsNeedUpdate=false;Ka.attributes&&q(Ka)}}};this.initMaterial=function(a,b,c,d){var e,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h=
+"phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,l,n,m;j=n=m=i=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&n++;l instanceof THREE.PointLight&&m++;l instanceof THREE.SpotLight&&i++}}if(m+i+n<=V){k=n;l=m;n=i}else{k=Math.ceil(V*n/(m+n));n=
+l=V-k}var o=0,i=0;for(m=b.length;i<m;i++){j=b[i];if(j.castShadow){j instanceof THREE.SpotLight&&o++;j instanceof THREE.DirectionalLight&&!j.shadowCascade&&o++}}var q=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)q=d.bones.length;var p;a:{j=a.fragmentShader;m=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:q,morphTargets:a.morphTargets,
+morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:n,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(h)d.push(h);else{d.push(j);d.push(m)}for(r in c){d.push(r);
+d.push(c[r])}h=d.join();r=0;for(d=$.length;r<d;r++){k=$[r];if(k.code===h){k.usedTimes++;p=k.program;break a}}r=g.createProgram();d=["precision "+D+" float;",wc>0?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
 c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":
 c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":
 "",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 "",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-k=["precision "+E+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
+k=["precision "+D+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-j=C("fragment",k+j);d=C("vertex",d+n);g.attachShader(r,d);g.attachShader(r,j);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(j);g.deleteShader(d);r.uniforms={};r.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in i)d.push(s);
-s=d;d=0;for(i=s.length;d<i;d++){n=s[d];r.uniforms[n]=g.getUniformLocation(r,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(p in b)d.push(p);p=d;s=0;for(b=p.length;s<b;s++){c=p[s];r.attributes[c]=g.getAttribLocation(r,c)}r.id=fa++;$.push({program:r,code:h,usedTimes:1});F.info.memory.programs=$.length;p=r}a.program=p;p=a.program.attributes;
+j=x("fragment",k+j);d=x("vertex",d+m);g.attachShader(r,d);g.attachShader(r,j);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(j);g.deleteShader(d);r.uniforms={};r.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in i)d.push(s);
+s=d;d=0;for(i=s.length;d<i;d++){m=s[d];r.uniforms[m]=g.getUniformLocation(r,m)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(p in b)d.push(p);p=d;s=0;for(b=p.length;s<b;s++){c=p[s];r.attributes[c]=g.getAttribLocation(r,c)}r.id=fa++;$.push({program:r,code:h,usedTimes:1});E.info.memory.programs=$.length;p=r}a.program=p;p=a.program.attributes;
 p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);if(a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0){g.enableVertexAttribArray(p.skinVertexA);g.enableVertexAttribArray(p.skinVertexB);g.enableVertexAttribArray(p.skinIndex);g.enableVertexAttribArray(p.skinWeight)}if(a.attributes)for(f in a.attributes)p[f]!==void 0&&p[f]>=
 p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);if(a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0){g.enableVertexAttribArray(p.skinVertexA);g.enableVertexAttribArray(p.skinVertexB);g.enableVertexAttribArray(p.skinIndex);g.enableVertexAttribArray(p.skinWeight)}if(a.attributes)for(f in a.attributes)p[f]!==void 0&&p[f]>=
 0&&g.enableVertexAttribArray(p[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=b+f;if(p[s]>=0){g.enableVertexAttribArray(p[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=b+f;if(p[s]>=0){g.enableVertexAttribArray(p[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,
 0&&g.enableVertexAttribArray(p[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=b+f;if(p[s]>=0){g.enableVertexAttribArray(p[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=b+f;if(p[s]>=0){g.enableVertexAttribArray(p[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,
 b){if(a){!b||b==="ccw"?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.setObjectFaces=function(a){if(L!==a.doubleSided){a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE);L=a.doubleSided}if(qa!==a.flipSided){a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW);qa=a.flipSided}};this.setDepthTest=function(a){if(Ba!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);
 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.setObjectFaces=function(a){if(L!==a.doubleSided){a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE);L=a.doubleSided}if(qa!==a.flipSided){a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW);qa=a.flipSided}};this.setDepthTest=function(a){if(Ba!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);
 Ba=a}};this.setDepthWrite=function(a){if(Qa!==a){g.depthMask(a);Qa=a}};this.setBlending=function(a,b,c,d){if(a!==xa){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,
 Ba=a}};this.setDepthWrite=function(a){if(Qa!==a){g.depthMask(a);Qa=a}};this.setBlending=function(a,b,c,d){if(a!==xa){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)}xa=a}if(a===THREE.CustomBlending){if(b!==Aa){g.blendEquation(z(b));Aa=b}if(c!==Pa||d!==ja){g.blendFunc(z(c),z(d));Pa=c;ja=d}}else ja=Pa=Aa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=g.createTexture();F.info.memory.textures++}g.activeTexture(g.TEXTURE0+
-b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,a.flipY);g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=z(a.format),f=z(a.type);B(g.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?g.texImage2D(g.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):g.texImage2D(g.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&g.generateMipmap(g.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{g.activeTexture(g.TEXTURE0+
-b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=g.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=z(a.format),e=z(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];g.bindTexture(g.TEXTURE_CUBE_MAP,a.__webglTexture);B(g.TEXTURE_CUBE_MAP,a,c);
-for(var f=0;f<6;f++){a.__webglFramebuffer[f]=g.createFramebuffer();a.__webglRenderbuffer[f]=g.createRenderbuffer();g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,i=g.TEXTURE_CUBE_MAP_POSITIVE_X+f;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer[f]);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,i,h.__webglTexture,0);u(a.__webglRenderbuffer[f],a)}c&&g.generateMipmap(g.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=g.createFramebuffer();a.__webglRenderbuffer=
-g.createRenderbuffer();g.bindTexture(g.TEXTURE_2D,a.__webglTexture);B(g.TEXTURE_2D,a,c);g.texImage2D(g.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=g.TEXTURE_2D;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,d,a.__webglTexture,0);u(a.__webglRenderbuffer,a);c&&g.generateMipmap(g.TEXTURE_2D)}b?g.bindTexture(g.TEXTURE_CUBE_MAP,null):g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,
+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)}xa=a}if(a===THREE.CustomBlending){if(b!==Aa){g.blendEquation(A(b));Aa=b}if(c!==Pa||d!==ja){g.blendFunc(A(c),A(d));Pa=c;ja=d}}else ja=Pa=Aa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=g.createTexture();E.info.memory.textures++}g.activeTexture(g.TEXTURE0+
+b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,a.flipY);g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=A(a.format),f=A(a.type);F(g.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?g.texImage2D(g.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):g.texImage2D(g.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&g.generateMipmap(g.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{g.activeTexture(g.TEXTURE0+
+b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=g.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];g.bindTexture(g.TEXTURE_CUBE_MAP,a.__webglTexture);F(g.TEXTURE_CUBE_MAP,a,c);
+for(var f=0;f<6;f++){a.__webglFramebuffer[f]=g.createFramebuffer();a.__webglRenderbuffer[f]=g.createRenderbuffer();g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,i=g.TEXTURE_CUBE_MAP_POSITIVE_X+f;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer[f]);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,i,h.__webglTexture,0);s(a.__webglRenderbuffer[f],a)}c&&g.generateMipmap(g.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=g.createFramebuffer();a.__webglRenderbuffer=
+g.createRenderbuffer();g.bindTexture(g.TEXTURE_2D,a.__webglTexture);F(g.TEXTURE_2D,a,c);g.texImage2D(g.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=g.TEXTURE_2D;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,d,a.__webglTexture,0);s(a.__webglRenderbuffer,a);c&&g.generateMipmap(g.TEXTURE_2D)}b?g.bindTexture(g.TEXTURE_CUBE_MAP,null):g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,
 null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=Ub;a=gc;d=Tb;e=ec}if(b!==ra){g.bindFramebuffer(g.FRAMEBUFFER,b);g.viewport(d,e,c,a);ra=b}uc=c;vc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=Ub;a=gc;d=Tb;e=ec}if(b!==ra){g.bindFramebuffer(g.FRAMEBUFFER,b);g.viewport(d,e,c,a);ra=b}uc=c;vc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
@@ -411,11 +411,11 @@ THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this
 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,
 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,f,e=0,h=a.length;e<h;e=e+3){c=a[e];d=a[e+1];f=a[e+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(f<b.min.z)b.min.z=f;else if(f>b.max.z)b.max.z=f}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=
 Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,f,e=0,h=a.length;e<h;e=e+3){c=a[e];d=a[e+1];f=a[e+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(f<b.min.z)b.min.z=f;else if(f>b.max.z)b.max.z=f}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,f,e=0,h=a.length;e<h;e=e+3){b=a[e];d=a[e+1];f=a[e+2];b=Math.sqrt(b*b+d*d+f*f);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]=
 {radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,f,e=0,h=a.length;e<h;e=e+3){b=a[e];d=a[e+1];f=a[e+2];b=Math.sqrt(b*b+d*d+f*f);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 f=this.offsets,e=this.attributes.index.array,h=this.attributes.position.array,j=this.attributes.normal.array,m,l,i,o,k,s,r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;c=0;for(d=f.length;c<d;++c){b=f[c].start;m=f[c].count;var C=f[c].index;a=b;for(b=b+m;a<b;a=a+3){m=C+e[a];l=C+e[a+1];i=C+e[a+2];o=h[m*3];k=h[m*3+1];s=h[m*3+2];r.set(o,k,s);o=h[l*3];k=h[l*3+1];s=h[l*3+2];n.set(o,k,s);o=h[i*3];k=h[i*3+1];s=h[i*3+2];q.set(o,k,s);p.sub(q,n);v.sub(r,
-n);p.crossSelf(v);j[m*3]=j[m*3]+p.x;j[m*3+1]=j[m*3+1]+p.y;j[m*3+2]=j[m*3+2]+p.z;j[l*3]=j[l*3]+p.x;j[l*3+1]=j[l*3+1]+p.y;j[l*3+2]=j[l*3+2]+p.z;j[i*3]=j[i*3]+p.x;j[i*3+1]=j[i*3+1]+p.y;j[i*3+2]=j[i*3+2]+p.z}}a=0;for(b=j.length;a<b;a=a+3){o=j[a];k=j[a+1];s=j[a+2];c=1/Math.sqrt(o*o+k*k+s*s);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){o=d[a*3];k=d[a*3+1];s=d[a*3+2];r=d[b*3];n=d[b*3+1];q=d[b*3+2];p=d[c*3];v=d[c*3+1];C=d[c*3+2];B=
-e[a*2];u=e[a*2+1];J=e[b*2];z=e[b*2+1];N=e[c*2];E=e[c*2+1];H=r-o;G=p-o;R=n-k;U=v-k;T=q-s;y=C-s;K=J-B;V=N-B;F=z-u;$=E-u;fa=1/(K*$-V*F);I.set(($*H-F*G)*fa,($*R-F*U)*fa,($*T-F*y)*fa);ra.set((K*G-V*H)*fa,(K*U-V*R)*fa,(K*y-V*T)*fa);l[a].addSelf(I);l[b].addSelf(I);l[c].addSelf(I);i[a].addSelf(ra);i[b].addSelf(ra);i[c].addSelf(ra)}function b(a){ja.x=f[a*3];ja.y=f[a*3+1];ja.z=f[a*3+2];Ba.copy(ja);Va=l[a];Aa.copy(Va);Aa.subSelf(ja.multiplyScalar(ja.dot(Va))).normalize();Pa.cross(Ba,Va);ob=Pa.dot(i[a]);Qa=ob<
-0?-1:1;m[a*4]=Aa.x;m[a*4+1]=Aa.y;m[a*4+2]=Aa.z;m[a*4+3]=Qa}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,f=this.attributes.normal.array,e=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 m=this.attributes.tangent.array,l=[],i=[],j=0;j<h;j++){l[j]=new THREE.Vector3;i[j]=new THREE.Vector3}var o,k,s,r,n,q,p,v,C,B,u,J,z,N,E,H,G,R,U,T,y,K,V,F,$,fa,I=new THREE.Vector3,ra=new THREE.Vector3,S,ba,aa,va,L,qa=this.offsets,j=0;for(ba=qa.length;j<ba;++j){S=qa[j].start;aa=qa[j].count;var xa=qa[j].index,h=S;for(S=S+aa;h<S;h=h+3){aa=xa+c[h];va=xa+c[h+1];L=xa+c[h+2];a(aa,va,L)}}var Aa=new THREE.Vector3,Pa=new THREE.Vector3,ja=new THREE.Vector3,
+0}var f=this.offsets,e=this.attributes.index.array,h=this.attributes.position.array,j=this.attributes.normal.array,l,k,i,n,m,q,u=new THREE.Vector3,o=new THREE.Vector3,r=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;c=0;for(d=f.length;c<d;++c){b=f[c].start;l=f[c].count;var x=f[c].index;a=b;for(b=b+l;a<b;a=a+3){l=x+e[a];k=x+e[a+1];i=x+e[a+2];n=h[l*3];m=h[l*3+1];q=h[l*3+2];u.set(n,m,q);n=h[k*3];m=h[k*3+1];q=h[k*3+2];o.set(n,m,q);n=h[i*3];m=h[i*3+1];q=h[i*3+2];r.set(n,m,q);p.sub(r,o);v.sub(u,
+o);p.crossSelf(v);j[l*3]=j[l*3]+p.x;j[l*3+1]=j[l*3+1]+p.y;j[l*3+2]=j[l*3+2]+p.z;j[k*3]=j[k*3]+p.x;j[k*3+1]=j[k*3+1]+p.y;j[k*3+2]=j[k*3+2]+p.z;j[i*3]=j[i*3]+p.x;j[i*3+1]=j[i*3+1]+p.y;j[i*3+2]=j[i*3+2]+p.z}}a=0;for(b=j.length;a<b;a=a+3){n=j[a];m=j[a+1];q=j[a+2];c=1/Math.sqrt(n*n+m*m+q*q);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){n=d[a*3];m=d[a*3+1];q=d[a*3+2];u=d[b*3];o=d[b*3+1];r=d[b*3+2];p=d[c*3];v=d[c*3+1];x=d[c*3+2];F=
+e[a*2];s=e[a*2+1];I=e[b*2];A=e[b*2+1];N=e[c*2];D=e[c*2+1];H=u-n;G=p-n;R=o-m;U=v-m;T=r-q;z=x-q;K=I-F;V=N-F;E=A-s;$=D-s;fa=1/(K*$-V*E);J.set(($*H-E*G)*fa,($*R-E*U)*fa,($*T-E*z)*fa);ra.set((K*G-V*H)*fa,(K*U-V*R)*fa,(K*z-V*T)*fa);k[a].addSelf(J);k[b].addSelf(J);k[c].addSelf(J);i[a].addSelf(ra);i[b].addSelf(ra);i[c].addSelf(ra)}function b(a){ja.x=f[a*3];ja.y=f[a*3+1];ja.z=f[a*3+2];Ba.copy(ja);Va=k[a];Aa.copy(Va);Aa.subSelf(ja.multiplyScalar(ja.dot(Va))).normalize();Pa.cross(Ba,Va);ob=Pa.dot(i[a]);Qa=ob<
+0?-1:1;l[a*4]=Aa.x;l[a*4+1]=Aa.y;l[a*4+2]=Aa.z;l[a*4+3]=Qa}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,f=this.attributes.normal.array,e=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 l=this.attributes.tangent.array,k=[],i=[],j=0;j<h;j++){k[j]=new THREE.Vector3;i[j]=new THREE.Vector3}var n,m,q,u,o,r,p,v,x,F,s,I,A,N,D,H,G,R,U,T,z,K,V,E,$,fa,J=new THREE.Vector3,ra=new THREE.Vector3,S,ba,aa,va,L,qa=this.offsets,j=0;for(ba=qa.length;j<ba;++j){S=qa[j].start;aa=qa[j].count;var xa=qa[j].index,h=S;for(S=S+aa;h<S;h=h+3){aa=xa+c[h];va=xa+c[h+1];L=xa+c[h+2];a(aa,va,L)}}var Aa=new THREE.Vector3,Pa=new THREE.Vector3,ja=new THREE.Vector3,
 Ba=new THREE.Vector3,Qa,Va,ob,j=0;for(ba=qa.length;j<ba;++j){S=qa[j].start;aa=qa[j].count;xa=qa[j].index;h=S;for(S=S+aa;h<S;h=h+3){aa=xa+c[h];va=xa+c[h+1];L=xa+c[h+2];b(aa);b(va);b(L)}}this.tangentsNeedUpdate=this.hasTangents=true}}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
 Ba=new THREE.Vector3,Qa,Va,ob,j=0;for(ba=qa.length;j<ba;++j){S=qa[j].start;aa=qa[j].count;xa=qa[j].index;h=S;for(S=S+aa;h<S;h=h+3){aa=xa+c[h];va=xa+c[h+1];L=xa+c[h+2];b(aa);b(va);b(L)}}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);
 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;
 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;
@@ -427,33 +427,34 @@ THREE.CameraHelper.prototype.update=function(){function a(a,d,f,e){THREE.CameraH
 THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){b===void 0&&(b=-1);c===void 0&&(c=0);e===void 0&&(e=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:e,color:f,blending:d})};
 THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){b===void 0&&(b=-1);c===void 0&&(c=0);e===void 0&&(e=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:e,color:f,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,f=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+f*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,f=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+f*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};THREE.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,f,e,h,j,m,l,i,o,k,s;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
-0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;e=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);j=b.createTexture();m=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,m);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){l=false;i=a(THREE.ShaderFlares.lensFlare)}else{l=true;i=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};k={};o.vertex=b.getAttribLocation(i,"position");o.uv=b.getAttribLocation(i,"uv");k.renderType=b.getUniformLocation(i,"renderType");k.map=b.getUniformLocation(i,"map");k.occlusionMap=b.getUniformLocation(i,"occlusionMap");k.opacity=b.getUniformLocation(i,"opacity");k.color=b.getUniformLocation(i,
-"color");k.scale=b.getUniformLocation(i,"scale");k.rotation=b.getUniformLocation(i,"rotation");k.screenPosition=b.getUniformLocation(i,"screenPosition");s=false};this.render=function(a,d,f,p){var a=a.__webglFlares,v=a.length;if(v){var C=new THREE.Vector3,B=p/f,u=f*0.5,J=p*0.5,z=16/p,N=new THREE.Vector2(z*B,z),E=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),G=k,z=o;b.useProgram(i);if(!s){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);s=true}b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var R,U,T,y,K;for(R=0;R<v;R++){z=16/p;N.set(z*B,z);y=a[R];C.set(y.matrixWorld.elements[12],y.matrixWorld.elements[13],y.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(C);d.projectionMatrix.multiplyVector3(C);E.copy(C);H.x=E.x*u+u;H.y=E.y*J+J;if(l||H.x>0&&H.x<f&&H.y>0&&
-H.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,N.x,N.y);b.uniform3f(G.screenPosition,E.x,E.y,E.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,m);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(G.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);y.positionScreen.copy(E);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);U=0;for(T=y.lensFlares.length;U<T;U++){K=y.lensFlares[U];if(K.opacity>0.0010&&K.scale>0.0010){E.x=K.x;E.y=K.y;E.z=K.z;z=K.size*K.scale/p;N.x=z*B;N.y=z;b.uniform3f(G.screenPosition,E.x,E.y,E.z);b.uniform2f(G.scale,N.x,N.y);b.uniform1f(G.rotation,K.rotation);b.uniform1f(G.opacity,K.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,f,e,h,j,l,k,i,n,m,q;this.init=function(u){b=u.context;c=u;d=new Float32Array(16);f=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;f[u++]=0;f[u++]=1;f[u++]=2;f[u++]=0;f[u++]=2;f[u++]=3;e=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);j=b.createTexture();l=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,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;i=a(THREE.ShaderFlares.lensFlare)}else{k=true;i=a(THREE.ShaderFlares.lensFlareVertexTexture)}n={};m={};n.vertex=b.getAttribLocation(i,"position");n.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");q=false};this.render=function(a,d,f,p){var a=a.__webglFlares,v=a.length;if(v){var x=new THREE.Vector3,F=p/f,s=f*0.5,I=p*0.5,A=16/p,N=new THREE.Vector2(A*F,A),D=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),G=m,A=n;b.useProgram(i);if(!q){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);q=true}b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(A.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var R,U,T,z,K;for(R=0;R<v;R++){A=16/p;N.set(A*F,A);z=a[R];x.set(z.matrixWorld.elements[12],z.matrixWorld.elements[13],z.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(x);d.projectionMatrix.multiplyVector3(x);D.copy(x);H.x=D.x*s+s;H.y=D.y*I+I;if(k||H.x>0&&H.x<f&&H.y>0&&
+H.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,N.x,N.y);b.uniform3f(G.screenPosition,D.x,D.y,D.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,H.x-8,H.y-8,16,16,0);b.uniform1i(G.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);z.positionScreen.copy(D);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);U=0;for(T=z.lensFlares.length;U<T;U++){K=z.lensFlares[U];if(K.opacity>0.0010&&K.scale>0.0010){D.x=K.x;D.y=K.y;D.z=K.z;A=K.size*K.scale/p;N.x=A*F;N.y=A;b.uniform3f(G.screenPosition,D.x,D.y,D.z);b.uniform2f(G.scale,N.x,N.y);b.uniform1f(G.rotation,K.rotation);b.uniform1f(G.opacity,K.opacity);
 b.uniform3f(G.color,K.color.r,K.color.g,K.color.b);c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst);c.setTexture(K.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 b.uniform3f(G.color,K.color.r,K.color.g,K.color.b);c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst);c.setTexture(K.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
-THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4,h=new THREE.Vector3,j=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,l){var i,o,k,s,r,n,q,p,v,C=[];s=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);i=0;for(o=m.__lights.length;i<o;i++){k=m.__lights[i];if(k.castShadow)if(k instanceof THREE.DirectionalLight&&k.shadowCascade)for(r=0;r<k.shadowCascadeCount;r++){var B;if(k.shadowCascadeArray[r])B=k.shadowCascadeArray[r];
-else{v=k;q=r;B=new THREE.DirectionalLight;B.isVirtual=true;B.onlyShadow=true;B.castShadow=true;B.shadowCameraNear=v.shadowCameraNear;B.shadowCameraFar=v.shadowCameraFar;B.shadowCameraLeft=v.shadowCameraLeft;B.shadowCameraRight=v.shadowCameraRight;B.shadowCameraBottom=v.shadowCameraBottom;B.shadowCameraTop=v.shadowCameraTop;B.shadowCameraVisible=v.shadowCameraVisible;B.shadowDarkness=v.shadowDarkness;B.shadowBias=v.shadowCascadeBias[q];B.shadowMapWidth=v.shadowCascadeWidth[q];B.shadowMapHeight=v.shadowCascadeHeight[q];
-B.pointsWorld=[];B.pointsFrustum=[];p=B.pointsWorld;n=B.pointsFrustum;for(var u=0;u<8;u++){p[u]=new THREE.Vector3;n[u]=new THREE.Vector3}p=v.shadowCascadeNearZ[q];v=v.shadowCascadeFarZ[q];n[0].set(-1,-1,p);n[1].set(1,-1,p);n[2].set(-1,1,p);n[3].set(1,1,p);n[4].set(-1,-1,v);n[5].set(1,-1,v);n[6].set(-1,1,v);n[7].set(1,1,v);B.originalCamera=l;n=new THREE.Gyroscope;n.position=k.shadowCascadeOffset;n.add(B);n.add(B.target);l.add(n);k.shadowCascadeArray[r]=B;console.log("Created virtualLight",B)}q=k;p=
-r;v=q.shadowCascadeArray[p];v.position.copy(q.position);v.target.position.copy(q.target.position);v.lookAt(v.target);v.shadowCameraVisible=q.shadowCameraVisible;v.shadowDarkness=q.shadowDarkness;v.shadowBias=q.shadowCascadeBias[p];n=q.shadowCascadeNearZ[p];q=q.shadowCascadeFarZ[p];v=v.pointsFrustum;v[0].z=n;v[1].z=n;v[2].z=n;v[3].z=n;v[4].z=q;v[5].z=q;v[6].z=q;v[7].z=q;C[s]=B;s++}else{C[s]=k;s++}}i=0;for(o=C.length;i<o;i++){k=C[i];if(!k.shadowMap){k.shadowMap=new THREE.WebGLRenderTarget(k.shadowMapWidth,
-k.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});k.shadowMapSize=new THREE.Vector2(k.shadowMapWidth,k.shadowMapHeight);k.shadowMatrix=new THREE.Matrix4}if(!k.shadowCamera){if(k instanceof THREE.SpotLight)k.shadowCamera=new THREE.PerspectiveCamera(k.shadowCameraFov,k.shadowMapWidth/k.shadowMapHeight,k.shadowCameraNear,k.shadowCameraFar);else if(k instanceof THREE.DirectionalLight)k.shadowCamera=new THREE.OrthographicCamera(k.shadowCameraLeft,k.shadowCameraRight,
-k.shadowCameraTop,k.shadowCameraBottom,k.shadowCameraNear,k.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(k.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}if(k.shadowCameraVisible&&!k.cameraHelper){k.cameraHelper=new THREE.CameraHelper(k.shadowCamera);k.shadowCamera.add(k.cameraHelper)}if(k.isVirtual&&B.originalCamera==l){r=l;s=k.shadowCamera;n=k.pointsFrustum;v=k.pointsWorld;h.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(q=
-0;q<8;q++){p=v[q];p.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,r);s.matrixWorldInverse.multiplyVector3(p);if(p.x<h.x)h.x=p.x;if(p.x>j.x)j.x=p.x;if(p.y<h.y)h.y=p.y;if(p.y>j.y)j.y=p.y;if(p.z<h.z)h.z=p.z;if(p.z>j.z)j.z=p.z}s.left=h.x;s.right=j.x;s.top=j.y;s.bottom=h.y;s.updateProjectionMatrix()}s=k.shadowMap;n=k.shadowMatrix;r=k.shadowCamera;r.position.copy(k.matrixWorld.getPosition());r.lookAt(k.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);
-if(k.cameraHelper)k.cameraHelper.lines.visible=k.shadowCameraVisible;k.shadowCameraVisible&&k.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);e.multiply(r.projectionMatrix,
-r.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(s);b.clear();v=m.__webglObjects;k=0;for(s=v.length;k<s;k++){q=v[k];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||f.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}k=0;for(s=v.length;k<s;k++){q=v[k];if(q.render){n=q.object;q=q.buffer;p=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?
-b.renderBufferDirect(r,m.__lights,null,p,q,n):b.renderBuffer(r,m.__lights,null,p,q,n)}}v=m.__webglObjectsImmediate;k=0;for(s=v.length;k<s;k++){q=v[k];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,m.__lights,null,c,n)}}}i=b.getClearColor();o=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,h,j,m,l,i;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=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;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,k=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(s,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(s);b.compileShader(r);b.attachShader(k,s);b.attachShader(k,r);b.linkProgram(k);j=k;m={};l={};m.position=b.getAttribLocation(j,"position");m.uv=b.getAttribLocation(j,"uv");l.uvOffset=b.getUniformLocation(j,"uvOffset");l.uvScale=b.getUniformLocation(j,
-"uvScale");l.rotation=b.getUniformLocation(j,"rotation");l.scale=b.getUniformLocation(j,"scale");l.alignment=b.getUniformLocation(j,"alignment");l.color=b.getUniformLocation(j,"color");l.map=b.getUniformLocation(j,"map");l.opacity=b.getUniformLocation(j,"opacity");l.useScreenCoordinates=b.getUniformLocation(j,"useScreenCoordinates");l.affectedByDistance=b.getUniformLocation(j,"affectedByDistance");l.screenPosition=b.getUniformLocation(j,"screenPosition");l.modelViewMatrix=b.getUniformLocation(j,"modelViewMatrix");
-l.projectionMatrix=b.getUniformLocation(j,"projectionMatrix");i=false};this.render=function(d,f,s,r){var d=d.__webglSprites,n=d.length;if(n){var q=m,p=l,v=r/s,s=s*0.5,C=r*0.5,B=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,e);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-h);b.uniformMatrix4fv(p.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);for(var u,J=[],q=0;q<n;q++){u=d[q];if(u.visible&&u.opacity!==0)if(u.useScreenCoordinates)u.z=-u.position.z;else{u._modelViewMatrix.multiply(f.matrixWorldInverse,u.matrixWorld);u.z=-u._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){u=d[q];if(u.visible&&u.opacity!==0&&u.map&&u.map.image&&u.map.image.width){if(u.useScreenCoordinates){b.uniform1i(p.useScreenCoordinates,1);
-b.uniform3f(p.screenPosition,(u.position.x-s)/s,(C-u.position.y)/C,Math.max(0,Math.min(1,u.position.z)))}else{b.uniform1i(p.useScreenCoordinates,0);b.uniform1i(p.affectedByDistance,u.affectedByDistance?1:0);b.uniformMatrix4fv(p.modelViewMatrix,false,u._modelViewMatrix.elements)}f=u.map.image.width/(u.scaleByViewport?r:1);J[0]=f*v*u.scale.x;J[1]=f*u.scale.y;b.uniform2f(p.uvScale,u.uvScale.x,u.uvScale.y);b.uniform2f(p.uvOffset,u.uvOffset.x,u.uvOffset.y);b.uniform2f(p.alignment,u.alignment.x,u.alignment.y);
-b.uniform1f(p.opacity,u.opacity);b.uniform3f(p.color,u.color.r,u.color.g,u.color.b);b.uniform1f(p.rotation,u.rotation);b.uniform2fv(p.scale,J);if(u.mergeWith3D&&!B){b.enable(b.DEPTH_TEST);B=true}else if(!u.mergeWith3D&&B){b.disable(b.DEPTH_TEST);B=false}c.setBlending(u.blending,u.blendEquation,u.blendSrc,u.blendDst);c.setTexture(u.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.ShadowMapPlugin=function(){var a,b,c,d,f,e=new THREE.Frustum,h=new THREE.Matrix4,j=new THREE.Vector3,l=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:h,morphTargets:true});f=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,
+vertexShader:e.vertexShader,uniforms:h,skinning:true});c._shadowPass=true;d._shadowPass=true;f._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,i){var n,m,q,u,o,r,p,v,x,F=[];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);n=0;for(m=k.__lights.length;n<m;n++){q=k.__lights[n];if(q.castShadow)if(q instanceof THREE.DirectionalLight&&
+q.shadowCascade)for(o=0;o<q.shadowCascadeCount;o++){var s;if(q.shadowCascadeArray[o])s=q.shadowCascadeArray[o];else{x=q;p=o;s=new THREE.DirectionalLight;s.isVirtual=true;s.onlyShadow=true;s.castShadow=true;s.shadowCameraNear=x.shadowCameraNear;s.shadowCameraFar=x.shadowCameraFar;s.shadowCameraLeft=x.shadowCameraLeft;s.shadowCameraRight=x.shadowCameraRight;s.shadowCameraBottom=x.shadowCameraBottom;s.shadowCameraTop=x.shadowCameraTop;s.shadowCameraVisible=x.shadowCameraVisible;s.shadowDarkness=x.shadowDarkness;
+s.shadowBias=x.shadowCascadeBias[p];s.shadowMapWidth=x.shadowCascadeWidth[p];s.shadowMapHeight=x.shadowCascadeHeight[p];s.pointsWorld=[];s.pointsFrustum=[];v=s.pointsWorld;r=s.pointsFrustum;for(var I=0;I<8;I++){v[I]=new THREE.Vector3;r[I]=new THREE.Vector3}v=x.shadowCascadeNearZ[p];x=x.shadowCascadeFarZ[p];r[0].set(-1,-1,v);r[1].set(1,-1,v);r[2].set(-1,1,v);r[3].set(1,1,v);r[4].set(-1,-1,x);r[5].set(1,-1,x);r[6].set(-1,1,x);r[7].set(1,1,x);s.originalCamera=i;r=new THREE.Gyroscope;r.position=q.shadowCascadeOffset;
+r.add(s);r.add(s.target);i.add(r);q.shadowCascadeArray[o]=s;console.log("Created virtualLight",s)}p=q;v=o;x=p.shadowCascadeArray[v];x.position.copy(p.position);x.target.position.copy(p.target.position);x.lookAt(x.target);x.shadowCameraVisible=p.shadowCameraVisible;x.shadowDarkness=p.shadowDarkness;x.shadowBias=p.shadowCascadeBias[v];r=p.shadowCascadeNearZ[v];p=p.shadowCascadeFarZ[v];x=x.pointsFrustum;x[0].z=r;x[1].z=r;x[2].z=r;x[3].z=r;x[4].z=p;x[5].z=p;x[6].z=p;x[7].z=p;F[u]=s;u++}else{F[u]=q;u++}}n=
+0;for(m=F.length;n<m;n++){q=F[n];if(!q.shadowMap){q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight);q.shadowMatrix=new THREE.Matrix4}if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof
+THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}k.add(q.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(q.shadowCameraVisible&&!q.cameraHelper){q.cameraHelper=new THREE.CameraHelper(q.shadowCamera);q.shadowCamera.add(q.cameraHelper)}if(q.isVirtual&&s.originalCamera==i){o=i;u=q.shadowCamera;
+r=q.pointsFrustum;x=q.pointsWorld;j.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(p=0;p<8;p++){v=x[p];v.copy(r[p]);THREE.ShadowMapPlugin.__projector.unprojectVector(v,o);u.matrixWorldInverse.multiplyVector3(v);if(v.x<j.x)j.x=v.x;if(v.x>l.x)l.x=v.x;if(v.y<j.y)j.y=v.y;if(v.y>l.y)l.y=v.y;if(v.z<j.z)j.z=v.z;if(v.z>l.z)l.z=v.z}u.left=j.x;u.right=l.x;u.top=l.y;u.bottom=j.y;u.updateProjectionMatrix()}u=q.shadowMap;r=q.shadowMatrix;o=q.shadowCamera;o.position.copy(q.matrixWorld.getPosition());
+o.lookAt(q.target.matrixWorld.getPosition());o.updateMatrixWorld();o.matrixWorldInverse.getInverse(o.matrixWorld);if(q.cameraHelper)q.cameraHelper.lines.visible=q.shadowCameraVisible;q.shadowCameraVisible&&q.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(o.projectionMatrix);r.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);e.setFromMatrix(h);b.setRenderTarget(u);b.clear();x=k.__webglObjects;q=0;for(u=x.length;q<u;q++){p=x[q];r=p.object;p.render=false;if(r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh)||!r.frustumCulled||e.contains(r))){r._modelViewMatrix.multiply(o.matrixWorldInverse,r.matrixWorld);p.render=true}}q=0;for(u=x.length;q<u;q++){p=x[q];if(p.render){r=p.object;p=p.buffer;v=r.customDepthMaterial?
+r.customDepthMaterial:r.geometry.morphTargets.length?d:r instanceof THREE.SkinnedMesh?f:c;p instanceof THREE.BufferGeometry?b.renderBufferDirect(o,k.__lights,null,v,p,r):b.renderBuffer(o,k.__lights,null,v,p,r)}}x=k.__webglObjectsImmediate;q=0;for(u=x.length;q<u;q++){p=x[q];r=p.object;if(r.visible&&r.castShadow){r._modelViewMatrix.multiply(o.matrixWorldInverse,r.matrixWorld);b.renderImmediateObject(o,k.__lights,null,c,r)}}}n=b.getClearColor();m=b.getClearAlpha();a.clearColor(n.r,n.g,n.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,f,e,h,j,l,k,i;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=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;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),q=b.createShader(b.FRAGMENT_SHADER),u=b.createShader(b.VERTEX_SHADER);b.shaderSource(q,a.fragmentShader);b.shaderSource(u,a.vertexShader);b.compileShader(q);b.compileShader(u);b.attachShader(m,q);b.attachShader(m,u);b.linkProgram(m);j=m;l={};k={};l.position=b.getAttribLocation(j,"position");l.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,f,q,u){var d=d.__webglSprites,o=d.length;if(o){var r=l,p=k,v=u/q,q=q*0.5,x=u*0.5,F=true;b.useProgram(j);if(!i){b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);i=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h);b.uniformMatrix4fv(p.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);for(var s,I=[],r=0;r<o;r++){s=d[r];if(s.visible&&s.opacity!==0)if(s.useScreenCoordinates)s.z=-s.position.z;else{s._modelViewMatrix.multiply(f.matrixWorldInverse,s.matrixWorld);s.z=-s._modelViewMatrix.elements[14]}}d.sort(a);for(r=0;r<o;r++){s=d[r];if(s.visible&&s.opacity!==0&&s.map&&s.map.image&&s.map.image.width){if(s.useScreenCoordinates){b.uniform1i(p.useScreenCoordinates,1);
+b.uniform3f(p.screenPosition,(s.position.x-q)/q,(x-s.position.y)/x,Math.max(0,Math.min(1,s.position.z)))}else{b.uniform1i(p.useScreenCoordinates,0);b.uniform1i(p.affectedByDistance,s.affectedByDistance?1:0);b.uniformMatrix4fv(p.modelViewMatrix,false,s._modelViewMatrix.elements)}f=s.map.image.width/(s.scaleByViewport?u:1);I[0]=f*v*s.scale.x;I[1]=f*s.scale.y;b.uniform2f(p.uvScale,s.uvScale.x,s.uvScale.y);b.uniform2f(p.uvOffset,s.uvOffset.x,s.uvOffset.y);b.uniform2f(p.alignment,s.alignment.x,s.alignment.y);
+b.uniform1f(p.opacity,s.opacity);b.uniform3f(p.color,s.color.r,s.color.g,s.color.b);b.uniform1f(p.rotation,s.rotation);b.uniform2fv(p.scale,I);if(s.mergeWith3D&&!F){b.enable(b.DEPTH_TEST);F=true}else if(!s.mergeWith3D&&F){b.disable(b.DEPTH_TEST);F=false}c.setBlending(s.blending,s.blendEquation,s.blendSrc,s.blendDst);c.setTexture(s.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}"},
 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}"}};
 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}",
 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}",

+ 7 - 1
src/extras/renderers/plugins/ShadowMapPlugin.js

@@ -6,7 +6,7 @@ THREE.ShadowMapPlugin = function ( ) {
 
 
 	var _gl,
 	var _gl,
 	_renderer,
 	_renderer,
-	_depthMaterial, _depthMaterialMorph,
+	_depthMaterial, _depthMaterialMorph, _depthMaterialSkin,
 
 
 	_frustum = new THREE.Frustum(),
 	_frustum = new THREE.Frustum(),
 	_projScreenMatrix = new THREE.Matrix4(),
 	_projScreenMatrix = new THREE.Matrix4(),
@@ -24,9 +24,11 @@ THREE.ShadowMapPlugin = function ( ) {
 
 
 		_depthMaterial = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms } );
 		_depthMaterial = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms } );
 		_depthMaterialMorph = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, morphTargets: true } );
 		_depthMaterialMorph = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, morphTargets: true } );
+		_depthMaterialSkin = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, skinning: true } );
 
 
 		_depthMaterial._shadowPass = true;
 		_depthMaterial._shadowPass = true;
 		_depthMaterialMorph._shadowPass = true;
 		_depthMaterialMorph._shadowPass = true;
+		_depthMaterialSkin._shadowPass = true;
 
 
 	};
 	};
 
 
@@ -267,6 +269,10 @@ THREE.ShadowMapPlugin = function ( ) {
 
 
 						material = _depthMaterialMorph;
 						material = _depthMaterialMorph;
 
 
+					} else if ( object instanceof THREE.SkinnedMesh ) {
+
+						material = _depthMaterialSkin;
+
 					} else {
 					} else {
 
 
 						material = _depthMaterial;
 						material = _depthMaterial;

+ 2 - 0
src/renderers/WebGLShaders.js

@@ -1930,12 +1930,14 @@ THREE.ShaderLib = {
 
 
 		vertexShader: [
 		vertexShader: [
 
 
+			THREE.ShaderChunk[ "skinning_pars_vertex" ],
 			THREE.ShaderChunk[ "morphtarget_pars_vertex" ],
 			THREE.ShaderChunk[ "morphtarget_pars_vertex" ],
 
 
 			"void main() {",
 			"void main() {",
 
 
 				"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
 				"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
 
 
+				THREE.ShaderChunk[ "skinning_vertex" ],
 				THREE.ShaderChunk[ "morphtarget_vertex" ],
 				THREE.ShaderChunk[ "morphtarget_vertex" ],
 				THREE.ShaderChunk[ "default_vertex" ],
 				THREE.ShaderChunk[ "default_vertex" ],