Explorar o código

Updated builds.

Mr.doob %!s(int64=9) %!d(string=hai) anos
pai
achega
3c6588761a
Modificáronse 2 ficheiros con 189 adicións e 167 borrados
  1. 49 27
      build/three.js
  2. 140 140
      build/three.min.js

+ 49 - 27
build/three.js

@@ -10107,15 +10107,15 @@ THREE.Geometry.prototype = {
 
 	},
 
-	sortFacesByMaterial: function () {
+	sortFacesByMaterialIndex: function () {
 
-		function materialSort( a, b ) {
+		function materialIndexSort( a, b ) {
 
 			return a.materialIndex - b.materialIndex;
 
 		}
 
-		this.faces.sort( materialSort );
+		this.faces.sort( materialIndexSort );
 
 	},
 
@@ -22287,8 +22287,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( geometryAttribute !== undefined ) {
 
-					state.enableAttribute( programAttribute );
-
 					var size = geometryAttribute.itemSize;
 					var buffer = objects.getAttributeBuffer( geometryAttribute );
 
@@ -22298,19 +22296,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 						var stride = data.stride;
 						var offset = geometryAttribute.offset;
 
-						_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
-						_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, stride * data.array.BYTES_PER_ELEMENT, ( startIndex * stride + offset ) * data.array.BYTES_PER_ELEMENT );
-
 						if ( data instanceof THREE.InstancedInterleavedBuffer ) {
 
-							if ( extension === null ) {
-
-								console.error( 'THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.' );
-								return;
-
-							}
-
-							extension.vertexAttribDivisorANGLE( programAttribute, data.meshPerAttribute );
+							state.enableAttributeAndDivisor( programAttribute, data.meshPerAttribute, extension );
 
 							if ( geometry.maxInstancedCount === undefined ) {
 
@@ -22318,23 +22306,20 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 							}
 
-						}
-
-					} else {
+						} else {
 
-						_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
-						_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, 0, startIndex * size * 4 ); // 4 bytes per Float32
+							state.enableAttribute( programAttribute );
 
-						if ( geometryAttribute instanceof THREE.InstancedBufferAttribute ) {
+						}
 
-							if ( extension === null ) {
+						_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
+						_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, stride * data.array.BYTES_PER_ELEMENT, ( startIndex * stride + offset ) * data.array.BYTES_PER_ELEMENT );
 
-								console.error( 'THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.' );
-								return;
+					} else {
 
-							}
+						if ( geometryAttribute instanceof THREE.InstancedBufferAttribute ) {
 
-							extension.vertexAttribDivisorANGLE( programAttribute, geometryAttribute.meshPerAttribute );
+							state.enableAttributeAndDivisor( programAttribute, geometryAttribute.meshPerAttribute, extension );
 
 							if ( geometry.maxInstancedCount === undefined ) {
 
@@ -22342,8 +22327,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 							}
 
+						} else {
+
+							state.enableAttribute( programAttribute );
+
 						}
 
+						_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
+						_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, 0, startIndex * size * 4 ); // 4 bytes per Float32
+
 					}
 
 				} else if ( materialDefaultAttributeValues !== undefined ) {
@@ -26759,6 +26751,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
 
 	var newAttributes = new Uint8Array( 16 );
 	var enabledAttributes = new Uint8Array( 16 );
+	var attributeDivisors = new Uint8Array( 16 );
 
 	var capabilities = {};
 
@@ -26829,6 +26822,35 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
 
 		}
 
+		if ( attributeDivisors[ attribute ] !== 0 ) {
+
+			var extension = extensions.get( 'ANGLE_instanced_arrays' );
+
+			extension.vertexAttribDivisorANGLE( attribute, 0 );
+			attributeDivisors[ attribute ] = 0;
+
+		}
+
+	};
+
+	this.enableAttributeAndDivisor = function ( attribute, meshPerAttribute, extension ) {
+
+		newAttributes[ attribute ] = 1;
+
+		if ( enabledAttributes[ attribute ] === 0 ) {
+
+			gl.enableVertexAttribArray( attribute );
+			enabledAttributes[ attribute ] = 1;
+
+		}
+
+		if ( attributeDivisors[ attribute ] !== meshPerAttribute ) {
+
+			extension.vertexAttribDivisorANGLE( attribute, meshPerAttribute );
+			attributeDivisors[ attribute ] = meshPerAttribute;
+
+		}
+
 	};
 
 	this.disableUnusedAttributes = function () {

+ 140 - 140
build/three.min.js

@@ -106,8 +106,8 @@ e=Math.sin(e);if("XYZ"===a.order){a=g*h;var k=g*e,l=c*h,n=c*e;b[0]=f*h;b[4]=-f*e
 n*d+a,b[9]=k*d-l,b[2]=-d,b[6]=c*f,b[10]=g*f):"YZX"===a.order?(a=g*f,k=g*d,l=c*f,n=c*d,b[0]=f*h,b[4]=n-a*e,b[8]=l*e+k,b[1]=e,b[5]=g*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+l,b[10]=a-n*e):"XZY"===a.order&&(a=g*f,k=g*d,l=c*f,n=c*d,b[0]=f*h,b[4]=-e,b[8]=d*h,b[1]=a*e+n,b[5]=g*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=n*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");
 return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,g=a.w,f=c+c,h=d+d,k=e+e;a=c*f;var l=c*h,c=c*k,n=d*h,d=d*k,e=e*k,f=g*f,h=g*h,g=g*k;b[0]=1-(n+e);b[4]=l-g;b[8]=c+h;b[1]=l+g;b[5]=1-(a+e);b[9]=d-f;b[2]=c-h;b[6]=d+f;b[10]=1-(a+n);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a,b,c;return function(d,e,g){void 0===a&&(a=new THREE.Vector3);void 0===b&&(b=new THREE.Vector3);void 0===c&&(c=new THREE.Vector3);
 var f=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(g,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(g,c).normalize());b.crossVectors(c,a);f[0]=a.x;f[4]=b.x;f[8]=c.x;f[1]=a.y;f[5]=b.y;f[9]=c.y;f[2]=a.z;f[6]=b.z;f[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,
-b){var c=a.elements,d=b.elements,e=this.elements,g=c[0],f=c[4],h=c[8],k=c[12],l=c[1],n=c[5],p=c[9],m=c[13],q=c[2],r=c[6],t=c[10],v=c[14],w=c[3],u=c[7],y=c[11],c=c[15],x=d[0],I=d[4],E=d[8],z=d[12],A=d[1],G=d[5],L=d[9],D=d[13],C=d[2],N=d[6],K=d[10],H=d[14],M=d[3],F=d[7],Q=d[11],d=d[15];e[0]=g*x+f*A+h*C+k*M;e[4]=g*I+f*G+h*N+k*F;e[8]=g*E+f*L+h*K+k*Q;e[12]=g*z+f*D+h*H+k*d;e[1]=l*x+n*A+p*C+m*M;e[5]=l*I+n*G+p*N+m*F;e[9]=l*E+n*L+p*K+m*Q;e[13]=l*z+n*D+p*H+m*d;e[2]=q*x+r*A+t*C+v*M;e[6]=q*I+r*G+t*N+v*F;e[10]=
-q*E+r*L+t*K+v*Q;e[14]=q*z+r*D+t*H+v*d;e[3]=w*x+u*A+y*C+c*M;e[7]=w*I+u*G+y*N+c*F;e[11]=w*E+u*L+y*K+c*Q;e[15]=w*z+u*D+y*H+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(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]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=
+b){var c=a.elements,d=b.elements,e=this.elements,g=c[0],f=c[4],h=c[8],k=c[12],l=c[1],n=c[5],p=c[9],m=c[13],q=c[2],r=c[6],t=c[10],v=c[14],w=c[3],u=c[7],z=c[11],c=c[15],x=d[0],I=d[4],E=d[8],B=d[12],A=d[1],G=d[5],J=d[9],F=d[13],M=d[2],K=d[6],y=d[10],H=d[14],D=d[3],P=d[7],O=d[11],d=d[15];e[0]=g*x+f*A+h*M+k*D;e[4]=g*I+f*G+h*K+k*P;e[8]=g*E+f*J+h*y+k*O;e[12]=g*B+f*F+h*H+k*d;e[1]=l*x+n*A+p*M+m*D;e[5]=l*I+n*G+p*K+m*P;e[9]=l*E+n*J+p*y+m*O;e[13]=l*B+n*F+p*H+m*d;e[2]=q*x+r*A+t*M+v*D;e[6]=q*I+r*G+t*K+v*P;e[10]=
+q*E+r*J+t*y+v*O;e[14]=q*B+r*F+t*H+v*d;e[3]=w*x+u*A+z*M+c*D;e[7]=w*I+u*G+z*K+c*P;e[11]=w*E+u*J+z*y+c*O;e[15]=w*B+u*F+z*H+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(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]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=
 a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return a.applyProjection(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");
 return this.applyToVector3Array(a)},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.fromArray(b,c),a.applyMatrix4(this),a.toArray(b,c);return b}}(),applyToBuffer:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0===d&&(d=b.length/b.itemSize);for(var e=0;e<d;e++,c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix4(this),b.setXYZ(a.x,
 a.y,a.z);return b}}(),rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],g=a[1],f=a[5],h=a[9],k=a[13],l=a[2],n=a[6],p=a[10],m=a[14];return a[3]*(+e*h*n-d*k*
@@ -215,16 +215,16 @@ g.computeFaceNormals();g.computeVertexNormals();c=0;for(d=this.faces.length;c<d;
 a);else{var d,e=this.vertices.length,g=this.vertices,f=a.vertices,h=this.faces,k=a.faces,l=this.faceVertexUvs[0];a=a.faceVertexUvs[0];void 0===c&&(c=0);void 0!==b&&(d=(new THREE.Matrix3).getNormalMatrix(b));for(var n=0,p=f.length;n<p;n++){var m=f[n].clone();void 0!==b&&m.applyMatrix4(b);g.push(m)}n=0;for(p=k.length;n<p;n++){var f=k[n],q,r=f.vertexNormals,t=f.vertexColors,m=new THREE.Face3(f.a+e,f.b+e,f.c+e);m.normal.copy(f.normal);void 0!==d&&m.normal.applyMatrix3(d).normalize();b=0;for(g=r.length;b<
 g;b++)q=r[b].clone(),void 0!==d&&q.applyMatrix3(d).normalize(),m.vertexNormals.push(q);m.color.copy(f.color);b=0;for(g=t.length;b<g;b++)q=t[b],m.vertexColors.push(q.clone());m.materialIndex=f.materialIndex+c;h.push(m)}n=0;for(p=a.length;n<p;n++)if(c=a[n],d=[],void 0!==c){b=0;for(g=c.length;b<g;b++)d.push(c[b].clone());l.push(d)}}},mergeMesh:function(a){!1===a instanceof THREE.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a):(a.matrixAutoUpdate&&a.updateMatrix(),
 this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];a=[];g=0;for(f=this.faces.length;g<f;g++)for(e=this.faces[g],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]===e[(d+1)%3]){a.push(g);break}for(g=a.length-1;0<=g;g--)for(e=a[g],this.faces.splice(e,
-1),c=0,f=this.faceVertexUvs.length;c<f;c++)this.faceVertexUvs[c].splice(e,1);g=this.vertices.length-b.length;this.vertices=b;return g},sortFacesByMaterial:function(){this.faces.sort(function(a,b){return a.materialIndex-b.materialIndex})},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();if(void 0!==l[b])return l[b];l[b]=k.length/3;k.push(a.x,a.y,a.z);return l[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();
+1),c=0,f=this.faceVertexUvs.length;c<f;c++)this.faceVertexUvs[c].splice(e,1);g=this.vertices.length-b.length;this.vertices=b;return g},sortFacesByMaterialIndex:function(){this.faces.sort(function(a,b){return a.materialIndex-b.materialIndex})},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();if(void 0!==l[b])return l[b];l[b]=k.length/3;k.push(a.x,a.y,a.z);return l[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();
 if(void 0!==p[b])return p[b];p[b]=n.length;n.push(a.getHex());return p[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==q[b])return q[b];q[b]=m.length/2;m.push(a.x,a.y);return q[b]}var e={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};e.uuid=this.uuid;e.type=this.type;""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var g=this.parameters,f;for(f in g)void 0!==g[f]&&(e[f]=g[f]);return e}g=[];for(f=0;f<this.vertices.length;f++){var h=this.vertices[f];
-g.push(h.x,h.y,h.z)}var h=[],k=[],l={},n=[],p={},m=[],q={};for(f=0;f<this.faces.length;f++){var r=this.faces[f],t=void 0!==this.faceVertexUvs[0][f],v=0<r.normal.length(),w=0<r.vertexNormals.length,u=1!==r.color.r||1!==r.color.g||1!==r.color.b,y=0<r.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!1),x=a(x,2,!1),x=a(x,3,t),x=a(x,4,v),x=a(x,5,w),x=a(x,6,u),x=a(x,7,y);h.push(x);h.push(r.a,r.b,r.c);t&&(t=this.faceVertexUvs[0][f],h.push(d(t[0]),d(t[1]),d(t[2])));v&&h.push(b(r.normal));w&&(v=r.vertexNormals,
-h.push(b(v[0]),b(v[1]),b(v[2])));u&&h.push(c(r.color));y&&(r=r.vertexColors,h.push(c(r[0]),c(r[1]),c(r[2])))}e.data={};e.data.vertices=g;e.data.normals=k;0<n.length&&(e.data.colors=n);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.vertices=[];this.faces=[];this.faceVertexUvs=[[]];for(var b=a.vertices,c=0,d=b.length;c<d;c++)this.vertices.push(b[c].clone());b=a.faces;c=0;for(d=b.length;c<d;c++)this.faces.push(b[c].clone());
+g.push(h.x,h.y,h.z)}var h=[],k=[],l={},n=[],p={},m=[],q={};for(f=0;f<this.faces.length;f++){var r=this.faces[f],t=void 0!==this.faceVertexUvs[0][f],v=0<r.normal.length(),w=0<r.vertexNormals.length,u=1!==r.color.r||1!==r.color.g||1!==r.color.b,z=0<r.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!1),x=a(x,2,!1),x=a(x,3,t),x=a(x,4,v),x=a(x,5,w),x=a(x,6,u),x=a(x,7,z);h.push(x);h.push(r.a,r.b,r.c);t&&(t=this.faceVertexUvs[0][f],h.push(d(t[0]),d(t[1]),d(t[2])));v&&h.push(b(r.normal));w&&(v=r.vertexNormals,
+h.push(b(v[0]),b(v[1]),b(v[2])));u&&h.push(c(r.color));z&&(r=r.vertexColors,h.push(c(r[0]),c(r[1]),c(r[2])))}e.data={};e.data.vertices=g;e.data.normals=k;0<n.length&&(e.data.colors=n);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.vertices=[];this.faces=[];this.faceVertexUvs=[[]];for(var b=a.vertices,c=0,d=b.length;c<d;c++)this.vertices.push(b[c].clone());b=a.faces;c=0;for(d=b.length;c<d;c++)this.faces.push(b[c].clone());
 c=0;for(d=a.faceVertexUvs.length;c<d;c++){b=a.faceVertexUvs[c];void 0===this.faceVertexUvs[c]&&(this.faceVertexUvs[c]=[]);for(var e=0,g=b.length;e<g;e++){for(var f=b[e],h=[],k=0,l=f.length;k<l;k++)h.push(f[k].clone());this.faceVertexUvs[c].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;
 THREE.DirectGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="DirectGeometry";this.indices=[];this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1};
 THREE.DirectGeometry.prototype={constructor:THREE.DirectGeometry,computeBoundingBox:THREE.Geometry.prototype.computeBoundingBox,computeBoundingSphere:THREE.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(a){var b,c=[],
 d;a=a.faces;for(var e=0;e<a.length;e++){var g=a[e];g.materialIndex!==d&&(d=g.materialIndex,void 0!==b&&(b.count=3*e-b.start,c.push(b)),b={start:3*e,materialIndex:d})}void 0!==b&&(b.count=3*e-b.start,c.push(b));this.groups=c},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,g=d[1]&&0<d[1].length,f=a.morphTargets,h=f.length;if(0<h){for(var k=[],l=0;l<h;l++)k[l]=[];this.morphTargets.position=k}var n=a.morphNormals,p=n.length;if(0<p){for(var m=[],l=0;l<p;l++)m[l]=
 [];this.morphTargets.normal=m}for(var q=a.skinIndices,r=a.skinWeights,t=q.length===c.length,v=r.length===c.length,l=0;l<b.length;l++){var w=b[l];this.vertices.push(c[w.a],c[w.b],c[w.c]);var u=w.vertexNormals;3===u.length?this.normals.push(u[0],u[1],u[2]):(u=w.normal,this.normals.push(u,u,u));u=w.vertexColors;3===u.length?this.colors.push(u[0],u[1],u[2]):(u=w.color,this.colors.push(u,u,u));!0===e&&(u=d[0][l],void 0!==u?this.uvs.push(u[0],u[1],u[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",
-l),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===g&&(u=d[1][l],void 0!==u?this.uvs2.push(u[0],u[1],u[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));for(u=0;u<h;u++){var y=f[u].vertices;k[u].push(y[w.a],y[w.b],y[w.c])}for(u=0;u<p;u++)y=n[u].vertexNormals[l],m[u].push(y.a,y.b,y.c);t&&this.skinIndices.push(q[w.a],q[w.b],q[w.c]);v&&this.skinWeights.push(r[w.a],r[w.b],
+l),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===g&&(u=d[1][l],void 0!==u?this.uvs2.push(u[0],u[1],u[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));for(u=0;u<h;u++){var z=f[u].vertices;k[u].push(z[w.a],z[w.b],z[w.c])}for(u=0;u<p;u++)z=n[u].vertexNormals[l],m[u].push(z.a,z.b,z.c);t&&this.skinIndices.push(q[w.a],q[w.b],q[w.c]);v&&this.skinWeights.push(r[w.a],r[w.b],
 r[w.c])}this.computeGroups(a);this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.DirectGeometry.prototype);
 THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}};
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(a)},getIndex:function(){return this.index},setIndex:function(a){this.index=a},addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute&&!1===b instanceof THREE.InterleavedBufferAttribute?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(a,new THREE.BufferAttribute(b,
@@ -321,8 +321,8 @@ this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=t
 THREE.SpotLight.prototype.copy=function(a){THREE.Light.prototype.copy.call(this,a);this.intensity=a.intensity;this.distance=a.distance;this.angle=a.angle;this.exponent=a.exponent;this.decay=a.decay;this.target=a.target.clone();this.castShadow=a.castShadow;this.onlyShadow=a.onlyShadow;this.shadowCameraNear=a.shadowCameraNear;this.shadowCameraFar=a.shadowCameraFar;this.shadowCameraFov=a.shadowCameraFov;this.shadowCameraVisible=a.shadowCameraVisible;this.shadowBias=a.shadowBias;this.shadowDarkness=a.shadowDarkness;
 this.shadowMapWidth=a.shadowMapWidth;this.shadowMapHeight=a.shadowMapHeight;return this};THREE.SpotLight.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.color=this.color.getHex();a.object.intensity=this.intensity;a.object.distance=this.distance;a.object.angle=this.angle;a.object.exponent=this.exponent;a.object.decay=this.decay;return a};
 THREE.Cache={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}};THREE.Loader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
-THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b,c){for(var d=[],e=0;e<a.length;++e)d[e]=this.createMaterial(a[e],b,c);return d},createMaterial:function(){var a;return function(b,c,d){function e(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function g(b,g,f,h,k,l,v){var w=c+f,u,y=THREE.Loader.Handlers.get(w);null!==y?u=y.load(w):(u=new THREE.Texture,
-y=a,y.setCrossOrigin(d),y.load(w,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=e(a.width),c=e(a.height),d=document.createElement("canvas");d.width=b;d.height=c;d.getContext("2d").drawImage(a,0,0,b,c);u.image=d}else u.image=a;u.needsUpdate=!0}));u.sourceFile=f;h&&(u.repeat.set(h[0],h[1]),1!==h[0]&&(u.wrapS=THREE.RepeatWrapping),1!==h[1]&&(u.wrapT=THREE.RepeatWrapping));k&&u.offset.set(k[0],k[1]);l&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
+THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b,c){for(var d=[],e=0;e<a.length;++e)d[e]=this.createMaterial(a[e],b,c);return d},createMaterial:function(){var a;return function(b,c,d){function e(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function g(b,g,f,h,k,l,v){var w=c+f,u,z=THREE.Loader.Handlers.get(w);null!==z?u=z.load(w):(u=new THREE.Texture,
+z=a,z.setCrossOrigin(d),z.load(w,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=e(a.width),c=e(a.height),d=document.createElement("canvas");d.width=b;d.height=c;d.getContext("2d").drawImage(a,0,0,b,c);u.image=d}else u.image=a;u.needsUpdate=!0}));u.sourceFile=f;h&&(u.repeat.set(h[0],h[1]),1!==h[0]&&(u.wrapS=THREE.RepeatWrapping),1!==h[1]&&(u.wrapT=THREE.RepeatWrapping));k&&u.offset.set(k[0],k[1]);l&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
 void 0!==f[l[0]]&&(u.wrapS=f[l[0]]),void 0!==f[l[1]]&&(u.wrapT=f[l[1]]));v&&(u.anisotropy=v);b[g]=u}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}void 0===d&&void 0!==this.crossOrigin&&(d=this.crossOrigin);void 0===a&&(a=new THREE.ImageLoader);var h="MeshLambertMaterial",k={};if(b.shading){var l=b.shading.toLowerCase();"phong"===l?h="MeshPhongMaterial":"basic"===l&&(h="MeshBasicMaterial")}void 0!==b.blending&&void 0!==THREE[b.blending]&&(k.blending=THREE[b.blending]);void 0!==b.transparent&&
 (k.transparent=b.transparent);void 0!==b.opacity&&1>b.opacity&&(k.transparent=!0);void 0!==b.depthTest&&(k.depthTest=b.depthTest);void 0!==b.depthWrite&&(k.depthWrite=b.depthWrite);void 0!==b.visible&&(k.visible=b.visible);void 0!==b.flipSided&&(k.side=THREE.BackSide);void 0!==b.doubleSided&&(k.side=THREE.DoubleSide);void 0!==b.wireframe&&(k.wireframe=b.wireframe);void 0!==b.vertexColors&&("face"===b.vertexColors?k.vertexColors=THREE.FaceColors:b.vertexColors&&(k.vertexColors=THREE.VertexColors));
 b.colorDiffuse?k.color=f(b.colorDiffuse):b.DbgColor&&(k.color=b.DbgColor);b.colorEmissive&&(k.emissive=f(b.colorEmissive));"MeshPhongMaterial"===h&&(b.colorSpecular&&(k.specular=f(b.colorSpecular)),b.specularCoef&&(k.shininess=b.specularCoef));void 0!==b.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),b.opacity=b.transparency);void 0!==b.opacity&&(k.opacity=b.opacity);c&&(b.mapDiffuse&&g(k,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap,
@@ -335,10 +335,10 @@ THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d
 e.manager.itemStart(a);f.src=a;return f},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){"boolean"===typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.withCredentials=!1};
 THREE.JSONLoader.prototype={constructor:THREE.JSONLoader,get statusDomElement(){void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div"));console.warn("THREE.JSONLoader: .statusDomElement has been removed.");return this._statusDomElement},load:function(a,b,c,d){var e=this,g=this.texturePath&&"string"===typeof this.texturePath?this.texturePath:THREE.Loader.prototype.extractUrlBase(a);c=new THREE.XHRLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.setWithCredentials(this.withCredentials);
 c.load(a,function(c){c=JSON.parse(c);var d=c.metadata;if(void 0!==d){if("object"===d.type){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");return}if("scene"===d.type){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.");return}}c=e.parse(c,g);b(c.geometry,c.materials)})},setCrossOrigin:function(a){this.crossOrigin=a},setTexturePath:function(a){this.texturePath=a},parse:function(a,b){var c=new THREE.Geometry,d=void 0!==
-a.scale?1/a.scale:1;(function(b){var d,f,h,k,l,n,p,m,q,r,t,v,w,u=a.faces;n=a.vertices;var y=a.normals,x=a.colors,I=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&I++;for(d=0;d<I;d++)c.faceVertexUvs[d]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=u.length;k<l;)if(b=u[k++],q=b&1,h=b&2,d=b&8,p=b&16,r=b&32,n=b&64,b&=128,q){q=new THREE.Face3;q.a=u[k];q.b=u[k+1];q.c=u[k+3];t=new THREE.Face3;t.a=u[k+1];t.b=u[k+2];t.c=
-u[k+3];k+=4;h&&(h=u[k++],q.materialIndex=h,t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<I;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],f=0;4>f;f++)m=u[k++],w=v[2*m],m=v[2*m+1],w=new THREE.Vector2(w,m),2!==f&&c.faceVertexUvs[d][h].push(w),0!==f&&c.faceVertexUvs[d][h+1].push(w);p&&(p=3*u[k++],q.normal.set(y[p++],y[p++],y[p]),t.normal.copy(q.normal));if(r)for(d=0;4>d;d++)p=3*u[k++],r=new THREE.Vector3(y[p++],y[p++],y[p]),2!==d&&q.vertexNormals.push(r),0!==d&&t.vertexNormals.push(r);
-n&&(n=u[k++],n=x[n],q.color.setHex(n),t.color.setHex(n));if(b)for(d=0;4>d;d++)n=u[k++],n=x[n],2!==d&&q.vertexColors.push(new THREE.Color(n)),0!==d&&t.vertexColors.push(new THREE.Color(n));c.faces.push(q);c.faces.push(t)}else{q=new THREE.Face3;q.a=u[k++];q.b=u[k++];q.c=u[k++];h&&(h=u[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<I;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],f=0;3>f;f++)m=u[k++],w=v[2*m],m=v[2*m+1],w=new THREE.Vector2(w,m),c.faceVertexUvs[d][h].push(w);p&&(p=3*u[k++],q.normal.set(y[p++],
-y[p++],y[p]));if(r)for(d=0;3>d;d++)p=3*u[k++],r=new THREE.Vector3(y[p++],y[p++],y[p]),q.vertexNormals.push(r);n&&(n=u[k++],q.color.setHex(x[n]));if(b)for(d=0;3>d;d++)n=u[k++],q.vertexColors.push(new THREE.Color(x[n]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,f=a.skinWeights.length;d<f;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d],1<b?a.skinWeights[d+1]:0,2<b?a.skinWeights[d+2]:0,3<b?a.skinWeights[d+3]:
+a.scale?1/a.scale:1;(function(b){var d,f,h,k,l,n,p,m,q,r,t,v,w,u=a.faces;n=a.vertices;var z=a.normals,x=a.colors,I=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&I++;for(d=0;d<I;d++)c.faceVertexUvs[d]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=u.length;k<l;)if(b=u[k++],q=b&1,h=b&2,d=b&8,p=b&16,r=b&32,n=b&64,b&=128,q){q=new THREE.Face3;q.a=u[k];q.b=u[k+1];q.c=u[k+3];t=new THREE.Face3;t.a=u[k+1];t.b=u[k+2];t.c=
+u[k+3];k+=4;h&&(h=u[k++],q.materialIndex=h,t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<I;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],f=0;4>f;f++)m=u[k++],w=v[2*m],m=v[2*m+1],w=new THREE.Vector2(w,m),2!==f&&c.faceVertexUvs[d][h].push(w),0!==f&&c.faceVertexUvs[d][h+1].push(w);p&&(p=3*u[k++],q.normal.set(z[p++],z[p++],z[p]),t.normal.copy(q.normal));if(r)for(d=0;4>d;d++)p=3*u[k++],r=new THREE.Vector3(z[p++],z[p++],z[p]),2!==d&&q.vertexNormals.push(r),0!==d&&t.vertexNormals.push(r);
+n&&(n=u[k++],n=x[n],q.color.setHex(n),t.color.setHex(n));if(b)for(d=0;4>d;d++)n=u[k++],n=x[n],2!==d&&q.vertexColors.push(new THREE.Color(n)),0!==d&&t.vertexColors.push(new THREE.Color(n));c.faces.push(q);c.faces.push(t)}else{q=new THREE.Face3;q.a=u[k++];q.b=u[k++];q.c=u[k++];h&&(h=u[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<I;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],f=0;3>f;f++)m=u[k++],w=v[2*m],m=v[2*m+1],w=new THREE.Vector2(w,m),c.faceVertexUvs[d][h].push(w);p&&(p=3*u[k++],q.normal.set(z[p++],
+z[p++],z[p]));if(r)for(d=0;3>d;d++)p=3*u[k++],r=new THREE.Vector3(z[p++],z[p++],z[p]),q.vertexNormals.push(r);n&&(n=u[k++],q.color.setHex(x[n]));if(b)for(d=0;3>d;d++)n=u[k++],q.vertexColors.push(new THREE.Color(x[n]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,f=a.skinWeights.length;d<f;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d],1<b?a.skinWeights[d+1]:0,2<b?a.skinWeights[d+2]:0,3<b?a.skinWeights[d+3]:
 0));if(a.skinIndices)for(d=0,f=a.skinIndices.length;d<f;d+=b)c.skinIndices.push(new THREE.Vector4(a.skinIndices[d],1<b?a.skinIndices[d+1]:0,2<b?a.skinIndices[d+2]:0,3<b?a.skinIndices[d+3]:0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.")})();(function(b){if(void 0!==
 a.morphTargets){var d,f,h,k,l,n;d=0;for(f=a.morphTargets.length;d<f;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],l=c.morphTargets[d].vertices,n=a.morphTargets[d].vertices,h=0,k=n.length;h<k;h+=3){var p=new THREE.Vector3;p.x=n[h]*b;p.y=n[h+1]*b;p.z=n[h+2]*b;l.push(p)}}if(void 0!==a.morphColors)for(d=0,f=a.morphColors.length;d<f;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,
 l=a.morphColors[d].colors,b=0,h=l.length;b<h;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)})(d);(function(){var b=[],d=[];void 0!==a.animation&&d.push(a.animation);void 0!==a.animations&&(a.animations.length?d=d.concat(a.animations):d.push(a.animations));for(var f=0;f<d.length;f++){var h=THREE.AnimationClip.parseAnimation(d[f],c.bones);h&&b.push(h)}c.morphTargets&&(d=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(c.morphTargets,10),b=b.concat(d));0<b.length&&(c.animations=
@@ -438,12 +438,12 @@ THREE.LineSegments.prototype=Object.create(THREE.Line.prototype);THREE.LineSegme
 THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Mesh.prototype.raycast=function(){function a(a,b,c,d,e,f,g){THREE.Triangle.barycoordFromPoint(a,b,c,d,q);e.multiplyScalar(q.x);f.multiplyScalar(q.y);g.multiplyScalar(q.z);e.add(f).add(g);return e.clone()}var b=new THREE.Matrix4,c=new THREE.Ray,d=new THREE.Sphere,e=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector2,p=new THREE.Vector2,m=new THREE.Vector2,q=new THREE.Vector3,r=new THREE.Vector3,t=new THREE.Vector3;
-return function(q,w){var u=this.geometry,y=this.material;if(void 0!==y&&(null===u.boundingSphere&&u.computeBoundingSphere(),d.copy(u.boundingSphere),d.applyMatrix4(this.matrixWorld),!1!==q.ray.isIntersectionSphere(d)&&(b.getInverse(this.matrixWorld),c.copy(q.ray).applyMatrix4(b),null===u.boundingBox||!1!==c.isIntersectionBox(u.boundingBox)))){var x,I,E;if(u instanceof THREE.BufferGeometry)if(x=u.index,u=u.attributes,null!==x)for(var z=x.array,A=u.position.array,G=0,L=z.length;G<L;G+=3){x=z[G];I=z[G+
-1];E=z[G+2];e.fromArray(A,3*x);g.fromArray(A,3*I);f.fromArray(A,3*E);if(y.side===THREE.BackSide){if(null===c.intersectTriangle(f,g,e,!0,r))continue}else if(null===c.intersectTriangle(e,g,f,y.side!==THREE.DoubleSide,r))continue;t.copy(r);t.applyMatrix4(this.matrixWorld);var D=q.ray.origin.distanceTo(t);if(!(D<q.near||D>q.far)){var C;void 0!==u.uv&&(C=u.uv.array,n.fromArray(C,2*x),p.fromArray(C,2*I),m.fromArray(C,2*E),C=a(r,e,g,f,n,p,m));w.push({distance:D,point:t.clone(),uv:C,face:new THREE.Face3(x,
-I,E,THREE.Triangle.normal(e,g,f)),faceIndex:Math.floor(G/3),object:this})}}else for(A=u.position.array,G=0,L=A.length;G<L;G+=9){e.fromArray(A,G);g.fromArray(A,G+3);f.fromArray(A,G+6);if(y.side===THREE.BackSide){if(null===c.intersectTriangle(f,g,e,!0,r))continue}else if(null===c.intersectTriangle(e,g,f,y.side!==THREE.DoubleSide,r))continue;t.copy(r);t.applyMatrix4(this.matrixWorld);D=q.ray.origin.distanceTo(t);D<q.near||D>q.far||(void 0!==u.uv&&(C=u.uv.array,n.fromArray(C,G),p.fromArray(C,G+2),m.fromArray(C,
-G+4),C=a(r,e,g,f,n,p,m)),x=G/3,I=x+1,E=x+2,w.push({distance:D,point:t.clone(),uv:C,face:new THREE.Face3(x,I,E,THREE.Triangle.normal(e,g,f)),index:x,object:this}))}else if(u instanceof THREE.Geometry)for(var z=y instanceof THREE.MeshFaceMaterial,A=!0===z?y.materials:null,G=u.vertices,L=u.faces,N=0,K=L.length;N<K;N++){var H=L[N],D=!0===z?A[H.materialIndex]:y;if(void 0!==D){x=G[H.a];I=G[H.b];E=G[H.c];if(!0===D.morphTargets){var M=u.morphTargets,F=this.morphTargetInfluences;e.set(0,0,0);g.set(0,0,0);
-f.set(0,0,0);for(var Q=0,V=M.length;Q<V;Q++){var S=F[Q];if(0!==S){var R=M[Q].vertices;e.addScaledVector(h.subVectors(R[H.a],x),S);g.addScaledVector(k.subVectors(R[H.b],I),S);f.addScaledVector(l.subVectors(R[H.c],E),S)}}e.add(x);g.add(I);f.add(E);x=e;I=g;E=f}if(D.side===THREE.BackSide){if(null===c.intersectTriangle(E,I,x,!0,r))continue}else if(null===c.intersectTriangle(x,I,E,D.side!==THREE.DoubleSide,r))continue;t.copy(r);t.applyMatrix4(this.matrixWorld);D=q.ray.origin.distanceTo(t);D<q.near||D>q.far||
-(0<u.faceVertexUvs[0].length&&(C=u.faceVertexUvs[0][N],n.copy(C[0]),p.copy(C[1]),m.copy(C[2]),C=a(r,x,I,E,n,p,m)),w.push({distance:D,point:t.clone(),uv:C,face:H,faceIndex:N,object:this}))}}}}}();THREE.Mesh.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};
+return function(q,w){var u=this.geometry,z=this.material;if(void 0!==z&&(null===u.boundingSphere&&u.computeBoundingSphere(),d.copy(u.boundingSphere),d.applyMatrix4(this.matrixWorld),!1!==q.ray.isIntersectionSphere(d)&&(b.getInverse(this.matrixWorld),c.copy(q.ray).applyMatrix4(b),null===u.boundingBox||!1!==c.isIntersectionBox(u.boundingBox)))){var x,I,E;if(u instanceof THREE.BufferGeometry)if(x=u.index,u=u.attributes,null!==x)for(var B=x.array,A=u.position.array,G=0,J=B.length;G<J;G+=3){x=B[G];I=B[G+
+1];E=B[G+2];e.fromArray(A,3*x);g.fromArray(A,3*I);f.fromArray(A,3*E);if(z.side===THREE.BackSide){if(null===c.intersectTriangle(f,g,e,!0,r))continue}else if(null===c.intersectTriangle(e,g,f,z.side!==THREE.DoubleSide,r))continue;t.copy(r);t.applyMatrix4(this.matrixWorld);var F=q.ray.origin.distanceTo(t);if(!(F<q.near||F>q.far)){var M;void 0!==u.uv&&(M=u.uv.array,n.fromArray(M,2*x),p.fromArray(M,2*I),m.fromArray(M,2*E),M=a(r,e,g,f,n,p,m));w.push({distance:F,point:t.clone(),uv:M,face:new THREE.Face3(x,
+I,E,THREE.Triangle.normal(e,g,f)),faceIndex:Math.floor(G/3),object:this})}}else for(A=u.position.array,G=0,J=A.length;G<J;G+=9){e.fromArray(A,G);g.fromArray(A,G+3);f.fromArray(A,G+6);if(z.side===THREE.BackSide){if(null===c.intersectTriangle(f,g,e,!0,r))continue}else if(null===c.intersectTriangle(e,g,f,z.side!==THREE.DoubleSide,r))continue;t.copy(r);t.applyMatrix4(this.matrixWorld);F=q.ray.origin.distanceTo(t);F<q.near||F>q.far||(void 0!==u.uv&&(M=u.uv.array,n.fromArray(M,G),p.fromArray(M,G+2),m.fromArray(M,
+G+4),M=a(r,e,g,f,n,p,m)),x=G/3,I=x+1,E=x+2,w.push({distance:F,point:t.clone(),uv:M,face:new THREE.Face3(x,I,E,THREE.Triangle.normal(e,g,f)),index:x,object:this}))}else if(u instanceof THREE.Geometry)for(var B=z instanceof THREE.MeshFaceMaterial,A=!0===B?z.materials:null,G=u.vertices,J=u.faces,K=0,y=J.length;K<y;K++){var H=J[K],F=!0===B?A[H.materialIndex]:z;if(void 0!==F){x=G[H.a];I=G[H.b];E=G[H.c];if(!0===F.morphTargets){var D=u.morphTargets,P=this.morphTargetInfluences;e.set(0,0,0);g.set(0,0,0);
+f.set(0,0,0);for(var O=0,V=D.length;O<V;O++){var Q=P[O];if(0!==Q){var R=D[O].vertices;e.addScaledVector(h.subVectors(R[H.a],x),Q);g.addScaledVector(k.subVectors(R[H.b],I),Q);f.addScaledVector(l.subVectors(R[H.c],E),Q)}}e.add(x);g.add(I);f.add(E);x=e;I=g;E=f}if(F.side===THREE.BackSide){if(null===c.intersectTriangle(E,I,x,!0,r))continue}else if(null===c.intersectTriangle(x,I,E,F.side!==THREE.DoubleSide,r))continue;t.copy(r);t.applyMatrix4(this.matrixWorld);F=q.ray.origin.distanceTo(t);F<q.near||F>q.far||
+(0<u.faceVertexUvs[0].length&&(M=u.faceVertexUvs[0][K],n.copy(M[0]),p.copy(M[1]),m.copy(M[2]),M=a(r,x,I,E,n,p,m)),w.push({distance:F,point:t.clone(),uv:M,face:H,faceIndex:K,object:this}))}}}}}();THREE.Mesh.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};
 THREE.Mesh.prototype.toJSON=function(a){var b=THREE.Object3D.prototype.toJSON.call(this,a);void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON(a));void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON(a));b.object.geometry=this.geometry.uuid;b.object.material=this.material.uuid;return b};THREE.Bone=function(a){THREE.Object3D.call(this);this.type="Bone";this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.copy=function(a){THREE.Object3D.prototype.copy.call(this,a);this.skin=a.skin;return this};
 THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(a=Math.sqrt(4*this.bones.length),a=THREE.Math.nextPowerOfTwo(Math.ceil(a)),this.boneTextureHeight=this.boneTextureWidth=a=Math.max(a,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType)):
@@ -531,87 +531,87 @@ value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPositio
 THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",THREE.ShaderChunk.logdepthbuf_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,
 "vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===V&&(a*=d,b*=d,c*=d);s.clearColor(a,b,c,d)}function c(){O.init();s.viewport(Ea,ua,Fa,Ga);b(R.r,R.g,R.b,B)}function d(){Pa=eb=null;pa="";Qa=-1;$a=!0;O.reset()}function e(a){a.preventDefault();d();c();Z.clear()}function g(a){a=a.target;a.removeEventListener("dispose",g);a:{var b=Z.get(a);if(a.image&&b.__image__webglTextureCube)s.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;s.deleteTexture(b.__webglTexture)}Z.delete(a)}Ha.textures--}
-function f(a){a=a.target;a.removeEventListener("dispose",f);var b=Z.get(a);if(a&&void 0!==b.__webglTexture){s.deleteTexture(b.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var c=0;6>c;c++)s.deleteFramebuffer(b.__webglFramebuffer[c]),s.deleteRenderbuffer(b.__webglRenderbuffer[c]);else s.deleteFramebuffer(b.__webglFramebuffer),s.deleteRenderbuffer(b.__webglRenderbuffer);Z.delete(a)}Ha.textures--}function h(a){a=a.target;a.removeEventListener("dispose",h);k(a);Z.delete(a)}function k(a){var b=
-Z.get(a).program;a.program=void 0;void 0!==b&&Ra.releaseProgram(b)}function l(a,b){return b[0]-a[0]}function n(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function p(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b,c,d,e){var f;c.transparent?(d=qa,f=++ya):(d=ba,f=++la);
-f=d[f];void 0!==f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=Y.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:Y.z,group:e},d.push(f))}function q(a){if(!1!==a.visible){if(a instanceof THREE.Light)fa.push(a);else if(a instanceof THREE.Sprite)Ia.push(a);else if(a instanceof THREE.LensFlare)za.push(a);else if(a instanceof THREE.ImmediateRenderObject)!0===ha.sortObjects&&(Y.setFromMatrixPosition(a.matrixWorld),Y.applyProjection(Ja)),m(a,null,a.material,Y.z,null);else if(a instanceof
-THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),!1===a.frustumCulled||!0===Sa.intersectsObject(a)){var b=a.material;if(!0===b.visible){!0===ha.sortObjects&&(Y.setFromMatrixPosition(a.matrixWorld),Y.applyProjection(Ja));var c=ra.update(a);if(b instanceof THREE.MeshFaceMaterial)for(var d=c.groups,e=b.materials,b=0,f=d.length;b<f;b++){var g=d[b],h=e[g.materialIndex];!0===h.visible&&m(a,c,h,Y.z,g)}else m(a,c,b,Y.z,null)}}a=a.children;
-b=0;for(f=a.length;b<f;b++)q(a[b])}}function r(a,b,c,d,e){for(var f=0,g=a.length;f<g;f++){var h=a[f],k=h.object,l=h.geometry,m=void 0===e?h.material:e,h=h.group;k.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,k.matrixWorld);k.normalMatrix.getNormalMatrix(k.modelViewMatrix);if(k instanceof THREE.ImmediateRenderObject){t(m);var n=v(b,c,d,m,k);pa="";k.render(function(a){ha.renderBufferImmediate(a,n,m)})}else ha.renderBufferDirect(b,c,d,l,m,k,h)}}function t(a){a.side!==THREE.DoubleSide?O.enable(s.CULL_FACE):
-O.disable(s.CULL_FACE);O.setFlipSided(a.side===THREE.BackSide);!0===a.transparent?O.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha):O.setBlending(THREE.NoBlending);O.setDepthFunc(a.depthFunc);O.setDepthTest(a.depthTest);O.setDepthWrite(a.depthWrite);O.setColorWrite(a.colorWrite);O.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function v(a,b,c,d,e){ab=0;var f=Z.get(d);if(d.needsUpdate||!f.program){a:{var l=
-Z.get(d),m=Ra.getParameters(d,b,c,e),n=Ra.getProgramCode(d,m),q=l.program,p=!0;if(void 0===q)d.addEventListener("dispose",h);else if(q.code!==n)k(d);else if(void 0!==m.shaderID)break a;else p=!1;if(p){if(m.shaderID){var r=THREE.ShaderLib[m.shaderID];l.__webglShader={name:d.type,uniforms:THREE.UniformsUtils.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}}else l.__webglShader={name:d.type,uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};
-d.__webglShader=l.__webglShader;q=Ra.acquireProgram(d,m,n);l.program=q;d.program=q}var t=q.getAttributes();if(d.morphTargets)for(var v=d.numSupportedMorphTargets=0;v<ha.maxMorphTargets;v++)0<=t["morphTarget"+v]&&d.numSupportedMorphTargets++;if(d.morphNormals)for(v=d.numSupportedMorphNormals=0;v<ha.maxMorphNormals;v++)0<=t["morphNormal"+v]&&d.numSupportedMorphNormals++;l.uniformsList=[];var z=l.program.getUniforms(),E;for(E in l.__webglShader.uniforms){var A=z[E];A&&l.uniformsList.push([l.__webglShader.uniforms[E],
-A])}}d.needsUpdate=!1}var D=!1,H=!1,N=!1,K=f.program,F=K.getUniforms(),J=f.__webglShader.uniforms;K.id!==eb&&(s.useProgram(K.program),eb=K.id,N=H=D=!0);d.id!==Qa&&(-1===Qa&&(N=!0),Qa=d.id,H=!0);if(D||a!==Pa)s.uniformMatrix4fv(F.projectionMatrix,!1,a.projectionMatrix.elements),ma.logarithmicDepthBuffer&&s.uniform1f(F.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Pa&&(Pa=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&void 0!==F.cameraPosition&&(Y.setFromMatrixPosition(a.matrixWorld),
-s.uniform3f(F.cameraPosition,Y.x,Y.y,Y.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&void 0!==F.viewMatrix&&s.uniformMatrix4fv(F.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&void 0!==F.bindMatrix&&s.uniformMatrix4fv(F.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&void 0!==F.bindMatrixInverse&&s.uniformMatrix4fv(F.bindMatrixInverse,!1,
-e.bindMatrixInverse.elements),ma.floatVertexTextures&&e.skeleton&&e.skeleton.useVertexTexture){if(void 0!==F.boneTexture){var M=u();s.uniform1i(F.boneTexture,M);ha.setTexture(e.skeleton.boneTexture,M)}void 0!==F.boneTextureWidth&&s.uniform1i(F.boneTextureWidth,e.skeleton.boneTextureWidth);void 0!==F.boneTextureHeight&&s.uniform1i(F.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&void 0!==F.boneGlobalMatrices&&s.uniformMatrix4fv(F.boneGlobalMatrices,!1,e.skeleton.boneMatrices);
-if(H){c&&d.fog&&(J.fogColor.value=c.color,c instanceof THREE.Fog?(J.fogNear.value=c.near,J.fogFar.value=c.far):c instanceof THREE.FogExp2&&(J.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if($a){var N=!0,B,Q,C,qa=0,S=0,V=0,R,Ia,X,ta,ya,$=tb,oa=a.matrixWorldInverse,za=$.directional.colors,ba=$.directional.positions,pa=$.point.colors,fa=$.point.positions,ja=$.point.distances,la=$.point.decays,ka=$.spot.colors,ra=$.spot.positions,
-Ea=$.spot.distances,ua=$.spot.directions,Fa=$.spot.anglesCos,Ga=$.spot.exponents,Ja=$.spot.decays,fb=$.hemi.skyColors,gb=$.hemi.groundColors,hb=$.hemi.positions,Ta=0,Aa=0,sa=0,Ka=0,ib=0,jb=0,kb=0,bb=0,Ua=0,Va=0,va=0,La=0;B=0;for(Q=b.length;B<Q;B++)C=b[B],C.onlyShadow||(R=C.color,ta=C.intensity,ya=C.distance,C instanceof THREE.AmbientLight?C.visible&&(qa+=R.r,S+=R.g,V+=R.b):C instanceof THREE.DirectionalLight?(ib+=1,C.visible&&(ca.setFromMatrixPosition(C.matrixWorld),Y.setFromMatrixPosition(C.target.matrixWorld),
-ca.sub(Y),ca.transformDirection(oa),Ua=3*Ta,ba[Ua+0]=ca.x,ba[Ua+1]=ca.y,ba[Ua+2]=ca.z,y(za,Ua,R,ta),Ta+=1)):C instanceof THREE.PointLight?(jb+=1,C.visible&&(Va=3*Aa,y(pa,Va,R,ta),Y.setFromMatrixPosition(C.matrixWorld),Y.applyMatrix4(oa),fa[Va+0]=Y.x,fa[Va+1]=Y.y,fa[Va+2]=Y.z,ja[Aa]=ya,la[Aa]=0===C.distance?0:C.decay,Aa+=1)):C instanceof THREE.SpotLight?(kb+=1,C.visible&&(va=3*sa,y(ka,va,R,ta),ca.setFromMatrixPosition(C.matrixWorld),Y.copy(ca).applyMatrix4(oa),ra[va+0]=Y.x,ra[va+1]=Y.y,ra[va+2]=Y.z,
-Ea[sa]=ya,Y.setFromMatrixPosition(C.target.matrixWorld),ca.sub(Y),ca.transformDirection(oa),ua[va+0]=ca.x,ua[va+1]=ca.y,ua[va+2]=ca.z,Fa[sa]=Math.cos(C.angle),Ga[sa]=C.exponent,Ja[sa]=0===C.distance?0:C.decay,sa+=1)):C instanceof THREE.HemisphereLight&&(bb+=1,C.visible&&(ca.setFromMatrixPosition(C.matrixWorld),ca.transformDirection(oa),La=3*Ka,hb[La+0]=ca.x,hb[La+1]=ca.y,hb[La+2]=ca.z,Ia=C.color,X=C.groundColor,y(fb,La,Ia,ta),y(gb,La,X,ta),Ka+=1)));B=3*Ta;for(Q=Math.max(za.length,3*ib);B<Q;B++)za[B]=
-0;B=3*Aa;for(Q=Math.max(pa.length,3*jb);B<Q;B++)pa[B]=0;B=3*sa;for(Q=Math.max(ka.length,3*kb);B<Q;B++)ka[B]=0;B=3*Ka;for(Q=Math.max(fb.length,3*bb);B<Q;B++)fb[B]=0;B=3*Ka;for(Q=Math.max(gb.length,3*bb);B<Q;B++)gb[B]=0;$.directional.length=Ta;$.point.length=Aa;$.spot.length=sa;$.hemi.length=Ka;$.ambient[0]=qa;$.ambient[1]=S;$.ambient[2]=V;$a=!1}if(N){var ea=tb;J.ambientLightColor.value=ea.ambient;J.directionalLightColor.value=ea.directional.colors;J.directionalLightDirection.value=ea.directional.positions;
-J.pointLightColor.value=ea.point.colors;J.pointLightPosition.value=ea.point.positions;J.pointLightDistance.value=ea.point.distances;J.pointLightDecay.value=ea.point.decays;J.spotLightColor.value=ea.spot.colors;J.spotLightPosition.value=ea.spot.positions;J.spotLightDistance.value=ea.spot.distances;J.spotLightDirection.value=ea.spot.directions;J.spotLightAngleCos.value=ea.spot.anglesCos;J.spotLightExponent.value=ea.spot.exponents;J.spotLightDecay.value=ea.spot.decays;J.hemisphereLightSkyColor.value=
-ea.hemi.skyColors;J.hemisphereLightGroundColor.value=ea.hemi.groundColors;J.hemisphereLightDirection.value=ea.hemi.positions;w(J,!0)}else w(J,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){J.opacity.value=d.opacity;J.diffuse.value=d.color;d.emissive&&(J.emissive.value=d.emissive);J.map.value=d.map;J.specularMap.value=d.specularMap;J.alphaMap.value=d.alphaMap;d.aoMap&&(J.aoMap.value=d.aoMap,J.aoMapIntensity.value=d.aoMapIntensity);
-var na;d.map?na=d.map:d.specularMap?na=d.specularMap:d.displacementMap?na=d.displacementMap:d.normalMap?na=d.normalMap:d.bumpMap?na=d.bumpMap:d.alphaMap?na=d.alphaMap:d.emissiveMap&&(na=d.emissiveMap);if(void 0!==na){var Sa=na.offset,Ya=na.repeat;J.offsetRepeat.value.set(Sa.x,Sa.y,Ya.x,Ya.y)}J.envMap.value=d.envMap;J.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;J.reflectivity.value=d.reflectivity;J.refractionRatio.value=d.refractionRatio}if(d instanceof THREE.LineBasicMaterial)J.diffuse.value=
-d.color,J.opacity.value=d.opacity;else if(d instanceof THREE.LineDashedMaterial)J.diffuse.value=d.color,J.opacity.value=d.opacity,J.dashSize.value=d.dashSize,J.totalSize.value=d.dashSize+d.gapSize,J.scale.value=d.scale;else if(d instanceof THREE.PointsMaterial){if(J.psColor.value=d.color,J.opacity.value=d.opacity,J.size.value=d.size,J.scale.value=L.height/2,J.map.value=d.map,null!==d.map){var Za=d.map.offset,ub=d.map.repeat;J.offsetRepeat.value.set(Za.x,Za.y,ub.x,ub.y)}}else d instanceof THREE.MeshPhongMaterial?
-(J.specular.value=d.specular,J.shininess.value=d.shininess,d.lightMap&&(J.lightMap.value=d.lightMap,J.lightMapIntensity.value=d.lightMapIntensity),d.emissiveMap&&(J.emissiveMap.value=d.emissiveMap),d.bumpMap&&(J.bumpMap.value=d.bumpMap,J.bumpScale.value=d.bumpScale),d.normalMap&&(J.normalMap.value=d.normalMap,J.normalScale.value.copy(d.normalScale)),d.displacementMap&&(J.displacementMap.value=d.displacementMap,J.displacementScale.value=d.displacementScale,J.displacementBias.value=d.displacementBias)):
-d instanceof THREE.MeshDepthMaterial?(J.mNear.value=a.near,J.mFar.value=a.far,J.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(J.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&J.shadowMatrix)for(var Ma=0,lb=0,pb=b.length;lb<pb;lb++){var wa=b[lb];wa.castShadow&&(wa instanceof THREE.SpotLight||wa instanceof THREE.DirectionalLight)&&(J.shadowMap.value[Ma]=wa.shadowMap,J.shadowMapSize.value[Ma]=wa.shadowMapSize,J.shadowMatrix.value[Ma]=wa.shadowMatrix,J.shadowDarkness.value[Ma]=
-wa.shadowDarkness,J.shadowBias.value[Ma]=wa.shadowBias,Ma++)}for(var mb=f.uniformsList,ia,Ba,cb=0,qb=mb.length;cb<qb;cb++){var T=mb[cb][0];if(!1!==T.needsUpdate){var vb=T.type,P=T.value,W=mb[cb][1];switch(vb){case "1i":s.uniform1i(W,P);break;case "1f":s.uniform1f(W,P);break;case "2f":s.uniform2f(W,P[0],P[1]);break;case "3f":s.uniform3f(W,P[0],P[1],P[2]);break;case "4f":s.uniform4f(W,P[0],P[1],P[2],P[3]);break;case "1iv":s.uniform1iv(W,P);break;case "3iv":s.uniform3iv(W,P);break;case "1fv":s.uniform1fv(W,
-P);break;case "2fv":s.uniform2fv(W,P);break;case "3fv":s.uniform3fv(W,P);break;case "4fv":s.uniform4fv(W,P);break;case "Matrix3fv":s.uniformMatrix3fv(W,!1,P);break;case "Matrix4fv":s.uniformMatrix4fv(W,!1,P);break;case "i":s.uniform1i(W,P);break;case "f":s.uniform1f(W,P);break;case "v2":s.uniform2f(W,P.x,P.y);break;case "v3":s.uniform3f(W,P.x,P.y,P.z);break;case "v4":s.uniform4f(W,P.x,P.y,P.z,P.w);break;case "c":s.uniform3f(W,P.r,P.g,P.b);break;case "iv1":s.uniform1iv(W,P);break;case "iv":s.uniform3iv(W,
-P);break;case "fv1":s.uniform1fv(W,P);break;case "fv":s.uniform3fv(W,P);break;case "v2v":void 0===T._array&&(T._array=new Float32Array(2*P.length));for(var U=0,db=0,ga=P.length;U<ga;U++,db+=2)T._array[db+0]=P[U].x,T._array[db+1]=P[U].y;s.uniform2fv(W,T._array);break;case "v3v":void 0===T._array&&(T._array=new Float32Array(3*P.length));for(var Wa=U=0,ga=P.length;U<ga;U++,Wa+=3)T._array[Wa+0]=P[U].x,T._array[Wa+1]=P[U].y,T._array[Wa+2]=P[U].z;s.uniform3fv(W,T._array);break;case "v4v":void 0===T._array&&
-(T._array=new Float32Array(4*P.length));for(var Na=U=0,ga=P.length;U<ga;U++,Na+=4)T._array[Na+0]=P[U].x,T._array[Na+1]=P[U].y,T._array[Na+2]=P[U].z,T._array[Na+3]=P[U].w;s.uniform4fv(W,T._array);break;case "m3":s.uniformMatrix3fv(W,!1,P.elements);break;case "m3v":void 0===T._array&&(T._array=new Float32Array(9*P.length));U=0;for(ga=P.length;U<ga;U++)P[U].flattenToArrayOffset(T._array,9*U);s.uniformMatrix3fv(W,!1,T._array);break;case "m4":s.uniformMatrix4fv(W,!1,P.elements);break;case "m4v":void 0===
-T._array&&(T._array=new Float32Array(16*P.length));U=0;for(ga=P.length;U<ga;U++)P[U].flattenToArrayOffset(T._array,16*U);s.uniformMatrix4fv(W,!1,T._array);break;case "t":ia=P;Ba=u();s.uniform1i(W,Ba);if(!ia)continue;if(ia instanceof THREE.CubeTexture||Array.isArray(ia.image)&&6===ia.image.length){var aa=ia,wb=Ba,Oa=Z.get(aa);if(6===aa.image.length)if(0<aa.version&&Oa.__version!==aa.version){Oa.__image__webglTextureCube||(aa.addEventListener("dispose",g),Oa.__image__webglTextureCube=s.createTexture(),
-Ha.textures++);O.activeTexture(s.TEXTURE0+wb);O.bindTexture(s.TEXTURE_CUBE_MAP,Oa.__image__webglTextureCube);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,aa.flipY);for(var xb=aa instanceof THREE.CompressedTexture,nb=aa.image[0]instanceof THREE.DataTexture,Ca=[],da=0;6>da;da++)Ca[da]=!ha.autoScaleCubemaps||xb||nb?nb?aa.image[da].image:aa.image[da]:I(aa.image[da],ma.maxCubemapSize);var yb=Ca[0],zb=THREE.Math.isPowerOfTwo(yb.width)&&THREE.Math.isPowerOfTwo(yb.height),xa=G(aa.format),ob=G(aa.type);x(s.TEXTURE_CUBE_MAP,
-aa,zb);for(da=0;6>da;da++)if(xb)for(var Da,Ab=Ca[da].mipmaps,Xa=0,rb=Ab.length;Xa<rb;Xa++)Da=Ab[Xa],aa.format!==THREE.RGBAFormat&&aa.format!==THREE.RGBFormat?-1<O.getCompressedTextureFormats().indexOf(xa)?O.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+da,Xa,xa,Da.width,Da.height,0,Da.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):O.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+da,Xa,xa,Da.width,Da.height,0,xa,ob,Da.data);else nb?
-O.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+da,0,xa,Ca[da].width,Ca[da].height,0,xa,ob,Ca[da].data):O.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+da,0,xa,xa,ob,Ca[da]);aa.generateMipmaps&&zb&&s.generateMipmap(s.TEXTURE_CUBE_MAP);Oa.__version=aa.version;if(aa.onUpdate)aa.onUpdate(aa)}else O.activeTexture(s.TEXTURE0+wb),O.bindTexture(s.TEXTURE_CUBE_MAP,Oa.__image__webglTextureCube)}else if(ia instanceof THREE.WebGLRenderTargetCube){var sb=ia;O.activeTexture(s.TEXTURE0+Ba);O.bindTexture(s.TEXTURE_CUBE_MAP,
-Z.get(sb).__webglTexture)}else ha.setTexture(ia,Ba);break;case "tv":void 0===T._array&&(T._array=[]);U=0;for(ga=T.value.length;U<ga;U++)T._array[U]=u();s.uniform1iv(W,T._array);U=0;for(ga=T.value.length;U<ga;U++)ia=T.value[U],Ba=T._array[U],ia&&ha.setTexture(ia,Ba);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+vb)}}}}s.uniformMatrix4fv(F.modelViewMatrix,!1,e.modelViewMatrix.elements);F.normalMatrix&&s.uniformMatrix3fv(F.normalMatrix,!1,e.normalMatrix.elements);void 0!==
-F.modelMatrix&&s.uniformMatrix4fv(F.modelMatrix,!1,e.matrixWorld.elements);return K}function w(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.pointLightDecay.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=
-b;a.spotLightExponent.needsUpdate=b;a.spotLightDecay.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=b}function u(){var a=ab;a>=ma.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ma.maxTextures);ab+=1;return a}function y(a,b,c,d){a[b+0]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function x(a,b,c){c?(s.texParameteri(a,s.TEXTURE_WRAP_S,G(b.wrapS)),s.texParameteri(a,
+THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===V&&(a*=d,b*=d,c*=d);s.clearColor(a,b,c,d)}function c(){L.init();s.viewport(ua,Ea,va,Fa);b(R.r,R.g,R.b,C)}function d(){Na=db=null;pa="";Oa=-1;Ya=!0;L.reset()}function e(a){a.preventDefault();d();c();Z.clear()}function g(a){a=a.target;a.removeEventListener("dispose",g);a:{var b=Z.get(a);if(a.image&&b.__image__webglTextureCube)s.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;s.deleteTexture(b.__webglTexture)}Z.delete(a)}Ga.textures--}
+function f(a){a=a.target;a.removeEventListener("dispose",f);var b=Z.get(a);if(a&&void 0!==b.__webglTexture){s.deleteTexture(b.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var c=0;6>c;c++)s.deleteFramebuffer(b.__webglFramebuffer[c]),s.deleteRenderbuffer(b.__webglRenderbuffer[c]);else s.deleteFramebuffer(b.__webglFramebuffer),s.deleteRenderbuffer(b.__webglRenderbuffer);Z.delete(a)}Ga.textures--}function h(a){a=a.target;a.removeEventListener("dispose",h);k(a);Z.delete(a)}function k(a){var b=
+Z.get(a).program;a.program=void 0;void 0!==b&&Pa.releaseProgram(b)}function l(a,b){return b[0]-a[0]}function n(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function p(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b,c,d,e){var f;c.transparent?(d=U,f=++la):(d=ba,f=++ma);
+f=d[f];void 0!==f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=Y.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:Y.z,group:e},d.push(f))}function q(a){if(!1!==a.visible){if(a instanceof THREE.Light)fa.push(a);else if(a instanceof THREE.Sprite)ka.push(a);else if(a instanceof THREE.LensFlare)qa.push(a);else if(a instanceof THREE.ImmediateRenderObject)!0===ia.sortObjects&&(Y.setFromMatrixPosition(a.matrixWorld),Y.applyProjection(Ha)),m(a,null,a.material,Y.z,null);else if(a instanceof
+THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),!1===a.frustumCulled||!0===Za.intersectsObject(a)){var b=a.material;if(!0===b.visible){!0===ia.sortObjects&&(Y.setFromMatrixPosition(a.matrixWorld),Y.applyProjection(Ha));var c=ra.update(a);if(b instanceof THREE.MeshFaceMaterial)for(var d=c.groups,e=b.materials,b=0,f=d.length;b<f;b++){var g=d[b],h=e[g.materialIndex];!0===h.visible&&m(a,c,h,Y.z,g)}else m(a,c,b,Y.z,null)}}a=a.children;
+b=0;for(f=a.length;b<f;b++)q(a[b])}}function r(a,b,c,d,e){for(var f=0,g=a.length;f<g;f++){var h=a[f],k=h.object,l=h.geometry,m=void 0===e?h.material:e,h=h.group;k.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,k.matrixWorld);k.normalMatrix.getNormalMatrix(k.modelViewMatrix);if(k instanceof THREE.ImmediateRenderObject){t(m);var n=v(b,c,d,m,k);pa="";k.render(function(a){ia.renderBufferImmediate(a,n,m)})}else ia.renderBufferDirect(b,c,d,l,m,k,h)}}function t(a){a.side!==THREE.DoubleSide?L.enable(s.CULL_FACE):
+L.disable(s.CULL_FACE);L.setFlipSided(a.side===THREE.BackSide);!0===a.transparent?L.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha):L.setBlending(THREE.NoBlending);L.setDepthFunc(a.depthFunc);L.setDepthTest(a.depthTest);L.setDepthWrite(a.depthWrite);L.setColorWrite(a.colorWrite);L.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function v(a,b,c,d,e){$a=0;var f=Z.get(d);if(d.needsUpdate||!f.program){a:{var l=
+Z.get(d),m=Pa.getParameters(d,b,c,e),n=Pa.getProgramCode(d,m),q=l.program,p=!0;if(void 0===q)d.addEventListener("dispose",h);else if(q.code!==n)k(d);else if(void 0!==m.shaderID)break a;else p=!1;if(p){if(m.shaderID){var r=THREE.ShaderLib[m.shaderID];l.__webglShader={name:d.type,uniforms:THREE.UniformsUtils.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}}else l.__webglShader={name:d.type,uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};
+d.__webglShader=l.__webglShader;q=Pa.acquireProgram(d,m,n);l.program=q;d.program=q}var t=q.getAttributes();if(d.morphTargets)for(var v=d.numSupportedMorphTargets=0;v<ia.maxMorphTargets;v++)0<=t["morphTarget"+v]&&d.numSupportedMorphTargets++;if(d.morphNormals)for(v=d.numSupportedMorphNormals=0;v<ia.maxMorphNormals;v++)0<=t["morphNormal"+v]&&d.numSupportedMorphNormals++;l.uniformsList=[];var B=l.program.getUniforms(),E;for(E in l.__webglShader.uniforms){var A=B[E];A&&l.uniformsList.push([l.__webglShader.uniforms[E],
+A])}}d.needsUpdate=!1}var F=!1,H=!1,M=!1,K=f.program,D=K.getUniforms(),y=f.__webglShader.uniforms;K.id!==db&&(s.useProgram(K.program),db=K.id,M=H=F=!0);d.id!==Oa&&(-1===Oa&&(M=!0),Oa=d.id,H=!0);if(F||a!==Na)s.uniformMatrix4fv(D.projectionMatrix,!1,a.projectionMatrix.elements),na.logarithmicDepthBuffer&&s.uniform1f(D.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Na&&(Na=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&void 0!==D.cameraPosition&&(Y.setFromMatrixPosition(a.matrixWorld),
+s.uniform3f(D.cameraPosition,Y.x,Y.y,Y.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&void 0!==D.viewMatrix&&s.uniformMatrix4fv(D.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&void 0!==D.bindMatrix&&s.uniformMatrix4fv(D.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&void 0!==D.bindMatrixInverse&&s.uniformMatrix4fv(D.bindMatrixInverse,!1,
+e.bindMatrixInverse.elements),na.floatVertexTextures&&e.skeleton&&e.skeleton.useVertexTexture){if(void 0!==D.boneTexture){var P=u();s.uniform1i(D.boneTexture,P);ia.setTexture(e.skeleton.boneTexture,P)}void 0!==D.boneTextureWidth&&s.uniform1i(D.boneTextureWidth,e.skeleton.boneTextureWidth);void 0!==D.boneTextureHeight&&s.uniform1i(D.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&void 0!==D.boneGlobalMatrices&&s.uniformMatrix4fv(D.boneGlobalMatrices,!1,e.skeleton.boneMatrices);
+if(H){c&&d.fog&&(y.fogColor.value=c.color,c instanceof THREE.Fog?(y.fogNear.value=c.near,y.fogFar.value=c.far):c instanceof THREE.FogExp2&&(y.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ya){var M=!0,C,O,U,Q=0,V=0,R=0,ka,X,Va,la,za,$=sb,qa=a.matrixWorldInverse,ba=$.directional.colors,pa=$.directional.positions,fa=$.point.colors,ga=$.point.positions,ma=$.point.distances,ta=$.point.decays,ra=$.spot.colors,ua=$.spot.positions,
+Ea=$.spot.distances,va=$.spot.directions,Fa=$.spot.anglesCos,Ha=$.spot.exponents,Za=$.spot.decays,eb=$.hemi.skyColors,fb=$.hemi.groundColors,gb=$.hemi.positions,Qa=0,Aa=0,sa=0,Ia=0,hb=0,ib=0,jb=0,ab=0,Ra=0,Sa=0,wa=0,Ja=0;C=0;for(O=b.length;C<O;C++)U=b[C],U.onlyShadow||(ka=U.color,la=U.intensity,za=U.distance,U instanceof THREE.AmbientLight?U.visible&&(Q+=ka.r,V+=ka.g,R+=ka.b):U instanceof THREE.DirectionalLight?(hb+=1,U.visible&&(ca.setFromMatrixPosition(U.matrixWorld),Y.setFromMatrixPosition(U.target.matrixWorld),
+ca.sub(Y),ca.transformDirection(qa),Ra=3*Qa,pa[Ra+0]=ca.x,pa[Ra+1]=ca.y,pa[Ra+2]=ca.z,z(ba,Ra,ka,la),Qa+=1)):U instanceof THREE.PointLight?(ib+=1,U.visible&&(Sa=3*Aa,z(fa,Sa,ka,la),Y.setFromMatrixPosition(U.matrixWorld),Y.applyMatrix4(qa),ga[Sa+0]=Y.x,ga[Sa+1]=Y.y,ga[Sa+2]=Y.z,ma[Aa]=za,ta[Aa]=0===U.distance?0:U.decay,Aa+=1)):U instanceof THREE.SpotLight?(jb+=1,U.visible&&(wa=3*sa,z(ra,wa,ka,la),ca.setFromMatrixPosition(U.matrixWorld),Y.copy(ca).applyMatrix4(qa),ua[wa+0]=Y.x,ua[wa+1]=Y.y,ua[wa+2]=
+Y.z,Ea[sa]=za,Y.setFromMatrixPosition(U.target.matrixWorld),ca.sub(Y),ca.transformDirection(qa),va[wa+0]=ca.x,va[wa+1]=ca.y,va[wa+2]=ca.z,Fa[sa]=Math.cos(U.angle),Ha[sa]=U.exponent,Za[sa]=0===U.distance?0:U.decay,sa+=1)):U instanceof THREE.HemisphereLight&&(ab+=1,U.visible&&(ca.setFromMatrixPosition(U.matrixWorld),ca.transformDirection(qa),Ja=3*Ia,gb[Ja+0]=ca.x,gb[Ja+1]=ca.y,gb[Ja+2]=ca.z,X=U.color,Va=U.groundColor,z(eb,Ja,X,la),z(fb,Ja,Va,la),Ia+=1)));C=3*Qa;for(O=Math.max(ba.length,3*hb);C<O;C++)ba[C]=
+0;C=3*Aa;for(O=Math.max(fa.length,3*ib);C<O;C++)fa[C]=0;C=3*sa;for(O=Math.max(ra.length,3*jb);C<O;C++)ra[C]=0;C=3*Ia;for(O=Math.max(eb.length,3*ab);C<O;C++)eb[C]=0;C=3*Ia;for(O=Math.max(fb.length,3*ab);C<O;C++)fb[C]=0;$.directional.length=Qa;$.point.length=Aa;$.spot.length=sa;$.hemi.length=Ia;$.ambient[0]=Q;$.ambient[1]=V;$.ambient[2]=R;Ya=!1}if(M){var ea=sb;y.ambientLightColor.value=ea.ambient;y.directionalLightColor.value=ea.directional.colors;y.directionalLightDirection.value=ea.directional.positions;
+y.pointLightColor.value=ea.point.colors;y.pointLightPosition.value=ea.point.positions;y.pointLightDistance.value=ea.point.distances;y.pointLightDecay.value=ea.point.decays;y.spotLightColor.value=ea.spot.colors;y.spotLightPosition.value=ea.spot.positions;y.spotLightDistance.value=ea.spot.distances;y.spotLightDirection.value=ea.spot.directions;y.spotLightAngleCos.value=ea.spot.anglesCos;y.spotLightExponent.value=ea.spot.exponents;y.spotLightDecay.value=ea.spot.decays;y.hemisphereLightSkyColor.value=
+ea.hemi.skyColors;y.hemisphereLightGroundColor.value=ea.hemi.groundColors;y.hemisphereLightDirection.value=ea.hemi.positions;w(y,!0)}else w(y,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){y.opacity.value=d.opacity;y.diffuse.value=d.color;d.emissive&&(y.emissive.value=d.emissive);y.map.value=d.map;y.specularMap.value=d.specularMap;y.alphaMap.value=d.alphaMap;d.aoMap&&(y.aoMap.value=d.aoMap,y.aoMapIntensity.value=d.aoMapIntensity);
+var oa;d.map?oa=d.map:d.specularMap?oa=d.specularMap:d.displacementMap?oa=d.displacementMap:d.normalMap?oa=d.normalMap:d.bumpMap?oa=d.bumpMap:d.alphaMap?oa=d.alphaMap:d.emissiveMap&&(oa=d.emissiveMap);if(void 0!==oa){var Wa=oa.offset,Xa=oa.repeat;y.offsetRepeat.value.set(Wa.x,Wa.y,Xa.x,Xa.y)}y.envMap.value=d.envMap;y.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;y.reflectivity.value=d.reflectivity;y.refractionRatio.value=d.refractionRatio}if(d instanceof THREE.LineBasicMaterial)y.diffuse.value=
+d.color,y.opacity.value=d.opacity;else if(d instanceof THREE.LineDashedMaterial)y.diffuse.value=d.color,y.opacity.value=d.opacity,y.dashSize.value=d.dashSize,y.totalSize.value=d.dashSize+d.gapSize,y.scale.value=d.scale;else if(d instanceof THREE.PointsMaterial){if(y.psColor.value=d.color,y.opacity.value=d.opacity,y.size.value=d.size,y.scale.value=J.height/2,y.map.value=d.map,null!==d.map){var tb=d.map.offset,ub=d.map.repeat;y.offsetRepeat.value.set(tb.x,tb.y,ub.x,ub.y)}}else d instanceof THREE.MeshPhongMaterial?
+(y.specular.value=d.specular,y.shininess.value=d.shininess,d.lightMap&&(y.lightMap.value=d.lightMap,y.lightMapIntensity.value=d.lightMapIntensity),d.emissiveMap&&(y.emissiveMap.value=d.emissiveMap),d.bumpMap&&(y.bumpMap.value=d.bumpMap,y.bumpScale.value=d.bumpScale),d.normalMap&&(y.normalMap.value=d.normalMap,y.normalScale.value.copy(d.normalScale)),d.displacementMap&&(y.displacementMap.value=d.displacementMap,y.displacementScale.value=d.displacementScale,y.displacementBias.value=d.displacementBias)):
+d instanceof THREE.MeshDepthMaterial?(y.mNear.value=a.near,y.mFar.value=a.far,y.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(y.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&y.shadowMatrix)for(var Ka=0,kb=0,ob=b.length;kb<ob;kb++){var xa=b[kb];xa.castShadow&&(xa instanceof THREE.SpotLight||xa instanceof THREE.DirectionalLight)&&(y.shadowMap.value[Ka]=xa.shadowMap,y.shadowMapSize.value[Ka]=xa.shadowMapSize,y.shadowMatrix.value[Ka]=xa.shadowMatrix,y.shadowDarkness.value[Ka]=
+xa.shadowDarkness,y.shadowBias.value[Ka]=xa.shadowBias,Ka++)}for(var lb=f.uniformsList,ja,Ba,bb=0,pb=lb.length;bb<pb;bb++){var S=lb[bb][0];if(!1!==S.needsUpdate){var vb=S.type,N=S.value,W=lb[bb][1];switch(vb){case "1i":s.uniform1i(W,N);break;case "1f":s.uniform1f(W,N);break;case "2f":s.uniform2f(W,N[0],N[1]);break;case "3f":s.uniform3f(W,N[0],N[1],N[2]);break;case "4f":s.uniform4f(W,N[0],N[1],N[2],N[3]);break;case "1iv":s.uniform1iv(W,N);break;case "3iv":s.uniform3iv(W,N);break;case "1fv":s.uniform1fv(W,
+N);break;case "2fv":s.uniform2fv(W,N);break;case "3fv":s.uniform3fv(W,N);break;case "4fv":s.uniform4fv(W,N);break;case "Matrix3fv":s.uniformMatrix3fv(W,!1,N);break;case "Matrix4fv":s.uniformMatrix4fv(W,!1,N);break;case "i":s.uniform1i(W,N);break;case "f":s.uniform1f(W,N);break;case "v2":s.uniform2f(W,N.x,N.y);break;case "v3":s.uniform3f(W,N.x,N.y,N.z);break;case "v4":s.uniform4f(W,N.x,N.y,N.z,N.w);break;case "c":s.uniform3f(W,N.r,N.g,N.b);break;case "iv1":s.uniform1iv(W,N);break;case "iv":s.uniform3iv(W,
+N);break;case "fv1":s.uniform1fv(W,N);break;case "fv":s.uniform3fv(W,N);break;case "v2v":void 0===S._array&&(S._array=new Float32Array(2*N.length));for(var T=0,cb=0,ha=N.length;T<ha;T++,cb+=2)S._array[cb+0]=N[T].x,S._array[cb+1]=N[T].y;s.uniform2fv(W,S._array);break;case "v3v":void 0===S._array&&(S._array=new Float32Array(3*N.length));for(var Ta=T=0,ha=N.length;T<ha;T++,Ta+=3)S._array[Ta+0]=N[T].x,S._array[Ta+1]=N[T].y,S._array[Ta+2]=N[T].z;s.uniform3fv(W,S._array);break;case "v4v":void 0===S._array&&
+(S._array=new Float32Array(4*N.length));for(var La=T=0,ha=N.length;T<ha;T++,La+=4)S._array[La+0]=N[T].x,S._array[La+1]=N[T].y,S._array[La+2]=N[T].z,S._array[La+3]=N[T].w;s.uniform4fv(W,S._array);break;case "m3":s.uniformMatrix3fv(W,!1,N.elements);break;case "m3v":void 0===S._array&&(S._array=new Float32Array(9*N.length));T=0;for(ha=N.length;T<ha;T++)N[T].flattenToArrayOffset(S._array,9*T);s.uniformMatrix3fv(W,!1,S._array);break;case "m4":s.uniformMatrix4fv(W,!1,N.elements);break;case "m4v":void 0===
+S._array&&(S._array=new Float32Array(16*N.length));T=0;for(ha=N.length;T<ha;T++)N[T].flattenToArrayOffset(S._array,16*T);s.uniformMatrix4fv(W,!1,S._array);break;case "t":ja=N;Ba=u();s.uniform1i(W,Ba);if(!ja)continue;if(ja instanceof THREE.CubeTexture||Array.isArray(ja.image)&&6===ja.image.length){var aa=ja,wb=Ba,Ma=Z.get(aa);if(6===aa.image.length)if(0<aa.version&&Ma.__version!==aa.version){Ma.__image__webglTextureCube||(aa.addEventListener("dispose",g),Ma.__image__webglTextureCube=s.createTexture(),
+Ga.textures++);L.activeTexture(s.TEXTURE0+wb);L.bindTexture(s.TEXTURE_CUBE_MAP,Ma.__image__webglTextureCube);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,aa.flipY);for(var xb=aa instanceof THREE.CompressedTexture,mb=aa.image[0]instanceof THREE.DataTexture,Ca=[],da=0;6>da;da++)Ca[da]=!ia.autoScaleCubemaps||xb||mb?mb?aa.image[da].image:aa.image[da]:I(aa.image[da],na.maxCubemapSize);var yb=Ca[0],zb=THREE.Math.isPowerOfTwo(yb.width)&&THREE.Math.isPowerOfTwo(yb.height),ya=G(aa.format),nb=G(aa.type);x(s.TEXTURE_CUBE_MAP,
+aa,zb);for(da=0;6>da;da++)if(xb)for(var Da,Ab=Ca[da].mipmaps,Ua=0,qb=Ab.length;Ua<qb;Ua++)Da=Ab[Ua],aa.format!==THREE.RGBAFormat&&aa.format!==THREE.RGBFormat?-1<L.getCompressedTextureFormats().indexOf(ya)?L.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+da,Ua,ya,Da.width,Da.height,0,Da.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+da,Ua,ya,Da.width,Da.height,0,ya,nb,Da.data);else mb?
+L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+da,0,ya,Ca[da].width,Ca[da].height,0,ya,nb,Ca[da].data):L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+da,0,ya,ya,nb,Ca[da]);aa.generateMipmaps&&zb&&s.generateMipmap(s.TEXTURE_CUBE_MAP);Ma.__version=aa.version;if(aa.onUpdate)aa.onUpdate(aa)}else L.activeTexture(s.TEXTURE0+wb),L.bindTexture(s.TEXTURE_CUBE_MAP,Ma.__image__webglTextureCube)}else if(ja instanceof THREE.WebGLRenderTargetCube){var rb=ja;L.activeTexture(s.TEXTURE0+Ba);L.bindTexture(s.TEXTURE_CUBE_MAP,
+Z.get(rb).__webglTexture)}else ia.setTexture(ja,Ba);break;case "tv":void 0===S._array&&(S._array=[]);T=0;for(ha=S.value.length;T<ha;T++)S._array[T]=u();s.uniform1iv(W,S._array);T=0;for(ha=S.value.length;T<ha;T++)ja=S.value[T],Ba=S._array[T],ja&&ia.setTexture(ja,Ba);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+vb)}}}}s.uniformMatrix4fv(D.modelViewMatrix,!1,e.modelViewMatrix.elements);D.normalMatrix&&s.uniformMatrix3fv(D.normalMatrix,!1,e.normalMatrix.elements);void 0!==
+D.modelMatrix&&s.uniformMatrix4fv(D.modelMatrix,!1,e.matrixWorld.elements);return K}function w(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.pointLightDecay.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=
+b;a.spotLightExponent.needsUpdate=b;a.spotLightDecay.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=b}function u(){var a=$a;a>=na.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+na.maxTextures);$a+=1;return a}function z(a,b,c,d){a[b+0]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function x(a,b,c){c?(s.texParameteri(a,s.TEXTURE_WRAP_S,G(b.wrapS)),s.texParameteri(a,
 s.TEXTURE_WRAP_T,G(b.wrapT)),s.texParameteri(a,s.TEXTURE_MAG_FILTER,G(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,G(b.minFilter))):(s.texParameteri(a,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(a,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+b.sourceFile+" )"),s.texParameteri(a,s.TEXTURE_MAG_FILTER,
 A(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,A(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+b.sourceFile+" )"));!(c=X.get("EXT_texture_filter_anisotropic"))||b.type===THREE.FloatType&&null===X.get("OES_texture_float_linear")||b.type===THREE.HalfFloatType&&null===X.get("OES_texture_half_float_linear")||!(1<
-b.anisotropy||Z.get(b).__currentAnisotropy)||(s.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,ha.getMaxAnisotropy())),Z.get(b).__currentAnisotropy=b.anisotropy)}function I(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+
-"). Resized to "+d.width+"x"+d.height,a);return d}return a}function E(a,b,c){s.bindFramebuffer(s.FRAMEBUFFER,a);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,c,Z.get(b).__webglTexture,0)}function z(a,b){s.bindRenderbuffer(s.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT16,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,
+b.anisotropy||Z.get(b).__currentAnisotropy)||(s.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,ia.getMaxAnisotropy())),Z.get(b).__currentAnisotropy=b.anisotropy)}function I(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+
+"). Resized to "+d.width+"x"+d.height,a);return d}return a}function E(a,b,c){s.bindFramebuffer(s.FRAMEBUFFER,a);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,c,Z.get(b).__webglTexture,0)}function B(a,b){s.bindRenderbuffer(s.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT16,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,
 s.DEPTH_STENCIL,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,a)):s.renderbufferStorage(s.RENDERBUFFER,s.RGBA4,b.width,b.height)}function A(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?s.NEAREST:s.LINEAR}function G(a){var b;if(a===THREE.RepeatWrapping)return s.REPEAT;if(a===THREE.ClampToEdgeWrapping)return s.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return s.MIRRORED_REPEAT;
 if(a===THREE.NearestFilter)return s.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return s.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return s.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return s.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return s.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return s.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return s.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return s.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return s.UNSIGNED_SHORT_5_5_5_1;
 if(a===THREE.UnsignedShort565Type)return s.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return s.BYTE;if(a===THREE.ShortType)return s.SHORT;if(a===THREE.UnsignedShortType)return s.UNSIGNED_SHORT;if(a===THREE.IntType)return s.INT;if(a===THREE.UnsignedIntType)return s.UNSIGNED_INT;if(a===THREE.FloatType)return s.FLOAT;b=X.get("OES_texture_half_float");if(null!==b&&a===THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return s.ALPHA;if(a===THREE.RGBFormat)return s.RGB;if(a===THREE.RGBAFormat)return s.RGBA;
 if(a===THREE.LuminanceFormat)return s.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return s.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return s.FUNC_ADD;if(a===THREE.SubtractEquation)return s.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return s.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return s.ZERO;if(a===THREE.OneFactor)return s.ONE;if(a===THREE.SrcColorFactor)return s.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return s.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return s.SRC_ALPHA;
 if(a===THREE.OneMinusSrcAlphaFactor)return s.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return s.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return s.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return s.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return s.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return s.SRC_ALPHA_SATURATE;b=X.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;
 if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=X.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=
-X.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var L=void 0!==a.canvas?a.canvas:document.createElement("canvas"),D=void 0!==a.context?a.context:null,C=L.width,N=L.height,K=1,H=void 0!==a.alpha?a.alpha:!1,M=void 0!==a.depth?a.depth:!0,F=void 0!==a.stencil?a.stencil:!0,Q=void 0!==a.antialias?a.antialias:!1,V=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:
-!0,S=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,R=new THREE.Color(0),B=0,fa=[],ba=[],la=-1,qa=[],ya=-1,ta=new Float32Array(8),Ia=[],za=[];this.domElement=L;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var ha=this,eb=null,oa=null,Qa=-1,pa="",Pa=null,ab=0,Ea=0,ua=0,Fa=L.width,Ga=L.height,
-Ya=0,Za=0,Sa=new THREE.Frustum,Ja=new THREE.Matrix4,Y=new THREE.Vector3,ca=new THREE.Vector3,$a=!0,tb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},Ha={geometries:0,textures:0},ka={calls:0,vertices:0,faces:0,points:0};this.info={render:ka,memory:Ha,programs:null};
-var s;try{H={alpha:H,depth:M,stencil:F,antialias:Q,premultipliedAlpha:V,preserveDrawingBuffer:S};s=D||L.getContext("webgl",H)||L.getContext("experimental-webgl",H);if(null===s){if(null!==L.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}L.addEventListener("webglcontextlost",e,!1)}catch(pb){console.error("THREE.WebGLRenderer: "+pb)}var X=new THREE.WebGLExtensions(s);X.get("OES_texture_float");X.get("OES_texture_float_linear");
-X.get("OES_texture_half_float");X.get("OES_texture_half_float_linear");X.get("OES_standard_derivatives");X.get("ANGLE_instanced_arrays");X.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var ma=new THREE.WebGLCapabilities(s,X,a),O=new THREE.WebGLState(s,X,G),Z=new THREE.WebGLProperties,ra=new THREE.WebGLObjects(s,Z,this.info),Ra=new THREE.WebGLPrograms(this,ma);this.info.programs=Ra.programs;var qb=new THREE.WebGLBufferRenderer(s,X,ka),rb=new THREE.WebGLIndexedBufferRenderer(s,
-X,ka);c();this.context=s;this.capabilities=ma;this.extensions=X;this.state=O;var ja=new THREE.WebGLShadowMap(this,fa,ra);this.shadowMap=ja;var sb=new THREE.SpritePlugin(this,Ia),Bb=new THREE.LensFlarePlugin(this,za);this.getContext=function(){return s};this.getContextAttributes=function(){return s.getContextAttributes()};this.forceContextLoss=function(){X.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=X.get("EXT_texture_filter_anisotropic");
-return a=null!==b?s.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return ma.precision};this.getPixelRatio=function(){return K};this.setPixelRatio=function(a){void 0!==a&&(K=a)};this.getSize=function(){return{width:C,height:N}};this.setSize=function(a,b,c){C=a;N=b;L.width=a*K;L.height=b*K;!1!==c&&(L.style.width=a+"px",L.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){Ea=a*K;ua=b*K;Fa=c*K;Ga=d*K;s.viewport(Ea,ua,Fa,Ga)};this.setScissor=
-function(a,b,c,d){s.scissor(a*K,b*K,c*K,d*K)};this.enableScissorTest=function(a){O.setScissorTest(a)};this.getClearColor=function(){return R};this.setClearColor=function(a,c){R.set(a);B=void 0!==c?c:1;b(R.r,R.g,R.b,B)};this.getClearAlpha=function(){return B};this.setClearAlpha=function(a){B=a;b(R.r,R.g,R.b,B)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=s.COLOR_BUFFER_BIT;if(void 0===b||b)d|=s.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=s.STENCIL_BUFFER_BIT;s.clear(d)};this.clearColor=function(){s.clear(s.COLOR_BUFFER_BIT)};
-this.clearDepth=function(){s.clear(s.DEPTH_BUFFER_BIT)};this.clearStencil=function(){s.clear(s.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){L.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){O.initAttributes();var d=Z.get(a);a.hasPositions&&!d.position&&(d.position=s.createBuffer());a.hasNormals&&!d.normal&&(d.normal=s.createBuffer());a.hasUvs&&!d.uv&&(d.uv=s.createBuffer());
-a.hasColors&&!d.color&&(d.color=s.createBuffer());b=b.getAttributes();a.hasPositions&&(s.bindBuffer(s.ARRAY_BUFFER,d.position),s.bufferData(s.ARRAY_BUFFER,a.positionArray,s.DYNAMIC_DRAW),O.enableAttribute(b.position),s.vertexAttribPointer(b.position,3,s.FLOAT,!1,0,0));if(a.hasNormals){s.bindBuffer(s.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==c.type&&c.shading===THREE.FlatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,k=(g[e+1]+g[e+4]+g[e+7])/3,l=(g[e+
-2]+g[e+5]+g[e+8])/3;g[e+0]=h;g[e+1]=k;g[e+2]=l;g[e+3]=h;g[e+4]=k;g[e+5]=l;g[e+6]=h;g[e+7]=k;g[e+8]=l}s.bufferData(s.ARRAY_BUFFER,a.normalArray,s.DYNAMIC_DRAW);O.enableAttribute(b.normal);s.vertexAttribPointer(b.normal,3,s.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(s.bindBuffer(s.ARRAY_BUFFER,d.uv),s.bufferData(s.ARRAY_BUFFER,a.uvArray,s.DYNAMIC_DRAW),O.enableAttribute(b.uv),s.vertexAttribPointer(b.uv,2,s.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(s.bindBuffer(s.ARRAY_BUFFER,d.color),s.bufferData(s.ARRAY_BUFFER,
-a.colorArray,s.DYNAMIC_DRAW),O.enableAttribute(b.color),s.vertexAttribPointer(b.color,3,s.FLOAT,!1,0,0));O.disableUnusedAttributes();s.drawArrays(s.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f,g){t(e);var h=v(a,b,c,e,f),k=!1;a=d.id+"_"+h.id+"_"+e.wireframe;a!==pa&&(pa=a,k=!0);a=f.morphTargetInfluences;if(void 0!==a){b=[];c=0;for(k=a.length;c<k;c++){var m=a[c];b.push([m,c])}b.sort(l);8<b.length&&(b.length=8);var n=d.morphAttributes;c=0;for(k=b.length;c<k;c++)m=b[c],
-ta[c]=m[0],0!==m[0]?(a=m[1],!0===e.morphTargets&&n.position&&d.addAttribute("morphTarget"+c,n.position[a]),!0===e.morphNormals&&n.normal&&d.addAttribute("morphNormal"+c,n.normal[a])):(!0===e.morphTargets&&d.removeAttribute("morphTarget"+c),!0===e.morphNormals&&d.removeAttribute("morphNormal"+c));a=h.getUniforms();null!==a.morphTargetInfluences&&s.uniform1fv(a.morphTargetInfluences,ta);k=!0}a=d.index;c=d.attributes.position;!0===e.wireframe&&(a=ra.getWireframeAttribute(d));null!==a?(b=rb,b.setIndex(a)):
-b=qb;if(k){a:{var k=void 0,q;if(d instanceof THREE.InstancedBufferGeometry&&(q=X.get("ANGLE_instanced_arrays"),null===q)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===k&&(k=0);O.initAttributes();var m=d.attributes,h=h.getAttributes(),n=e.defaultAttributeValues,p;for(p in h){var r=h[p];if(0<=r){var u=m[p];if(void 0!==u){O.enableAttribute(r);var w=u.itemSize,x=ra.getAttributeBuffer(u);
-if(u instanceof THREE.InterleavedBufferAttribute){var y=u.data,G=y.stride,u=u.offset;s.bindBuffer(s.ARRAY_BUFFER,x);s.vertexAttribPointer(r,w,s.FLOAT,!1,G*y.array.BYTES_PER_ELEMENT,(k*G+u)*y.array.BYTES_PER_ELEMENT);if(y instanceof THREE.InstancedInterleavedBuffer){if(null===q){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");break a}q.vertexAttribDivisorANGLE(r,y.meshPerAttribute);void 0===
-d.maxInstancedCount&&(d.maxInstancedCount=y.meshPerAttribute*y.count)}}else if(s.bindBuffer(s.ARRAY_BUFFER,x),s.vertexAttribPointer(r,w,s.FLOAT,!1,0,k*w*4),u instanceof THREE.InstancedBufferAttribute){if(null===q){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");break a}q.vertexAttribDivisorANGLE(r,u.meshPerAttribute);void 0===d.maxInstancedCount&&(d.maxInstancedCount=u.meshPerAttribute*
-u.count)}}else if(void 0!==n&&(w=n[p],void 0!==w))switch(w.length){case 2:s.vertexAttrib2fv(r,w);break;case 3:s.vertexAttrib3fv(r,w);break;case 4:s.vertexAttrib4fv(r,w);break;default:s.vertexAttrib1fv(r,w)}}}O.disableUnusedAttributes()}null!==a&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,ra.getAttributeBuffer(a))}null===g&&(g=d.drawRange,g={start:g.start,count:Math.min(g.count,null!==a?a.array.length:c.count)});f instanceof THREE.Mesh?(!0===e.wireframe?(O.setLineWidth(e.wireframeLinewidth*K),b.setMode(s.LINES)):
-b.setMode(s.TRIANGLES),d instanceof THREE.InstancedBufferGeometry&&0<d.maxInstancedCount?b.renderInstances(d):b.render(g.start,g.count)):f instanceof THREE.Line?(d=e.linewidth,void 0===d&&(d=1),O.setLineWidth(d*K),f instanceof THREE.LineSegments?b.setMode(s.LINES):b.setMode(s.LINE_STRIP),b.render(g.start,g.count)):f instanceof THREE.Points&&(b.setMode(s.POINTS),b.render(g.start,g.count))};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
-else{var e=a.fog;pa="";Qa=-1;Pa=null;$a=!0;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ja.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Sa.setFromMatrix(Ja);fa.length=0;ya=la=-1;Ia.length=0;za.length=0;q(a);ba.length=la+1;qa.length=ya+1;!0===ha.sortObjects&&(ba.sort(n),qa.sort(p));ja.render(a);ka.calls=0;ka.vertices=0;ka.faces=0;ka.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,r(ba,b,fa,e,d),r(qa,b,fa,e,d)):(O.setBlending(THREE.NoBlending),r(ba,b,fa,e),r(qa,b,fa,e));sb.render(a,b);Bb.render(a,b,Ya,Za);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,c=Z.get(c).__webglTexture,O.bindTexture(a,c),s.generateMipmap(a),O.bindTexture(a,null));O.setDepthTest(!0);O.setDepthWrite(!0);
-O.setColorWrite(!0)}};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?O.disable(s.CULL_FACE):(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):s.frontFace(s.CCW),a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),O.enable(s.CULL_FACE))};this.setTexture=function(a,b){var c=Z.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",
-a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",a);else{void 0===c.__webglInit&&(c.__webglInit=!0,a.__webglInit=!0,a.addEventListener("dispose",g),c.__webglTexture=s.createTexture(),Ha.textures++);O.activeTexture(s.TEXTURE0+b);O.bindTexture(s.TEXTURE_2D,c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);
-a.image=I(a.image,ma.maxTextureSize);var e=a.image,d=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),f=G(a.format),h=G(a.type);x(s.TEXTURE_2D,a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,m=k.length;l<m;l++)e=k[l],O.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);a.generateMipmaps=!1}else O.texImage2D(s.TEXTURE_2D,0,f,e.width,e.height,0,f,h,e.data);else if(a instanceof THREE.CompressedTexture)for(l=0,m=k.length;l<m;l++)e=k[l],a.format!==
-THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<O.getCompressedTextureFormats().indexOf(f)?O.compressedTexImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):O.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);else if(0<k.length&&d){l=0;for(m=k.length;l<m;l++)e=k[l],O.texImage2D(s.TEXTURE_2D,l,f,f,h,e);a.generateMipmaps=!1}else O.texImage2D(s.TEXTURE_2D,0,f,f,h,a.image);a.generateMipmaps&&
-d&&s.generateMipmap(s.TEXTURE_2D);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else O.activeTexture(s.TEXTURE0+b),O.bindTexture(s.TEXTURE_2D,c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===Z.get(a).__webglFramebuffer){var c=Z.get(a);void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",f);c.__webglTexture=s.createTexture();Ha.textures++;var d=THREE.Math.isPowerOfTwo(a.width)&&
-THREE.Math.isPowerOfTwo(a.height),e=G(a.format),g=G(a.type);if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=[];O.bindTexture(s.TEXTURE_CUBE_MAP,c.__webglTexture);x(s.TEXTURE_CUBE_MAP,a,d);for(var h=0;6>h;h++)c.__webglFramebuffer[h]=s.createFramebuffer(),c.__webglRenderbuffer[h]=s.createRenderbuffer(),O.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,e,a.width,a.height,0,e,g,null),E(c.__webglFramebuffer[h],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+h),z(c.__webglRenderbuffer[h],a);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=
-s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),O.bindTexture(s.TEXTURE_2D,c.__webglTexture),x(s.TEXTURE_2D,a,d),O.texImage2D(s.TEXTURE_2D,0,e,a.width,a.height,0,e,g,null),E(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,
-s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):z(c.__webglRenderbuffer,a),a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);b?O.bindTexture(s.TEXTURE_CUBE_MAP,null):O.bindTexture(s.TEXTURE_2D,null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=Z.get(a),b=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Fa,a=Ga,d=Ea,e=ua);b!==oa&&(s.bindFramebuffer(s.FRAMEBUFFER,b),s.viewport(d,e,c,a),oa=b);
-Ya=c;Za=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(Z.get(a).__webglFramebuffer){var g=!1;Z.get(a).__webglFramebuffer!==oa&&(s.bindFramebuffer(s.FRAMEBUFFER,Z.get(a).__webglFramebuffer),g=!0);a.format!==THREE.RGBAFormat&&G(a.format)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):
-a.type!==THREE.UnsignedByteType&&G(a.type)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."):(s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,c,d,e,G(a.format),G(a.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),g&&s.bindFramebuffer(s.FRAMEBUFFER,oa))}};
-this.supportsFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return X.get("OES_texture_float")};this.supportsHalfFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");return X.get("OES_texture_half_float")};this.supportsStandardDerivatives=function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");
-return X.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).");return X.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return X.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=
-function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return X.get("EXT_blend_minmax")};this.supportsVertexTextures=function(){return ma.vertexTextures};this.supportsInstancedArrays=function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");return X.get("ANGLE_instanced_arrays")};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};
-this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Object.defineProperties(this,{shadowMapEnabled:{get:function(){return ja.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");ja.enabled=
-a}},shadowMapType:{get:function(){return ja.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");ja.type=a}},shadowMapCullFace:{get:function(){return ja.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");ja.cullFace=a}},shadowMapDebug:{get:function(){return ja.debug},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.");ja.debug=a}}})};
-THREE.WebGLRenderTarget=function(a,b,c){this.uuid=THREE.Math.generateUUID();this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,
-1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=void 0!==c.shareDepthFrom?c.shareDepthFrom:null};
+X.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var J=void 0!==a.canvas?a.canvas:document.createElement("canvas"),F=void 0!==a.context?a.context:null,M=J.width,K=J.height,y=1,H=void 0!==a.alpha?a.alpha:!1,D=void 0!==a.depth?a.depth:!0,P=void 0!==a.stencil?a.stencil:!0,O=void 0!==a.antialias?a.antialias:!1,V=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:
+!0,Q=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,R=new THREE.Color(0),C=0,fa=[],ba=[],ma=-1,U=[],la=-1,Va=new Float32Array(8),ka=[],qa=[];this.domElement=J;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var ia=this,db=null,za=null,Oa=-1,pa="",Na=null,$a=0,ua=0,Ea=0,va=J.width,Fa=J.height,Wa=
+0,Xa=0,Za=new THREE.Frustum,Ha=new THREE.Matrix4,Y=new THREE.Vector3,ca=new THREE.Vector3,Ya=!0,sb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},Ga={geometries:0,textures:0},ta={calls:0,vertices:0,faces:0,points:0};this.info={render:ta,memory:Ga,programs:null};
+var s;try{H={alpha:H,depth:D,stencil:P,antialias:O,premultipliedAlpha:V,preserveDrawingBuffer:Q};s=F||J.getContext("webgl",H)||J.getContext("experimental-webgl",H);if(null===s){if(null!==J.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}J.addEventListener("webglcontextlost",e,!1)}catch(ob){console.error("THREE.WebGLRenderer: "+ob)}var X=new THREE.WebGLExtensions(s);X.get("OES_texture_float");X.get("OES_texture_float_linear");
+X.get("OES_texture_half_float");X.get("OES_texture_half_float_linear");X.get("OES_standard_derivatives");X.get("ANGLE_instanced_arrays");X.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var na=new THREE.WebGLCapabilities(s,X,a),L=new THREE.WebGLState(s,X,G),Z=new THREE.WebGLProperties,ra=new THREE.WebGLObjects(s,Z,this.info),Pa=new THREE.WebGLPrograms(this,na);this.info.programs=Pa.programs;var pb=new THREE.WebGLBufferRenderer(s,X,ta),qb=new THREE.WebGLIndexedBufferRenderer(s,
+X,ta);c();this.context=s;this.capabilities=na;this.extensions=X;this.state=L;var ga=new THREE.WebGLShadowMap(this,fa,ra);this.shadowMap=ga;var rb=new THREE.SpritePlugin(this,ka),Bb=new THREE.LensFlarePlugin(this,qa);this.getContext=function(){return s};this.getContextAttributes=function(){return s.getContextAttributes()};this.forceContextLoss=function(){X.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=X.get("EXT_texture_filter_anisotropic");
+return a=null!==b?s.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return na.precision};this.getPixelRatio=function(){return y};this.setPixelRatio=function(a){void 0!==a&&(y=a)};this.getSize=function(){return{width:M,height:K}};this.setSize=function(a,b,c){M=a;K=b;J.width=a*y;J.height=b*y;!1!==c&&(J.style.width=a+"px",J.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){ua=a*y;Ea=b*y;va=c*y;Fa=d*y;s.viewport(ua,Ea,va,Fa)};this.setScissor=
+function(a,b,c,d){s.scissor(a*y,b*y,c*y,d*y)};this.enableScissorTest=function(a){L.setScissorTest(a)};this.getClearColor=function(){return R};this.setClearColor=function(a,c){R.set(a);C=void 0!==c?c:1;b(R.r,R.g,R.b,C)};this.getClearAlpha=function(){return C};this.setClearAlpha=function(a){C=a;b(R.r,R.g,R.b,C)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=s.COLOR_BUFFER_BIT;if(void 0===b||b)d|=s.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=s.STENCIL_BUFFER_BIT;s.clear(d)};this.clearColor=function(){s.clear(s.COLOR_BUFFER_BIT)};
+this.clearDepth=function(){s.clear(s.DEPTH_BUFFER_BIT)};this.clearStencil=function(){s.clear(s.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){J.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){L.initAttributes();var d=Z.get(a);a.hasPositions&&!d.position&&(d.position=s.createBuffer());a.hasNormals&&!d.normal&&(d.normal=s.createBuffer());a.hasUvs&&!d.uv&&(d.uv=s.createBuffer());
+a.hasColors&&!d.color&&(d.color=s.createBuffer());b=b.getAttributes();a.hasPositions&&(s.bindBuffer(s.ARRAY_BUFFER,d.position),s.bufferData(s.ARRAY_BUFFER,a.positionArray,s.DYNAMIC_DRAW),L.enableAttribute(b.position),s.vertexAttribPointer(b.position,3,s.FLOAT,!1,0,0));if(a.hasNormals){s.bindBuffer(s.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==c.type&&c.shading===THREE.FlatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,k=(g[e+1]+g[e+4]+g[e+7])/3,l=(g[e+
+2]+g[e+5]+g[e+8])/3;g[e+0]=h;g[e+1]=k;g[e+2]=l;g[e+3]=h;g[e+4]=k;g[e+5]=l;g[e+6]=h;g[e+7]=k;g[e+8]=l}s.bufferData(s.ARRAY_BUFFER,a.normalArray,s.DYNAMIC_DRAW);L.enableAttribute(b.normal);s.vertexAttribPointer(b.normal,3,s.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(s.bindBuffer(s.ARRAY_BUFFER,d.uv),s.bufferData(s.ARRAY_BUFFER,a.uvArray,s.DYNAMIC_DRAW),L.enableAttribute(b.uv),s.vertexAttribPointer(b.uv,2,s.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(s.bindBuffer(s.ARRAY_BUFFER,d.color),s.bufferData(s.ARRAY_BUFFER,
+a.colorArray,s.DYNAMIC_DRAW),L.enableAttribute(b.color),s.vertexAttribPointer(b.color,3,s.FLOAT,!1,0,0));L.disableUnusedAttributes();s.drawArrays(s.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f,g){t(e);var h=v(a,b,c,e,f),k=!1;a=d.id+"_"+h.id+"_"+e.wireframe;a!==pa&&(pa=a,k=!0);a=f.morphTargetInfluences;if(void 0!==a){b=[];c=0;for(k=a.length;c<k;c++){var m=a[c];b.push([m,c])}b.sort(l);8<b.length&&(b.length=8);var n=d.morphAttributes;c=0;for(k=b.length;c<k;c++)m=b[c],
+Va[c]=m[0],0!==m[0]?(a=m[1],!0===e.morphTargets&&n.position&&d.addAttribute("morphTarget"+c,n.position[a]),!0===e.morphNormals&&n.normal&&d.addAttribute("morphNormal"+c,n.normal[a])):(!0===e.morphTargets&&d.removeAttribute("morphTarget"+c),!0===e.morphNormals&&d.removeAttribute("morphNormal"+c));a=h.getUniforms();null!==a.morphTargetInfluences&&s.uniform1fv(a.morphTargetInfluences,Va);k=!0}a=d.index;c=d.attributes.position;!0===e.wireframe&&(a=ra.getWireframeAttribute(d));null!==a?(b=qb,b.setIndex(a)):
+b=pb;if(k){a:{var k=void 0,q;if(d instanceof THREE.InstancedBufferGeometry&&(q=X.get("ANGLE_instanced_arrays"),null===q)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===k&&(k=0);L.initAttributes();var m=d.attributes,h=h.getAttributes(),n=e.defaultAttributeValues,p;for(p in h){var r=h[p];if(0<=r){var u=m[p];if(void 0!==u){var w=u.itemSize,x=ra.getAttributeBuffer(u);if(u instanceof
+THREE.InterleavedBufferAttribute){var z=u.data,J=z.stride,u=u.offset;z instanceof THREE.InstancedInterleavedBuffer?(L.enableAttributeAndDivisor(r,z.meshPerAttribute,q),void 0===d.maxInstancedCount&&(d.maxInstancedCount=z.meshPerAttribute*z.count)):L.enableAttribute(r);s.bindBuffer(s.ARRAY_BUFFER,x);s.vertexAttribPointer(r,w,s.FLOAT,!1,J*z.array.BYTES_PER_ELEMENT,(k*J+u)*z.array.BYTES_PER_ELEMENT)}else u instanceof THREE.InstancedBufferAttribute?(L.enableAttributeAndDivisor(r,u.meshPerAttribute,q),
+void 0===d.maxInstancedCount&&(d.maxInstancedCount=u.meshPerAttribute*u.count)):L.enableAttribute(r),s.bindBuffer(s.ARRAY_BUFFER,x),s.vertexAttribPointer(r,w,s.FLOAT,!1,0,k*w*4)}else if(void 0!==n&&(w=n[p],void 0!==w))switch(w.length){case 2:s.vertexAttrib2fv(r,w);break;case 3:s.vertexAttrib3fv(r,w);break;case 4:s.vertexAttrib4fv(r,w);break;default:s.vertexAttrib1fv(r,w)}}}L.disableUnusedAttributes()}null!==a&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,ra.getAttributeBuffer(a))}null===g&&(g=d.drawRange,
+g={start:g.start,count:Math.min(g.count,null!==a?a.array.length:c.count)});f instanceof THREE.Mesh?(!0===e.wireframe?(L.setLineWidth(e.wireframeLinewidth*y),b.setMode(s.LINES)):b.setMode(s.TRIANGLES),d instanceof THREE.InstancedBufferGeometry&&0<d.maxInstancedCount?b.renderInstances(d):b.render(g.start,g.count)):f instanceof THREE.Line?(d=e.linewidth,void 0===d&&(d=1),L.setLineWidth(d*y),f instanceof THREE.LineSegments?b.setMode(s.LINES):b.setMode(s.LINE_STRIP),b.render(g.start,g.count)):f instanceof
+THREE.Points&&(b.setMode(s.POINTS),b.render(g.start,g.count))};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;pa="";Oa=-1;Na=null;Ya=!0;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ha.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Za.setFromMatrix(Ha);fa.length=0;la=ma=-1;ka.length=0;qa.length=
+0;q(a);ba.length=ma+1;U.length=la+1;!0===ia.sortObjects&&(ba.sort(n),U.sort(p));ga.render(a);ta.calls=0;ta.vertices=0;ta.faces=0;ta.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,r(ba,b,fa,e,d),r(U,b,fa,e,d)):(L.setBlending(THREE.NoBlending),r(ba,b,fa,e),r(U,b,fa,e));rb.render(a,b);Bb.render(a,b,Wa,Xa);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
+(a=c instanceof THREE.WebGLRenderTargetCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,c=Z.get(c).__webglTexture,L.bindTexture(a,c),s.generateMipmap(a),L.bindTexture(a,null));L.setDepthTest(!0);L.setDepthWrite(!0);L.setColorWrite(!0)}};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?L.disable(s.CULL_FACE):(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):s.frontFace(s.CCW),a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),L.enable(s.CULL_FACE))};
+this.setTexture=function(a,b){var c=Z.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",a);else{void 0===c.__webglInit&&(c.__webglInit=!0,a.__webglInit=!0,a.addEventListener("dispose",g),c.__webglTexture=s.createTexture(),Ga.textures++);L.activeTexture(s.TEXTURE0+b);L.bindTexture(s.TEXTURE_2D,
+c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=I(a.image,na.maxTextureSize);var e=a.image,d=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),f=G(a.format),h=G(a.type);x(s.TEXTURE_2D,a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,m=k.length;l<m;l++)e=k[l],L.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,
+0,f,h,e.data);a.generateMipmaps=!1}else L.texImage2D(s.TEXTURE_2D,0,f,e.width,e.height,0,f,h,e.data);else if(a instanceof THREE.CompressedTexture)for(l=0,m=k.length;l<m;l++)e=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<L.getCompressedTextureFormats().indexOf(f)?L.compressedTexImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):L.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,
+0,f,h,e.data);else if(0<k.length&&d){l=0;for(m=k.length;l<m;l++)e=k[l],L.texImage2D(s.TEXTURE_2D,l,f,f,h,e);a.generateMipmaps=!1}else L.texImage2D(s.TEXTURE_2D,0,f,f,h,a.image);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else L.activeTexture(s.TEXTURE0+b),L.bindTexture(s.TEXTURE_2D,c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===Z.get(a).__webglFramebuffer){var c=Z.get(a);
+void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",f);c.__webglTexture=s.createTexture();Ga.textures++;var d=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),e=G(a.format),g=G(a.type);if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=[];L.bindTexture(s.TEXTURE_CUBE_MAP,c.__webglTexture);x(s.TEXTURE_CUBE_MAP,a,d);for(var h=0;6>h;h++)c.__webglFramebuffer[h]=s.createFramebuffer(),c.__webglRenderbuffer[h]=s.createRenderbuffer(),
+L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,e,a.width,a.height,0,e,g,null),E(c.__webglFramebuffer[h],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+h),B(c.__webglRenderbuffer[h],a);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),L.bindTexture(s.TEXTURE_2D,c.__webglTexture),x(s.TEXTURE_2D,a,d),L.texImage2D(s.TEXTURE_2D,0,e,a.width,a.height,0,e,g,null),E(c.__webglFramebuffer,
+a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):B(c.__webglRenderbuffer,a),a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);b?L.bindTexture(s.TEXTURE_CUBE_MAP,null):L.bindTexture(s.TEXTURE_2D,null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,
+null)}a?(c=Z.get(a),b=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=va,a=Fa,d=ua,e=Ea);b!==za&&(s.bindFramebuffer(s.FRAMEBUFFER,b),s.viewport(d,e,c,a),za=b);Wa=c;Xa=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(Z.get(a).__webglFramebuffer){var g=!1;Z.get(a).__webglFramebuffer!==za&&
+(s.bindFramebuffer(s.FRAMEBUFFER,Z.get(a).__webglFramebuffer),g=!0);a.format!==THREE.RGBAFormat&&G(a.format)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):a.type!==THREE.UnsignedByteType&&G(a.type)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."):
+(s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,c,d,e,G(a.format),G(a.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),g&&s.bindFramebuffer(s.FRAMEBUFFER,za))}};this.supportsFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return X.get("OES_texture_float")};this.supportsHalfFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");
+return X.get("OES_texture_half_float")};this.supportsStandardDerivatives=function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return X.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).");return X.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=
+function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return X.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return X.get("EXT_blend_minmax")};this.supportsVertexTextures=function(){return na.vertexTextures};this.supportsInstancedArrays=function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");
+return X.get("ANGLE_instanced_arrays")};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Object.defineProperties(this,{shadowMapEnabled:{get:function(){return ga.enabled},
+set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");ga.enabled=a}},shadowMapType:{get:function(){return ga.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");ga.type=a}},shadowMapCullFace:{get:function(){return ga.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");ga.cullFace=a}},shadowMapDebug:{get:function(){return ga.debug},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.");
+ga.debug=a}}})};
+THREE.WebGLRenderTarget=function(a,b,c){this.uuid=THREE.Math.generateUUID();this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);
+this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=void 0!==c.shareDepthFrom?c.shareDepthFrom:null};
 THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose()},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.format=a.format;this.type=a.type;this.depthBuffer=
 a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.generateMipmaps=a.generateMipmaps;this.shareDepthFrom=a.shareDepthFrom;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);
 THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;
@@ -642,8 +642,8 @@ g.__webglShader.name,v,"#define MAX_DIR_LIGHTS "+f.maxDirLights,"#define MAX_POI
 "",f.envMap?"#define "+m:"",f.envMap?"#define "+q:"",f.envMap?"#define "+r:"",f.lightMap?"#define USE_LIGHTMAP":"",f.aoMap?"#define USE_AOMAP":"",f.emissiveMap?"#define USE_EMISSIVEMAP":"",f.bumpMap?"#define USE_BUMPMAP":"",f.normalMap?"#define USE_NORMALMAP":"",f.specularMap?"#define USE_SPECULARMAP":"",f.alphaMap?"#define USE_ALPHAMAP":"",f.vertexColors?"#define USE_COLOR":"",f.flatShading?"#define FLAT_SHADED":"",f.metal?"#define METAL":"",f.doubleSided?"#define DOUBLE_SIDED":"",f.flipSided?"#define FLIP_SIDED":
 "",f.shadowMapEnabled?"#define USE_SHADOWMAP":"",f.shadowMapEnabled?"#define "+p:"",f.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",f.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",f.logarithmicDepthBuffer&&d.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(b).join("\n"));n=d+n;l=THREE.WebGLShader(h,h.VERTEX_SHADER,k+l);n=THREE.WebGLShader(h,h.FRAGMENT_SHADER,n);h.attachShader(w,l);h.attachShader(w,n);void 0!==
 g.index0AttributeName?h.bindAttribLocation(w,0,g.index0AttributeName):!0===f.morphTargets&&h.bindAttribLocation(w,0,"position");h.linkProgram(w);f=h.getProgramInfoLog(w);p=h.getShaderInfoLog(l);m=h.getShaderInfoLog(n);r=q=!0;if(!1===h.getProgramParameter(w,h.LINK_STATUS))q=!1,console.error("THREE.WebGLProgram: shader error: ",h.getError(),"gl.VALIDATE_STATUS",h.getProgramParameter(w,h.VALIDATE_STATUS),"gl.getProgramInfoLog",f,p,m);else if(""!==f)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",
-f);else if(""===p||""===m)r=!1;r&&(this.diagnostics={runnable:q,material:g,programLog:f,vertexShader:{log:p,prefix:k},fragmentShader:{log:m,prefix:d}});h.deleteShader(l);h.deleteShader(n);var u;this.getUniforms=function(){if(void 0===u){for(var a={},b=h.getProgramParameter(w,h.ACTIVE_UNIFORMS),c=0;c<b;c++){var d=h.getActiveUniform(w,c).name,e=h.getUniformLocation(w,d),g=d.lastIndexOf("[0]");-1!==g&&g===d.length-3&&(a[d.substr(0,g)]=e);a[d]=e}u=a}return u};var y;this.getAttributes=function(){if(void 0===
-y){for(var a={},b=h.getProgramParameter(w,h.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=h.getActiveAttrib(w,c).name;a[d]=h.getAttribLocation(w,d)}y=a}return y};this.destroy=function(){h.deleteProgram(w);this.program=void 0};Object.defineProperties(this,{uniforms:{get:function(){console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms().");return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");return this.getAttributes()}}});
+f);else if(""===p||""===m)r=!1;r&&(this.diagnostics={runnable:q,material:g,programLog:f,vertexShader:{log:p,prefix:k},fragmentShader:{log:m,prefix:d}});h.deleteShader(l);h.deleteShader(n);var u;this.getUniforms=function(){if(void 0===u){for(var a={},b=h.getProgramParameter(w,h.ACTIVE_UNIFORMS),c=0;c<b;c++){var d=h.getActiveUniform(w,c).name,e=h.getUniformLocation(w,d),g=d.lastIndexOf("[0]");-1!==g&&g===d.length-3&&(a[d.substr(0,g)]=e);a[d]=e}u=a}return u};var z;this.getAttributes=function(){if(void 0===
+z){for(var a={},b=h.getProgramParameter(w,h.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=h.getActiveAttrib(w,c).name;a[d]=h.getAttribLocation(w,d)}z=a}return z};this.destroy=function(){h.deleteProgram(w);this.program=void 0};Object.defineProperties(this,{uniforms:{get:function(){console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms().");return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");return this.getAttributes()}}});
 this.id=c++;this.code=e;this.usedTimes=1;this.program=w;this.vertexShader=l;this.fragmentShader=n;return this}}();
 THREE.WebGLPrograms=function(a,b){var c=[],d={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},e="precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap specularMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals maxDirLights maxPointLights maxSpotLights maxHemiLights maxShadows shadowMapEnabled shadowMapType shadowMapDebug alphaTest metal doubleSided flipSided".split(" ");this.getParameters=
 function(c,e,h,k){for(var l,n,p,m,q=d[c.type],r=m=p=n=l=0,t=e.length;r<t;r++){var v=e[r];v.onlyShadow||!1===v.visible||(v instanceof THREE.DirectionalLight&&l++,v instanceof THREE.PointLight&&n++,v instanceof THREE.SpotLight&&p++,v instanceof THREE.HemisphereLight&&m++)}t=r=0;for(v=e.length;t<v;t++){var w=e[t];w.castShadow&&(w instanceof THREE.SpotLight&&r++,w instanceof THREE.DirectionalLight&&r++)}e=r;b.floatVertexTextures&&k&&k.skeleton&&k.skeleton.useVertexTexture?r=1024:(r=Math.floor((b.maxVertexUniforms-
@@ -659,34 +659,34 @@ vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,morphTargets:!0}),t=
 this.render=function(m){if(!1!==w.enabled&&(!1!==w.autoUpdate||!1!==w.needsUpdate)){g.clearColor(1,1,1,1);f.disable(g.BLEND);f.enable(g.CULL_FACE);g.frontFace(g.CCW);w.cullFace===THREE.CullFaceFront?g.cullFace(g.FRONT):g.cullFace(g.BACK);f.setDepthTest(!0);for(var q=0,p=b.length;q<p;q++){var r=b[q];if(r.castShadow){if(!r.shadowMap){var t=THREE.LinearFilter;w.type===THREE.PCFSoftShadowMap&&(t=THREE.NearestFilter);r.shadowMap=new THREE.WebGLRenderTarget(r.shadowMapWidth,r.shadowMapHeight,{minFilter:t,
 magFilter:t,format:THREE.RGBAFormat});r.shadowMapSize=new THREE.Vector2(r.shadowMapWidth,r.shadowMapHeight);r.shadowMatrix=new THREE.Matrix4}if(!r.shadowCamera){if(r instanceof THREE.SpotLight)r.shadowCamera=new THREE.PerspectiveCamera(r.shadowCameraFov,r.shadowMapWidth/r.shadowMapHeight,r.shadowCameraNear,r.shadowCameraFar);else if(r instanceof THREE.DirectionalLight)r.shadowCamera=new THREE.OrthographicCamera(r.shadowCameraLeft,r.shadowCameraRight,r.shadowCameraTop,r.shadowCameraBottom,r.shadowCameraNear,
 r.shadowCameraFar);else{console.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",r);continue}m.add(r.shadowCamera);!0===m.autoUpdate&&m.updateMatrixWorld()}r.shadowCameraVisible&&!r.cameraHelper&&(r.cameraHelper=new THREE.CameraHelper(r.shadowCamera),m.add(r.cameraHelper));var v=r.shadowMap,A=r.shadowMatrix,t=r.shadowCamera;t.position.setFromMatrixPosition(r.matrixWorld);l.setFromMatrixPosition(r.target.matrixWorld);t.lookAt(l);t.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);
-r.cameraHelper&&(r.cameraHelper.visible=r.shadowCameraVisible);r.shadowCameraVisible&&r.cameraHelper.update();A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);A.multiply(t.projectionMatrix);A.multiply(t.matrixWorldInverse);k.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);h.setFromMatrix(k);a.setRenderTarget(v);a.clear();n.length=0;e(m,t);r=0;for(v=n.length;r<v;r++){var A=n[r],G=c.update(A),L=A.material;if(L instanceof THREE.MeshFaceMaterial)for(var D=G.groups,L=L.materials,C=0,N=D.length;C<
-N;C++){var K=D[C],H=L[K.materialIndex];!0===H.visible&&a.renderBufferDirect(t,b,null,G,d(A,H),A,K)}else a.renderBufferDirect(t,b,null,G,d(A,L),A,null)}}}m=a.getClearColor();q=a.getClearAlpha();a.setClearColor(m,q);f.enable(g.BLEND);w.cullFace===THREE.CullFaceFront&&g.cullFace(g.BACK);a.resetGLState();w.needsUpdate=!1}}};
-THREE.WebGLState=function(a,b,c){var d=this,e=new Uint8Array(16),g=new Uint8Array(16),f={},h=null,k=null,l=null,n=null,p=null,m=null,q=null,r=null,t=null,v=null,w=null,u=null,y=null,x=null,I=null,E=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),z=void 0,A={};this.init=function(){a.clearColor(0,0,0,1);a.clearDepth(1);a.clearStencil(0);this.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.frontFace(a.CCW);a.cullFace(a.BACK);this.enable(a.CULL_FACE);this.enable(a.BLEND);a.blendEquation(a.FUNC_ADD);a.blendFunc(a.SRC_ALPHA,
-a.ONE_MINUS_SRC_ALPHA)};this.initAttributes=function(){for(var a=0,b=e.length;a<b;a++)e[a]=0};this.enableAttribute=function(b){e[b]=1;0===g[b]&&(a.enableVertexAttribArray(b),g[b]=1)};this.disableUnusedAttributes=function(){for(var b=0,c=g.length;b<c;b++)g[b]!==e[b]&&(a.disableVertexAttribArray(b),g[b]=0)};this.enable=function(b){!0!==f[b]&&(a.enable(b),f[b]=!0)};this.disable=function(b){!1!==f[b]&&(a.disable(b),f[b]=!1)};this.getCompressedTextureFormats=function(){if(null===h&&(h=[],b.get("WEBGL_compressed_texture_pvrtc")||
-b.get("WEBGL_compressed_texture_s3tc")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),d=0;d<c.length;d++)h.push(c[d]);return h};this.setBlending=function(b,d,e,f,g,h,t){b!==k&&(b===THREE.NoBlending?this.disable(a.BLEND):b===THREE.AdditiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):b===THREE.SubtractiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):b===THREE.MultiplyBlending?(this.enable(a.BLEND),
-a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):b===THREE.CustomBlending?this.enable(a.BLEND):(this.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),k=b);if(b===THREE.CustomBlending){g=g||d;h=h||e;t=t||f;if(d!==l||g!==m)a.blendEquationSeparate(c(d),c(g)),l=d,m=g;if(e!==n||f!==p||h!==q||t!==r)a.blendFuncSeparate(c(e),c(f),c(h),c(t)),n=e,p=f,q=h,r=t}else r=q=m=p=n=l=null};this.setDepthFunc=
-function(b){if(t!==b){if(b)switch(b){case THREE.NeverDepth:a.depthFunc(a.NEVER);break;case THREE.AlwaysDepth:a.depthFunc(a.ALWAYS);break;case THREE.LessDepth:a.depthFunc(a.LESS);break;case THREE.LessEqualDepth:a.depthFunc(a.LEQUAL);break;case THREE.EqualDepth:a.depthFunc(a.EQUAL);break;case THREE.GreaterEqualDepth:a.depthFunc(a.GEQUAL);break;case THREE.GreaterDepth:a.depthFunc(a.GREATER);break;case THREE.NotEqualDepth:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);
-t=b}};this.setDepthTest=function(b){b?this.enable(a.DEPTH_TEST):this.disable(a.DEPTH_TEST)};this.setDepthWrite=function(b){v!==b&&(a.depthMask(b),v=b)};this.setColorWrite=function(b){w!==b&&(a.colorMask(b,b,b,b),w=b)};this.setFlipSided=function(b){u!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),u=b)};this.setLineWidth=function(b){b!==y&&(a.lineWidth(b),y=b)};this.setPolygonOffset=function(b,c,d){b?this.enable(a.POLYGON_OFFSET_FILL):this.disable(a.POLYGON_OFFSET_FILL);!b||x===c&&I===d||(a.polygonOffset(c,
-d),x=c,I=d)};this.setScissorTest=function(b){b?this.enable(a.SCISSOR_TEST):this.disable(a.SCISSOR_TEST)};this.activeTexture=function(b){void 0===b&&(b=a.TEXTURE0+E-1);z!==b&&(a.activeTexture(b),z=b)};this.bindTexture=function(b,c){void 0===z&&d.activeTexture();var e=A[z];void 0===e&&(e={type:void 0,texture:void 0},A[z]=e);if(e.type!==b||e.texture!==c)a.bindTexture(b,c),e.type=b,e.texture=c};this.compressedTexImage2D=function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(b){console.error(b)}};
-this.texImage2D=function(){try{a.texImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.reset=function(){for(var b=0;b<g.length;b++)1===g[b]&&(a.disableVertexAttribArray(b),g[b]=0);f={};u=w=v=k=h=null}};
-THREE.LensFlarePlugin=function(a,b){var c,d,e,g,f,h,k,l,n,p,m=a.context,q=a.state,r,t,v,w,u,y;this.render=function(x,I,E,z){if(0!==b.length){x=new THREE.Vector3;var A=z/E,G=.5*E,L=.5*z,D=16/z,C=new THREE.Vector2(D*A,D),N=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1);if(void 0===v){var D=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),H=new Uint16Array([0,1,2,0,2,3]);r=m.createBuffer();t=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,r);m.bufferData(m.ARRAY_BUFFER,D,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
-t);m.bufferData(m.ELEMENT_ARRAY_BUFFER,H,m.STATIC_DRAW);u=m.createTexture();y=m.createTexture();q.bindTexture(m.TEXTURE_2D,u);m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);q.bindTexture(m.TEXTURE_2D,y);m.texImage2D(m.TEXTURE_2D,0,
-m.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);var D=(w=0<m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\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 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 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}",
+r.cameraHelper&&(r.cameraHelper.visible=r.shadowCameraVisible);r.shadowCameraVisible&&r.cameraHelper.update();A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);A.multiply(t.projectionMatrix);A.multiply(t.matrixWorldInverse);k.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);h.setFromMatrix(k);a.setRenderTarget(v);a.clear();n.length=0;e(m,t);r=0;for(v=n.length;r<v;r++){var A=n[r],G=c.update(A),J=A.material;if(J instanceof THREE.MeshFaceMaterial)for(var F=G.groups,J=J.materials,M=0,K=F.length;M<
+K;M++){var y=F[M],H=J[y.materialIndex];!0===H.visible&&a.renderBufferDirect(t,b,null,G,d(A,H),A,y)}else a.renderBufferDirect(t,b,null,G,d(A,J),A,null)}}}m=a.getClearColor();q=a.getClearAlpha();a.setClearColor(m,q);f.enable(g.BLEND);w.cullFace===THREE.CullFaceFront&&g.cullFace(g.BACK);a.resetGLState();w.needsUpdate=!1}}};
+THREE.WebGLState=function(a,b,c){var d=this,e=new Uint8Array(16),g=new Uint8Array(16),f=new Uint8Array(16),h={},k=null,l=null,n=null,p=null,m=null,q=null,r=null,t=null,v=null,w=null,u=null,z=null,x=null,I=null,E=null,B=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),A=void 0,G={};this.init=function(){a.clearColor(0,0,0,1);a.clearDepth(1);a.clearStencil(0);this.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.frontFace(a.CCW);a.cullFace(a.BACK);this.enable(a.CULL_FACE);this.enable(a.BLEND);a.blendEquation(a.FUNC_ADD);
+a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)};this.initAttributes=function(){for(var a=0,b=e.length;a<b;a++)e[a]=0};this.enableAttribute=function(c){e[c]=1;0===g[c]&&(a.enableVertexAttribArray(c),g[c]=1);0!==f[c]&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c,0),f[c]=0)};this.enableAttributeAndDivisor=function(b,c,d){e[b]=1;0===g[b]&&(a.enableVertexAttribArray(b),g[b]=1);f[b]!==c&&(d.vertexAttribDivisorANGLE(b,c),f[b]=c)};this.disableUnusedAttributes=function(){for(var b=0,c=g.length;b<
+c;b++)g[b]!==e[b]&&(a.disableVertexAttribArray(b),g[b]=0)};this.enable=function(b){!0!==h[b]&&(a.enable(b),h[b]=!0)};this.disable=function(b){!1!==h[b]&&(a.disable(b),h[b]=!1)};this.getCompressedTextureFormats=function(){if(null===k&&(k=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),d=0;d<c.length;d++)k.push(c[d]);return k};this.setBlending=function(b,d,e,f,g,h,k){b!==l&&(b===THREE.NoBlending?this.disable(a.BLEND):
+b===THREE.AdditiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):b===THREE.SubtractiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):b===THREE.MultiplyBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):b===THREE.CustomBlending?this.enable(a.BLEND):(this.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,
+a.ONE,a.ONE_MINUS_SRC_ALPHA)),l=b);if(b===THREE.CustomBlending){g=g||d;h=h||e;k=k||f;if(d!==n||g!==q)a.blendEquationSeparate(c(d),c(g)),n=d,q=g;if(e!==p||f!==m||h!==r||k!==t)a.blendFuncSeparate(c(e),c(f),c(h),c(k)),p=e,m=f,r=h,t=k}else t=r=q=m=p=n=null};this.setDepthFunc=function(b){if(v!==b){if(b)switch(b){case THREE.NeverDepth:a.depthFunc(a.NEVER);break;case THREE.AlwaysDepth:a.depthFunc(a.ALWAYS);break;case THREE.LessDepth:a.depthFunc(a.LESS);break;case THREE.LessEqualDepth:a.depthFunc(a.LEQUAL);
+break;case THREE.EqualDepth:a.depthFunc(a.EQUAL);break;case THREE.GreaterEqualDepth:a.depthFunc(a.GEQUAL);break;case THREE.GreaterDepth:a.depthFunc(a.GREATER);break;case THREE.NotEqualDepth:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);v=b}};this.setDepthTest=function(b){b?this.enable(a.DEPTH_TEST):this.disable(a.DEPTH_TEST)};this.setDepthWrite=function(b){w!==b&&(a.depthMask(b),w=b)};this.setColorWrite=function(b){u!==b&&(a.colorMask(b,b,b,b),u=b)};this.setFlipSided=
+function(b){z!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),z=b)};this.setLineWidth=function(b){b!==x&&(a.lineWidth(b),x=b)};this.setPolygonOffset=function(b,c,d){b?this.enable(a.POLYGON_OFFSET_FILL):this.disable(a.POLYGON_OFFSET_FILL);!b||I===c&&E===d||(a.polygonOffset(c,d),I=c,E=d)};this.setScissorTest=function(b){b?this.enable(a.SCISSOR_TEST):this.disable(a.SCISSOR_TEST)};this.activeTexture=function(b){void 0===b&&(b=a.TEXTURE0+B-1);A!==b&&(a.activeTexture(b),A=b)};this.bindTexture=function(b,c){void 0===
+A&&d.activeTexture();var e=G[A];void 0===e&&(e={type:void 0,texture:void 0},G[A]=e);if(e.type!==b||e.texture!==c)a.bindTexture(b,c),e.type=b,e.texture=c};this.compressedTexImage2D=function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.texImage2D=function(){try{a.texImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.reset=function(){for(var b=0;b<g.length;b++)1===g[b]&&(a.disableVertexAttribArray(b),g[b]=0);h={};z=u=w=l=k=null}};
+THREE.LensFlarePlugin=function(a,b){var c,d,e,g,f,h,k,l,n,p,m=a.context,q=a.state,r,t,v,w,u,z;this.render=function(x,I,E,B){if(0!==b.length){x=new THREE.Vector3;var A=B/E,G=.5*E,J=.5*B,F=16/B,M=new THREE.Vector2(F*A,F),K=new THREE.Vector3(1,1,0),y=new THREE.Vector2(1,1);if(void 0===v){var F=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),H=new Uint16Array([0,1,2,0,2,3]);r=m.createBuffer();t=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,r);m.bufferData(m.ARRAY_BUFFER,F,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
+t);m.bufferData(m.ELEMENT_ARRAY_BUFFER,H,m.STATIC_DRAW);u=m.createTexture();z=m.createTexture();q.bindTexture(m.TEXTURE_2D,u);m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);q.bindTexture(m.TEXTURE_2D,z);m.texImage2D(m.TEXTURE_2D,0,
+m.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);var F=(w=0<m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\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 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 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:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\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}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\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 lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\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;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( 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}"},
-H=m.createProgram(),M=m.createShader(m.FRAGMENT_SHADER),F=m.createShader(m.VERTEX_SHADER),Q="precision "+a.getPrecision()+" float;\n";m.shaderSource(M,Q+D.fragmentShader);m.shaderSource(F,Q+D.vertexShader);m.compileShader(M);m.compileShader(F);m.attachShader(H,M);m.attachShader(H,F);m.linkProgram(H);v=H;n=m.getAttribLocation(v,"position");p=m.getAttribLocation(v,"uv");c=m.getUniformLocation(v,"renderType");d=m.getUniformLocation(v,"map");e=m.getUniformLocation(v,"occlusionMap");g=m.getUniformLocation(v,
-"opacity");f=m.getUniformLocation(v,"color");h=m.getUniformLocation(v,"scale");k=m.getUniformLocation(v,"rotation");l=m.getUniformLocation(v,"screenPosition")}m.useProgram(v);q.initAttributes();q.enableAttribute(n);q.enableAttribute(p);q.disableUnusedAttributes();m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,r);m.vertexAttribPointer(n,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,t);q.disable(m.CULL_FACE);m.depthMask(!1);H=0;for(M=
-b.length;H<M;H++)if(D=16/z,C.set(D*A,D),F=b[H],x.set(F.matrixWorld.elements[12],F.matrixWorld.elements[13],F.matrixWorld.elements[14]),x.applyMatrix4(I.matrixWorldInverse),x.applyProjection(I.projectionMatrix),N.copy(x),K.x=N.x*G+G,K.y=N.y*L+L,w||0<K.x&&K.x<E&&0<K.y&&K.y<z){q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,null);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,u);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,K.x-8,K.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,C.x,C.y);m.uniform3f(l,
-N.x,N.y,N.z);q.disable(m.BLEND);q.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,y);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,K.x-8,K.y-8,16,16,0);m.uniform1i(c,1);q.disable(m.DEPTH_TEST);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,u);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);F.positionScreen.copy(N);F.customUpdateCallback?F.customUpdateCallback(F):F.updateLensFlares();m.uniform1i(c,2);q.enable(m.BLEND);for(var Q=
-0,V=F.lensFlares.length;Q<V;Q++){var S=F.lensFlares[Q];.001<S.opacity&&.001<S.scale&&(N.x=S.x,N.y=S.y,N.z=S.z,D=S.size*S.scale/z,C.x=D*A,C.y=D,m.uniform3f(l,N.x,N.y,N.z),m.uniform2f(h,C.x,C.y),m.uniform1f(k,S.rotation),m.uniform1f(g,S.opacity),m.uniform3f(f,S.color.r,S.color.g,S.color.b),q.setBlending(S.blending,S.blendEquation,S.blendSrc,S.blendDst),a.setTexture(S.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}q.enable(m.CULL_FACE);q.enable(m.DEPTH_TEST);m.depthMask(!0);a.resetGLState()}}};
-THREE.SpritePlugin=function(a,b){var c,d,e,g,f,h,k,l,n,p,m,q,r,t,v,w,u;function y(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,I=a.state,E,z,A,G,L=new THREE.Vector3,D=new THREE.Quaternion,C=new THREE.Vector3;this.render=function(N,K){if(0!==b.length){if(void 0===A){var H=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),M=new Uint16Array([0,1,2,0,2,3]);E=x.createBuffer();z=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,E);x.bufferData(x.ARRAY_BUFFER,H,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,
-z);x.bufferData(x.ELEMENT_ARRAY_BUFFER,M,x.STATIC_DRAW);var H=x.createProgram(),M=x.createShader(x.VERTEX_SHADER),F=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(M,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
-x.shaderSource(F,["precision "+a.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
-x.compileShader(M);x.compileShader(F);x.attachShader(H,M);x.attachShader(H,F);x.linkProgram(H);A=H;w=x.getAttribLocation(A,"position");u=x.getAttribLocation(A,"uv");c=x.getUniformLocation(A,"uvOffset");d=x.getUniformLocation(A,"uvScale");e=x.getUniformLocation(A,"rotation");g=x.getUniformLocation(A,"scale");f=x.getUniformLocation(A,"color");h=x.getUniformLocation(A,"map");k=x.getUniformLocation(A,"opacity");l=x.getUniformLocation(A,"modelViewMatrix");n=x.getUniformLocation(A,"projectionMatrix");p=
-x.getUniformLocation(A,"fogType");m=x.getUniformLocation(A,"fogDensity");q=x.getUniformLocation(A,"fogNear");r=x.getUniformLocation(A,"fogFar");t=x.getUniformLocation(A,"fogColor");v=x.getUniformLocation(A,"alphaTest");H=document.createElement("canvas");H.width=8;H.height=8;M=H.getContext("2d");M.fillStyle="white";M.fillRect(0,0,8,8);G=new THREE.Texture(H);G.needsUpdate=!0}x.useProgram(A);I.initAttributes();I.enableAttribute(w);I.enableAttribute(u);I.disableUnusedAttributes();I.disable(x.CULL_FACE);
-I.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,E);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(u,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.uniformMatrix4fv(n,!1,K.projectionMatrix.elements);I.activeTexture(x.TEXTURE0);x.uniform1i(h,0);M=H=0;(F=N.fog)?(x.uniform3f(t,F.color.r,F.color.g,F.color.b),F instanceof THREE.Fog?(x.uniform1f(q,F.near),x.uniform1f(r,F.far),x.uniform1i(p,1),M=H=1):F instanceof THREE.FogExp2&&(x.uniform1f(m,F.density),x.uniform1i(p,2),M=H=2)):
-(x.uniform1i(p,0),M=H=0);for(var F=0,Q=b.length;F<Q;F++){var V=b[F];V.modelViewMatrix.multiplyMatrices(K.matrixWorldInverse,V.matrixWorld);V.z=-V.modelViewMatrix.elements[14]}b.sort(y);for(var S=[],F=0,Q=b.length;F<Q;F++){var V=b[F],R=V.material;x.uniform1f(v,R.alphaTest);x.uniformMatrix4fv(l,!1,V.modelViewMatrix.elements);V.matrixWorld.decompose(L,D,C);S[0]=C.x;S[1]=C.y;V=0;N.fog&&R.fog&&(V=M);H!==V&&(x.uniform1i(p,V),H=V);null!==R.map?(x.uniform2f(c,R.map.offset.x,R.map.offset.y),x.uniform2f(d,
-R.map.repeat.x,R.map.repeat.y)):(x.uniform2f(c,0,0),x.uniform2f(d,1,1));x.uniform1f(k,R.opacity);x.uniform3f(f,R.color.r,R.color.g,R.color.b);x.uniform1f(e,R.rotation);x.uniform2fv(g,S);I.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst);I.setDepthTest(R.depthTest);I.setDepthWrite(R.depthWrite);R.map&&R.map.image&&R.map.image.width?a.setTexture(R.map,0):a.setTexture(G,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}I.enable(x.CULL_FACE);a.resetGLState()}}};
+H=m.createProgram(),D=m.createShader(m.FRAGMENT_SHADER),P=m.createShader(m.VERTEX_SHADER),O="precision "+a.getPrecision()+" float;\n";m.shaderSource(D,O+F.fragmentShader);m.shaderSource(P,O+F.vertexShader);m.compileShader(D);m.compileShader(P);m.attachShader(H,D);m.attachShader(H,P);m.linkProgram(H);v=H;n=m.getAttribLocation(v,"position");p=m.getAttribLocation(v,"uv");c=m.getUniformLocation(v,"renderType");d=m.getUniformLocation(v,"map");e=m.getUniformLocation(v,"occlusionMap");g=m.getUniformLocation(v,
+"opacity");f=m.getUniformLocation(v,"color");h=m.getUniformLocation(v,"scale");k=m.getUniformLocation(v,"rotation");l=m.getUniformLocation(v,"screenPosition")}m.useProgram(v);q.initAttributes();q.enableAttribute(n);q.enableAttribute(p);q.disableUnusedAttributes();m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,r);m.vertexAttribPointer(n,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,t);q.disable(m.CULL_FACE);m.depthMask(!1);H=0;for(D=
+b.length;H<D;H++)if(F=16/B,M.set(F*A,F),P=b[H],x.set(P.matrixWorld.elements[12],P.matrixWorld.elements[13],P.matrixWorld.elements[14]),x.applyMatrix4(I.matrixWorldInverse),x.applyProjection(I.projectionMatrix),K.copy(x),y.x=K.x*G+G,y.y=K.y*J+J,w||0<y.x&&y.x<E&&0<y.y&&y.y<B){q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,null);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,u);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,y.x-8,y.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,M.x,M.y);m.uniform3f(l,
+K.x,K.y,K.z);q.disable(m.BLEND);q.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,z);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,y.x-8,y.y-8,16,16,0);m.uniform1i(c,1);q.disable(m.DEPTH_TEST);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,u);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);P.positionScreen.copy(K);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares();m.uniform1i(c,2);q.enable(m.BLEND);for(var O=
+0,V=P.lensFlares.length;O<V;O++){var Q=P.lensFlares[O];.001<Q.opacity&&.001<Q.scale&&(K.x=Q.x,K.y=Q.y,K.z=Q.z,F=Q.size*Q.scale/B,M.x=F*A,M.y=F,m.uniform3f(l,K.x,K.y,K.z),m.uniform2f(h,M.x,M.y),m.uniform1f(k,Q.rotation),m.uniform1f(g,Q.opacity),m.uniform3f(f,Q.color.r,Q.color.g,Q.color.b),q.setBlending(Q.blending,Q.blendEquation,Q.blendSrc,Q.blendDst),a.setTexture(Q.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}q.enable(m.CULL_FACE);q.enable(m.DEPTH_TEST);m.depthMask(!0);a.resetGLState()}}};
+THREE.SpritePlugin=function(a,b){var c,d,e,g,f,h,k,l,n,p,m,q,r,t,v,w,u;function z(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,I=a.state,E,B,A,G,J=new THREE.Vector3,F=new THREE.Quaternion,M=new THREE.Vector3;this.render=function(K,y){if(0!==b.length){if(void 0===A){var H=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),D=new Uint16Array([0,1,2,0,2,3]);E=x.createBuffer();B=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,E);x.bufferData(x.ARRAY_BUFFER,H,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,
+B);x.bufferData(x.ELEMENT_ARRAY_BUFFER,D,x.STATIC_DRAW);var H=x.createProgram(),D=x.createShader(x.VERTEX_SHADER),P=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(D,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
+x.shaderSource(P,["precision "+a.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
+x.compileShader(D);x.compileShader(P);x.attachShader(H,D);x.attachShader(H,P);x.linkProgram(H);A=H;w=x.getAttribLocation(A,"position");u=x.getAttribLocation(A,"uv");c=x.getUniformLocation(A,"uvOffset");d=x.getUniformLocation(A,"uvScale");e=x.getUniformLocation(A,"rotation");g=x.getUniformLocation(A,"scale");f=x.getUniformLocation(A,"color");h=x.getUniformLocation(A,"map");k=x.getUniformLocation(A,"opacity");l=x.getUniformLocation(A,"modelViewMatrix");n=x.getUniformLocation(A,"projectionMatrix");p=
+x.getUniformLocation(A,"fogType");m=x.getUniformLocation(A,"fogDensity");q=x.getUniformLocation(A,"fogNear");r=x.getUniformLocation(A,"fogFar");t=x.getUniformLocation(A,"fogColor");v=x.getUniformLocation(A,"alphaTest");H=document.createElement("canvas");H.width=8;H.height=8;D=H.getContext("2d");D.fillStyle="white";D.fillRect(0,0,8,8);G=new THREE.Texture(H);G.needsUpdate=!0}x.useProgram(A);I.initAttributes();I.enableAttribute(w);I.enableAttribute(u);I.disableUnusedAttributes();I.disable(x.CULL_FACE);
+I.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,E);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(u,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,B);x.uniformMatrix4fv(n,!1,y.projectionMatrix.elements);I.activeTexture(x.TEXTURE0);x.uniform1i(h,0);D=H=0;(P=K.fog)?(x.uniform3f(t,P.color.r,P.color.g,P.color.b),P instanceof THREE.Fog?(x.uniform1f(q,P.near),x.uniform1f(r,P.far),x.uniform1i(p,1),D=H=1):P instanceof THREE.FogExp2&&(x.uniform1f(m,P.density),x.uniform1i(p,2),D=H=2)):
+(x.uniform1i(p,0),D=H=0);for(var P=0,O=b.length;P<O;P++){var V=b[P];V.modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,V.matrixWorld);V.z=-V.modelViewMatrix.elements[14]}b.sort(z);for(var Q=[],P=0,O=b.length;P<O;P++){var V=b[P],R=V.material;x.uniform1f(v,R.alphaTest);x.uniformMatrix4fv(l,!1,V.modelViewMatrix.elements);V.matrixWorld.decompose(J,F,M);Q[0]=M.x;Q[1]=M.y;V=0;K.fog&&R.fog&&(V=D);H!==V&&(x.uniform1i(p,V),H=V);null!==R.map?(x.uniform2f(c,R.map.offset.x,R.map.offset.y),x.uniform2f(d,
+R.map.repeat.x,R.map.repeat.y)):(x.uniform2f(c,0,0),x.uniform2f(d,1,1));x.uniform1f(k,R.opacity);x.uniform3f(f,R.color.r,R.color.g,R.color.b);x.uniform1f(e,R.rotation);x.uniform2fv(g,Q);I.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst);I.setDepthTest(R.depthTest);I.setDepthWrite(R.depthWrite);R.map&&R.map.image&&R.map.image.width?a.setTexture(R.map,0):a.setTexture(G,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}I.enable(x.CULL_FACE);a.resetGLState()}}};
 THREE.GeometryUtils={merge:function(a,b,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry);a.merge(b,d,c)},center:function(a){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return a.center()}};
 THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var g=new THREE.Texture(void 0,b);e.load(a,function(a){g.image=a;g.needsUpdate=!0;c&&c(g)},void 0,function(a){d&&d(a)});g.sourceFile=a;return g},loadTextureCube:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var g=new THREE.CubeTexture([],b),f=0;b=function(b){e.load(a[b],function(a){g.images[b]=a;f+=1;6===f&&(g.needsUpdate=!0,c&&c(g))},void 0,
 d)};for(var h=0,k=a.length;h<k;++h)b(h);return g},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},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|=1;var d=a.width,e=a.height,g=document.createElement("canvas");
@@ -700,7 +700,7 @@ break;case "l":k=b[a++]*c+d;n=b[a++]*c;e.lineTo(k,n);break;case "q":k=b[a++]*c+d
 m,r,v,n)}return{offset:w.ha*c,path:e}}}};
 THREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",g=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(g=c.length;e<g;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
 (function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],k,l,n;if(0<b(a))for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var p=2*e;for(l=e-1;2<e;){if(0>=p--){console.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);n=l+1;e<=n&&(n=0);var m;a:{var q=m=void 0,r=void 0,t=void 0,
-v=void 0,w=void 0,u=void 0,y=void 0,x=void 0,q=a[f[k]].x,r=a[f[k]].y,t=a[f[l]].x,v=a[f[l]].y,w=a[f[n]].x,u=a[f[n]].y;if(1E-10>(t-q)*(u-r)-(v-r)*(w-q))m=!1;else{var I=void 0,E=void 0,z=void 0,A=void 0,G=void 0,L=void 0,D=void 0,C=void 0,N=void 0,K=void 0,N=C=D=x=y=void 0,I=w-t,E=u-v,z=q-w,A=r-u,G=t-q,L=v-r;for(m=0;m<e;m++)if(y=a[f[m]].x,x=a[f[m]].y,!(y===q&&x===r||y===t&&x===v||y===w&&x===u)&&(D=y-q,C=x-r,N=y-t,K=x-v,y-=w,x-=u,N=I*K-E*N,D=G*C-L*D,C=z*x-A*y,-1E-10<=N&&-1E-10<=C&&-1E-10<=D)){m=!1;break a}m=
+v=void 0,w=void 0,u=void 0,z=void 0,x=void 0,q=a[f[k]].x,r=a[f[k]].y,t=a[f[l]].x,v=a[f[l]].y,w=a[f[n]].x,u=a[f[n]].y;if(1E-10>(t-q)*(u-r)-(v-r)*(w-q))m=!1;else{var I=void 0,E=void 0,B=void 0,A=void 0,G=void 0,J=void 0,F=void 0,M=void 0,K=void 0,y=void 0,K=M=F=x=z=void 0,I=w-t,E=u-v,B=q-w,A=r-u,G=t-q,J=v-r;for(m=0;m<e;m++)if(z=a[f[m]].x,x=a[f[m]].y,!(z===q&&x===r||z===t&&x===v||z===w&&x===u)&&(F=z-q,M=x-r,K=z-t,y=x-v,z-=w,x-=u,K=I*y-E*K,F=G*M-J*F,M=B*x-A*z,-1E-10<=K&&-1E-10<=M&&-1E-10<=F)){m=!1;break a}m=
 !0}}if(m){g.push([a[f[k]],a[f[l]],a[f[n]]]);h.push([f[k],f[l],f[n]]);k=l;for(n=l+1;n<e;k++,n++)f[k]=f[n];e--;p=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);THREE.typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};"undefined"!==typeof self&&(self._typeface_js=THREE.typeface_js);
 THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.source.onended=this.onEnded.bind(this);this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain);this.autoplay=!1;this.startTime=0;this.playbackRate=1;this.isPlaying=!1};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Audio.prototype.constructor=THREE.Audio;THREE.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a;b.autoplay&&b.play()})};c.send();return this};
@@ -733,18 +733,18 @@ THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<
 THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,g,f,h,k,l,n,p,m,q,r,t;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];k=g[3];p=g[0];m=g[1];0<c.length?(f=c[c.length-1],q=f.x,r=f.y):(f=this.actions[d-
 1].args,q=f[f.length-2],r=f[f.length-1]);for(g=1;g<=a;g++)t=g/a,f=THREE.Shape.Utils.b2(t,q,p,h),t=THREE.Shape.Utils.b2(t,r,m,k),c.push(new THREE.Vector2(f,t));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];k=g[5];p=g[0];m=g[1];l=g[2];n=g[3];0<c.length?(f=c[c.length-1],q=f.x,r=f.y):(f=this.actions[d-1].args,q=f[f.length-2],r=f[f.length-1]);for(g=1;g<=a;g++)t=g/a,f=THREE.Shape.Utils.b3(t,q,p,l,h),t=THREE.Shape.Utils.b3(t,r,m,n,k),c.push(new THREE.Vector2(f,t));break;case THREE.PathActions.CSPLINE_THRU:f=
 this.actions[d-1].args;t=[new THREE.Vector2(f[f.length-2],f[f.length-1])];f=a*g[0].length;t=t.concat(g[0]);t=new THREE.SplineCurve(t);for(g=1;g<=f;g++)c.push(t.getPointAt(g/f));break;case THREE.PathActions.ARC:h=g[0];k=g[1];m=g[2];l=g[3];f=g[4];p=!!g[5];q=f-l;r=2*a;for(g=1;g<=r;g++)t=g/r,p||(t=1-t),t=l+t*q,f=h+m*Math.cos(t),t=k+m*Math.sin(t),c.push(new THREE.Vector2(f,t));break;case THREE.PathActions.ELLIPSE:h=g[0];k=g[1];m=g[2];n=g[3];l=g[4];f=g[5];p=!!g[6];var v=g[7];q=f-l;r=2*a;var w,u;0!==v&&
-(w=Math.cos(v),u=Math.sin(v));for(g=1;g<=r;g++){t=g/r;p||(t=1-t);t=l+t*q;f=h+m*Math.cos(t);t=k+n*Math.sin(t);if(0!==v){var y=f;f=(y-h)*w-(t-k)*u+h;t=(y-h)*u+(t-k)*w+k}c.push(new THREE.Vector2(f,t))}}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
+(w=Math.cos(v),u=Math.sin(v));for(g=1;g<=r;g++){t=g/r;p||(t=1-t);t=l+t*q;f=h+m*Math.cos(t);t=k+n*Math.sin(t);if(0!==v){var z=f;f=(z-h)*w-(t-k)*u+h;t=(z-h)*u+(t-k)*w+k}c.push(new THREE.Vector2(f,t))}}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
 THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new THREE.Shape;f.actions=e.actions;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,l=h.y-g.y;if(1E-10<Math.abs(l)){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.y<g.y||a.y>h.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&
 a.x<=h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;b<c;b++)d=a[b],e=d.args,d=d.action,d===THREE.PathActions.MOVE_TO&&0!==g.actions.length&&(f.push(g),g=new THREE.Path),g[d].apply(g,e);0!==g.actions.length&&f.push(g);return f}(this.actions);if(0===e.length)return[];if(!0===b)return c(e);var g,f,h,k=[];if(1===e.length)return f=e[0],h=new THREE.Shape,h.actions=f.actions,h.curves=f.curves,k.push(h),k;var l=!THREE.Shape.Utils.isClockWise(e[0].getPoints()),
 l=a?!l:l;h=[];var n=[],p=[],m=0,q;n[m]=void 0;p[m]=[];var r,t;r=0;for(t=e.length;r<t;r++)f=e[r],q=f.getPoints(),g=THREE.Shape.Utils.isClockWise(q),(g=a?!g:g)?(!l&&n[m]&&m++,n[m]={s:new THREE.Shape,p:q},n[m].s.actions=f.actions,n[m].s.curves=f.curves,l&&m++,p[m]=[]):p[m].push({h:f,p:q[0]});if(!n[0])return c(e);if(1<n.length){r=!1;t=[];f=0;for(e=n.length;f<e;f++)h[f]=[];f=0;for(e=n.length;f<e;f++)for(g=p[f],l=0;l<g.length;l++){m=g[l];q=!0;for(var v=0;v<n.length;v++)d(m.p,n[v].p)&&(f!==v&&t.push({froms:f,
 tos:v,hole:l}),q?(q=!1,h[v].push(m)):r=!0);q&&h[f].push(m)}0<t.length&&(r||(p=h))}r=0;for(t=n.length;r<t;r++)for(h=n[r].s,k.push(h),f=p[r],e=0,g=f.length;e<g;e++)h.holes.push(f[e].h);return k};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.constructor=THREE.Shape;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!==b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,n=a.x-d.x,p=a.y-d.y,z=h*k-g*l,A=h*n-g*p;if(1E-10<Math.abs(z)){if(0<z){if(0>A||A>z)return[];k=l*n-k*p;if(0>k||k>z)return[]}else{if(0<A||A<z)return[];k=l*n-k*p;if(0<k||k<z)return[]}if(0===k)return!f||0!==A&&A!==z?[a]:[];if(k===z)return!f||0!==A&&A!==z?[b]:[];if(0===
-A)return[d];if(A===z)return[e];f=k/z;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!==A||l*n!==k*p)return[];h=0===g&&0===h;k=0===k&&0===l;if(h&&k)return a.x!==d.x||a.y!==d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!==g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,z=d.x,l=e,d=e.x):(b=e,z=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,z=d.y,l=e,d=e.y):(b=e,z=e.y,l=d,d=d.y));return k<=z?a<z?[]:a===z?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:
-k===d?f?[]:[g]:a<=d?[g,h]:[g,l]}function e(a,b,c,d){var e=b.x-a.x,g=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var f=d.x-a.x;d=d.y-a.y;a=e*c-g*b;e=e*d-g*f;return 1E-10<Math.abs(a)?(b=f*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var g,f,h,k,l,n={};h=a.concat();g=0;for(f=b.length;g<f;g++)Array.prototype.push.apply(h,b[g]);g=0;for(f=h.length;g<f;g++)l=h[g].x+":"+h[g].y,void 0!==n[l]&&console.warn("THREE.Shape: Duplicate point",l),n[l]=g;g=function(a,b){function c(a,b){var d=h.length-1,g=a-1;0>g&&(g=d);var f=a+1;f>d&&(f=
-0);d=e(h[a],h[g],h[f],k[b]);if(!d)return!1;d=k.length-1;g=b-1;0>g&&(g=d);f=b+1;f>d&&(f=0);return(d=e(k[b],k[g],k[f],h[a]))?!0:!1}function g(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function f(a,c){var e,g,h,k;for(e=0;e<l.length;e++)for(g=b[l[e]],h=0;h<g.length;h++)if(k=h+1,k%=g.length,k=d(a,c,g[h],g[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],n,p,E,z,A,G=[],L,D,C,N=0;for(n=b.length;N<n;N++)l.push(N);L=0;for(var K=2*
-l.length;0<l.length;){K--;if(0>K){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(p=L;p<h.length;p++){E=h[p];n=-1;for(N=0;N<l.length;N++)if(z=l[N],A=E.x+":"+E.y+":"+z,void 0===G[A]){k=b[z];for(D=0;D<k.length;D++)if(z=k[D],c(p,D)&&!g(E,z)&&!f(E,z)){n=D;l.splice(N,1);L=h.slice(0,p+1);z=h.slice(p);D=k.slice(n);C=k.slice(0,n+1);h=L.concat(D).concat(C).concat(z);L=p;break}if(0<=n)break;G[A]=!0}if(0<=n)break}}return h}(a,b);var p=THREE.FontUtils.Triangulate(g,
+THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!==b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,g){var f=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,n=a.x-d.x,p=a.y-d.y,B=h*k-f*l,A=h*n-f*p;if(1E-10<Math.abs(B)){if(0<B){if(0>A||A>B)return[];k=l*n-k*p;if(0>k||k>B)return[]}else{if(0<A||A<B)return[];k=l*n-k*p;if(0<k||k<B)return[]}if(0===k)return!g||0!==A&&A!==B?[a]:[];if(k===B)return!g||0!==A&&A!==B?[b]:[];if(0===
+A)return[d];if(A===B)return[e];g=k/B;return[{x:a.x+g*f,y:a.y+g*h}]}if(0!==A||l*n!==k*p)return[];h=0===f&&0===h;k=0===k&&0===l;if(h&&k)return a.x!==d.x||a.y!==d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!==f?(a.x<b.x?(f=a,k=a.x,h=b,a=b.x):(f=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,B=d.x,l=e,d=e.x):(b=e,B=e.x,l=d,d=d.x)):(a.y<b.y?(f=a,k=a.y,h=b,a=b.y):(f=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,B=d.y,l=e,d=e.y):(b=e,B=e.y,l=d,d=d.y));return k<=B?a<B?[]:a===B?g?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:
+k===d?g?[]:[f]:a<=d?[f,h]:[f,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10<Math.abs(a)?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var g,f,h,k,l,n={};h=a.concat();g=0;for(f=b.length;g<f;g++)Array.prototype.push.apply(h,b[g]);g=0;for(f=h.length;g<f;g++)l=h[g].x+":"+h[g].y,void 0!==n[l]&&console.warn("THREE.Shape: Duplicate point",l),n[l]=g;g=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=
+0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],n,p,E,B,A,G=[],J,F,M,K=0;for(n=b.length;K<n;K++)l.push(K);J=0;for(var y=2*
+l.length;0<l.length;){y--;if(0>y){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(p=J;p<h.length;p++){E=h[p];n=-1;for(K=0;K<l.length;K++)if(B=l[K],A=E.x+":"+E.y+":"+B,void 0===G[A]){k=b[B];for(F=0;F<k.length;F++)if(B=k[F],c(p,F)&&!f(E,B)&&!g(E,B)){n=F;l.splice(K,1);J=h.slice(0,p+1);B=h.slice(p);F=k.slice(n);M=k.slice(0,n+1);h=J.concat(F).concat(M).concat(B);J=p;break}if(0<=n)break;G[A]=!0}if(0<=n)break}}return h}(a,b);var p=THREE.FontUtils.Triangulate(g,
 !1);g=0;for(f=p.length;g<f;g++)for(k=p[g],h=0;3>h;h++)l=k[h].x+":"+k[h].y,l=n[l],void 0!==l&&(k[h]=l);return p.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-
 a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};
 THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
@@ -763,9 +763,9 @@ THREE.CatmullRomCurve3=function(){function a(){}var b=new THREE.Vector3,c=new a,
 b*a};return THREE.Curve.create(function(a){this.points=a||[]},function(a){var f=this.points,h,k;k=f.length;2>k&&console.log("duh, you need at least 2 points");a*=k-1;h=Math.floor(a);a-=h;0===a&&h===k-1&&(h=k-2,a=1);var l,n,p;0===h?(b.subVectors(f[0],f[1]).add(f[0]),l=b):l=f[h-1];n=f[h];p=f[h+1];h+2<k?f=f[h+2]:(b.subVectors(f[k-1],f[k-2]).add(f[k-2]),f=b);if(void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25;k=Math.pow(l.distanceToSquared(n),m);
 h=Math.pow(n.distanceToSquared(p),m);m=Math.pow(p.distanceToSquared(f),m);1E-4>h&&(h=1);1E-4>k&&(k=h);1E-4>m&&(m=h);c.initNonuniformCatmullRom(l.x,n.x,p.x,f.x,k,h,m);d.initNonuniformCatmullRom(l.y,n.y,p.y,f.y,k,h,m);e.initNonuniformCatmullRom(l.z,n.z,p.z,f.z,k,h,m)}else"catmullrom"===this.type&&(k=void 0!==this.tension?this.tension:.5,c.initCatmullRom(l.x,n.x,p.x,f.x,k),d.initCatmullRom(l.y,n.y,p.y,f.y,k),e.initCatmullRom(l.z,n.z,p.z,f.z,k));return new THREE.Vector3(c.calc(a),d.calc(a),e.calc(a))})}();
 THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-0;var c=Math.floor(a);a-=c;var c=c+(0<c?0:(Math.floor(Math.abs(c)/b.length)+1)*b.length),d=b[(c-1)%b.length],e=b[c%b.length],g=b[(c+1)%b.length],b=b[(c+2)%b.length],c=new THREE.Vector3;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,g.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,g.y,b.y,a);c.z=THREE.Curve.Utils.interpolate(d.z,e.z,g.z,b.z,a);return c});
-THREE.BoxGeometry=function(a,b,c,d,e,g){function f(a,b,c,d,e,f,g,t){var v,w=h.widthSegments,u=h.heightSegments,y=e/2,x=f/2,I=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",u=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var E=w+1,z=u+1,A=e/w,G=f/u,L=new THREE.Vector3;L[v]=0<g?1:-1;for(e=0;e<z;e++)for(f=0;f<E;f++){var D=new THREE.Vector3;D[a]=(f*A-y)*c;D[b]=(e*G-x)*d;D[v]=g;h.vertices.push(D)}for(e=
-0;e<u;e++)for(f=0;f<w;f++)x=f+E*e,a=f+E*(e+1),b=f+1+E*(e+1),c=f+1+E*e,d=new THREE.Vector2(f/w,1-e/u),g=new THREE.Vector2(f/w,1-(e+1)/u),v=new THREE.Vector2((f+1)/w,1-(e+1)/u),y=new THREE.Vector2((f+1)/w,1-e/u),x=new THREE.Face3(x+I,a+I,c+I),x.normal.copy(L),x.vertexNormals.push(L.clone(),L.clone(),L.clone()),x.materialIndex=t,h.faces.push(x),h.faceVertexUvs[0].push([d,g,y]),x=new THREE.Face3(a+I,b+I,c+I),x.normal.copy(L),x.vertexNormals.push(L.clone(),L.clone(),L.clone()),x.materialIndex=t,h.faces.push(x),
-h.faceVertexUvs[0].push([g.clone(),v,y.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:g};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=g||1;var h=this;d=a/2;e=b/2;g=c/2;f("z","y",-1,-1,c,b,d,0);f("z","y",1,-1,c,b,-d,1);f("x","z",1,1,a,c,e,2);f("x","z",1,-1,a,c,-e,3);f("x","y",1,-1,a,b,g,4);f("x","y",-1,-1,a,b,-g,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.BoxGeometry=function(a,b,c,d,e,g){function f(a,b,c,d,e,f,g,t){var v,w=h.widthSegments,u=h.heightSegments,z=e/2,x=f/2,I=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",u=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var E=w+1,B=u+1,A=e/w,G=f/u,J=new THREE.Vector3;J[v]=0<g?1:-1;for(e=0;e<B;e++)for(f=0;f<E;f++){var F=new THREE.Vector3;F[a]=(f*A-z)*c;F[b]=(e*G-x)*d;F[v]=g;h.vertices.push(F)}for(e=
+0;e<u;e++)for(f=0;f<w;f++)x=f+E*e,a=f+E*(e+1),b=f+1+E*(e+1),c=f+1+E*e,d=new THREE.Vector2(f/w,1-e/u),g=new THREE.Vector2(f/w,1-(e+1)/u),v=new THREE.Vector2((f+1)/w,1-(e+1)/u),z=new THREE.Vector2((f+1)/w,1-e/u),x=new THREE.Face3(x+I,a+I,c+I),x.normal.copy(J),x.vertexNormals.push(J.clone(),J.clone(),J.clone()),x.materialIndex=t,h.faces.push(x),h.faceVertexUvs[0].push([d,g,z]),x=new THREE.Face3(a+I,b+I,c+I),x.normal.copy(J),x.vertexNormals.push(J.clone(),J.clone(),J.clone()),x.materialIndex=t,h.faces.push(x),
+h.faceVertexUvs[0].push([g.clone(),v,z.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:g};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=g||1;var h=this;d=a/2;e=b/2;g=c/2;f("z","y",-1,-1,c,b,d,0);f("z","y",1,-1,c,b,-d,1);f("x","z",1,1,a,c,e,2);f("x","z",1,-1,a,c,-e,3);f("x","y",1,-1,a,b,g,4);f("x","y",-1,-1,a,b,-g,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry;THREE.BoxGeometry.prototype.clone=function(){return new THREE.BoxGeometry(this.parameters.width,this.parameters.height,this.parameters.depth,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.depthSegments)};THREE.CubeGeometry=THREE.BoxGeometry;
 THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e,g=[];e=new THREE.Vector3;var f=new THREE.Vector2(.5,.5);this.vertices.push(e);g.push(f);for(e=0;e<=b;e++){var h=new THREE.Vector3,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);g.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,
 0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([g[e].clone(),g[e+1].clone(),f.clone()]);this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry;
@@ -775,20 +775,20 @@ THREE.CircleBufferGeometry=function(a,b,c,d){THREE.BufferGeometry.call(this);thi
 THREE.CircleBufferGeometry.prototype.clone=function(){var a=new THREE.CircleBufferGeometry(this.parameters.radius,this.parameters.segments,this.parameters.thetaStart,this.parameters.thetaLength);a.copy(this);return a};
 THREE.CylinderGeometry=function(a,b,c,d,e,g,f,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:g,thetaStart:f,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;g=void 0!==g?g:!1;f=void 0!==f?f:0;h=void 0!==h?h:2*Math.PI;var k=c/2,l,n,p=[],m=[];for(n=0;n<=e;n++){var q=[],r=[],t=n/e,v=t*(b-a)+a;for(l=0;l<=d;l++){var w=l/d,u=new THREE.Vector3;u.x=v*Math.sin(w*h+
 f);u.y=-t*c+k;u.z=v*Math.cos(w*h+f);this.vertices.push(u);q.push(this.vertices.length-1);r.push(new THREE.Vector2(w,1-t))}p.push(q);m.push(r)}c=(b-a)/c;for(l=0;l<d;l++)for(0!==a?(f=this.vertices[p[0][l]].clone(),h=this.vertices[p[0][l+1]].clone()):(f=this.vertices[p[1][l]].clone(),h=this.vertices[p[1][l+1]].clone()),f.setY(Math.sqrt(f.x*f.x+f.z*f.z)*c).normalize(),h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize(),n=0;n<e;n++){var q=p[n][l],r=p[n+1][l],t=p[n+1][l+1],v=p[n][l+1],w=f.clone(),u=f.clone(),
-y=h.clone(),x=h.clone(),I=m[n][l].clone(),E=m[n+1][l].clone(),z=m[n+1][l+1].clone(),A=m[n][l+1].clone();this.faces.push(new THREE.Face3(q,r,v,[w,u,x]));this.faceVertexUvs[0].push([I,E,A]);this.faces.push(new THREE.Face3(r,t,v,[u.clone(),y,x.clone()]));this.faceVertexUvs[0].push([E.clone(),z,A.clone()])}if(!1===g&&0<a)for(this.vertices.push(new THREE.Vector3(0,k,0)),l=0;l<d;l++)q=p[0][l],r=p[0][l+1],t=this.vertices.length-1,w=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,
-1,0),I=m[0][l].clone(),E=m[0][l+1].clone(),z=new THREE.Vector2(E.x,0),this.faces.push(new THREE.Face3(q,r,t,[w,u,y],void 0,1)),this.faceVertexUvs[0].push([I,E,z]);if(!1===g&&0<b)for(this.vertices.push(new THREE.Vector3(0,-k,0)),l=0;l<d;l++)q=p[e][l+1],r=p[e][l],t=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),I=m[e][l+1].clone(),E=m[e][l].clone(),z=new THREE.Vector2(E.x,1),this.faces.push(new THREE.Face3(q,r,t,[w,u,y],void 0,2)),this.faceVertexUvs[0].push([I,
-E,z]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.CylinderGeometry.prototype.clone=function(){return new THREE.CylinderGeometry(this.parameters.radiusTop,this.parameters.radiusBottom,this.parameters.height,this.parameters.radialSegments,this.parameters.heightSegments,this.parameters.openEnded,this.parameters.thetaStart,this.parameters.thetaLength)};
+z=h.clone(),x=h.clone(),I=m[n][l].clone(),E=m[n+1][l].clone(),B=m[n+1][l+1].clone(),A=m[n][l+1].clone();this.faces.push(new THREE.Face3(q,r,v,[w,u,x]));this.faceVertexUvs[0].push([I,E,A]);this.faces.push(new THREE.Face3(r,t,v,[u.clone(),z,x.clone()]));this.faceVertexUvs[0].push([E.clone(),B,A.clone()])}if(!1===g&&0<a)for(this.vertices.push(new THREE.Vector3(0,k,0)),l=0;l<d;l++)q=p[0][l],r=p[0][l+1],t=this.vertices.length-1,w=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,
+1,0),I=m[0][l].clone(),E=m[0][l+1].clone(),B=new THREE.Vector2(E.x,0),this.faces.push(new THREE.Face3(q,r,t,[w,u,z],void 0,1)),this.faceVertexUvs[0].push([I,E,B]);if(!1===g&&0<b)for(this.vertices.push(new THREE.Vector3(0,-k,0)),l=0;l<d;l++)q=p[e][l+1],r=p[e][l],t=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),I=m[e][l+1].clone(),E=m[e][l].clone(),B=new THREE.Vector2(E.x,1),this.faces.push(new THREE.Face3(q,r,t,[w,u,z],void 0,2)),this.faceVertexUvs[0].push([I,
+E,B]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.CylinderGeometry.prototype.clone=function(){return new THREE.CylinderGeometry(this.parameters.radiusTop,this.parameters.radiusBottom,this.parameters.height,this.parameters.radialSegments,this.parameters.heightSegments,this.parameters.openEnded,this.parameters.thetaStart,this.parameters.thetaLength)};
 THREE.EdgesGeometry=function(a,b){THREE.BufferGeometry.call(this);var c=Math.cos(THREE.Math.degToRad(void 0!==b?b:1)),d=[0,0],e={},g=function(a,b){return a-b},f=["a","b","c"],h;a instanceof THREE.BufferGeometry?(h=new THREE.Geometry,h.fromBufferGeometry(a)):h=a.clone();h.mergeVertices();h.computeFaceNormals();var k=h.vertices;h=h.faces;for(var l=0,n=h.length;l<n;l++)for(var p=h[l],m=0;3>m;m++){d[0]=p[f[m]];d[1]=p[f[(m+1)%3]];d.sort(g);var q=d.toString();void 0===e[q]?e[q]={vert1:d[0],vert2:d[1],face1:l,
 face2:void 0}:e[q].face2=l}d=[];for(q in e)if(g=e[q],void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=c)f=k[g.vert1],d.push(f.x),d.push(f.y),d.push(f.z),f=k[g.vert2],d.push(f.x),d.push(f.y),d.push(f.z);this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(d),3))};THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry;
 THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(1E-10<Math.abs(d*g-e*f)){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10<d?1E-10<f&&(a=
-!0):-1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(B=a.length;0<=--B;){c=B;d=B-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*n,e=0;e<f;e++){var g=V*e,h=V*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+L,g=g+L,l=l+L,h=h+L;G.faces.push(new THREE.Face3(k,g,h));G.faces.push(new THREE.Face3(g,l,h));k=w.generateSideWallUV(G,k,g,l,h);G.faceVertexUvs[0].push([k[0],k[1],k[3]]);G.faceVertexUvs[0].push([k[1],
-k[2],k[3]])}}}function g(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function f(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,b,c));a=w.generateTopUV(G,a,b,c);G.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,r=b.extrudePath,
-t,v=!1,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,u,y,x,I;r&&(t=r.getSpacedPoints(q),v=!0,p=!1,u=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,q,!1),y=new THREE.Vector3,x=new THREE.Vector3,I=new THREE.Vector3);p||(l=k=n=0);var E,z,A,G=this,L=this.vertices.length,r=a.extractPoints(m),m=r.shape,D=r.holes;if(r=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();z=0;for(A=D.length;z<A;z++)E=D[z],THREE.Shape.Utils.isClockWise(E)&&(D[z]=E.reverse());r=
-!1}var C=THREE.Shape.Utils.triangulateShape(m,D),N=m;z=0;for(A=D.length;z<A;z++)E=D[z],m=m.concat(E);var K,H,M,F,Q,V=m.length,S,R=C.length,r=[],B=0;M=N.length;K=M-1;for(H=B+1;B<M;B++,K++,H++)K===M&&(K=0),H===M&&(H=0),r[B]=d(N[B],N[K],N[H]);var fa=[],ba,la=r.concat();z=0;for(A=D.length;z<A;z++){E=D[z];ba=[];B=0;M=E.length;K=M-1;for(H=B+1;B<M;B++,K++,H++)K===M&&(K=0),H===M&&(H=0),ba[B]=d(E[B],E[K],E[H]);fa.push(ba);la=la.concat(ba)}for(K=0;K<n;K++){M=K/n;F=k*(1-M);H=l*Math.sin(M*Math.PI/2);B=0;for(M=
-N.length;B<M;B++)Q=c(N[B],r[B],H),g(Q.x,Q.y,-F);z=0;for(A=D.length;z<A;z++)for(E=D[z],ba=fa[z],B=0,M=E.length;B<M;B++)Q=c(E[B],ba[B],H),g(Q.x,Q.y,-F)}H=l;for(B=0;B<V;B++)Q=p?c(m[B],la[B],H):m[B],v?(x.copy(u.normals[0]).multiplyScalar(Q.x),y.copy(u.binormals[0]).multiplyScalar(Q.y),I.copy(t[0]).add(x).add(y),g(I.x,I.y,I.z)):g(Q.x,Q.y,0);for(M=1;M<=q;M++)for(B=0;B<V;B++)Q=p?c(m[B],la[B],H):m[B],v?(x.copy(u.normals[M]).multiplyScalar(Q.x),y.copy(u.binormals[M]).multiplyScalar(Q.y),I.copy(t[M]).add(x).add(y),
-g(I.x,I.y,I.z)):g(Q.x,Q.y,h/q*M);for(K=n-1;0<=K;K--){M=K/n;F=k*(1-M);H=l*Math.sin(M*Math.PI/2);B=0;for(M=N.length;B<M;B++)Q=c(N[B],r[B],H),g(Q.x,Q.y,h+F);z=0;for(A=D.length;z<A;z++)for(E=D[z],ba=fa[z],B=0,M=E.length;B<M;B++)Q=c(E[B],ba[B],H),v?g(Q.x,Q.y+t[q-1].y,t[q-1].x+F):g(Q.x,Q.y,h+F)}(function(){if(p){var a;a=0*V;for(B=0;B<R;B++)S=C[B],f(S[2]+a,S[1]+a,S[0]+a);a=q+2*n;a*=V;for(B=0;B<R;B++)S=C[B],f(S[0]+a,S[1]+a,S[2]+a)}else{for(B=0;B<R;B++)S=C[B],f(S[2],S[1],S[0]);for(B=0;B<R;B++)S=C[B],f(S[0]+
-V*q,S[1]+V*q,S[2]+V*q)}})();(function(){var a=0;e(N,a);a+=N.length;z=0;for(A=D.length;z<A;z++)E=D[z],e(E,a),a+=E.length})()};
+!0):-1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(C=a.length;0<=--C;){c=C;d=C-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*n,e=0;e<f;e++){var g=V*e,h=V*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+J,g=g+J,l=l+J,h=h+J;G.faces.push(new THREE.Face3(k,g,h));G.faces.push(new THREE.Face3(g,l,h));k=w.generateSideWallUV(G,k,g,l,h);G.faceVertexUvs[0].push([k[0],k[1],k[3]]);G.faceVertexUvs[0].push([k[1],
+k[2],k[3]])}}}function g(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function f(a,b,c){a+=J;b+=J;c+=J;G.faces.push(new THREE.Face3(a,b,c));a=w.generateTopUV(G,a,b,c);G.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,r=b.extrudePath,
+t,v=!1,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,u,z,x,I;r&&(t=r.getSpacedPoints(q),v=!0,p=!1,u=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,q,!1),z=new THREE.Vector3,x=new THREE.Vector3,I=new THREE.Vector3);p||(l=k=n=0);var E,B,A,G=this,J=this.vertices.length,r=a.extractPoints(m),m=r.shape,F=r.holes;if(r=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();B=0;for(A=F.length;B<A;B++)E=F[B],THREE.Shape.Utils.isClockWise(E)&&(F[B]=E.reverse());r=
+!1}var M=THREE.Shape.Utils.triangulateShape(m,F),K=m;B=0;for(A=F.length;B<A;B++)E=F[B],m=m.concat(E);var y,H,D,P,O,V=m.length,Q,R=M.length,r=[],C=0;D=K.length;y=D-1;for(H=C+1;C<D;C++,y++,H++)y===D&&(y=0),H===D&&(H=0),r[C]=d(K[C],K[y],K[H]);var fa=[],ba,ma=r.concat();B=0;for(A=F.length;B<A;B++){E=F[B];ba=[];C=0;D=E.length;y=D-1;for(H=C+1;C<D;C++,y++,H++)y===D&&(y=0),H===D&&(H=0),ba[C]=d(E[C],E[y],E[H]);fa.push(ba);ma=ma.concat(ba)}for(y=0;y<n;y++){D=y/n;P=k*(1-D);H=l*Math.sin(D*Math.PI/2);C=0;for(D=
+K.length;C<D;C++)O=c(K[C],r[C],H),g(O.x,O.y,-P);B=0;for(A=F.length;B<A;B++)for(E=F[B],ba=fa[B],C=0,D=E.length;C<D;C++)O=c(E[C],ba[C],H),g(O.x,O.y,-P)}H=l;for(C=0;C<V;C++)O=p?c(m[C],ma[C],H):m[C],v?(x.copy(u.normals[0]).multiplyScalar(O.x),z.copy(u.binormals[0]).multiplyScalar(O.y),I.copy(t[0]).add(x).add(z),g(I.x,I.y,I.z)):g(O.x,O.y,0);for(D=1;D<=q;D++)for(C=0;C<V;C++)O=p?c(m[C],ma[C],H):m[C],v?(x.copy(u.normals[D]).multiplyScalar(O.x),z.copy(u.binormals[D]).multiplyScalar(O.y),I.copy(t[D]).add(x).add(z),
+g(I.x,I.y,I.z)):g(O.x,O.y,h/q*D);for(y=n-1;0<=y;y--){D=y/n;P=k*(1-D);H=l*Math.sin(D*Math.PI/2);C=0;for(D=K.length;C<D;C++)O=c(K[C],r[C],H),g(O.x,O.y,h+P);B=0;for(A=F.length;B<A;B++)for(E=F[B],ba=fa[B],C=0,D=E.length;C<D;C++)O=c(E[C],ba[C],H),v?g(O.x,O.y+t[q-1].y,t[q-1].x+P):g(O.x,O.y,h+P)}(function(){if(p){var a;a=0*V;for(C=0;C<R;C++)Q=M[C],f(Q[2]+a,Q[1]+a,Q[0]+a);a=q+2*n;a*=V;for(C=0;C<R;C++)Q=M[C],f(Q[0]+a,Q[1]+a,Q[2]+a)}else{for(C=0;C<R;C++)Q=M[C],f(Q[2],Q[1],Q[0]);for(C=0;C<R;C++)Q=M[C],f(Q[0]+
+V*q,Q[1]+V*q,Q[2]+V*q)}})();(function(){var a=0;e(K,a);a+=K.length;B=0;for(A=F.length;B<A;B++)E=F[B],e(E,a),a+=E.length})()};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d){a=a.vertices;b=a[b];c=a[c];d=a[d];return[new THREE.Vector2(b.x,b.y),new THREE.Vector2(c.x,c.y),new THREE.Vector2(d.x,d.y)]},generateSideWallUV:function(a,b,c,d,e){a=a.vertices;b=a[b];c=a[c];d=a[d];e=a[e];return.01>Math.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y,
 1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===Array.isArray(a)&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
 THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,g,f,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,l=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse(),e=0,g=l.length;e<g;e++)f=l[e],THREE.Shape.Utils.isClockWise(f)&&(l[e]=f.reverse());var n=THREE.Shape.Utils.triangulateShape(k,l);e=0;for(g=l.length;e<g;e++)f=l[e],
@@ -806,7 +806,7 @@ THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingG
 THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:g,thetaLength:f};this.fromBufferGeometry(new THREE.SphereBufferGeometry(a,b,c,d,e,g,f))};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.SphereGeometry.prototype.clone=function(){return new THREE.SphereGeometry(this.parameters.radius,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.phiStart,this.parameters.phiLength,this.parameters.thetaStart,this.parameters.thetaLength)};
 THREE.SphereBufferGeometry=function(a,b,c,d,e,g,f){THREE.BufferGeometry.call(this);this.type="SphereBufferGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:g,thetaLength:f};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;g=void 0!==g?g:0;f=void 0!==f?f:Math.PI;for(var h=g+f,k=(b+1)*(c+1),l=new THREE.BufferAttribute(new Float32Array(3*k),3),n=new THREE.BufferAttribute(new Float32Array(3*
-k),3),k=new THREE.BufferAttribute(new Float32Array(2*k),2),p=0,m=[],q=new THREE.Vector3,r=0;r<=c;r++){for(var t=[],v=r/c,w=0;w<=b;w++){var u=w/b,y=-a*Math.cos(d+u*e)*Math.sin(g+v*f),x=a*Math.cos(g+v*f),I=a*Math.sin(d+u*e)*Math.sin(g+v*f);q.set(y,x,I).normalize();l.setXYZ(p,y,x,I);n.setXYZ(p,q.x,q.y,q.z);k.setXY(p,u,1-v);t.push(p);p++}m.push(t)}d=[];for(r=0;r<c;r++)for(w=0;w<b;w++)e=m[r][w+1],f=m[r][w],p=m[r+1][w],q=m[r+1][w+1],(0!==r||0<g)&&d.push(e,f,q),(r!==c-1||h<Math.PI)&&d.push(f,p,q);this.setIndex(new THREE.BufferAttribute(new Uint16Array(d),
+k),3),k=new THREE.BufferAttribute(new Float32Array(2*k),2),p=0,m=[],q=new THREE.Vector3,r=0;r<=c;r++){for(var t=[],v=r/c,w=0;w<=b;w++){var u=w/b,z=-a*Math.cos(d+u*e)*Math.sin(g+v*f),x=a*Math.cos(g+v*f),I=a*Math.sin(d+u*e)*Math.sin(g+v*f);q.set(z,x,I).normalize();l.setXYZ(p,z,x,I);n.setXYZ(p,q.x,q.y,q.z);k.setXY(p,u,1-v);t.push(p);p++}m.push(t)}d=[];for(r=0;r<c;r++)for(w=0;w<b;w++)e=m[r][w+1],f=m[r][w],p=m[r+1][w],q=m[r+1][w+1],(0!==r||0<g)&&d.push(e,f,q),(r!==c-1||h<Math.PI)&&d.push(f,p,q);this.setIndex(new THREE.BufferAttribute(new Uint16Array(d),
 1));this.addAttribute("position",l);this.addAttribute("normal",n);this.addAttribute("uv",k);this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.SphereBufferGeometry.prototype.constructor=THREE.SphereBufferGeometry;
 THREE.SphereBufferGeometry.prototype.clone=function(){var a=new THREE.SphereBufferGeometry(this.parameters.radius,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.phiStart,this.parameters.phiLength,this.parameters.thetaStart,this.parameters.thetaLength);a.copy(this);return a};
 THREE.TextGeometry=function(a,b){b=b||{};var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b);this.type="TextGeometry"};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;