Pārlūkot izejas kodu

Updated builds.

Mr.doob 10 gadi atpakaļ
vecāks
revīzija
d4f73ae81f
4 mainītis faili ar 255 papildinājumiem un 175 dzēšanām
  1. 104 24
      build/three.js
  2. 119 118
      build/three.min.js
  3. 1 2
      src/extras/audio/AudioListener.js
  4. 31 31
      src/objects/Line.js

+ 104 - 24
build/three.js

@@ -7594,33 +7594,24 @@ THREE.Object3D.prototype = {
 
 	getObjectById: function ( id, recursive ) {
 
-		if ( this.id === id ) return this;
+		return this.getObjectByProperty( 'id', id, recursive );
 
-		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
-
-			var child = this.children[ i ];
-			var object = child.getObjectById( id, recursive );
-
-			if ( object !== undefined ) {
-
-				return object;
-
-			}
+	},
 
-		}
+	getObjectByName: function ( name, recursive ) {
 
-		return undefined;
+		return this.getObjectByProperty( 'name', name, recursive );
 
 	},
 
-	getObjectByName: function ( name, recursive ) {
+	getObjectByProperty: function ( name, value, recursive ) {
 
-		if ( this.name === name ) return this;
+		if ( this[ name ] === value ) return this;
 
 		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
 
 			var child = this.children[ i ];
-			var object = child.getObjectByName( name, recursive );
+			var object = child.getObjectByProperty( name, value, recursive );
 
 			if ( object !== undefined ) {
 
@@ -14757,17 +14748,105 @@ THREE.Line.prototype.raycast = ( function () {
 		inverseMatrix.getInverse( this.matrixWorld );
 		ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
 
-		/* if ( geometry instanceof THREE.BufferGeometry ) {
+		var vStart = new THREE.Vector3();
+		var vEnd = new THREE.Vector3();
+		var interSegment = new THREE.Vector3();
+		var interRay = new THREE.Vector3();
+		var step = this.mode === THREE.LineStrip ? 1 : 2;
+
+		if ( geometry instanceof THREE.BufferGeometry ) {
+
+			var attributes = geometry.attributes;
+
+			if ( attributes.index !== undefined ) {
+
+				var indices = attributes.index.array;
+				var positions = attributes.position.array;
+				var offsets = geometry.offsets;
+
+				if ( offsets.length === 0 ) {
+
+					offsets = [ { start: 0, count: indices.length, index: 0 } ];
+
+				}
+
+				for ( var oi = 0; oi < offsets.length; oi++){
+
+					var start = offsets[ oi ].start;
+					var count = offsets[ oi ].count;
+					var index = offsets[ oi ].index;
+
+					for ( var i = start; i < start + count - 1; i += step ) {
+
+						var a = index + indices[ i ];
+						var b = index + indices[ i + 1 ];
+
+						vStart.fromArray( positions, a * 3 );
+						vEnd.fromArray( positions, b * 3 );
+
+						var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 
-		} else */ if ( geometry instanceof THREE.Geometry ) {
+						if ( distSq > precisionSq ) continue;
+
+						var distance = ray.origin.distanceTo( interRay );
+
+						if ( distance < raycaster.near || distance > raycaster.far ) continue;
+
+						intersects.push( {
+
+							distance: distance,
+							// What do we want? intersection point on the ray or on the segment??
+							// point: raycaster.ray.at( distance ),
+							point: interSegment.clone().applyMatrix4( this.matrixWorld ),
+							face: null,
+							faceIndex: null,
+							object: this
+
+						} );
+
+					}
+
+				}
+
+			} else {
+
+				var positions = attributes.position.array;
+
+				for ( var i = 0; i < positions.length / 3 - 1; i += step ) {
+
+					vStart.fromArray( positions, 3 * i );
+					vEnd.fromArray( positions, 3 * i + 3 );
+
+					var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
+
+					if ( distSq > precisionSq ) continue;
+
+					var distance = ray.origin.distanceTo( interRay );
+
+					if ( distance < raycaster.near || distance > raycaster.far ) continue;
+
+					intersects.push( {
+
+						distance: distance,
+						// What do we want? intersection point on the ray or on the segment??
+						// point: raycaster.ray.at( distance ),
+						point: interSegment.clone().applyMatrix4( this.matrixWorld ),
+						face: null,
+						faceIndex: null,
+						object: this
+
+					} );
+
+				}
+
+			}
+
+		} else if ( geometry instanceof THREE.Geometry ) {
 
 			var vertices = geometry.vertices;
 			var nbVertices = vertices.length;
-			var interSegment = new THREE.Vector3();
-			var interRay = new THREE.Vector3();
-			var step = this.mode === THREE.LineStrip ? 1 : 2;
 
-			for ( var i = 0; i < nbVertices - 1; i = i + step ) {
+			for ( var i = 0; i < nbVertices - 1; i += step ) {
 
 				var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );
 
@@ -27132,14 +27211,15 @@ THREE.AudioListener.prototype.updateMatrixWorld = ( function () {
 		THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
 
 		var listener = this.context.listener;
-
+		var up = this.up;
+		
 		this.matrixWorld.decompose( position, quaternion, scale );
 
 		orientation.set( 0, 0, -1 ).applyQuaternion( quaternion );
 		velocity.subVectors( position, positionPrev );
 
 		listener.setPosition( position.x, position.y, position.z );
-		listener.setOrientation( orientation.x, orientation.y, orientation.z, this.up.x, this.up.y, this.up.z );
+		listener.setOrientation( orientation.x, orientation.y, orientation.z, up.x, up.y, up.z );
 		listener.setVelocity( velocity.x, velocity.y, velocity.z );
 
 		positionPrev.copy( position );

+ 119 - 118
build/three.min.js

@@ -97,8 +97,8 @@ console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotati
 b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,n=d*h,p=d*e,b[0]=a-p*c,b[4]=-f*e,b[8]=n+k*c,b[1]=k+n*c,b[5]=f*h,b[9]=p-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,n=c*h,p=c*e,b[0]=g*h,b[4]=n*d-k,b[8]=a*d+p,b[1]=g*e,b[5]=p*d+a,b[9]=k*d-n,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,n=c*g,p=c*d,b[0]=g*h,b[4]=p-a*e,b[8]=n*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+n,b[10]=a-p*e):"XZY"===a.order&&(a=f*g,k=f*d,n=c*g,p=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+p,b[5]=f*h,b[9]=k*
 e-n,b[2]=n*e-k,b[6]=c*h,b[10]=p*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,f=a.w,g=c+c,h=d+d,k=e+e;a=c*g;var n=c*h,c=c*k,p=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(p+e);b[4]=n-f;b[8]=c+h;b[1]=n+f;b[5]=1-
 (a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+p);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=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[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,f=c[0],g=c[4],h=c[8],k=c[12],n=c[1],p=c[5],q=c[9],m=c[13],t=c[2],s=c[6],r=c[10],u=c[14],v=c[3],y=c[7],L=c[11],c=c[15],x=d[0],E=d[4],z=d[8],F=d[12],D=d[1],w=d[5],C=d[9],A=d[13],U=d[2],M=d[6],I=d[10],K=d[14],N=d[3],
-T=d[7],P=d[11],d=d[15];e[0]=f*x+g*D+h*U+k*N;e[4]=f*E+g*w+h*M+k*T;e[8]=f*z+g*C+h*I+k*P;e[12]=f*F+g*A+h*K+k*d;e[1]=n*x+p*D+q*U+m*N;e[5]=n*E+p*w+q*M+m*T;e[9]=n*z+p*C+q*I+m*P;e[13]=n*F+p*A+q*K+m*d;e[2]=t*x+s*D+r*U+u*N;e[6]=t*E+s*w+r*M+u*T;e[10]=t*z+s*C+r*I+u*P;e[14]=t*F+s*A+r*K+u*d;e[3]=v*x+y*D+L*U+c*N;e[7]=v*E+y*w+L*M+c*T;e[11]=v*z+y*C+L*I+c*P;e[15]=v*F+y*A+L*K+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]=
+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,f=c[0],g=c[4],h=c[8],k=c[12],n=c[1],p=c[5],q=c[9],m=c[13],t=c[2],s=c[6],r=c[10],u=c[14],v=c[3],y=c[7],H=c[11],c=c[15],x=d[0],E=d[4],z=d[8],F=d[12],D=d[1],w=d[5],C=d[9],A=d[13],U=d[2],M=d[6],J=d[10],L=d[14],N=d[3],
+T=d[7],P=d[11],d=d[15];e[0]=f*x+g*D+h*U+k*N;e[4]=f*E+g*w+h*M+k*T;e[8]=f*z+g*C+h*J+k*P;e[12]=f*F+g*A+h*L+k*d;e[1]=n*x+p*D+q*U+m*N;e[5]=n*E+p*w+q*M+m*T;e[9]=n*z+p*C+q*J+m*P;e[13]=n*F+p*A+q*L+m*d;e[2]=t*x+s*D+r*U+u*N;e[6]=t*E+s*w+r*M+u*T;e[10]=t*z+s*C+r*J+u*P;e[14]=t*F+s*A+r*L+u*d;e[3]=v*x+y*D+H*U+c*N;e[7]=v*E+y*w+H*M+c*T;e[11]=v*z+y*C+H*J+c*P;e[15]=v*F+y*A+H*L+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=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=
 b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix4(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=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=
@@ -160,7 +160,7 @@ c);this.quaternion.multiply(a);return this}}(),rotateX:function(){var a=new THRE
 return this}}(),translate:function(a,b){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(b,a)},translateX:function(){var a=new THREE.Vector3(1,0,0);return function(b){return this.translateOnAxis(a,b)}}(),translateY:function(){var a=new THREE.Vector3(0,1,0);return function(b){return this.translateOnAxis(a,b)}}(),translateZ:function(){var a=new THREE.Vector3(0,0,1);return function(b){return this.translateOnAxis(a,
 b)}}(),localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var a=new THREE.Matrix4;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}}(),lookAt:function(){var a=new THREE.Matrix4;return function(b){a.lookAt(b,this.position,this.up);this.quaternion.setFromRotationMatrix(a)}}(),add:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.add(arguments[b]);return this}if(a===this)return console.error("THREE.Object3D.add:",
 a,"can't be added as a child of itself."),this;a instanceof THREE.Object3D?(void 0!==a.parent&&a.parent.remove(a),a.parent=this,a.dispatchEvent({type:"added"}),this.children.push(a)):console.error("THREE.Object3D.add:",a,"is not an instance of THREE.Object3D.");return this},remove:function(a){if(1<arguments.length)for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);b=this.children.indexOf(a);-1!==b&&(a.parent=void 0,a.dispatchEvent({type:"removed"}),this.children.splice(b,1))},getChildByName:function(a,
-b){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a,b)},getObjectById:function(a,b){if(this.id===a)return this;for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c].getObjectById(a,b);if(void 0!==e)return e}},getObjectByName:function(a,b){if(this.name===a)return this;for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c].getObjectByName(a,b);if(void 0!==e)return e}},getWorldPosition:function(a){a=a||new THREE.Vector3;
+b){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a,b)},getObjectById:function(a,b){return this.getObjectByProperty("id",a,b)},getObjectByName:function(a,b){return this.getObjectByProperty("name",a,b)},getObjectByProperty:function(a,b,c){if(this[a]===b)return this;for(var d=0,e=this.children.length;d<e;d++){var f=this.children[d].getObjectByProperty(a,b,c);if(void 0!==f)return f}},getWorldPosition:function(a){a=a||new THREE.Vector3;
 this.updateMatrixWorld(!0);return a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){c=c||new THREE.Quaternion;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a,c,b);return c}}(),getWorldRotation:function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Euler;this.getWorldQuaternion(a);return b.setFromQuaternion(a,this.rotation.order,!1)}}(),getWorldScale:function(){var a=new THREE.Vector3,b=new THREE.Quaternion;
 return function(c){c=c||new THREE.Vector3;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a,b,c);return c}}(),getWorldDirection:function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,1).applyQuaternion(a)}}(),raycast:function(){},traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var b=0,c=this.children.length;b<
 c;b++)this.children[b].traverseVisible(a)}},traverseAncestors:function(a){this.parent&&(a(this.parent),this.parent.traverseAncestors(a))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),
@@ -188,10 +188,10 @@ b||0===b.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0);
 if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=
 this.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;d<e;d++)c[d]=0;var c=a.normal.array,f,g,h,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3;if(a.index)for(var t=a.index.array,s=0<this.offsets.length?this.offsets:[{start:0,count:t.length,index:0}],r=0,u=s.length;r<u;++r){e=s[r].start;f=s[r].count;
 for(var v=s[r].index,d=e,e=e+f;d<e;d+=3)f=3*(v+t[d]),g=3*(v+t[d+1]),h=3*(v+t[d+2]),k.fromArray(b,f),n.fromArray(b,g),p.fromArray(b,h),q.subVectors(p,n),m.subVectors(k,n),q.cross(m),c[f]+=q.x,c[f+1]+=q.y,c[f+2]+=q.z,c[g]+=q.x,c[g+1]+=q.y,c[g+2]+=q.z,c[h]+=q.x,c[h+1]+=q.y,c[h+2]+=q.z}else for(d=0,e=b.length;d<e;d+=9)k.fromArray(b,d),n.fromArray(b,d+3),p.fromArray(b,d+6),q.subVectors(p,n),m.subVectors(k,n),q.cross(m),c[d]=q.x,c[d+1]=q.y,c[d+2]=q.z,c[d+3]=q.x,c[d+4]=q.y,c[d+5]=q.z,c[d+6]=q.x,c[d+7]=q.y,
-c[d+8]=q.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){q.fromArray(d,3*a);m.fromArray(d,3*b);t.fromArray(d,3*c);s.fromArray(f,2*a);r.fromArray(f,2*b);u.fromArray(f,2*c);v=m.x-q.x;y=t.x-q.x;L=m.y-q.y;x=t.y-q.y;E=m.z-q.z;z=t.z-q.z;F=r.x-s.x;D=u.x-s.x;w=r.y-s.y;C=u.y-s.y;A=1/(F*C-D*w);U.set((C*v-w*y)*A,(C*L-w*x)*A,(C*E-w*z)*A);M.set((F*y-D*v)*A,(F*x-D*L)*A,(F*z-D*E)*A);k[a].add(U);k[b].add(U);k[c].add(U);n[a].add(M);n[b].add(M);n[c].add(M)}function b(a){Ba.fromArray(e,
+c[d+8]=q.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){q.fromArray(d,3*a);m.fromArray(d,3*b);t.fromArray(d,3*c);s.fromArray(f,2*a);r.fromArray(f,2*b);u.fromArray(f,2*c);v=m.x-q.x;y=t.x-q.x;H=m.y-q.y;x=t.y-q.y;E=m.z-q.z;z=t.z-q.z;F=r.x-s.x;D=u.x-s.x;w=r.y-s.y;C=u.y-s.y;A=1/(F*C-D*w);U.set((C*v-w*y)*A,(C*H-w*x)*A,(C*E-w*z)*A);M.set((F*y-D*v)*A,(F*x-D*H)*A,(F*z-D*E)*A);k[a].add(U);k[b].add(U);k[c].add(U);n[a].add(M);n[b].add(M);n[c].add(M)}function b(a){Ba.fromArray(e,
 3*a);G.copy(Ba);qa=k[a];pa.copy(qa);pa.sub(Ba.multiplyScalar(Ba.dot(qa))).normalize();ca.crossVectors(G,qa);La=ca.dot(n[a]);wa=0>La?-1:1;h[4*a]=pa.x;h[4*a+1]=pa.y;h[4*a+2]=pa.z;h[4*a+3]=wa}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,
-e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],n=[],p=0;p<g;p++)k[p]=new THREE.Vector3,n[p]=new THREE.Vector3;var q=new THREE.Vector3,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector2,r=new THREE.Vector2,u=new THREE.Vector2,v,y,L,x,E,z,F,D,w,C,A,U=new THREE.Vector3,M=new THREE.Vector3,I,K,N,T,P;0===this.drawcalls.length&&
-this.addDrawCall(0,c.length,0);var X=this.drawcalls,p=0;for(K=X.length;p<K;++p){I=X[p].start;N=X[p].count;var Q=X[p].index,g=I;for(I+=N;g<I;g+=3)N=Q+c[g],T=Q+c[g+1],P=Q+c[g+2],a(N,T,P)}var pa=new THREE.Vector3,ca=new THREE.Vector3,Ba=new THREE.Vector3,G=new THREE.Vector3,wa,qa,La,p=0;for(K=X.length;p<K;++p)for(I=X[p].start,N=X[p].count,Q=X[p].index,g=I,I+=N;g<I;g+=3)N=Q+c[g],T=Q+c[g+1],P=Q+c[g+2],b(N),b(T),b(P)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;
+e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],n=[],p=0;p<g;p++)k[p]=new THREE.Vector3,n[p]=new THREE.Vector3;var q=new THREE.Vector3,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector2,r=new THREE.Vector2,u=new THREE.Vector2,v,y,H,x,E,z,F,D,w,C,A,U=new THREE.Vector3,M=new THREE.Vector3,J,L,N,T,P;0===this.drawcalls.length&&
+this.addDrawCall(0,c.length,0);var X=this.drawcalls,p=0;for(L=X.length;p<L;++p){J=X[p].start;N=X[p].count;var Q=X[p].index,g=J;for(J+=N;g<J;g+=3)N=Q+c[g],T=Q+c[g+1],P=Q+c[g+2],a(N,T,P)}var pa=new THREE.Vector3,ca=new THREE.Vector3,Ba=new THREE.Vector3,G=new THREE.Vector3,wa,qa,La,p=0;for(L=X.length;p<L;++p)for(J=X[p].start,N=X[p].count,Q=X[p].index,g=J,J+=N;g<J;g+=3)N=Q+c[g],T=Q+c[g+1],P=Q+c[g+2],b(N),b(T),b(P)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;
 for(var c=this.attributes.position.array,d=a.length/3,e=new Uint16Array(a.length),f=0,g=0,h=[{start:0,count:0,index:0}],k=h[0],n=0,p=0,q=new Int32Array(6),m=new Int32Array(c.length),t=new Int32Array(c.length),s=0;s<c.length;s++)m[s]=-1,t[s]=-1;for(c=0;c<d;c++){for(var r=p=0;3>r;r++)s=a[3*c+r],-1==m[s]?(q[2*r]=s,q[2*r+1]=-1,p++):m[s]<k.index?(q[2*r]=s,q[2*r+1]=-1,n++):(q[2*r]=s,q[2*r+1]=m[s]);if(g+p>k.index+b)for(k={start:f,count:0,index:g},h.push(k),p=0;6>p;p+=2)r=q[p+1],-1<r&&r<k.index&&(q[p+1]=
 -1);for(p=0;6>p;p+=2)s=q[p],r=q[p+1],-1===r&&(r=g++),m[s]=r,t[r]=s,e[f++]=r-k.index,k.count++}this.reorderBuffers(e,t,g);return this.offsets=h},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,f=a.attributes[d],g=f.array,h=0,f=f.itemSize*b;h<g.length;h++,f++)e[f]=g[h];return this}},
 normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!=e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize*c));for(var f=0;f<c;f++){var g=b[f];for(e in this.attributes)if("index"!=e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,n=d[e],p=0;p<k;p++)n[f*k+p]=h[g*
@@ -207,16 +207,16 @@ g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){
 0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.vertexNormals[0]=d[c.a].clone(),c.vertexNormals[1]=d[c.b].clone(),c.vertexNormals[2]=d[c.c].clone()},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=
 e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var g=
 this.morphNormals[a].vertexNormals,h,k;c=0;for(d=this.faces.length;c<d;c++)h=new THREE.Vector3,k={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(h),g.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],k=g.vertexNormals[c],h.copy(e.normal),k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<
-d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,v=[],y=[];c=new THREE.Vector3;var L=new THREE.Vector3,x=new THREE.Vector3,E=new THREE.Vector3,z=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)v[a]=new THREE.Vector3,y[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,g=this.vertices[d],h=this.vertices[u],k=this.vertices[e],
-n=f[0],p=f[1],q=f[2],f=h.x-g.x,m=k.x-g.x,t=h.y-g.y,s=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=p.x-n.x,r=q.x-n.x,p=p.y-n.y,n=q.y-n.y,q=1/(k*n-r*p),c.set((n*f-p*m)*q,(n*t-p*s)*q,(n*h-p*g)*q),L.set((k*m-r*f)*q,(k*s-r*t)*q,(k*g-r*h)*q),v[d].add(c),v[u].add(c),v[e].add(c),y[d].add(L),y[u].add(L),y[e].add(L);L=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)z.copy(e.vertexNormals[c]),d=e[L[c]],u=v[d],x.copy(u),x.sub(z.multiplyScalar(z.dot(u))).normalize(),
+d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,v=[],y=[];c=new THREE.Vector3;var H=new THREE.Vector3,x=new THREE.Vector3,E=new THREE.Vector3,z=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)v[a]=new THREE.Vector3,y[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,g=this.vertices[d],h=this.vertices[u],k=this.vertices[e],
+n=f[0],p=f[1],q=f[2],f=h.x-g.x,m=k.x-g.x,t=h.y-g.y,s=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=p.x-n.x,r=q.x-n.x,p=p.y-n.y,n=q.y-n.y,q=1/(k*n-r*p),c.set((n*f-p*m)*q,(n*t-p*s)*q,(n*h-p*g)*q),H.set((k*m-r*f)*q,(k*s-r*t)*q,(k*g-r*h)*q),v[d].add(c),v[u].add(c),v[e].add(c),y[d].add(H),y[u].add(H),y[e].add(H);H=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)z.copy(e.vertexNormals[c]),d=e[H[c]],u=v[d],x.copy(u),x.sub(z.multiplyScalar(z.dot(u))).normalize(),
 E.crossVectors(e.vertexNormals[c],u),d=E.dot(y[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(x.x,x.y,x.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
 this.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(!1===a instanceof THREE.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",a);else{var d,e=this.vertices.length,f=this.vertices,g=a.vertices,h=this.faces,k=a.faces,n=this.faceVertexUvs[0];a=a.faceVertexUvs[0];void 0===c&&(c=0);void 0!==b&&(d=(new THREE.Matrix3).getNormalMatrix(b));for(var p=0,q=g.length;p<q;p++){var m=g[p].clone();void 0!==b&&m.applyMatrix4(b);f.push(m)}p=0;for(q=k.length;p<
 q;p++){var g=k[p],t,s=g.vertexNormals,r=g.vertexColors,m=new THREE.Face3(g.a+e,g.b+e,g.c+e);m.normal.copy(g.normal);void 0!==d&&m.normal.applyMatrix3(d).normalize();b=0;for(f=s.length;b<f;b++)t=s[b].clone(),void 0!==d&&t.applyMatrix3(d).normalize(),m.vertexNormals.push(t);m.color.copy(g.color);b=0;for(f=r.length;b<f;b++)t=r[b],m.vertexColors.push(t.clone());m.materialIndex=g.materialIndex+c;h.push(m)}p=0;for(q=a.length;p<q;p++)if(c=a[p],d=[],void 0!==c){b=0;for(f=c.length;b<f;b++)d.push(c[b].clone());
 n.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),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<
 g;f++)for(e=this.faces[f],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(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},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!==n[b])return n[b];n[b]=k.length/3;k.push(a.x,a.y,
 a.z);return n[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();if(void 0!==q[b])return q[b];q[b]=p.length;p.push(a.getHex());return q[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==t[b])return t[b];t[b]=m.length/2;m.push(a.x,a.y);return t[b]}var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var f=this.parameters,g;for(g in f)void 0!==
-f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],k=[],n={},p=[],q={},m=[],t={};for(g=0;g<this.faces.length;g++){var s=this.faces[g],r=void 0!==this.faceVertexUvs[0][g],u=0<s.normal.length(),v=0<s.vertexNormals.length,y=1!==s.color.r||1!==s.color.g||1!==s.color.b,L=0<s.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!1),x=a(x,2,!1),x=a(x,3,r),x=a(x,4,u),x=a(x,5,v),x=a(x,6,y),x=a(x,7,L);h.push(x);h.push(s.a,s.b,s.c);r&&(r=this.faceVertexUvs[0][g],
-h.push(d(r[0]),d(r[1]),d(r[2])));u&&h.push(b(s.normal));v&&(u=s.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));y&&h.push(c(s.color));L&&(s=s.vertexColors,h.push(c(s[0]),c(s[1]),c(s[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<p.length&&(e.data.colors=p);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());c=0;
+f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],k=[],n={},p=[],q={},m=[],t={};for(g=0;g<this.faces.length;g++){var s=this.faces[g],r=void 0!==this.faceVertexUvs[0][g],u=0<s.normal.length(),v=0<s.vertexNormals.length,y=1!==s.color.r||1!==s.color.g||1!==s.color.b,H=0<s.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!1),x=a(x,2,!1),x=a(x,3,r),x=a(x,4,u),x=a(x,5,v),x=a(x,6,y),x=a(x,7,H);h.push(x);h.push(s.a,s.b,s.c);r&&(r=this.faceVertexUvs[0][g],
+h.push(d(r[0]),d(r[1]),d(r[2])));u&&h.push(b(s.normal));v&&(u=s.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));y&&h.push(c(s.color));H&&(s=s.vertexColors,h.push(c(s[0]),c(s[1]),c(s[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<p.length&&(e.data.colors=p);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());c=0;
 for(d=this.faceVertexUvs.length;c<d;c++){b=this.faceVertexUvs[c];void 0===a.faceVertexUvs[c]&&(a.faceVertexUvs[c]=[]);for(var e=0,f=b.length;e<f;e++){for(var g=b[e],h=[],k=0,n=g.length;k<n;k++)h.push(g[k].clone());a.faceVertexUvs[c].push(h)}}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;
 THREE.Camera=function(){THREE.Object3D.call(this);this.type="Camera";this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.getWorldDirection=function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,-1).applyQuaternion(a)}}();
 THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a};
@@ -260,10 +260,10 @@ THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d
 a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);if(void 0!==h.metadata&&"scene"===h.metadata.type){console.error('THREE.JSONLoader: "'+b+'" seems to be a Scene. Use THREE.SceneLoader instead.');return}h=a.parse(h,d);c(h.geometry,h.materials)}else console.error('THREE.JSONLoader: "'+b+'" seems to be unreachable or the file is empty.');
 a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load \""+b+'" ('+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,n,p,q,m,t,s,r,u,v,y=a.faces;p=a.vertices;var L=a.normals,x=a.colors,E=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&E++;for(d=0;d<E;d++)c.faceVertexUvs[d]=[]}k=0;for(n=p.length;k<n;)d=new THREE.Vector3,d.x=p[k++]*b,d.y=p[k++]*b,d.z=p[k++]*b,c.vertices.push(d);k=0;for(n=y.length;k<n;)if(b=y[k++],t=b&1,h=b&2,d=b&8,q=b&16,s=b&32,p=b&64,b&=128,t){t=new THREE.Face3;
-t.a=y[k];t.b=y[k+1];t.c=y[k+3];r=new THREE.Face3;r.a=y[k+1];r.b=y[k+2];r.c=y[k+3];k+=4;h&&(h=y[k++],t.materialIndex=h,r.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)m=y[k++],v=u[2*m],m=u[2*m+1],v=new THREE.Vector2(v,m),2!==g&&c.faceVertexUvs[d][h].push(v),0!==g&&c.faceVertexUvs[d][h+1].push(v);q&&(q=3*y[k++],t.normal.set(L[q++],L[q++],L[q]),r.normal.copy(t.normal));if(s)for(d=0;4>d;d++)q=3*y[k++],s=new THREE.Vector3(L[q++],
-L[q++],L[q]),2!==d&&t.vertexNormals.push(s),0!==d&&r.vertexNormals.push(s);p&&(p=y[k++],p=x[p],t.color.setHex(p),r.color.setHex(p));if(b)for(d=0;4>d;d++)p=y[k++],p=x[p],2!==d&&t.vertexColors.push(new THREE.Color(p)),0!==d&&r.vertexColors.push(new THREE.Color(p));c.faces.push(t);c.faces.push(r)}else{t=new THREE.Face3;t.a=y[k++];t.b=y[k++];t.c=y[k++];h&&(h=y[k++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)m=y[k++],v=u[2*m],m=u[2*m+1],
-v=new THREE.Vector2(v,m),c.faceVertexUvs[d][h].push(v);q&&(q=3*y[k++],t.normal.set(L[q++],L[q++],L[q]));if(s)for(d=0;3>d;d++)q=3*y[k++],s=new THREE.Vector3(L[q++],L[q++],L[q]),t.vertexNormals.push(s);p&&(p=y[k++],t.color.setHex(x[p]));if(b)for(d=0;3>d;d++)p=y[k++],t.vertexColors.push(new THREE.Color(x[p]));c.faces.push(t)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d],
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,n,p,q,m,t,s,r,u,v,y=a.faces;p=a.vertices;var H=a.normals,x=a.colors,E=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&E++;for(d=0;d<E;d++)c.faceVertexUvs[d]=[]}k=0;for(n=p.length;k<n;)d=new THREE.Vector3,d.x=p[k++]*b,d.y=p[k++]*b,d.z=p[k++]*b,c.vertices.push(d);k=0;for(n=y.length;k<n;)if(b=y[k++],t=b&1,h=b&2,d=b&8,q=b&16,s=b&32,p=b&64,b&=128,t){t=new THREE.Face3;
+t.a=y[k];t.b=y[k+1];t.c=y[k+3];r=new THREE.Face3;r.a=y[k+1];r.b=y[k+2];r.c=y[k+3];k+=4;h&&(h=y[k++],t.materialIndex=h,r.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)m=y[k++],v=u[2*m],m=u[2*m+1],v=new THREE.Vector2(v,m),2!==g&&c.faceVertexUvs[d][h].push(v),0!==g&&c.faceVertexUvs[d][h+1].push(v);q&&(q=3*y[k++],t.normal.set(H[q++],H[q++],H[q]),r.normal.copy(t.normal));if(s)for(d=0;4>d;d++)q=3*y[k++],s=new THREE.Vector3(H[q++],
+H[q++],H[q]),2!==d&&t.vertexNormals.push(s),0!==d&&r.vertexNormals.push(s);p&&(p=y[k++],p=x[p],t.color.setHex(p),r.color.setHex(p));if(b)for(d=0;4>d;d++)p=y[k++],p=x[p],2!==d&&t.vertexColors.push(new THREE.Color(p)),0!==d&&r.vertexColors.push(new THREE.Color(p));c.faces.push(t);c.faces.push(r)}else{t=new THREE.Face3;t.a=y[k++];t.b=y[k++];t.c=y[k++];h&&(h=y[k++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)m=y[k++],v=u[2*m],m=u[2*m+1],
+v=new THREE.Vector2(v,m),c.faceVertexUvs[d][h].push(v);q&&(q=3*y[k++],t.normal.set(H[q++],H[q++],H[q]));if(s)for(d=0;3>d;d++)q=3*y[k++],s=new THREE.Vector3(H[q++],H[q++],H[q]),t.vertexNormals.push(s);p&&(p=y[k++],t.color.setHex(x[p]));if(b)for(d=0;3>d;d++)p=y[k++],t.vertexColors.push(new THREE.Color(x[p]));c.faces.push(t)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;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,g=a.skinIndices.length;d<g;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.");c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,g,h,k,n,p;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],n=c.morphTargets[d].vertices,p=a.morphTargets[d].vertices,h=0,k=p.length;h<k;h+=3){var q=new THREE.Vector3;q.x=p[h]*b;q.y=p[h+1]*b;q.z=p[h+2]*b;n.push(q)}}if(void 0!==a.morphColors)for(d=
 0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,n=a.morphColors[d].colors,b=0,h=n.length;b<h;b+=3)p=new THREE.Color(16755200),p.setRGB(n[b],n[b+1],n[b+2]),k.push(p)})(d);c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials||0===a.materials.length)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};
@@ -335,17 +335,18 @@ THREE.PointCloud.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THRE
 d.push({distance:m,distanceToRay:g,point:k.clone(),index:f,face:null,object:e})}};if(f instanceof THREE.BufferGeometry){var n=f.attributes,p=n.position.array;if(void 0!==n.index){var n=n.index.array,q=f.offsets;0===q.length&&(q=[{start:0,count:n.length,index:0}]);for(var m=0,t=q.length;m<t;++m)for(var s=q[m].start,r=q[m].index,f=s,s=s+q[m].count;f<s;f++){var u=r+n[f];k.fromArray(p,3*u);g(k,u)}}else for(n=p.length/3,f=0;f<n;f++)k.set(p[3*f],p[3*f+1],p[3*f+2]),g(k,f)}else for(k=this.geometry.vertices,
 f=0;f<k.length;f++)g(k[f],f)}}}();THREE.PointCloud.prototype.clone=function(a){void 0===a&&(a=new THREE.PointCloud(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){console.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud.");return new THREE.PointCloud(a,b)};
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.type="Line";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.mode=void 0!==c?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);THREE.Line.prototype.constructor=THREE.Line;
-THREE.Line.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere;return function(d,e){var f=d.linePrecision,f=f*f,g=this.geometry;null===g.boundingSphere&&g.computeBoundingSphere();c.copy(g.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==d.ray.isIntersectionSphere(c)&&(a.getInverse(this.matrixWorld),b.copy(d.ray).applyMatrix4(a),g instanceof THREE.Geometry))for(var g=g.vertices,h=g.length,k=new THREE.Vector3,n=new THREE.Vector3,p=this.mode===THREE.LineStrip?
-1:2,q=0;q<h-1;q+=p)if(!(b.distanceSqToSegment(g[q],g[q+1],n,k)>f)){var m=b.origin.distanceTo(n);m<d.near||m>d.far||e.push({distance:m,point:k.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}();THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.mode));THREE.Object3D.prototype.clone.call(this,a);return a};
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.constructor=THREE.Mesh;
-THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];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.Line.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere;return function(d,e){var f=d.linePrecision,f=f*f,g=this.geometry;null===g.boundingSphere&&g.computeBoundingSphere();c.copy(g.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==d.ray.isIntersectionSphere(c)){a.getInverse(this.matrixWorld);b.copy(d.ray).applyMatrix4(a);var h=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,q=this.mode===THREE.LineStrip?1:2;if(g instanceof
+THREE.BufferGeometry){var m=g.attributes;if(void 0!==m.index){var t=m.index.array,m=m.position.array,s=g.offsets;0===s.length&&(s=[{start:0,count:t.length,index:0}]);for(var r=0;r<s.length;r++)for(var u=s[r].start,v=s[r].count,y=s[r].index,g=u;g<u+v-1;g+=q){var H=y+t[g+1];h.fromArray(m,3*(y+t[g]));k.fromArray(m,3*H);H=b.distanceSqToSegment(h,k,p,n);H>f||(H=b.origin.distanceTo(p),H<d.near||H>d.far||e.push({distance:H,point:n.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this}))}}else for(m=
+m.position.array,g=0;g<m.length/3-1;g+=q)h.fromArray(m,3*g),k.fromArray(m,3*g+3),H=b.distanceSqToSegment(h,k,p,n),H>f||(H=b.origin.distanceTo(p),H<d.near||H>d.far||e.push({distance:H,point:n.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this}))}else if(g instanceof THREE.Geometry)for(h=g.vertices,k=h.length,g=0;g<k-1;g+=q)H=b.distanceSqToSegment(h[g],h[g+1],p,n),H>f||(H=b.origin.distanceTo(p),H<d.near||H>d.far||e.push({distance:H,point:n.clone().applyMatrix4(this.matrixWorld),
+face:null,faceIndex:null,object:this}))}}}();THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.mode));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);
+THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];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.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Mesh.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g,h){var k=this.geometry;null===k.boundingSphere&&k.computeBoundingSphere();c.copy(k.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==g.ray.isIntersectionSphere(c)&&(a.getInverse(this.matrixWorld),b.copy(g.ray).applyMatrix4(a),null===k.boundingBox||!1!==b.isIntersectionBox(k.boundingBox)))if(k instanceof THREE.BufferGeometry){var n=
-this.material;if(void 0!==n){var p=k.attributes,q,m,t=g.precision;if(void 0!==p.index){var s=p.index.array,r=p.position.array,u=k.offsets;0===u.length&&(u=[{start:0,count:s.length,index:0}]);for(var v=0,y=u.length;v<y;++v)for(var p=u[v].start,L=u[v].index,k=p,x=p+u[v].count;k<x;k+=3){p=L+s[k];q=L+s[k+1];m=L+s[k+2];d.fromArray(r,3*p);e.fromArray(r,3*q);f.fromArray(r,3*m);var E=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide);if(null!==E){E.applyMatrix4(this.matrixWorld);
+this.material;if(void 0!==n){var p=k.attributes,q,m,t=g.precision;if(void 0!==p.index){var s=p.index.array,r=p.position.array,u=k.offsets;0===u.length&&(u=[{start:0,count:s.length,index:0}]);for(var v=0,y=u.length;v<y;++v)for(var p=u[v].start,H=u[v].index,k=p,x=p+u[v].count;k<x;k+=3){p=H+s[k];q=H+s[k+1];m=H+s[k+2];d.fromArray(r,3*p);e.fromArray(r,3*q);f.fromArray(r,3*m);var E=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide);if(null!==E){E.applyMatrix4(this.matrixWorld);
 var z=g.ray.origin.distanceTo(E);z<t||z<g.near||z>g.far||h.push({distance:z,point:E,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this})}}}else for(r=p.position.array,s=k=0,x=r.length;k<x;k+=3,s+=9)p=k,q=k+1,m=k+2,d.fromArray(r,s),e.fromArray(r,s+3),f.fromArray(r,s+6),E=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide),null!==E&&(E.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(E),z<t||z<g.near||z>
-g.far||h.push({distance:z,point:E,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(s=this.material instanceof THREE.MeshFaceMaterial,r=!0===s?this.material.materials:null,t=g.precision,u=k.vertices,v=0,y=k.faces.length;v<y;v++)if(L=k.faces[v],n=!0===s?r[L.materialIndex]:this.material,void 0!==n){p=u[L.a];q=u[L.b];m=u[L.c];if(!0===n.morphTargets){E=k.morphTargets;z=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);f.set(0,
-0,0);for(var x=0,F=E.length;x<F;x++){var D=z[x];if(0!==D){var w=E[x].vertices;d.x+=(w[L.a].x-p.x)*D;d.y+=(w[L.a].y-p.y)*D;d.z+=(w[L.a].z-p.z)*D;e.x+=(w[L.b].x-q.x)*D;e.y+=(w[L.b].y-q.y)*D;e.z+=(w[L.b].z-q.z)*D;f.x+=(w[L.c].x-m.x)*D;f.y+=(w[L.c].y-m.y)*D;f.z+=(w[L.c].z-m.z)*D}}d.add(p);e.add(q);f.add(m);p=d;q=e;m=f}E=n.side===THREE.BackSide?b.intersectTriangle(m,q,p,!0):b.intersectTriangle(p,q,m,n.side!==THREE.DoubleSide);null!==E&&(E.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(E),z<t||
-z<g.near||z>g.far||h.push({distance:z,point:E,face:L,faceIndex:v,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone;
+g.far||h.push({distance:z,point:E,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(s=this.material instanceof THREE.MeshFaceMaterial,r=!0===s?this.material.materials:null,t=g.precision,u=k.vertices,v=0,y=k.faces.length;v<y;v++)if(H=k.faces[v],n=!0===s?r[H.materialIndex]:this.material,void 0!==n){p=u[H.a];q=u[H.b];m=u[H.c];if(!0===n.morphTargets){E=k.morphTargets;z=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);f.set(0,
+0,0);for(var x=0,F=E.length;x<F;x++){var D=z[x];if(0!==D){var w=E[x].vertices;d.x+=(w[H.a].x-p.x)*D;d.y+=(w[H.a].y-p.y)*D;d.z+=(w[H.a].z-p.z)*D;e.x+=(w[H.b].x-q.x)*D;e.y+=(w[H.b].y-q.y)*D;e.z+=(w[H.b].z-q.z)*D;f.x+=(w[H.c].x-m.x)*D;f.y+=(w[H.c].y-m.y)*D;f.z+=(w[H.c].z-m.z)*D}}d.add(p);e.add(q);f.add(m);p=d;q=e;m=f}E=n.side===THREE.BackSide?b.intersectTriangle(m,q,p,!0):b.intersectTriangle(p,q,m,n.side!==THREE.DoubleSide);null!==E&&(E.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(E),z<t||
+z<g.near||z>g.far||h.push({distance:z,point:E,face:H,faceIndex:v,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone;
 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?(this.boneTextureHeight=this.boneTextureWidth=a=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),
 this.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new THREE.Matrix4)};
 THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new THREE.Matrix4;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}};
@@ -443,76 +444,76 @@ f),a.__skinWeightArray=new Float32Array(4*f));c=null!==aa.get("OES_element_index
 !0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function e(a,b,c,d){c=c.attributes;var e=b.attributes;b=b.attributesKeys;for(var f=0,k=b.length;f<k;f++){var m=b[f],n=e[m];if(0<=n){var p=c[m];void 0!==p?(m=p.itemSize,l.bindBuffer(l.ARRAY_BUFFER,p.buffer),g(n),l.vertexAttribPointer(n,m,l.FLOAT,!1,0,d*m*4)):void 0!==a.defaultAttributeValues&&(2===a.defaultAttributeValues[m].length?l.vertexAttrib2fv(n,a.defaultAttributeValues[m]):
 3===a.defaultAttributeValues[m].length&&l.vertexAttrib3fv(n,a.defaultAttributeValues[m]))}}h()}function f(){for(var a=0,b=ib.length;a<b;a++)ib[a]=0}function g(a){ib[a]=1;0===Ra[a]&&(l.enableVertexAttribArray(a),Ra[a]=1)}function h(){for(var a=0,b=Ra.length;a<b;a++)Ra[a]!==ib[a]&&(l.disableVertexAttribArray(a),Ra[a]=0)}function k(a,b){return 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 n(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function p(a,b){return b[0]-
 a[0]}function q(a){if(!1!==a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group)){void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",hc));var c=a.geometry;if(void 0!==c&&void 0===c.__webglInit&&(c.__webglInit=!0,c.addEventListener("dispose",ic),!(c instanceof THREE.BufferGeometry)))if(a instanceof THREE.Mesh)r(a,c);else if(a instanceof THREE.Line){if(void 0===c.__webglVertexBuffer){c.__webglVertexBuffer=
-l.createBuffer();c.__webglColorBuffer=l.createBuffer();c.__webglLineDistanceBuffer=l.createBuffer();J.info.memory.geometries++;var d=c.vertices.length;c.__vertexArray=new Float32Array(3*d);c.__colorArray=new Float32Array(3*d);c.__lineDistanceArray=new Float32Array(1*d);c.__webglLineCount=d;b(a);c.verticesNeedUpdate=!0;c.colorsNeedUpdate=!0;c.lineDistancesNeedUpdate=!0}}else a instanceof THREE.PointCloud&&void 0===c.__webglVertexBuffer&&(c.__webglVertexBuffer=l.createBuffer(),c.__webglColorBuffer=
-l.createBuffer(),J.info.memory.geometries++,d=c.vertices.length,c.__vertexArray=new Float32Array(3*d),c.__colorArray=new Float32Array(3*d),c.__sortArray=[],c.__webglParticleCount=d,b(a),c.verticesNeedUpdate=!0,c.colorsNeedUpdate=!0);if(void 0===a.__webglActive)if(a.__webglActive=!0,a instanceof THREE.Mesh)if(c instanceof THREE.BufferGeometry)u(Ca,c,a);else{if(c instanceof THREE.Geometry)for(var c=jb[c.id],d=0,e=c.length;d<e;d++)u(Ca,c[d],a)}else a instanceof THREE.Line||a instanceof THREE.PointCloud?
+l.createBuffer();c.__webglColorBuffer=l.createBuffer();c.__webglLineDistanceBuffer=l.createBuffer();K.info.memory.geometries++;var d=c.vertices.length;c.__vertexArray=new Float32Array(3*d);c.__colorArray=new Float32Array(3*d);c.__lineDistanceArray=new Float32Array(1*d);c.__webglLineCount=d;b(a);c.verticesNeedUpdate=!0;c.colorsNeedUpdate=!0;c.lineDistancesNeedUpdate=!0}}else a instanceof THREE.PointCloud&&void 0===c.__webglVertexBuffer&&(c.__webglVertexBuffer=l.createBuffer(),c.__webglColorBuffer=
+l.createBuffer(),K.info.memory.geometries++,d=c.vertices.length,c.__vertexArray=new Float32Array(3*d),c.__colorArray=new Float32Array(3*d),c.__sortArray=[],c.__webglParticleCount=d,b(a),c.verticesNeedUpdate=!0,c.colorsNeedUpdate=!0);if(void 0===a.__webglActive)if(a.__webglActive=!0,a instanceof THREE.Mesh)if(c instanceof THREE.BufferGeometry)u(Ca,c,a);else{if(c instanceof THREE.Geometry)for(var c=jb[c.id],d=0,e=c.length;d<e;d++)u(Ca,c[d],a)}else a instanceof THREE.Line||a instanceof THREE.PointCloud?
 u(Ca,c,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&Ia.push({id:null,object:a,opaque:null,transparent:null,z:0});if(a instanceof THREE.Light)oa.push(a);else if(a instanceof THREE.Sprite)eb.push(a);else if(a instanceof THREE.LensFlare)fb.push(a);else if((c=Ca[a.id])&&(!1===a.frustumCulled||!0===kb.intersectsObject(a)))for(d=0,e=c.length;d<e;d++){var f=c[d],g=f,h=g.object,k=g.buffer,m=h.geometry,h=h.material;h instanceof THREE.MeshFaceMaterial?(h=h.materials[m instanceof
-THREE.BufferGeometry?0:k.materialIndex],g.material=h,h.transparent?Sa.push(g):xa.push(g)):h&&(g.material=h,h.transparent?Sa.push(g):xa.push(g));f.render=!0;!0===J.sortObjects&&(Da.setFromMatrixPosition(a.matrixWorld),Da.applyProjection(ub),f.z=Da.z)}}d=0;for(e=a.children.length;d<e;d++)q(a.children[d])}}function m(a,b,c,d,e,f){for(var g,h=0,k=a.length;h<k;h++){g=a[h];var l=g.object,m=g.buffer;F(l,b);if(f)g=f;else{g=g.material;if(!g)continue;e&&J.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);
-J.setDepthTest(g.depthTest);J.setDepthWrite(g.depthWrite);A(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}J.setMaterialFaces(g);m instanceof THREE.BufferGeometry?J.renderBufferDirect(b,c,d,g,m,l):J.renderBuffer(b,c,d,g,m,l)}}function t(a,b,c,d,e,f,g){for(var h,k=0,l=a.length;k<l;k++){h=a[k];var m=h.object;if(m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&J.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);J.setDepthTest(h.depthTest);J.setDepthWrite(h.depthWrite);A(h.polygonOffset,
-h.polygonOffsetFactor,h.polygonOffsetUnits)}J.renderImmediateObject(c,d,e,h,m)}}}function s(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function r(a,b){var d=a.material,e=!1;if(void 0===jb[b.id]||!0===b.groupsNeedUpdate){delete Ca[a.id];for(var f=jb,g=b.id,d=d instanceof THREE.MeshFaceMaterial,h=aa.get("OES_element_index_uint")?4294967296:65535,k,e={},m=b.morphTargets.length,n=b.morphNormals.length,p,q={},r=[],t=0,s=b.faces.length;t<s;t++){k=
+THREE.BufferGeometry?0:k.materialIndex],g.material=h,h.transparent?Sa.push(g):xa.push(g)):h&&(g.material=h,h.transparent?Sa.push(g):xa.push(g));f.render=!0;!0===K.sortObjects&&(Da.setFromMatrixPosition(a.matrixWorld),Da.applyProjection(ub),f.z=Da.z)}}d=0;for(e=a.children.length;d<e;d++)q(a.children[d])}}function m(a,b,c,d,e,f){for(var g,h=0,k=a.length;h<k;h++){g=a[h];var l=g.object,m=g.buffer;F(l,b);if(f)g=f;else{g=g.material;if(!g)continue;e&&K.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);
+K.setDepthTest(g.depthTest);K.setDepthWrite(g.depthWrite);A(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}K.setMaterialFaces(g);m instanceof THREE.BufferGeometry?K.renderBufferDirect(b,c,d,g,m,l):K.renderBuffer(b,c,d,g,m,l)}}function t(a,b,c,d,e,f,g){for(var h,k=0,l=a.length;k<l;k++){h=a[k];var m=h.object;if(m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&K.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);K.setDepthTest(h.depthTest);K.setDepthWrite(h.depthWrite);A(h.polygonOffset,
+h.polygonOffsetFactor,h.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,h,m)}}}function s(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function r(a,b){var d=a.material,e=!1;if(void 0===jb[b.id]||!0===b.groupsNeedUpdate){delete Ca[a.id];for(var f=jb,g=b.id,d=d instanceof THREE.MeshFaceMaterial,h=aa.get("OES_element_index_uint")?4294967296:65535,k,e={},m=b.morphTargets.length,n=b.morphNormals.length,p,q={},r=[],t=0,s=b.faces.length;t<s;t++){k=
 b.faces[t];var v=d?k.materialIndex:0;v in e||(e[v]={hash:v,counter:0});k=e[v].hash+"_"+e[v].counter;k in q||(p={id:jc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},q[k]=p,r.push(p));q[k].vertices+3>h&&(e[v].counter+=1,k=e[v].hash+"_"+e[v].counter,k in q||(p={id:jc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},q[k]=p,r.push(p)));q[k].faces3.push(t);q[k].vertices+=3}f[g]=r;b.groupsNeedUpdate=!1}f=jb[b.id];g=0;for(d=f.length;g<d;g++){h=f[g];
 if(void 0===h.__webglVertexBuffer){e=h;e.__webglVertexBuffer=l.createBuffer();e.__webglNormalBuffer=l.createBuffer();e.__webglTangentBuffer=l.createBuffer();e.__webglColorBuffer=l.createBuffer();e.__webglUVBuffer=l.createBuffer();e.__webglUV2Buffer=l.createBuffer();e.__webglSkinIndicesBuffer=l.createBuffer();e.__webglSkinWeightsBuffer=l.createBuffer();e.__webglFaceBuffer=l.createBuffer();e.__webglLineBuffer=l.createBuffer();n=m=void 0;if(e.numMorphTargets)for(e.__webglMorphTargetsBuffers=[],m=0,n=
-e.numMorphTargets;m<n;m++)e.__webglMorphTargetsBuffers.push(l.createBuffer());if(e.numMorphNormals)for(e.__webglMorphNormalsBuffers=[],m=0,n=e.numMorphNormals;m<n;m++)e.__webglMorphNormalsBuffers.push(l.createBuffer());J.info.memory.geometries++;c(h,a);b.verticesNeedUpdate=!0;b.morphTargetsNeedUpdate=!0;b.elementsNeedUpdate=!0;b.uvsNeedUpdate=!0;b.normalsNeedUpdate=!0;b.tangentsNeedUpdate=!0;e=b.colorsNeedUpdate=!0}else e=!1;(e||void 0===a.__webglActive)&&u(Ca,h,a)}a.__webglActive=!0}function u(a,
+e.numMorphTargets;m<n;m++)e.__webglMorphTargetsBuffers.push(l.createBuffer());if(e.numMorphNormals)for(e.__webglMorphNormalsBuffers=[],m=0,n=e.numMorphNormals;m<n;m++)e.__webglMorphNormalsBuffers.push(l.createBuffer());K.info.memory.geometries++;c(h,a);b.verticesNeedUpdate=!0;b.morphTargetsNeedUpdate=!0;b.elementsNeedUpdate=!0;b.uvsNeedUpdate=!0;b.normalsNeedUpdate=!0;b.tangentsNeedUpdate=!0;e=b.colorsNeedUpdate=!0}else e=!1;(e||void 0===a.__webglActive)&&u(Ca,h,a)}a.__webglActive=!0}function u(a,
 b,c){var d=c.id;a[d]=a[d]||[];a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function v(a){var b=a.geometry,e,f;if(b instanceof THREE.BufferGeometry)for(var g=b.attributes,h=b.attributesKeys,k=0,m=h.length;k<m;k++){var n=h[k],p=g[n];void 0===p.buffer&&(p.buffer=l.createBuffer(),p.needsUpdate=!0);if(!0===p.needsUpdate){var q="index"===n?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER;l.bindBuffer(q,p.buffer);l.bufferData(q,p.array,l.STATIC_DRAW);p.needsUpdate=!1}}else if(a instanceof THREE.Mesh){!0===
-b.groupsNeedUpdate&&r(a,b);for(var t=jb[b.id],k=0,s=t.length;k<s;k++){var u=t[k];f=d(a,u);!0===b.groupsNeedUpdate&&c(u,a);e=f.attributes&&y(f);if(b.verticesNeedUpdate||b.morphTargetsNeedUpdate||b.elementsNeedUpdate||b.uvsNeedUpdate||b.normalsNeedUpdate||b.colorsNeedUpdate||b.tangentsNeedUpdate||e){var v=u,x=a,z=l.DYNAMIC_DRAW,F=!b.dynamic,D=f;if(v.__inittedArrays){var C=D&&void 0!==D.shading&&D.shading===THREE.SmoothShading,w=void 0,E=void 0,J=void 0,A=void 0,P=void 0,M=void 0,I=void 0,N=void 0,T=
-void 0,Q=void 0,U=void 0,G=void 0,V=void 0,K=void 0,X=void 0,oa=void 0,Ca=void 0,db=void 0,Ia=void 0,Sa=void 0,aa=void 0,ca=void 0,xa=void 0,la=void 0,ga=void 0,O=void 0,eb=void 0,fa=void 0,fb=void 0,Y=void 0,pa=void 0,qa=void 0,Da=void 0,ya=void 0,Fa=void 0,Ba=void 0,ma=void 0,Ya=void 0,La=void 0,ka=void 0,Ma=0,Ta=0,nb=0,Wa=0,wa=0,Ua=0,Ga=0,ob=0,Na=0,ha=0,ra=0,H=0,za=void 0,Za=v.__vertexArray,vb=v.__uvArray,pb=v.__uv2Array,Oa=v.__normalArray,Aa=v.__tangentArray,$a=v.__colorArray,Ja=v.__skinIndexArray,
+b.groupsNeedUpdate&&r(a,b);for(var t=jb[b.id],k=0,s=t.length;k<s;k++){var u=t[k];f=d(a,u);!0===b.groupsNeedUpdate&&c(u,a);e=f.attributes&&y(f);if(b.verticesNeedUpdate||b.morphTargetsNeedUpdate||b.elementsNeedUpdate||b.uvsNeedUpdate||b.normalsNeedUpdate||b.colorsNeedUpdate||b.tangentsNeedUpdate||e){var v=u,x=a,z=l.DYNAMIC_DRAW,F=!b.dynamic,D=f;if(v.__inittedArrays){var C=D&&void 0!==D.shading&&D.shading===THREE.SmoothShading,w=void 0,E=void 0,K=void 0,A=void 0,P=void 0,M=void 0,J=void 0,N=void 0,T=
+void 0,Q=void 0,U=void 0,G=void 0,V=void 0,L=void 0,X=void 0,oa=void 0,Ca=void 0,db=void 0,Ia=void 0,Sa=void 0,aa=void 0,ca=void 0,xa=void 0,la=void 0,ga=void 0,O=void 0,eb=void 0,fa=void 0,fb=void 0,Y=void 0,pa=void 0,qa=void 0,Da=void 0,ya=void 0,Fa=void 0,Ba=void 0,ma=void 0,Ya=void 0,La=void 0,ka=void 0,Ma=0,Ta=0,nb=0,Wa=0,wa=0,Ua=0,Ga=0,ob=0,Na=0,ha=0,ra=0,I=0,za=void 0,Za=v.__vertexArray,vb=v.__uvArray,pb=v.__uv2Array,Oa=v.__normalArray,Aa=v.__tangentArray,$a=v.__colorArray,Ja=v.__skinIndexArray,
 Ka=v.__skinWeightArray,ab=v.__morphTargetsArrays,wb=v.__morphNormalsArrays,qb=v.__webglCustomAttributesList,B=void 0,cb=v.__faceArray,sa=v.__lineArray,na=x.geometry,Ra=na.elementsNeedUpdate,Cb=na.uvsNeedUpdate,Ab=na.normalsNeedUpdate,Jb=na.tangentsNeedUpdate,ib=na.colorsNeedUpdate,lb=na.morphTargetsNeedUpdate,Db=na.vertices,W=v.faces3,Ha=na.faces,Va=na.faceVertexUvs[0],Eb=na.faceVertexUvs[1],Ob=na.skinIndices,$=na.skinWeights,Fb=na.morphTargets,R=na.morphNormals;if(na.verticesNeedUpdate){w=0;for(E=
-W.length;w<E;w++)A=Ha[W[w]],G=Db[A.a],V=Db[A.b],K=Db[A.c],Za[Ta]=G.x,Za[Ta+1]=G.y,Za[Ta+2]=G.z,Za[Ta+3]=V.x,Za[Ta+4]=V.y,Za[Ta+5]=V.z,Za[Ta+6]=K.x,Za[Ta+7]=K.y,Za[Ta+8]=K.z,Ta+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Za,z)}if(lb)for(Fa=0,Ba=Fb.length;Fa<Ba;Fa++){w=ra=0;for(E=W.length;w<E;w++)La=W[w],A=Ha[La],G=Fb[Fa].vertices[A.a],V=Fb[Fa].vertices[A.b],K=Fb[Fa].vertices[A.c],ma=ab[Fa],ma[ra]=G.x,ma[ra+1]=G.y,ma[ra+2]=G.z,ma[ra+3]=V.x,ma[ra+4]=V.y,ma[ra+5]=
-V.z,ma[ra+6]=K.x,ma[ra+7]=K.y,ma[ra+8]=K.z,D.morphNormals&&(C?(ka=R[Fa].vertexNormals[La],db=ka.a,Ia=ka.b,Sa=ka.c):Sa=Ia=db=R[Fa].faceNormals[La],Ya=wb[Fa],Ya[ra]=db.x,Ya[ra+1]=db.y,Ya[ra+2]=db.z,Ya[ra+3]=Ia.x,Ya[ra+4]=Ia.y,Ya[ra+5]=Ia.z,Ya[ra+6]=Sa.x,Ya[ra+7]=Sa.y,Ya[ra+8]=Sa.z),ra+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[Fa]);l.bufferData(l.ARRAY_BUFFER,ab[Fa],z);D.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphNormalsBuffers[Fa]),l.bufferData(l.ARRAY_BUFFER,wb[Fa],
+W.length;w<E;w++)A=Ha[W[w]],G=Db[A.a],V=Db[A.b],L=Db[A.c],Za[Ta]=G.x,Za[Ta+1]=G.y,Za[Ta+2]=G.z,Za[Ta+3]=V.x,Za[Ta+4]=V.y,Za[Ta+5]=V.z,Za[Ta+6]=L.x,Za[Ta+7]=L.y,Za[Ta+8]=L.z,Ta+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Za,z)}if(lb)for(Fa=0,Ba=Fb.length;Fa<Ba;Fa++){w=ra=0;for(E=W.length;w<E;w++)La=W[w],A=Ha[La],G=Fb[Fa].vertices[A.a],V=Fb[Fa].vertices[A.b],L=Fb[Fa].vertices[A.c],ma=ab[Fa],ma[ra]=G.x,ma[ra+1]=G.y,ma[ra+2]=G.z,ma[ra+3]=V.x,ma[ra+4]=V.y,ma[ra+5]=
+V.z,ma[ra+6]=L.x,ma[ra+7]=L.y,ma[ra+8]=L.z,D.morphNormals&&(C?(ka=R[Fa].vertexNormals[La],db=ka.a,Ia=ka.b,Sa=ka.c):Sa=Ia=db=R[Fa].faceNormals[La],Ya=wb[Fa],Ya[ra]=db.x,Ya[ra+1]=db.y,Ya[ra+2]=db.z,Ya[ra+3]=Ia.x,Ya[ra+4]=Ia.y,Ya[ra+5]=Ia.z,Ya[ra+6]=Sa.x,Ya[ra+7]=Sa.y,Ya[ra+8]=Sa.z),ra+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[Fa]);l.bufferData(l.ARRAY_BUFFER,ab[Fa],z);D.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphNormalsBuffers[Fa]),l.bufferData(l.ARRAY_BUFFER,wb[Fa],
 z))}if($.length){w=0;for(E=W.length;w<E;w++)A=Ha[W[w]],la=$[A.a],ga=$[A.b],O=$[A.c],Ka[ha]=la.x,Ka[ha+1]=la.y,Ka[ha+2]=la.z,Ka[ha+3]=la.w,Ka[ha+4]=ga.x,Ka[ha+5]=ga.y,Ka[ha+6]=ga.z,Ka[ha+7]=ga.w,Ka[ha+8]=O.x,Ka[ha+9]=O.y,Ka[ha+10]=O.z,Ka[ha+11]=O.w,eb=Ob[A.a],fa=Ob[A.b],fb=Ob[A.c],Ja[ha]=eb.x,Ja[ha+1]=eb.y,Ja[ha+2]=eb.z,Ja[ha+3]=eb.w,Ja[ha+4]=fa.x,Ja[ha+5]=fa.y,Ja[ha+6]=fa.z,Ja[ha+7]=fa.w,Ja[ha+8]=fb.x,Ja[ha+9]=fb.y,Ja[ha+10]=fb.z,Ja[ha+11]=fb.w,ha+=12;0<ha&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinIndicesBuffer),
-l.bufferData(l.ARRAY_BUFFER,Ja,z),l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,Ka,z))}if(ib){w=0;for(E=W.length;w<E;w++)A=Ha[W[w]],I=A.vertexColors,N=A.color,3===I.length&&D.vertexColors===THREE.VertexColors?(aa=I[0],ca=I[1],xa=I[2]):xa=ca=aa=N,$a[Na]=aa.r,$a[Na+1]=aa.g,$a[Na+2]=aa.b,$a[Na+3]=ca.r,$a[Na+4]=ca.g,$a[Na+5]=ca.b,$a[Na+6]=xa.r,$a[Na+7]=xa.g,$a[Na+8]=xa.b,Na+=9;0<Na&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,$a,
+l.bufferData(l.ARRAY_BUFFER,Ja,z),l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,Ka,z))}if(ib){w=0;for(E=W.length;w<E;w++)A=Ha[W[w]],J=A.vertexColors,N=A.color,3===J.length&&D.vertexColors===THREE.VertexColors?(aa=J[0],ca=J[1],xa=J[2]):xa=ca=aa=N,$a[Na]=aa.r,$a[Na+1]=aa.g,$a[Na+2]=aa.b,$a[Na+3]=ca.r,$a[Na+4]=ca.g,$a[Na+5]=ca.b,$a[Na+6]=xa.r,$a[Na+7]=xa.g,$a[Na+8]=xa.b,Na+=9;0<Na&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,$a,
 z))}if(Jb&&na.hasTangents){w=0;for(E=W.length;w<E;w++)A=Ha[W[w]],T=A.vertexTangents,X=T[0],oa=T[1],Ca=T[2],Aa[Ga]=X.x,Aa[Ga+1]=X.y,Aa[Ga+2]=X.z,Aa[Ga+3]=X.w,Aa[Ga+4]=oa.x,Aa[Ga+5]=oa.y,Aa[Ga+6]=oa.z,Aa[Ga+7]=oa.w,Aa[Ga+8]=Ca.x,Aa[Ga+9]=Ca.y,Aa[Ga+10]=Ca.z,Aa[Ga+11]=Ca.w,Ga+=12;l.bindBuffer(l.ARRAY_BUFFER,v.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,Aa,z)}if(Ab){w=0;for(E=W.length;w<E;w++)if(A=Ha[W[w]],P=A.vertexNormals,M=A.normal,3===P.length&&C)for(Y=0;3>Y;Y++)qa=P[Y],Oa[Ua]=qa.x,Oa[Ua+1]=
-qa.y,Oa[Ua+2]=qa.z,Ua+=3;else for(Y=0;3>Y;Y++)Oa[Ua]=M.x,Oa[Ua+1]=M.y,Oa[Ua+2]=M.z,Ua+=3;l.bindBuffer(l.ARRAY_BUFFER,v.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,Oa,z)}if(Cb&&Va){w=0;for(E=W.length;w<E;w++)if(J=W[w],Q=Va[J],void 0!==Q)for(Y=0;3>Y;Y++)Da=Q[Y],vb[nb]=Da.x,vb[nb+1]=Da.y,nb+=2;0<nb&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,vb,z))}if(Cb&&Eb){w=0;for(E=W.length;w<E;w++)if(J=W[w],U=Eb[J],void 0!==U)for(Y=0;3>Y;Y++)ya=U[Y],pb[Wa]=ya.x,pb[Wa+1]=ya.y,
+qa.y,Oa[Ua+2]=qa.z,Ua+=3;else for(Y=0;3>Y;Y++)Oa[Ua]=M.x,Oa[Ua+1]=M.y,Oa[Ua+2]=M.z,Ua+=3;l.bindBuffer(l.ARRAY_BUFFER,v.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,Oa,z)}if(Cb&&Va){w=0;for(E=W.length;w<E;w++)if(K=W[w],Q=Va[K],void 0!==Q)for(Y=0;3>Y;Y++)Da=Q[Y],vb[nb]=Da.x,vb[nb+1]=Da.y,nb+=2;0<nb&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,vb,z))}if(Cb&&Eb){w=0;for(E=W.length;w<E;w++)if(K=W[w],U=Eb[K],void 0!==U)for(Y=0;3>Y;Y++)ya=U[Y],pb[Wa]=ya.x,pb[Wa+1]=ya.y,
 Wa+=2;0<Wa&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,pb,z))}if(Ra){w=0;for(E=W.length;w<E;w++)cb[wa]=Ma,cb[wa+1]=Ma+1,cb[wa+2]=Ma+2,wa+=3,sa[ob]=Ma,sa[ob+1]=Ma+1,sa[ob+2]=Ma,sa[ob+3]=Ma+2,sa[ob+4]=Ma+1,sa[ob+5]=Ma+2,ob+=6,Ma+=3;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,cb,z);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,sa,z)}if(qb)for(Y=0,pa=qb.length;Y<pa;Y++)if(B=
-qb[Y],B.__original.needsUpdate){H=0;if(1===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],B.array[H]=B.value[A.a],B.array[H+1]=B.value[A.b],B.array[H+2]=B.value[A.c],H+=3;else{if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],B.array[H]=za,B.array[H+1]=za,B.array[H+2]=za,H+=3}else if(2===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],K=B.value[A.c],B.array[H]=G.x,
-B.array[H+1]=G.y,B.array[H+2]=V.x,B.array[H+3]=V.y,B.array[H+4]=K.x,B.array[H+5]=K.y,H+=6;else{if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)K=V=G=za=B.value[W[w]],B.array[H]=G.x,B.array[H+1]=G.y,B.array[H+2]=V.x,B.array[H+3]=V.y,B.array[H+4]=K.x,B.array[H+5]=K.y,H+=6}else if(3===B.size){var S;S="c"===B.type?["r","g","b"]:["x","y","z"];if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],K=B.value[A.c],B.array[H]=G[S[0]],B.array[H+1]=
-G[S[1]],B.array[H+2]=G[S[2]],B.array[H+3]=V[S[0]],B.array[H+4]=V[S[1]],B.array[H+5]=V[S[2]],B.array[H+6]=K[S[0]],B.array[H+7]=K[S[1]],B.array[H+8]=K[S[2]],H+=9;else if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)K=V=G=za=B.value[W[w]],B.array[H]=G[S[0]],B.array[H+1]=G[S[1]],B.array[H+2]=G[S[2]],B.array[H+3]=V[S[0]],B.array[H+4]=V[S[1]],B.array[H+5]=V[S[2]],B.array[H+6]=K[S[0]],B.array[H+7]=K[S[1]],B.array[H+8]=K[S[2]],H+=9;else if("faceVertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],
-G=za[0],V=za[1],K=za[2],B.array[H]=G[S[0]],B.array[H+1]=G[S[1]],B.array[H+2]=G[S[2]],B.array[H+3]=V[S[0]],B.array[H+4]=V[S[1]],B.array[H+5]=V[S[2]],B.array[H+6]=K[S[0]],B.array[H+7]=K[S[1]],B.array[H+8]=K[S[2]],H+=9}else if(4===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],K=B.value[A.c],B.array[H]=G.x,B.array[H+1]=G.y,B.array[H+2]=G.z,B.array[H+3]=G.w,B.array[H+4]=V.x,B.array[H+5]=V.y,B.array[H+6]=V.z,B.array[H+7]=V.w,B.array[H+
-8]=K.x,B.array[H+9]=K.y,B.array[H+10]=K.z,B.array[H+11]=K.w,H+=12;else if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)K=V=G=za=B.value[W[w]],B.array[H]=G.x,B.array[H+1]=G.y,B.array[H+2]=G.z,B.array[H+3]=G.w,B.array[H+4]=V.x,B.array[H+5]=V.y,B.array[H+6]=V.z,B.array[H+7]=V.w,B.array[H+8]=K.x,B.array[H+9]=K.y,B.array[H+10]=K.z,B.array[H+11]=K.w,H+=12;else if("faceVertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],G=za[0],V=za[1],K=za[2],B.array[H]=G.x,B.array[H+1]=G.y,B.array[H+2]=
-G.z,B.array[H+3]=G.w,B.array[H+4]=V.x,B.array[H+5]=V.y,B.array[H+6]=V.z,B.array[H+7]=V.w,B.array[H+8]=K.x,B.array[H+9]=K.y,B.array[H+10]=K.z,B.array[H+11]=K.w,H+=12;l.bindBuffer(l.ARRAY_BUFFER,B.buffer);l.bufferData(l.ARRAY_BUFFER,B.array,z)}F&&(delete v.__inittedArrays,delete v.__colorArray,delete v.__normalArray,delete v.__tangentArray,delete v.__uvArray,delete v.__uv2Array,delete v.__faceArray,delete v.__vertexArray,delete v.__lineArray,delete v.__skinIndexArray,delete v.__skinWeightArray)}}}b.verticesNeedUpdate=
-!1;b.morphTargetsNeedUpdate=!1;b.elementsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.tangentsNeedUpdate=!1;f.attributes&&L(f)}else if(a instanceof THREE.Line){f=d(a,b);e=f.attributes&&y(f);if(b.verticesNeedUpdate||b.colorsNeedUpdate||b.lineDistancesNeedUpdate||e){var Z=l.DYNAMIC_DRAW,Ea,ja,Bb,Gb,ba,hb,ta=b.vertices,Pb=b.colors,Qb=b.lineDistances,rb=ta.length,Rb=Pb.length,xb=Qb.length,Hb=b.__vertexArray,sb=b.__colorArray,Ib=b.__lineDistanceArray,Nb=b.colorsNeedUpdate,
+qb[Y],B.__original.needsUpdate){I=0;if(1===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],B.array[I]=B.value[A.a],B.array[I+1]=B.value[A.b],B.array[I+2]=B.value[A.c],I+=3;else{if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],B.array[I]=za,B.array[I+1]=za,B.array[I+2]=za,I+=3}else if(2===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],L=B.value[A.c],B.array[I]=G.x,
+B.array[I+1]=G.y,B.array[I+2]=V.x,B.array[I+3]=V.y,B.array[I+4]=L.x,B.array[I+5]=L.y,I+=6;else{if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)L=V=G=za=B.value[W[w]],B.array[I]=G.x,B.array[I+1]=G.y,B.array[I+2]=V.x,B.array[I+3]=V.y,B.array[I+4]=L.x,B.array[I+5]=L.y,I+=6}else if(3===B.size){var S;S="c"===B.type?["r","g","b"]:["x","y","z"];if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],L=B.value[A.c],B.array[I]=G[S[0]],B.array[I+1]=
+G[S[1]],B.array[I+2]=G[S[2]],B.array[I+3]=V[S[0]],B.array[I+4]=V[S[1]],B.array[I+5]=V[S[2]],B.array[I+6]=L[S[0]],B.array[I+7]=L[S[1]],B.array[I+8]=L[S[2]],I+=9;else if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)L=V=G=za=B.value[W[w]],B.array[I]=G[S[0]],B.array[I+1]=G[S[1]],B.array[I+2]=G[S[2]],B.array[I+3]=V[S[0]],B.array[I+4]=V[S[1]],B.array[I+5]=V[S[2]],B.array[I+6]=L[S[0]],B.array[I+7]=L[S[1]],B.array[I+8]=L[S[2]],I+=9;else if("faceVertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],
+G=za[0],V=za[1],L=za[2],B.array[I]=G[S[0]],B.array[I+1]=G[S[1]],B.array[I+2]=G[S[2]],B.array[I+3]=V[S[0]],B.array[I+4]=V[S[1]],B.array[I+5]=V[S[2]],B.array[I+6]=L[S[0]],B.array[I+7]=L[S[1]],B.array[I+8]=L[S[2]],I+=9}else if(4===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],L=B.value[A.c],B.array[I]=G.x,B.array[I+1]=G.y,B.array[I+2]=G.z,B.array[I+3]=G.w,B.array[I+4]=V.x,B.array[I+5]=V.y,B.array[I+6]=V.z,B.array[I+7]=V.w,B.array[I+
+8]=L.x,B.array[I+9]=L.y,B.array[I+10]=L.z,B.array[I+11]=L.w,I+=12;else if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)L=V=G=za=B.value[W[w]],B.array[I]=G.x,B.array[I+1]=G.y,B.array[I+2]=G.z,B.array[I+3]=G.w,B.array[I+4]=V.x,B.array[I+5]=V.y,B.array[I+6]=V.z,B.array[I+7]=V.w,B.array[I+8]=L.x,B.array[I+9]=L.y,B.array[I+10]=L.z,B.array[I+11]=L.w,I+=12;else if("faceVertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],G=za[0],V=za[1],L=za[2],B.array[I]=G.x,B.array[I+1]=G.y,B.array[I+2]=
+G.z,B.array[I+3]=G.w,B.array[I+4]=V.x,B.array[I+5]=V.y,B.array[I+6]=V.z,B.array[I+7]=V.w,B.array[I+8]=L.x,B.array[I+9]=L.y,B.array[I+10]=L.z,B.array[I+11]=L.w,I+=12;l.bindBuffer(l.ARRAY_BUFFER,B.buffer);l.bufferData(l.ARRAY_BUFFER,B.array,z)}F&&(delete v.__inittedArrays,delete v.__colorArray,delete v.__normalArray,delete v.__tangentArray,delete v.__uvArray,delete v.__uv2Array,delete v.__faceArray,delete v.__vertexArray,delete v.__lineArray,delete v.__skinIndexArray,delete v.__skinWeightArray)}}}b.verticesNeedUpdate=
+!1;b.morphTargetsNeedUpdate=!1;b.elementsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.tangentsNeedUpdate=!1;f.attributes&&H(f)}else if(a instanceof THREE.Line){f=d(a,b);e=f.attributes&&y(f);if(b.verticesNeedUpdate||b.colorsNeedUpdate||b.lineDistancesNeedUpdate||e){var Z=l.DYNAMIC_DRAW,Ea,ja,Bb,Gb,ba,hb,ta=b.vertices,Pb=b.colors,Qb=b.lineDistances,rb=ta.length,Rb=Pb.length,xb=Qb.length,Hb=b.__vertexArray,sb=b.__colorArray,Ib=b.__lineDistanceArray,Nb=b.colorsNeedUpdate,
 tb=b.lineDistancesNeedUpdate,bb=b.__webglCustomAttributesList,Xa,zb,ua,Kb,Pa,da;if(b.verticesNeedUpdate){for(Ea=0;Ea<rb;Ea++)Gb=ta[Ea],ba=3*Ea,Hb[ba]=Gb.x,Hb[ba+1]=Gb.y,Hb[ba+2]=Gb.z;l.bindBuffer(l.ARRAY_BUFFER,b.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Hb,Z)}if(Nb){for(ja=0;ja<Rb;ja++)hb=Pb[ja],ba=3*ja,sb[ba]=hb.r,sb[ba+1]=hb.g,sb[ba+2]=hb.b;l.bindBuffer(l.ARRAY_BUFFER,b.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,sb,Z)}if(tb){for(Bb=0;Bb<xb;Bb++)Ib[Bb]=Qb[Bb];l.bindBuffer(l.ARRAY_BUFFER,
 b.__webglLineDistanceBuffer);l.bufferData(l.ARRAY_BUFFER,Ib,Z)}if(bb)for(Xa=0,zb=bb.length;Xa<zb;Xa++)if(da=bb[Xa],da.needsUpdate&&(void 0===da.boundTo||"vertices"===da.boundTo)){ba=0;Kb=da.value.length;if(1===da.size)for(ua=0;ua<Kb;ua++)da.array[ua]=da.value[ua];else if(2===da.size)for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.x,da.array[ba+1]=Pa.y,ba+=2;else if(3===da.size)if("c"===da.type)for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.r,da.array[ba+1]=Pa.g,da.array[ba+2]=Pa.b,ba+=3;
-else for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.x,da.array[ba+1]=Pa.y,da.array[ba+2]=Pa.z,ba+=3;else if(4===da.size)for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.x,da.array[ba+1]=Pa.y,da.array[ba+2]=Pa.z,da.array[ba+3]=Pa.w,ba+=4;l.bindBuffer(l.ARRAY_BUFFER,da.buffer);l.bufferData(l.ARRAY_BUFFER,da.array,Z);da.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;b.lineDistancesNeedUpdate=!1;f.attributes&&L(f)}else if(a instanceof THREE.PointCloud){f=d(a,b);e=f.attributes&&
+else for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.x,da.array[ba+1]=Pa.y,da.array[ba+2]=Pa.z,ba+=3;else if(4===da.size)for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.x,da.array[ba+1]=Pa.y,da.array[ba+2]=Pa.z,da.array[ba+3]=Pa.w,ba+=4;l.bindBuffer(l.ARRAY_BUFFER,da.buffer);l.bufferData(l.ARRAY_BUFFER,da.array,Z);da.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;b.lineDistancesNeedUpdate=!1;f.attributes&&H(f)}else if(a instanceof THREE.PointCloud){f=d(a,b);e=f.attributes&&
 y(f);if(b.verticesNeedUpdate||b.colorsNeedUpdate||e){var kb=l.DYNAMIC_DRAW,Sb,Tb,$b,ia,ac,ub=b.vertices,Ub=ub.length,Mb=b.colors,Vb=Mb.length,bc=b.__vertexArray,cc=b.__colorArray,Wb=b.colorsNeedUpdate,mb=b.__webglCustomAttributesList,dc,yb,va,Lb,Qa,ea;if(b.verticesNeedUpdate){for(Sb=0;Sb<Ub;Sb++)$b=ub[Sb],ia=3*Sb,bc[ia]=$b.x,bc[ia+1]=$b.y,bc[ia+2]=$b.z;l.bindBuffer(l.ARRAY_BUFFER,b.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,bc,kb)}if(Wb){for(Tb=0;Tb<Vb;Tb++)ac=Mb[Tb],ia=3*Tb,cc[ia]=ac.r,cc[ia+
 1]=ac.g,cc[ia+2]=ac.b;l.bindBuffer(l.ARRAY_BUFFER,b.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,cc,kb)}if(mb)for(dc=0,yb=mb.length;dc<yb;dc++){ea=mb[dc];if(ea.needsUpdate&&(void 0===ea.boundTo||"vertices"===ea.boundTo))if(Lb=ea.value.length,ia=0,1===ea.size)for(va=0;va<Lb;va++)ea.array[va]=ea.value[va];else if(2===ea.size)for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.x,ea.array[ia+1]=Qa.y,ia+=2;else if(3===ea.size)if("c"===ea.type)for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.r,ea.array[ia+
-1]=Qa.g,ea.array[ia+2]=Qa.b,ia+=3;else for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.x,ea.array[ia+1]=Qa.y,ea.array[ia+2]=Qa.z,ia+=3;else if(4===ea.size)for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.x,ea.array[ia+1]=Qa.y,ea.array[ia+2]=Qa.z,ea.array[ia+3]=Qa.w,ia+=4;l.bindBuffer(l.ARRAY_BUFFER,ea.buffer);l.bufferData(l.ARRAY_BUFFER,ea.array,kb);ea.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;f.attributes&&L(f)}}function y(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
-return!1}function L(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function x(a,b,c,d,e){var f,g,h,k;Ib=0;if(d.needsUpdate){d.program&&kc(d);d.addEventListener("dispose",lc);var m;d instanceof THREE.MeshDepthMaterial?m="depth":d instanceof THREE.MeshNormalMaterial?m="normal":d instanceof THREE.MeshBasicMaterial?m="basic":d instanceof THREE.MeshLambertMaterial?m="lambert":d instanceof THREE.MeshPhongMaterial?m="phong":d instanceof THREE.LineBasicMaterial?m="basic":d instanceof THREE.LineDashedMaterial?
+1]=Qa.g,ea.array[ia+2]=Qa.b,ia+=3;else for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.x,ea.array[ia+1]=Qa.y,ea.array[ia+2]=Qa.z,ia+=3;else if(4===ea.size)for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.x,ea.array[ia+1]=Qa.y,ea.array[ia+2]=Qa.z,ea.array[ia+3]=Qa.w,ia+=4;l.bindBuffer(l.ARRAY_BUFFER,ea.buffer);l.bufferData(l.ARRAY_BUFFER,ea.array,kb);ea.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;f.attributes&&H(f)}}function y(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
+return!1}function H(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function x(a,b,c,d,e){var f,g,h,k;Ib=0;if(d.needsUpdate){d.program&&kc(d);d.addEventListener("dispose",lc);var m;d instanceof THREE.MeshDepthMaterial?m="depth":d instanceof THREE.MeshNormalMaterial?m="normal":d instanceof THREE.MeshBasicMaterial?m="basic":d instanceof THREE.MeshLambertMaterial?m="lambert":d instanceof THREE.MeshPhongMaterial?m="phong":d instanceof THREE.LineBasicMaterial?m="basic":d instanceof THREE.LineDashedMaterial?
 m="dashed":d instanceof THREE.PointCloudMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];d.__webglShader={uniforms:THREE.UniformsUtils.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var p=0,q=0,r=0,t=0,s=0,v=b.length;s<v;s++){var u=b[s];u.onlyShadow||!1===u.visible||(u instanceof THREE.DirectionalLight&&p++,u instanceof THREE.PointLight&&q++,u instanceof
-THREE.SpotLight&&r++,u instanceof THREE.HemisphereLight&&t++)}f=p;g=q;h=r;k=t;for(var x,y=0,L=0,F=b.length;L<F;L++){var A=b[L];A.castShadow&&(A instanceof THREE.SpotLight&&y++,A instanceof THREE.DirectionalLight&&!A.shadowCascade&&y++)}x=y;var C;if(Ub&&e&&e.skeleton&&e.skeleton.useVertexTexture)C=1024;else{var G=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),V=Math.floor((G-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(V=Math.min(e.skeleton.bones.length,V),V<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+
-e.skeleton.bones.length+", this GPU supports just "+V+" (try OpenGL instead of ANGLE)"));C=V}var K={precision:Q,supportsVertexTextures:Mb,map:!!d.map,envMap:!!d.envMap,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:La,skinning:d.skinning,maxBones:C,useVertexTexture:Ub&&e&&e.skeleton&&e.skeleton.useVertexTexture,
-morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:J.maxMorphTargets,maxMorphNormals:J.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:x,shadowMapEnabled:J.shadowMapEnabled&&e.receiveShadow&&0<x,shadowMapType:J.shadowMapType,shadowMapDebug:J.shadowMapDebug,shadowMapCascade:J.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},I=[];m?I.push(m):
-(I.push(d.fragmentShader),I.push(d.vertexShader));if(void 0!==d.defines)for(var N in d.defines)I.push(N),I.push(d.defines[N]);for(N in K)I.push(N),I.push(K[N]);for(var X=I.join(),oa,Ca=0,db=Wa.length;Ca<db;Ca++){var Ia=Wa[Ca];if(Ia.code===X){oa=Ia;oa.usedTimes++;break}}void 0===oa&&(oa=new THREE.WebGLProgram(J,X,d,K),Wa.push(oa),J.info.memory.programs=Wa.length);d.program=oa;var Sa=oa.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var aa,ca="morphTarget",xa=0;xa<J.maxMorphTargets;xa++)aa=
-ca+xa,0<=Sa[aa]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,ca="morphNormal",xa=0;xa<J.maxMorphNormals;xa++)aa=ca+xa,0<=Sa[aa]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var eb in d.__webglShader.uniforms){var fb=d.program.uniforms[eb];fb&&d.uniformsList.push([d.__webglShader.uniforms[eb],fb])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(J.maxMorphTargets));var qa=!1,pa=!1,Ba=!1,wa=
+THREE.SpotLight&&r++,u instanceof THREE.HemisphereLight&&t++)}f=p;g=q;h=r;k=t;for(var x,y=0,H=0,F=b.length;H<F;H++){var A=b[H];A.castShadow&&(A instanceof THREE.SpotLight&&y++,A instanceof THREE.DirectionalLight&&!A.shadowCascade&&y++)}x=y;var C;if(Ub&&e&&e.skeleton&&e.skeleton.useVertexTexture)C=1024;else{var G=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),V=Math.floor((G-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(V=Math.min(e.skeleton.bones.length,V),V<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+
+e.skeleton.bones.length+", this GPU supports just "+V+" (try OpenGL instead of ANGLE)"));C=V}var L={precision:Q,supportsVertexTextures:Mb,map:!!d.map,envMap:!!d.envMap,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:La,skinning:d.skinning,maxBones:C,useVertexTexture:Ub&&e&&e.skeleton&&e.skeleton.useVertexTexture,
+morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:K.maxMorphTargets,maxMorphNormals:K.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:x,shadowMapEnabled:K.shadowMapEnabled&&e.receiveShadow&&0<x,shadowMapType:K.shadowMapType,shadowMapDebug:K.shadowMapDebug,shadowMapCascade:K.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},J=[];m?J.push(m):
+(J.push(d.fragmentShader),J.push(d.vertexShader));if(void 0!==d.defines)for(var N in d.defines)J.push(N),J.push(d.defines[N]);for(N in L)J.push(N),J.push(L[N]);for(var X=J.join(),oa,Ca=0,db=Wa.length;Ca<db;Ca++){var Ia=Wa[Ca];if(Ia.code===X){oa=Ia;oa.usedTimes++;break}}void 0===oa&&(oa=new THREE.WebGLProgram(K,X,d,L),Wa.push(oa),K.info.memory.programs=Wa.length);d.program=oa;var Sa=oa.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var aa,ca="morphTarget",xa=0;xa<K.maxMorphTargets;xa++)aa=
+ca+xa,0<=Sa[aa]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,ca="morphNormal",xa=0;xa<K.maxMorphNormals;xa++)aa=ca+xa,0<=Sa[aa]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var eb in d.__webglShader.uniforms){var fb=d.program.uniforms[eb];fb&&d.uniformsList.push([d.__webglShader.uniforms[eb],fb])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var qa=!1,pa=!1,Ba=!1,wa=
 d.program,ga=wa.uniforms,O=d.__webglShader.uniforms;wa.id!==Vb&&(l.useProgram(wa.program),Vb=wa.id,Ba=pa=qa=!0);d.id!==Cb&&(-1===Cb&&(Ba=!0),Cb=d.id,pa=!0);if(qa||a!==Jb)l.uniformMatrix4fv(ga.projectionMatrix,!1,a.projectionMatrix.elements),La&&l.uniform1f(ga.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Jb&&(Jb=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==ga.cameraPosition&&(Da.setFromMatrixPosition(a.matrixWorld),l.uniform3f(ga.cameraPosition,
 Da.x,Da.y,Da.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==ga.viewMatrix&&l.uniformMatrix4fv(ga.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==ga.bindMatrix&&l.uniformMatrix4fv(ga.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&null!==ga.bindMatrixInverse&&l.uniformMatrix4fv(ga.bindMatrixInverse,!1,e.bindMatrixInverse.elements),
-Ub&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==ga.boneTexture){var ab=z();l.uniform1i(ga.boneTexture,ab);J.setTexture(e.skeleton.boneTexture,ab)}null!==ga.boneTextureWidth&&l.uniform1i(ga.boneTextureWidth,e.skeleton.boneTextureWidth);null!==ga.boneTextureHeight&&l.uniform1i(ga.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==ga.boneGlobalMatrices&&l.uniformMatrix4fv(ga.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(pa){c&&d.fog&&(O.fogColor.value=
+Ub&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==ga.boneTexture){var ab=z();l.uniform1i(ga.boneTexture,ab);K.setTexture(e.skeleton.boneTexture,ab)}null!==ga.boneTextureWidth&&l.uniform1i(ga.boneTextureWidth,e.skeleton.boneTextureWidth);null!==ga.boneTextureHeight&&l.uniform1i(ga.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==ga.boneGlobalMatrices&&l.uniformMatrix4fv(ga.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(pa){c&&d.fog&&(O.fogColor.value=
 c.color,c instanceof THREE.Fog?(O.fogNear.value=c.near,O.fogFar.value=c.far):c instanceof THREE.FogExp2&&(O.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Nb){var Ba=!0,fa,gb,Y,Ra=0,Xa=0,bb=0,ya,Fa,jb,ma,Ya,kb,ka=mc,Ma=ka.directional.colors,Ta=ka.directional.positions,nb=ka.point.colors,mb=ka.point.positions,zb=ka.point.distances,Ua=ka.spot.colors,Ga=ka.spot.positions,ob=ka.spot.distances,Na=ka.spot.directions,ha=ka.spot.anglesCos,
-ra=ka.spot.exponents,H=ka.hemi.skyColors,za=ka.hemi.groundColors,Za=ka.hemi.positions,vb=0,pb=0,Oa=0,Aa=0,$a=0,Ja=0,Ka=0,ib=0,wb=0,qb=0,B=0,cb=0;fa=0;for(gb=b.length;fa<gb;fa++)Y=b[fa],Y.onlyShadow||(ya=Y.color,ma=Y.intensity,kb=Y.distance,Y instanceof THREE.AmbientLight?Y.visible&&(J.gammaInput?(Ra+=ya.r*ya.r,Xa+=ya.g*ya.g,bb+=ya.b*ya.b):(Ra+=ya.r,Xa+=ya.g,bb+=ya.b)):Y instanceof THREE.DirectionalLight?($a+=1,Y.visible&&(la.setFromMatrixPosition(Y.matrixWorld),Da.setFromMatrixPosition(Y.target.matrixWorld),
-la.sub(Da),la.normalize(),wb=3*vb,Ta[wb]=la.x,Ta[wb+1]=la.y,Ta[wb+2]=la.z,J.gammaInput?D(Ma,wb,ya,ma*ma):w(Ma,wb,ya,ma),vb+=1)):Y instanceof THREE.PointLight?(Ja+=1,Y.visible&&(qb=3*pb,J.gammaInput?D(nb,qb,ya,ma*ma):w(nb,qb,ya,ma),Da.setFromMatrixPosition(Y.matrixWorld),mb[qb]=Da.x,mb[qb+1]=Da.y,mb[qb+2]=Da.z,zb[pb]=kb,pb+=1)):Y instanceof THREE.SpotLight?(Ka+=1,Y.visible&&(B=3*Oa,J.gammaInput?D(Ua,B,ya,ma*ma):w(Ua,B,ya,ma),la.setFromMatrixPosition(Y.matrixWorld),Ga[B]=la.x,Ga[B+1]=la.y,Ga[B+2]=la.z,
-ob[Oa]=kb,Da.setFromMatrixPosition(Y.target.matrixWorld),la.sub(Da),la.normalize(),Na[B]=la.x,Na[B+1]=la.y,Na[B+2]=la.z,ha[Oa]=Math.cos(Y.angle),ra[Oa]=Y.exponent,Oa+=1)):Y instanceof THREE.HemisphereLight&&(ib+=1,Y.visible&&(la.setFromMatrixPosition(Y.matrixWorld),la.normalize(),cb=3*Aa,Za[cb]=la.x,Za[cb+1]=la.y,Za[cb+2]=la.z,Fa=Y.color,jb=Y.groundColor,J.gammaInput?(Ya=ma*ma,D(H,cb,Fa,Ya),D(za,cb,jb,Ya)):(w(H,cb,Fa,ma),w(za,cb,jb,ma)),Aa+=1)));fa=3*vb;for(gb=Math.max(Ma.length,3*$a);fa<gb;fa++)Ma[fa]=
-0;fa=3*pb;for(gb=Math.max(nb.length,3*Ja);fa<gb;fa++)nb[fa]=0;fa=3*Oa;for(gb=Math.max(Ua.length,3*Ka);fa<gb;fa++)Ua[fa]=0;fa=3*Aa;for(gb=Math.max(H.length,3*ib);fa<gb;fa++)H[fa]=0;fa=3*Aa;for(gb=Math.max(za.length,3*ib);fa<gb;fa++)za[fa]=0;ka.directional.length=vb;ka.point.length=pb;ka.spot.length=Oa;ka.hemi.length=Aa;ka.ambient[0]=Ra;ka.ambient[1]=Xa;ka.ambient[2]=bb;Nb=!1}if(Ba){var sa=mc;O.ambientLightColor.value=sa.ambient;O.directionalLightColor.value=sa.directional.colors;O.directionalLightDirection.value=
+ra=ka.spot.exponents,I=ka.hemi.skyColors,za=ka.hemi.groundColors,Za=ka.hemi.positions,vb=0,pb=0,Oa=0,Aa=0,$a=0,Ja=0,Ka=0,ib=0,wb=0,qb=0,B=0,cb=0;fa=0;for(gb=b.length;fa<gb;fa++)Y=b[fa],Y.onlyShadow||(ya=Y.color,ma=Y.intensity,kb=Y.distance,Y instanceof THREE.AmbientLight?Y.visible&&(K.gammaInput?(Ra+=ya.r*ya.r,Xa+=ya.g*ya.g,bb+=ya.b*ya.b):(Ra+=ya.r,Xa+=ya.g,bb+=ya.b)):Y instanceof THREE.DirectionalLight?($a+=1,Y.visible&&(la.setFromMatrixPosition(Y.matrixWorld),Da.setFromMatrixPosition(Y.target.matrixWorld),
+la.sub(Da),la.normalize(),wb=3*vb,Ta[wb]=la.x,Ta[wb+1]=la.y,Ta[wb+2]=la.z,K.gammaInput?D(Ma,wb,ya,ma*ma):w(Ma,wb,ya,ma),vb+=1)):Y instanceof THREE.PointLight?(Ja+=1,Y.visible&&(qb=3*pb,K.gammaInput?D(nb,qb,ya,ma*ma):w(nb,qb,ya,ma),Da.setFromMatrixPosition(Y.matrixWorld),mb[qb]=Da.x,mb[qb+1]=Da.y,mb[qb+2]=Da.z,zb[pb]=kb,pb+=1)):Y instanceof THREE.SpotLight?(Ka+=1,Y.visible&&(B=3*Oa,K.gammaInput?D(Ua,B,ya,ma*ma):w(Ua,B,ya,ma),la.setFromMatrixPosition(Y.matrixWorld),Ga[B]=la.x,Ga[B+1]=la.y,Ga[B+2]=la.z,
+ob[Oa]=kb,Da.setFromMatrixPosition(Y.target.matrixWorld),la.sub(Da),la.normalize(),Na[B]=la.x,Na[B+1]=la.y,Na[B+2]=la.z,ha[Oa]=Math.cos(Y.angle),ra[Oa]=Y.exponent,Oa+=1)):Y instanceof THREE.HemisphereLight&&(ib+=1,Y.visible&&(la.setFromMatrixPosition(Y.matrixWorld),la.normalize(),cb=3*Aa,Za[cb]=la.x,Za[cb+1]=la.y,Za[cb+2]=la.z,Fa=Y.color,jb=Y.groundColor,K.gammaInput?(Ya=ma*ma,D(I,cb,Fa,Ya),D(za,cb,jb,Ya)):(w(I,cb,Fa,ma),w(za,cb,jb,ma)),Aa+=1)));fa=3*vb;for(gb=Math.max(Ma.length,3*$a);fa<gb;fa++)Ma[fa]=
+0;fa=3*pb;for(gb=Math.max(nb.length,3*Ja);fa<gb;fa++)nb[fa]=0;fa=3*Oa;for(gb=Math.max(Ua.length,3*Ka);fa<gb;fa++)Ua[fa]=0;fa=3*Aa;for(gb=Math.max(I.length,3*ib);fa<gb;fa++)I[fa]=0;fa=3*Aa;for(gb=Math.max(za.length,3*ib);fa<gb;fa++)za[fa]=0;ka.directional.length=vb;ka.point.length=pb;ka.spot.length=Oa;ka.hemi.length=Aa;ka.ambient[0]=Ra;ka.ambient[1]=Xa;ka.ambient[2]=bb;Nb=!1}if(Ba){var sa=mc;O.ambientLightColor.value=sa.ambient;O.directionalLightColor.value=sa.directional.colors;O.directionalLightDirection.value=
 sa.directional.positions;O.pointLightColor.value=sa.point.colors;O.pointLightPosition.value=sa.point.positions;O.pointLightDistance.value=sa.point.distances;O.spotLightColor.value=sa.spot.colors;O.spotLightPosition.value=sa.spot.positions;O.spotLightDistance.value=sa.spot.distances;O.spotLightDirection.value=sa.spot.directions;O.spotLightAngleCos.value=sa.spot.anglesCos;O.spotLightExponent.value=sa.spot.exponents;O.hemisphereLightSkyColor.value=sa.hemi.skyColors;O.hemisphereLightGroundColor.value=
-sa.hemi.groundColors;O.hemisphereLightDirection.value=sa.hemi.positions;E(O,!0)}else E(O,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){O.opacity.value=d.opacity;J.gammaInput?O.diffuse.value.copyGammaToLinear(d.color):O.diffuse.value=d.color;O.map.value=d.map;O.lightMap.value=d.lightMap;O.specularMap.value=d.specularMap;O.alphaMap.value=d.alphaMap;d.bumpMap&&(O.bumpMap.value=d.bumpMap,O.bumpScale.value=d.bumpScale);d.normalMap&&
+sa.hemi.groundColors;O.hemisphereLightDirection.value=sa.hemi.positions;E(O,!0)}else E(O,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){O.opacity.value=d.opacity;K.gammaInput?O.diffuse.value.copyGammaToLinear(d.color):O.diffuse.value=d.color;O.map.value=d.map;O.lightMap.value=d.lightMap;O.specularMap.value=d.specularMap;O.alphaMap.value=d.alphaMap;d.bumpMap&&(O.bumpMap.value=d.bumpMap,O.bumpScale.value=d.bumpScale);d.normalMap&&
 (O.normalMap.value=d.normalMap,O.normalScale.value.copy(d.normalScale));var na;d.map?na=d.map:d.specularMap?na=d.specularMap:d.normalMap?na=d.normalMap:d.bumpMap?na=d.bumpMap:d.alphaMap&&(na=d.alphaMap);if(void 0!==na){var ub=na.offset,yb=na.repeat;O.offsetRepeat.value.set(ub.x,ub.y,yb.x,yb.y)}O.envMap.value=d.envMap;O.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;O.reflectivity.value=d.reflectivity;O.refractionRatio.value=d.refractionRatio;O.combine.value=d.combine;O.useRefract.value=
 d.envMap&&(d.envMap.mapping===THREE.CubeRefractionMapping||d.envMap.mapping===THREE.EquirectangularRefractionMapping)}d instanceof THREE.LineBasicMaterial?(O.diffuse.value=d.color,O.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(O.diffuse.value=d.color,O.opacity.value=d.opacity,O.dashSize.value=d.dashSize,O.totalSize.value=d.dashSize+d.gapSize,O.scale.value=d.scale):d instanceof THREE.PointCloudMaterial?(O.psColor.value=d.color,O.opacity.value=d.opacity,O.size.value=d.size,O.scale.value=
-P.height/2,O.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(O.shininess.value=d.shininess,J.gammaInput?(O.ambient.value.copyGammaToLinear(d.ambient),O.emissive.value.copyGammaToLinear(d.emissive),O.specular.value.copyGammaToLinear(d.specular)):(O.ambient.value=d.ambient,O.emissive.value=d.emissive,O.specular.value=d.specular),d.wrapAround&&O.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(J.gammaInput?(O.ambient.value.copyGammaToLinear(d.ambient),O.emissive.value.copyGammaToLinear(d.emissive)):
+P.height/2,O.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(O.shininess.value=d.shininess,K.gammaInput?(O.ambient.value.copyGammaToLinear(d.ambient),O.emissive.value.copyGammaToLinear(d.emissive),O.specular.value.copyGammaToLinear(d.specular)):(O.ambient.value=d.ambient,O.emissive.value=d.emissive,O.specular.value=d.specular),d.wrapAround&&O.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(K.gammaInput?(O.ambient.value.copyGammaToLinear(d.ambient),O.emissive.value.copyGammaToLinear(d.emissive)):
 (O.ambient.value=d.ambient,O.emissive.value=d.emissive),d.wrapAround&&O.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(O.mNear.value=a.near,O.mFar.value=a.far,O.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(O.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&O.shadowMatrix)for(var Ab=0,tb=0,Xb=b.length;tb<Xb;tb++){var lb=b[tb];lb.castShadow&&(lb instanceof THREE.SpotLight||lb instanceof THREE.DirectionalLight&&!lb.shadowCascade)&&(O.shadowMap.value[Ab]=
 lb.shadowMap,O.shadowMapSize.value[Ab]=lb.shadowMapSize,O.shadowMatrix.value[Ab]=lb.shadowMatrix,O.shadowDarkness.value[Ab]=lb.shadowDarkness,O.shadowBias.value[Ab]=lb.shadowBias,Ab++)}for(var Db=d.uniformsList,W,Ha,Va,Eb=0,Ob=Db.length;Eb<Ob;Eb++){var $=Db[Eb][0];if(!1!==$.needsUpdate){var Fb=$.type,R=$.value,S=Db[Eb][1];switch(Fb){case "1i":l.uniform1i(S,R);break;case "1f":l.uniform1f(S,R);break;case "2f":l.uniform2f(S,R[0],R[1]);break;case "3f":l.uniform3f(S,R[0],R[1],R[2]);break;case "4f":l.uniform4f(S,
 R[0],R[1],R[2],R[3]);break;case "1iv":l.uniform1iv(S,R);break;case "3iv":l.uniform3iv(S,R);break;case "1fv":l.uniform1fv(S,R);break;case "2fv":l.uniform2fv(S,R);break;case "3fv":l.uniform3fv(S,R);break;case "4fv":l.uniform4fv(S,R);break;case "Matrix3fv":l.uniformMatrix3fv(S,!1,R);break;case "Matrix4fv":l.uniformMatrix4fv(S,!1,R);break;case "i":l.uniform1i(S,R);break;case "f":l.uniform1f(S,R);break;case "v2":l.uniform2f(S,R.x,R.y);break;case "v3":l.uniform3f(S,R.x,R.y,R.z);break;case "v4":l.uniform4f(S,
 R.x,R.y,R.z,R.w);break;case "c":l.uniform3f(S,R.r,R.g,R.b);break;case "iv1":l.uniform1iv(S,R);break;case "iv":l.uniform3iv(S,R);break;case "fv1":l.uniform1fv(S,R);break;case "fv":l.uniform3fv(S,R);break;case "v2v":void 0===$._array&&($._array=new Float32Array(2*R.length));for(var Z=0,Ea=R.length;Z<Ea;Z++)Va=2*Z,$._array[Va]=R[Z].x,$._array[Va+1]=R[Z].y;l.uniform2fv(S,$._array);break;case "v3v":void 0===$._array&&($._array=new Float32Array(3*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)Va=3*Z,$._array[Va]=
 R[Z].x,$._array[Va+1]=R[Z].y,$._array[Va+2]=R[Z].z;l.uniform3fv(S,$._array);break;case "v4v":void 0===$._array&&($._array=new Float32Array(4*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)Va=4*Z,$._array[Va]=R[Z].x,$._array[Va+1]=R[Z].y,$._array[Va+2]=R[Z].z,$._array[Va+3]=R[Z].w;l.uniform4fv(S,$._array);break;case "m3":l.uniformMatrix3fv(S,!1,R.elements);break;case "m3v":void 0===$._array&&($._array=new Float32Array(9*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)R[Z].flattenToArrayOffset($._array,9*Z);l.uniformMatrix3fv(S,
 !1,$._array);break;case "m4":l.uniformMatrix4fv(S,!1,R.elements);break;case "m4v":void 0===$._array&&($._array=new Float32Array(16*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)R[Z].flattenToArrayOffset($._array,16*Z);l.uniformMatrix4fv(S,!1,$._array);break;case "t":W=R;Ha=z();l.uniform1i(S,Ha);if(!W)continue;if(W instanceof THREE.CubeTexture||W.image instanceof Array&&6===W.image.length){var ja=W,Bb=Ha;if(6===ja.image.length)if(ja.needsUpdate){ja.image.__webglTextureCube||(ja.addEventListener("dispose",
-Wb),ja.image.__webglTextureCube=l.createTexture(),J.info.memory.textures++);l.activeTexture(l.TEXTURE0+Bb);l.bindTexture(l.TEXTURE_CUBE_MAP,ja.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,ja.flipY);for(var Gb=ja instanceof THREE.CompressedTexture,ba=ja.image[0]instanceof THREE.DataTexture,hb=[],ta=0;6>ta;ta++)hb[ta]=!J.autoScaleCubemaps||Gb||ba?ba?ja.image[ta].image:ja.image[ta]:M(ja.image[ta],Cc);var Pb=hb[0],Qb=THREE.Math.isPowerOfTwo(Pb.width)&&THREE.Math.isPowerOfTwo(Pb.height),
+Wb),ja.image.__webglTextureCube=l.createTexture(),K.info.memory.textures++);l.activeTexture(l.TEXTURE0+Bb);l.bindTexture(l.TEXTURE_CUBE_MAP,ja.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,ja.flipY);for(var Gb=ja instanceof THREE.CompressedTexture,ba=ja.image[0]instanceof THREE.DataTexture,hb=[],ta=0;6>ta;ta++)hb[ta]=!K.autoScaleCubemaps||Gb||ba?ba?ja.image[ta].image:ja.image[ta]:M(ja.image[ta],Cc);var Pb=hb[0],Qb=THREE.Math.isPowerOfTwo(Pb.width)&&THREE.Math.isPowerOfTwo(Pb.height),
 rb=T(ja.format),Rb=T(ja.type);U(l.TEXTURE_CUBE_MAP,ja,Qb);for(ta=0;6>ta;ta++)if(Gb)for(var xb,Hb=hb[ta].mipmaps,sb=0,Yb=Hb.length;sb<Yb;sb++)xb=Hb[sb],ja.format!==THREE.RGBAFormat&&ja.format!==THREE.RGBFormat?-1<nc().indexOf(rb)?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ta,sb,rb,xb.width,xb.height,0,xb.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ta,sb,rb,xb.width,xb.height,0,rb,Rb,xb.data);else ba?l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
-ta,0,rb,hb[ta].width,hb[ta].height,0,rb,Rb,hb[ta].data):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ta,0,rb,rb,Rb,hb[ta]);ja.generateMipmaps&&Qb&&l.generateMipmap(l.TEXTURE_CUBE_MAP);ja.needsUpdate=!1;if(ja.onUpdate)ja.onUpdate()}else l.activeTexture(l.TEXTURE0+Bb),l.bindTexture(l.TEXTURE_CUBE_MAP,ja.image.__webglTextureCube)}else if(W instanceof THREE.WebGLRenderTargetCube){var Zb=W;l.activeTexture(l.TEXTURE0+Ha);l.bindTexture(l.TEXTURE_CUBE_MAP,Zb.__webglTexture)}else J.setTexture(W,Ha);break;case "tv":void 0===
-$._array&&($._array=[]);Z=0;for(Ea=$.value.length;Z<Ea;Z++)$._array[Z]=z();l.uniform1iv(S,$._array);Z=0;for(Ea=$.value.length;Z<Ea;Z++)W=$.value[Z],Ha=$._array[Z],W&&J.setTexture(W,Ha);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Fb)}}}}l.uniformMatrix4fv(ga.modelViewMatrix,!1,e._modelViewMatrix.elements);ga.normalMatrix&&l.uniformMatrix3fv(ga.normalMatrix,!1,e._normalMatrix.elements);null!==ga.modelMatrix&&l.uniformMatrix4fv(ga.modelMatrix,!1,e.matrixWorld.elements);return wa}
+ta,0,rb,hb[ta].width,hb[ta].height,0,rb,Rb,hb[ta].data):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ta,0,rb,rb,Rb,hb[ta]);ja.generateMipmaps&&Qb&&l.generateMipmap(l.TEXTURE_CUBE_MAP);ja.needsUpdate=!1;if(ja.onUpdate)ja.onUpdate()}else l.activeTexture(l.TEXTURE0+Bb),l.bindTexture(l.TEXTURE_CUBE_MAP,ja.image.__webglTextureCube)}else if(W instanceof THREE.WebGLRenderTargetCube){var Zb=W;l.activeTexture(l.TEXTURE0+Ha);l.bindTexture(l.TEXTURE_CUBE_MAP,Zb.__webglTexture)}else K.setTexture(W,Ha);break;case "tv":void 0===
+$._array&&($._array=[]);Z=0;for(Ea=$.value.length;Z<Ea;Z++)$._array[Z]=z();l.uniform1iv(S,$._array);Z=0;for(Ea=$.value.length;Z<Ea;Z++)W=$.value[Z],Ha=$._array[Z],W&&K.setTexture(W,Ha);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Fb)}}}}l.uniformMatrix4fv(ga.modelViewMatrix,!1,e._modelViewMatrix.elements);ga.normalMatrix&&l.uniformMatrix3fv(ga.normalMatrix,!1,e._normalMatrix.elements);null!==ga.modelMatrix&&l.uniformMatrix4fv(ga.modelMatrix,!1,e.matrixWorld.elements);return wa}
 function E(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.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=
 b;a.hemisphereLightDirection.needsUpdate=b}function z(){var a=Ib;a>=oc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+oc);Ib+=1;return a}function F(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function D(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function w(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function C(a){a!==pc&&(l.lineWidth(a),pc=a)}function A(a,
 b,c){qc!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),qc=a);!a||rc===b&&sc===c||(l.polygonOffset(b,c),rc=b,sc=c)}function U(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,T(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,T(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,T(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,T(b.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.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 is set to THREE.ClampToEdgeWrapping. ( "+b.sourceFile+" )"),l.texParameteri(a,l.TEXTURE_MAG_FILTER,N(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,N(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter is set to THREE.LinearFilter or THREE.NearestFilter. ( "+
-b.sourceFile+" )"));(c=aa.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(l.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,J.getMaxAnisotropy())),b.__oldAnisotropy=b.anisotropy)}function M(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.log("THREE.WebGLRenderer:",a,"is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height+".");return d}return a}function I(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,
-l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function K(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null))}function N(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?
+b.sourceFile+" )"));(c=aa.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(l.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,K.getMaxAnisotropy())),b.__oldAnisotropy=b.anisotropy)}function M(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.log("THREE.WebGLRenderer:",a,"is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height+".");return d}return a}function J(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,
+l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function L(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null))}function N(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?
 l.NEAREST:l.LINEAR}function T(a){var b;if(a===THREE.RepeatWrapping)return l.REPEAT;if(a===THREE.ClampToEdgeWrapping)return l.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return l.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return l.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return l.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return l.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return l.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return l.LINEAR_MIPMAP_NEAREST;if(a===
 THREE.LinearMipMapLinearFilter)return l.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return l.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return l.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return l.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return l.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return l.BYTE;if(a===THREE.ShortType)return l.SHORT;if(a===THREE.UnsignedShortType)return l.UNSIGNED_SHORT;if(a===THREE.IntType)return l.INT;if(a===THREE.UnsignedIntType)return l.UNSIGNED_INT;
 if(a===THREE.FloatType)return l.FLOAT;if(a===THREE.AlphaFormat)return l.ALPHA;if(a===THREE.RGBFormat)return l.RGB;if(a===THREE.RGBAFormat)return l.RGBA;if(a===THREE.LuminanceFormat)return l.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return l.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return l.FUNC_ADD;if(a===THREE.SubtractEquation)return l.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return l.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return l.ZERO;if(a===THREE.OneFactor)return l.ONE;if(a===
@@ -520,7 +521,7 @@ THREE.SrcColorFactor)return l.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)retu
 b=aa.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=aa.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=aa.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 P=void 0!==a.canvas?a.canvas:document.createElement("canvas"),X=void 0!==a.context?a.context:null,Q=void 0!==a.precision?a.precision:"highp",pa=
 void 0!==a.alpha?a.alpha:!1,ca=void 0!==a.depth?a.depth:!0,Ba=void 0!==a.stencil?a.stencil:!0,G=void 0!==a.antialias?a.antialias:!1,wa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,qa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,La=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,V=new THREE.Color(0),db=0,oa=[],Ca={},Ia=[],xa=[],Sa=[],eb=[],fb=[];this.domElement=P;this.context=null;this.devicePixelRatio=void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortObjects=
-this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var J=this,Wa=[],Vb=null,tc=null,Cb=-1,ab=-1,Jb=null,Ib=0,mb=-1,
+this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var K=this,Wa=[],Vb=null,tc=null,Cb=-1,ab=-1,Jb=null,Ib=0,mb=-1,
 yb=-1,Xb=-1,Yb=-1,Zb=-1,ec=-1,fc=-1,gc=-1,qc=null,rc=null,sc=null,pc=null,tb=0,bb=0,Xa=P.width,zb=P.height,uc=0,vc=0,ib=new Uint8Array(16),Ra=new Uint8Array(16),kb=new THREE.Frustum,ub=new THREE.Matrix4;new THREE.Matrix4;var Da=new THREE.Vector3,la=new THREE.Vector3,Nb=!0,mc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],
 groundColors:[],positions:[]}},l;try{var wc={alpha:pa,depth:ca,stencil:Ba,antialias:G,premultipliedAlpha:wa,preserveDrawingBuffer:qa};l=X||P.getContext("webgl",wc)||P.getContext("experimental-webgl",wc);if(null===l){if(null!==P.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}P.addEventListener("webglcontextlost",function(a){a.preventDefault();xc();yc();Ca={}},!1)}catch(Dc){console.error(Dc)}void 0===l.getShaderPrecisionFormat&&
 (l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var aa=new THREE.WebGLExtensions(l);aa.get("OES_texture_float");aa.get("OES_texture_float_linear");aa.get("OES_standard_derivatives");La&&aa.get("EXT_frag_depth");var yc=function(){l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);
@@ -532,41 +533,41 @@ this.supportsBlendMinMax=function(){return aa.get("EXT_blend_minmax")};this.getM
 function(a,b,c,d){tb=a*this.devicePixelRatio;bb=b*this.devicePixelRatio;Xa=c*this.devicePixelRatio;zb=d*this.devicePixelRatio;l.viewport(tb,bb,Xa,zb)};this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColor=function(a,b){V.set(a);db=void 0!==b?b:1;l.clearColor(V.r,V.g,V.b,db)};this.setClearColorHex=function(a,
 b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return V};this.getClearAlpha=function(){return db};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearColor=function(){l.clear(l.COLOR_BUFFER_BIT)};this.clearDepth=function(){l.clear(l.DEPTH_BUFFER_BIT)};this.clearStencil=
 function(){l.clear(l.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=xc;var hc=function(a){a.target.traverse(function(a){a.removeEventListener("remove",hc);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete Ca[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=Ia,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;
-delete a._normalMatrix;delete a.__webglActive})},ic=function(a){a=a.target;a.removeEventListener("dispose",ic);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(l.deleteBuffer(c.buffer),delete c.buffer)}J.info.memory.geometries--}else if(b=jb[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)l.deleteBuffer(e.__webglMorphTargetsBuffers[f]);
+delete a._normalMatrix;delete a.__webglActive})},ic=function(a){a=a.target;a.removeEventListener("dispose",ic);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(l.deleteBuffer(c.buffer),delete c.buffer)}K.info.memory.geometries--}else if(b=jb[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)l.deleteBuffer(e.__webglMorphTargetsBuffers[f]);
 delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f=0;for(g=e.numMorphNormals;f<g;f++)l.deleteBuffer(e.__webglMorphNormalsBuffers[f]);delete e.__webglMorphNormalsBuffers}Ac(e)}delete jb[a.id]}else Ac(a);ab=-1},Wb=function(a){a=a.target;a.removeEventListener("dispose",Wb);a.image&&a.image.__webglTextureCube?(l.deleteTexture(a.image.__webglTextureCube),delete a.image.__webglTextureCube):void 0!==a.__webglInit&&(l.deleteTexture(a.__webglTexture),delete a.__webglTexture,delete a.__webglInit);
-J.info.memory.textures--},Bc=function(a){a=a.target;a.removeEventListener("dispose",Bc);if(a&&void 0!==a.__webglTexture){l.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}J.info.memory.textures--},
+K.info.memory.textures--},Bc=function(a){a=a.target;a.removeEventListener("dispose",Bc);if(a&&void 0!==a.__webglTexture){l.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}K.info.memory.textures--},
 lc=function(a){a=a.target;a.removeEventListener("dispose",lc);kc(a)},Ac=function(a){for(var b="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),c=0,d=b.length;c<d;c++){var e=b[c];void 0!==a[e]&&(l.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(e in a.__webglCustomAttributesList)l.deleteBuffer(a.__webglCustomAttributesList[e].buffer);
-delete a.__webglCustomAttributesList}J.info.memory.geometries--},kc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Wa.length;a<c;a++)if(d=Wa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Wa.length;a<c;a++)d=Wa[a],d.program!==b&&e.push(d);Wa=e;l.deleteProgram(b);J.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){f();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());
+delete a.__webglCustomAttributesList}K.info.memory.geometries--},kc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Wa.length;a<c;a++)if(d=Wa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Wa.length;a<c;a++)d=Wa[a],d.program!==b&&e.push(d);Wa=e;l.deleteProgram(b);K.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){f();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());
 a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=l.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=l.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=l.createBuffer());a.hasPositions&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),g(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormals){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);
 if(c.shading===THREE.FlatShading){var d,e,k,m,n,p,q,r,t,s,v,u=3*a.count;for(v=0;v<u;v+=9)s=a.normalArray,d=s[v],e=s[v+1],k=s[v+2],m=s[v+3],p=s[v+4],r=s[v+5],n=s[v+6],q=s[v+7],t=s[v+8],d=(d+m+n)/3,e=(e+p+q)/3,k=(k+r+t)/3,s[v]=d,s[v+1]=e,s[v+2]=k,s[v+3]=d,s[v+4]=e,s[v+5]=k,s[v+6]=d,s[v+7]=e,s[v+8]=k}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);g(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer),
 l.bufferData(l.ARRAY_BUFFER,a.uvArray,l.DYNAMIC_DRAW),g(b.attributes.uv),l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW),g(b.attributes.color),l.vertexAttribPointer(b.attributes.color,3,l.FLOAT,!1,0,0));h();l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,g,h){if(!1!==d.visible)if(v(h),a=x(a,b,c,d,
-h),b=!1,c=16777215*g.id+2*a.id+(d.wireframe?1:0),c!==ab&&(ab=c,b=!0),b&&f(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?l.LINES:l.TRIANGLES,c=g.attributes.index){var k,m;c.array instanceof Uint32Array&&aa.get("OES_element_index_uint")?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2);var n=g.offsets;if(0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.vertices+=c.array.length,J.info.render.faces+=c.array.length/
-3;else{b=!0;for(var p=0,q=n.length;p<q;p++){var r=n[p].index;b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);J.info.render.calls++;J.info.render.vertices+=n[p].count;J.info.render.faces+=n[p].count/3}}}else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.vertices+=d.array.length/3,J.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)if(h=l.POINTS,c=g.attributes.index)if(c.array instanceof
-Uint32Array&&aa.get("OES_element_index_uint")?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=g.offsets,0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.points+=c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)r=n[p].index,b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),J.info.render.calls++,J.info.render.points+=n[p].count;
-else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,C(d.linewidth),c=g.attributes.index)if(c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=g.offsets,0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.vertices+=
-c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)r=n[p].index,b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),J.info.render.calls++,J.info.render.vertices+=n[p].count;else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length/3};this.renderBuffer=function(a,b,c,d,e,k){if(!1!==d.visible){v(k);c=x(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+
+h),b=!1,c=16777215*g.id+2*a.id+(d.wireframe?1:0),c!==ab&&(ab=c,b=!0),b&&f(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?l.LINES:l.TRIANGLES,c=g.attributes.index){var k,m;c.array instanceof Uint32Array&&aa.get("OES_element_index_uint")?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2);var n=g.offsets;if(0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),K.info.render.calls++,K.info.render.vertices+=c.array.length,K.info.render.faces+=c.array.length/
+3;else{b=!0;for(var p=0,q=n.length;p<q;p++){var s=n[p].index;b&&(e(d,a,g,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);K.info.render.calls++;K.info.render.vertices+=n[p].count;K.info.render.faces+=n[p].count/3}}}else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),K.info.render.calls++,K.info.render.vertices+=d.array.length/3,K.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)if(h=l.POINTS,c=g.attributes.index)if(c.array instanceof
+Uint32Array&&aa.get("OES_element_index_uint")?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=g.offsets,0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),K.info.render.calls++,K.info.render.points+=c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)s=n[p].index,b&&(e(d,a,g,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),K.info.render.calls++,K.info.render.points+=n[p].count;
+else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),K.info.render.calls++,K.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,C(d.linewidth),c=g.attributes.index)if(c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=g.offsets,0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),K.info.render.calls++,K.info.render.vertices+=
+c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)s=n[p].index,b&&(e(d,a,g,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),K.info.render.calls++,K.info.render.vertices+=n[p].count;else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),K.info.render.calls++,K.info.render.points+=d.array.length/3};this.renderBuffer=function(a,b,c,d,e,k){if(!1!==d.visible){v(k);c=x(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+
 (d.wireframe?1:0);c!==ab&&(ab=c,a=!0);a&&f();if(!d.morphTargets&&0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),g(b.position),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k.morphTargetBase]),g(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),g(c.position),
 l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var m=0,n=k.morphTargetForcedOrder,q=k.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<n.length;)0<=c["morphTarget"+m]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n[m]]),g(c["morphTarget"+m]),l.vertexAttribPointer(c["morphTarget"+m],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n[m]]),g(c["morphNormal"+m]),l.vertexAttribPointer(c["morphNormal"+
-m],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=q[n[m]],m++;else{var n=[],q=k.morphTargetInfluences,r,s=q.length;for(r=0;r<s;r++)m=q[r],0<m&&n.push([m,r]);n.length>d.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals?n.sort(p):0===n.length&&n.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)n[m]?(r=n[m][1],0<=c["morphTarget"+m]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[r]),g(c["morphTarget"+m]),l.vertexAttribPointer(c["morphTarget"+
-m],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[r]),g(c["morphNormal"+m]),l.vertexAttribPointer(c["morphNormal"+m],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=q[r]):k.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(c=0,q=e.__webglCustomAttributesList.length;c<
+m],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=q[n[m]],m++;else{var n=[],q=k.morphTargetInfluences,s,r=q.length;for(s=0;s<r;s++)m=q[s],0<m&&n.push([m,s]);n.length>d.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals?n.sort(p):0===n.length&&n.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)n[m]?(s=n[m][1],0<=c["morphTarget"+m]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[s]),g(c["morphTarget"+m]),l.vertexAttribPointer(c["morphTarget"+
+m],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[s]),g(c["morphNormal"+m]),l.vertexAttribPointer(c["morphNormal"+m],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=q[s]):k.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(c=0,q=e.__webglCustomAttributesList.length;c<
 q;c++)n=e.__webglCustomAttributesList[c],0<=b[n.buffer.belongsToAttribute]&&(l.bindBuffer(l.ARRAY_BUFFER,n.buffer),g(b[n.buffer.belongsToAttribute]),l.vertexAttribPointer(b[n.buffer.belongsToAttribute],n.size,l.FLOAT,!1,0,0));0<=b.color&&(0<k.geometry.colors.length||0<k.geometry.faces.length?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),g(b.color),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=
 b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),g(b.normal),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),g(b.tangent),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));0<=b.uv&&(k.geometry.faceVertexUvs[0]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),g(b.uv),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(k.geometry.faceVertexUvs[1]?
 (l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),g(b.uv2),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g(b.skinIndex),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g(b.skinWeight),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0));0<=b.lineDistance&&
-(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),g(b.lineDistance),l.vertexAttribPointer(b.lineDistance,1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,d.wireframe?(C(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),J.info.render.calls++,
-J.info.render.vertices+=e.__webglFaceCount,J.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,C(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),J.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),J.info.render.calls++,J.info.render.points+=e.__webglParticleCount)}};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;Cb=ab=-1;Jb=null;Nb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);ub.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);kb.setFromMatrix(ub);oa.length=0;xa.length=0;Sa.length=0;eb.length=0;fb.length=0;q(a);!0===J.sortObjects&&(xa.sort(k),Sa.sort(n));Lc.render(a,b);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=
-0;J.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var f=Ia.length;d<f;d++){var g=Ia[d],h=g.object;h.visible&&(F(h,b),s(g))}a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),A(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(xa,b,oa,e,!0,d),m(Sa,b,oa,e,!0,d),t(Ia,"",
-b,oa,e,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(xa,b,oa,e,!1,d),t(Ia,"opaque",b,oa,e,!1,d),m(Sa,b,oa,e,!0,d),t(Ia,"transparent",b,oa,e,!0,d));Mc.render(a,b);Nc.render(a,b,uc,vc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&K(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);ab=-1;J.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,kb):e.render(function(a){J.renderBufferImmediate(a,
+(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),g(b.lineDistance),l.vertexAttribPointer(b.lineDistance,1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,d.wireframe?(C(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),K.info.render.calls++,
+K.info.render.vertices+=e.__webglFaceCount,K.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,C(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),K.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),K.info.render.calls++,K.info.render.points+=e.__webglParticleCount)}};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;Cb=ab=-1;Jb=null;Nb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);ub.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);kb.setFromMatrix(ub);oa.length=0;xa.length=0;Sa.length=0;eb.length=0;fb.length=0;q(a);!0===K.sortObjects&&(xa.sort(k),Sa.sort(n));Lc.render(a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=
+0;K.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var f=Ia.length;d<f;d++){var g=Ia[d],h=g.object;h.visible&&(F(h,b),s(g))}a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),A(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(xa,b,oa,e,!0,d),m(Sa,b,oa,e,!0,d),t(Ia,"",
+b,oa,e,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(xa,b,oa,e,!1,d),t(Ia,"opaque",b,oa,e,!1,d),m(Sa,b,oa,e,!0,d),t(Ia,"transparent",b,oa,e,!0,d));Mc.render(a,b);Nc.render(a,b,uc,vc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&L(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);ab=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,kb):e.render(function(a){K.renderBufferImmediate(a,
 f,d)})};var jb={},jc=0;this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;mb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),mb=b);yb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),
 yb=a)};this.setDepthTest=function(a){fc!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),fc=a)};this.setDepthWrite=function(a){gc!==a&&(l.depthMask(a),gc=a)};this.setBlending=function(a,b,c,d){a!==Xb&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?
 (l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),Xb=a);if(a===THREE.CustomBlending){if(b!==Yb&&(l.blendEquation(T(b)),Yb=b),c!==Zb||d!==ec)l.blendFunc(T(c),T(d)),Zb=c,ec=d}else ec=Zb=Yb=null};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",
-Wb),a.__webglTexture=l.createTexture(),J.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=M(a.image,Fc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=T(a.format),e=T(a.type);U(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=
+Wb),a.__webglTexture=l.createTexture(),K.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=M(a.image,Fc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=T(a.format),e=T(a.type);U(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=
 0,h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g=0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<nc().indexOf(d)?l.compressedTexImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,b.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_2D,g,d,b.width,
-b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};this.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?J.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
-if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Bc);a.__webglTexture=l.createTexture();J.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=T(a.format),e=T(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);U(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();
-a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,h,g.__webglTexture,0);I(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),
+b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};this.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?K.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
+if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Bc);a.__webglTexture=l.createTexture();K.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=T(a.format),e=T(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);U(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();
+a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,h,g.__webglTexture,0);J(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),
 l.bindTexture(l.TEXTURE_2D,a.__webglTexture),U(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,
-l.RENDERBUFFER,a.__webglRenderbuffer):I(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Xa,a=zb,d=tb,e=bb);b!==tc&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),tc=b);uc=c;vc=a};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};
+l.RENDERBUFFER,a.__webglRenderbuffer):J(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Xa,a=zb,d=tb,e=bb);b!==tc&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),tc=b);uc=c;vc=a};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.")}};
 THREE.WebGLRenderTarget=function(a,b,c){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=null};
@@ -586,35 +587,35 @@ f.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader.
 e.useVertexTexture?(q.push("boneTexture"),q.push("boneTextureWidth"),q.push("boneTextureHeight")):q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&q.push("logDepthBufFC");for(var v in h)q.push(v);h=q;v={};q=0;for(b=h.length;q<b;q++)m=h[q],v[m]=f.getUniformLocation(g,m);this.uniforms=v;q="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(h=0;h<e.maxMorphTargets;h++)q.push("morphTarget"+h);for(h=0;h<e.maxMorphNormals;h++)q.push("morphNormal"+h);for(var y in k)q.push(y);
 e=q;k={};y=0;for(h=e.length;y<h;y++)v=e[y],k[v]=f.getAttribLocation(g,v);this.attributes=k;this.attributesKeys=Object.keys(this.attributes);this.id=a++;this.code=c;this.usedTimes=1;this.program=g;this.vertexShader=n;this.fragmentShader=p;return this}}();
 THREE.WebGLShader=function(){var a=function(a){a=a.split("\n");for(var c=0;c<a.length;c++)a[c]=c+1+": "+a[c];return a.join("\n")};return function(b,c,d){c=b.createShader(c);b.shaderSource(c,d);b.compileShader(c);!1===b.getShaderParameter(c,b.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(c)&&(console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",b.getShaderInfoLog(c)),console.warn(a(d)));return c}}();
-THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m=a.context,t,s,r,u,v,y;this.render=function(L,x,E,z){if(0!==b.length){L=new THREE.Vector3;var F=z/E,D=.5*E,w=.5*z,C=16/z,A=new THREE.Vector2(C*F,C),U=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1);if(void 0===r){var C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),I=new Uint16Array([0,1,2,0,2,3]);t=m.createBuffer();s=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,t);m.bufferData(m.ARRAY_BUFFER,C,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
-s);m.bufferData(m.ELEMENT_ARRAY_BUFFER,I,m.STATIC_DRAW);v=m.createTexture();y=m.createTexture();m.bindTexture(m.TEXTURE_2D,v);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);m.bindTexture(m.TEXTURE_2D,y);m.texImage2D(m.TEXTURE_2D,0,
+THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m=a.context,t,s,r,u,v,y;this.render=function(H,x,E,z){if(0!==b.length){H=new THREE.Vector3;var F=z/E,D=.5*E,w=.5*z,C=16/z,A=new THREE.Vector2(C*F,C),U=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1);if(void 0===r){var C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),J=new Uint16Array([0,1,2,0,2,3]);t=m.createBuffer();s=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,t);m.bufferData(m.ARRAY_BUFFER,C,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
+s);m.bufferData(m.ELEMENT_ARRAY_BUFFER,J,m.STATIC_DRAW);v=m.createTexture();y=m.createTexture();m.bindTexture(m.TEXTURE_2D,v);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);m.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 C=(u=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}"},
-I=m.createProgram(),K=m.createShader(m.FRAGMENT_SHADER),N=m.createShader(m.VERTEX_SHADER),T="precision "+a.getPrecision()+" float;\n";m.shaderSource(K,T+C.fragmentShader);m.shaderSource(N,T+C.vertexShader);m.compileShader(K);m.compileShader(N);m.attachShader(I,K);m.attachShader(I,N);m.linkProgram(I);r=I;p=m.getAttribLocation(r,"position");q=m.getAttribLocation(r,"uv");c=m.getUniformLocation(r,"renderType");d=m.getUniformLocation(r,"map");e=m.getUniformLocation(r,"occlusionMap");f=m.getUniformLocation(r,
-"opacity");g=m.getUniformLocation(r,"color");h=m.getUniformLocation(r,"scale");k=m.getUniformLocation(r,"rotation");n=m.getUniformLocation(r,"screenPosition")}m.useProgram(r);m.enableVertexAttribArray(p);m.enableVertexAttribArray(q);m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,t);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(q,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,s);m.disable(m.CULL_FACE);m.depthMask(!1);I=0;for(K=b.length;I<K;I++)if(C=16/z,A.set(C*
-F,C),N=b[I],L.set(N.matrixWorld.elements[12],N.matrixWorld.elements[13],N.matrixWorld.elements[14]),L.applyMatrix4(x.matrixWorldInverse),L.applyProjection(x.projectionMatrix),U.copy(L),M.x=U.x*D+D,M.y=U.y*w+w,u||0<M.x&&M.x<E&&0<M.y&&M.y<z){m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,M.x-8,M.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,A.x,A.y);m.uniform3f(n,U.x,U.y,U.z);m.disable(m.BLEND);m.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,
+J=m.createProgram(),L=m.createShader(m.FRAGMENT_SHADER),N=m.createShader(m.VERTEX_SHADER),T="precision "+a.getPrecision()+" float;\n";m.shaderSource(L,T+C.fragmentShader);m.shaderSource(N,T+C.vertexShader);m.compileShader(L);m.compileShader(N);m.attachShader(J,L);m.attachShader(J,N);m.linkProgram(J);r=J;p=m.getAttribLocation(r,"position");q=m.getAttribLocation(r,"uv");c=m.getUniformLocation(r,"renderType");d=m.getUniformLocation(r,"map");e=m.getUniformLocation(r,"occlusionMap");f=m.getUniformLocation(r,
+"opacity");g=m.getUniformLocation(r,"color");h=m.getUniformLocation(r,"scale");k=m.getUniformLocation(r,"rotation");n=m.getUniformLocation(r,"screenPosition")}m.useProgram(r);m.enableVertexAttribArray(p);m.enableVertexAttribArray(q);m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,t);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(q,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,s);m.disable(m.CULL_FACE);m.depthMask(!1);J=0;for(L=b.length;J<L;J++)if(C=16/z,A.set(C*
+F,C),N=b[J],H.set(N.matrixWorld.elements[12],N.matrixWorld.elements[13],N.matrixWorld.elements[14]),H.applyMatrix4(x.matrixWorldInverse),H.applyProjection(x.projectionMatrix),U.copy(H),M.x=U.x*D+D,M.y=U.y*w+w,u||0<M.x&&M.x<E&&0<M.y&&M.y<z){m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,M.x-8,M.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,A.x,A.y);m.uniform3f(n,U.x,U.y,U.z);m.disable(m.BLEND);m.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,
 0);m.activeTexture(m.TEXTURE0);m.bindTexture(m.TEXTURE_2D,y);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,M.x-8,M.y-8,16,16,0);m.uniform1i(c,1);m.disable(m.DEPTH_TEST);m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);N.positionScreen.copy(U);N.customUpdateCallback?N.customUpdateCallback(N):N.updateLensFlares();m.uniform1i(c,2);m.enable(m.BLEND);for(var T=0,P=N.lensFlares.length;T<P;T++){var X=N.lensFlares[T];.001<X.opacity&&.001<X.scale&&(U.x=X.x,
 U.y=X.y,U.z=X.z,C=X.size*X.scale/z,A.x=C*F,A.y=C,m.uniform3f(n,U.x,U.y,U.z),m.uniform2f(h,A.x,A.y),m.uniform1f(k,X.rotation),m.uniform1f(f,X.opacity),m.uniform3f(g,X.color.r,X.color.g,X.color.b),a.setBlending(X.blending,X.blendEquation,X.blendSrc,X.blendDst),a.setTexture(X.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(!0);a.resetGLState()}}};
 THREE.ShadowMapPlugin=function(a,b,c,d){function e(a,b,d){if(b.visible){var f=c[b.id];if(f&&b.castShadow&&(!1===b.frustumCulled||!0===p.intersectsObject(b)))for(var g=0,h=f.length;g<h;g++){var k=f[g];b._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,b.matrixWorld);r.push(k)}g=0;for(h=b.children.length;g<h;g++)e(a,b.children[g],d)}}var f=a.context,g,h,k,n,p=new THREE.Frustum,q=new THREE.Matrix4,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,r=[],u=THREE.ShaderLib.depthRGBA,v=THREE.UniformsUtils.clone(u.uniforms);
 g=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader});h=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0});k=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,skinning:!0});n=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0,skinning:!0});g._shadowPass=!0;h._shadowPass=!0;k._shadowPass=
-!0;n._shadowPass=!0;this.render=function(c,v){if(!1!==a.shadowMapEnabled){var u,E,z,F,D,w,C,A,U=[];F=0;f.clearColor(1,1,1,1);f.disable(f.BLEND);f.enable(f.CULL_FACE);f.frontFace(f.CCW);a.shadowMapCullFace===THREE.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK);a.setDepthTest(!0);u=0;for(E=b.length;u<E;u++)if(z=b[u],z.castShadow)if(z instanceof THREE.DirectionalLight&&z.shadowCascade)for(D=0;D<z.shadowCascadeCount;D++){var M;if(z.shadowCascadeArray[D])M=z.shadowCascadeArray[D];else{C=z;var I=
-D;M=new THREE.DirectionalLight;M.isVirtual=!0;M.onlyShadow=!0;M.castShadow=!0;M.shadowCameraNear=C.shadowCameraNear;M.shadowCameraFar=C.shadowCameraFar;M.shadowCameraLeft=C.shadowCameraLeft;M.shadowCameraRight=C.shadowCameraRight;M.shadowCameraBottom=C.shadowCameraBottom;M.shadowCameraTop=C.shadowCameraTop;M.shadowCameraVisible=C.shadowCameraVisible;M.shadowDarkness=C.shadowDarkness;M.shadowBias=C.shadowCascadeBias[I];M.shadowMapWidth=C.shadowCascadeWidth[I];M.shadowMapHeight=C.shadowCascadeHeight[I];
-M.pointsWorld=[];M.pointsFrustum=[];A=M.pointsWorld;w=M.pointsFrustum;for(var K=0;8>K;K++)A[K]=new THREE.Vector3,w[K]=new THREE.Vector3;A=C.shadowCascadeNearZ[I];C=C.shadowCascadeFarZ[I];w[0].set(-1,-1,A);w[1].set(1,-1,A);w[2].set(-1,1,A);w[3].set(1,1,A);w[4].set(-1,-1,C);w[5].set(1,-1,C);w[6].set(-1,1,C);w[7].set(1,1,C);M.originalCamera=v;w=new THREE.Gyroscope;w.position.copy(z.shadowCascadeOffset);w.add(M);w.add(M.target);v.add(w);z.shadowCascadeArray[D]=M;console.log("Created virtualLight",M)}I=
-z;A=D;C=I.shadowCascadeArray[A];C.position.copy(I.position);C.target.position.copy(I.target.position);C.lookAt(C.target);C.shadowCameraVisible=I.shadowCameraVisible;C.shadowDarkness=I.shadowDarkness;C.shadowBias=I.shadowCascadeBias[A];w=I.shadowCascadeNearZ[A];I=I.shadowCascadeFarZ[A];C=C.pointsFrustum;C[0].z=w;C[1].z=w;C[2].z=w;C[3].z=w;C[4].z=I;C[5].z=I;C[6].z=I;C[7].z=I;U[F]=M;F++}else U[F]=z,F++;u=0;for(E=U.length;u<E;u++){z=U[u];z.shadowMap||(D=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&
+!0;n._shadowPass=!0;this.render=function(c,v){if(!1!==a.shadowMapEnabled){var u,E,z,F,D,w,C,A,U=[];F=0;f.clearColor(1,1,1,1);f.disable(f.BLEND);f.enable(f.CULL_FACE);f.frontFace(f.CCW);a.shadowMapCullFace===THREE.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK);a.setDepthTest(!0);u=0;for(E=b.length;u<E;u++)if(z=b[u],z.castShadow)if(z instanceof THREE.DirectionalLight&&z.shadowCascade)for(D=0;D<z.shadowCascadeCount;D++){var M;if(z.shadowCascadeArray[D])M=z.shadowCascadeArray[D];else{C=z;var J=
+D;M=new THREE.DirectionalLight;M.isVirtual=!0;M.onlyShadow=!0;M.castShadow=!0;M.shadowCameraNear=C.shadowCameraNear;M.shadowCameraFar=C.shadowCameraFar;M.shadowCameraLeft=C.shadowCameraLeft;M.shadowCameraRight=C.shadowCameraRight;M.shadowCameraBottom=C.shadowCameraBottom;M.shadowCameraTop=C.shadowCameraTop;M.shadowCameraVisible=C.shadowCameraVisible;M.shadowDarkness=C.shadowDarkness;M.shadowBias=C.shadowCascadeBias[J];M.shadowMapWidth=C.shadowCascadeWidth[J];M.shadowMapHeight=C.shadowCascadeHeight[J];
+M.pointsWorld=[];M.pointsFrustum=[];A=M.pointsWorld;w=M.pointsFrustum;for(var L=0;8>L;L++)A[L]=new THREE.Vector3,w[L]=new THREE.Vector3;A=C.shadowCascadeNearZ[J];C=C.shadowCascadeFarZ[J];w[0].set(-1,-1,A);w[1].set(1,-1,A);w[2].set(-1,1,A);w[3].set(1,1,A);w[4].set(-1,-1,C);w[5].set(1,-1,C);w[6].set(-1,1,C);w[7].set(1,1,C);M.originalCamera=v;w=new THREE.Gyroscope;w.position.copy(z.shadowCascadeOffset);w.add(M);w.add(M.target);v.add(w);z.shadowCascadeArray[D]=M;console.log("Created virtualLight",M)}J=
+z;A=D;C=J.shadowCascadeArray[A];C.position.copy(J.position);C.target.position.copy(J.target.position);C.lookAt(C.target);C.shadowCameraVisible=J.shadowCameraVisible;C.shadowDarkness=J.shadowDarkness;C.shadowBias=J.shadowCascadeBias[A];w=J.shadowCascadeNearZ[A];J=J.shadowCascadeFarZ[A];C=C.pointsFrustum;C[0].z=w;C[1].z=w;C[2].z=w;C[3].z=w;C[4].z=J;C[5].z=J;C[6].z=J;C[7].z=J;U[F]=M;F++}else U[F]=z,F++;u=0;for(E=U.length;u<E;u++){z=U[u];z.shadowMap||(D=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&
 (D=THREE.NearestFilter),z.shadowMap=new THREE.WebGLRenderTarget(z.shadowMapWidth,z.shadowMapHeight,{minFilter:D,magFilter:D,format:THREE.RGBAFormat}),z.shadowMapSize=new THREE.Vector2(z.shadowMapWidth,z.shadowMapHeight),z.shadowMatrix=new THREE.Matrix4);if(!z.shadowCamera){if(z instanceof THREE.SpotLight)z.shadowCamera=new THREE.PerspectiveCamera(z.shadowCameraFov,z.shadowMapWidth/z.shadowMapHeight,z.shadowCameraNear,z.shadowCameraFar);else if(z instanceof THREE.DirectionalLight)z.shadowCamera=new THREE.OrthographicCamera(z.shadowCameraLeft,
 z.shadowCameraRight,z.shadowCameraTop,z.shadowCameraBottom,z.shadowCameraNear,z.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}c.add(z.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}z.shadowCameraVisible&&!z.cameraHelper&&(z.cameraHelper=new THREE.CameraHelper(z.shadowCamera),c.add(z.cameraHelper));if(z.isVirtual&&M.originalCamera==v){D=v;F=z.shadowCamera;w=z.pointsFrustum;C=z.pointsWorld;m.set(Infinity,Infinity,Infinity);t.set(-Infinity,-Infinity,-Infinity);
-for(I=0;8>I;I++)A=C[I],A.copy(w[I]),A.unproject(D),A.applyMatrix4(F.matrixWorldInverse),A.x<m.x&&(m.x=A.x),A.x>t.x&&(t.x=A.x),A.y<m.y&&(m.y=A.y),A.y>t.y&&(t.y=A.y),A.z<m.z&&(m.z=A.z),A.z>t.z&&(t.z=A.z);F.left=m.x;F.right=t.x;F.top=t.y;F.bottom=m.y;F.updateProjectionMatrix()}F=z.shadowMap;w=z.shadowMatrix;D=z.shadowCamera;D.position.setFromMatrixPosition(z.matrixWorld);s.setFromMatrixPosition(z.target.matrixWorld);D.lookAt(s);D.updateMatrixWorld();D.matrixWorldInverse.getInverse(D.matrixWorld);z.cameraHelper&&
-(z.cameraHelper.visible=z.shadowCameraVisible);z.shadowCameraVisible&&z.cameraHelper.update();w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);w.multiply(D.projectionMatrix);w.multiply(D.matrixWorldInverse);q.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(F);a.clear();r.length=0;e(c,c,D);z=0;for(F=r.length;z<F;z++)C=r[z],w=C.object,C=C.buffer,I=w.material instanceof THREE.MeshFaceMaterial?w.material.materials[0]:w.material,A=void 0!==w.geometry.morphTargets&&
-0<w.geometry.morphTargets.length&&I.morphTargets,K=w instanceof THREE.SkinnedMesh&&I.skinning,A=w.customDepthMaterial?w.customDepthMaterial:K?A?n:k:A?h:g,a.setMaterialFaces(I),C instanceof THREE.BufferGeometry?a.renderBufferDirect(D,b,null,A,C,w):a.renderBuffer(D,b,null,A,C,w);z=0;for(F=d.length;z<F;z++)C=d[z],w=C.object,w.visible&&w.castShadow&&(w._modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,w.matrixWorld),a.renderImmediateObject(D,b,null,g,w))}u=a.getClearColor();E=a.getClearAlpha();f.clearColor(u.r,
+for(J=0;8>J;J++)A=C[J],A.copy(w[J]),A.unproject(D),A.applyMatrix4(F.matrixWorldInverse),A.x<m.x&&(m.x=A.x),A.x>t.x&&(t.x=A.x),A.y<m.y&&(m.y=A.y),A.y>t.y&&(t.y=A.y),A.z<m.z&&(m.z=A.z),A.z>t.z&&(t.z=A.z);F.left=m.x;F.right=t.x;F.top=t.y;F.bottom=m.y;F.updateProjectionMatrix()}F=z.shadowMap;w=z.shadowMatrix;D=z.shadowCamera;D.position.setFromMatrixPosition(z.matrixWorld);s.setFromMatrixPosition(z.target.matrixWorld);D.lookAt(s);D.updateMatrixWorld();D.matrixWorldInverse.getInverse(D.matrixWorld);z.cameraHelper&&
+(z.cameraHelper.visible=z.shadowCameraVisible);z.shadowCameraVisible&&z.cameraHelper.update();w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);w.multiply(D.projectionMatrix);w.multiply(D.matrixWorldInverse);q.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(F);a.clear();r.length=0;e(c,c,D);z=0;for(F=r.length;z<F;z++)C=r[z],w=C.object,C=C.buffer,J=w.material instanceof THREE.MeshFaceMaterial?w.material.materials[0]:w.material,A=void 0!==w.geometry.morphTargets&&
+0<w.geometry.morphTargets.length&&J.morphTargets,L=w instanceof THREE.SkinnedMesh&&J.skinning,A=w.customDepthMaterial?w.customDepthMaterial:L?A?n:k:A?h:g,a.setMaterialFaces(J),C instanceof THREE.BufferGeometry?a.renderBufferDirect(D,b,null,A,C,w):a.renderBuffer(D,b,null,A,C,w);z=0;for(F=d.length;z<F;z++)C=d[z],w=C.object,w.visible&&w.castShadow&&(w._modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,w.matrixWorld),a.renderImmediateObject(D,b,null,g,w))}u=a.getClearColor();E=a.getClearAlpha();f.clearColor(u.r,
 u.g,u.b,E);f.enable(f.BLEND);a.shadowMapCullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState()}}};
-THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,v,y;function L(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,E,z,F,D,w=new THREE.Vector3,C=new THREE.Quaternion,A=new THREE.Vector3;this.render=function(U,M){if(0!==b.length){if(void 0===F){var I=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),K=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,I,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,
-z);x.bufferData(x.ELEMENT_ARRAY_BUFFER,K,x.STATIC_DRAW);var I=x.createProgram(),K=x.createShader(x.VERTEX_SHADER),N=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(K,["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"));
+THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,v,y;function H(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,E,z,F,D,w=new THREE.Vector3,C=new THREE.Quaternion,A=new THREE.Vector3;this.render=function(U,M){if(0!==b.length){if(void 0===F){var J=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),L=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,J,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,
+z);x.bufferData(x.ELEMENT_ARRAY_BUFFER,L,x.STATIC_DRAW);var J=x.createProgram(),L=x.createShader(x.VERTEX_SHADER),N=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(L,["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(N,["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;\nfloat fogFactor = 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(K);x.compileShader(N);x.attachShader(I,K);x.attachShader(I,N);x.linkProgram(I);F=I;v=x.getAttribLocation(F,"position");y=x.getAttribLocation(F,"uv");c=x.getUniformLocation(F,"uvOffset");d=x.getUniformLocation(F,"uvScale");e=x.getUniformLocation(F,"rotation");f=x.getUniformLocation(F,"scale");g=x.getUniformLocation(F,"color");h=x.getUniformLocation(F,"map");k=x.getUniformLocation(F,"opacity");n=x.getUniformLocation(F,"modelViewMatrix");p=x.getUniformLocation(F,"projectionMatrix");q=
-x.getUniformLocation(F,"fogType");m=x.getUniformLocation(F,"fogDensity");t=x.getUniformLocation(F,"fogNear");s=x.getUniformLocation(F,"fogFar");r=x.getUniformLocation(F,"fogColor");u=x.getUniformLocation(F,"alphaTest");I=document.createElement("canvas");I.width=8;I.height=8;K=I.getContext("2d");K.fillStyle="white";K.fillRect(0,0,8,8);D=new THREE.Texture(I);D.needsUpdate=!0}x.useProgram(F);x.enableVertexAttribArray(v);x.enableVertexAttribArray(y);x.disable(x.CULL_FACE);x.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,
-E);x.vertexAttribPointer(v,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(y,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.uniformMatrix4fv(p,!1,M.projectionMatrix.elements);x.activeTexture(x.TEXTURE0);x.uniform1i(h,0);K=I=0;(N=U.fog)?(x.uniform3f(r,N.color.r,N.color.g,N.color.b),N instanceof THREE.Fog?(x.uniform1f(t,N.near),x.uniform1f(s,N.far),x.uniform1i(q,1),K=I=1):N instanceof THREE.FogExp2&&(x.uniform1f(m,N.density),x.uniform1i(q,2),K=I=2)):(x.uniform1i(q,0),K=I=0);for(var N=0,T=b.length;N<
-T;N++){var P=b[N];P._modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,P.matrixWorld);P.z=-P._modelViewMatrix.elements[14]}b.sort(L);for(var X=[],N=0,T=b.length;N<T;N++){var P=b[N],Q=P.material;x.uniform1f(u,Q.alphaTest);x.uniformMatrix4fv(n,!1,P._modelViewMatrix.elements);P.matrixWorld.decompose(w,C,A);X[0]=A.x;X[1]=A.y;P=0;U.fog&&Q.fog&&(P=K);I!==P&&(x.uniform1i(q,P),I=P);null!==Q.map?(x.uniform2f(c,Q.map.offset.x,Q.map.offset.y),x.uniform2f(d,Q.map.repeat.x,Q.map.repeat.y)):(x.uniform2f(c,
+x.compileShader(L);x.compileShader(N);x.attachShader(J,L);x.attachShader(J,N);x.linkProgram(J);F=J;v=x.getAttribLocation(F,"position");y=x.getAttribLocation(F,"uv");c=x.getUniformLocation(F,"uvOffset");d=x.getUniformLocation(F,"uvScale");e=x.getUniformLocation(F,"rotation");f=x.getUniformLocation(F,"scale");g=x.getUniformLocation(F,"color");h=x.getUniformLocation(F,"map");k=x.getUniformLocation(F,"opacity");n=x.getUniformLocation(F,"modelViewMatrix");p=x.getUniformLocation(F,"projectionMatrix");q=
+x.getUniformLocation(F,"fogType");m=x.getUniformLocation(F,"fogDensity");t=x.getUniformLocation(F,"fogNear");s=x.getUniformLocation(F,"fogFar");r=x.getUniformLocation(F,"fogColor");u=x.getUniformLocation(F,"alphaTest");J=document.createElement("canvas");J.width=8;J.height=8;L=J.getContext("2d");L.fillStyle="white";L.fillRect(0,0,8,8);D=new THREE.Texture(J);D.needsUpdate=!0}x.useProgram(F);x.enableVertexAttribArray(v);x.enableVertexAttribArray(y);x.disable(x.CULL_FACE);x.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,
+E);x.vertexAttribPointer(v,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(y,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.uniformMatrix4fv(p,!1,M.projectionMatrix.elements);x.activeTexture(x.TEXTURE0);x.uniform1i(h,0);L=J=0;(N=U.fog)?(x.uniform3f(r,N.color.r,N.color.g,N.color.b),N instanceof THREE.Fog?(x.uniform1f(t,N.near),x.uniform1f(s,N.far),x.uniform1i(q,1),L=J=1):N instanceof THREE.FogExp2&&(x.uniform1f(m,N.density),x.uniform1i(q,2),L=J=2)):(x.uniform1i(q,0),L=J=0);for(var N=0,T=b.length;N<
+T;N++){var P=b[N];P._modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,P.matrixWorld);P.z=-P._modelViewMatrix.elements[14]}b.sort(H);for(var X=[],N=0,T=b.length;N<T;N++){var P=b[N],Q=P.material;x.uniform1f(u,Q.alphaTest);x.uniformMatrix4fv(n,!1,P._modelViewMatrix.elements);P.matrixWorld.decompose(w,C,A);X[0]=A.x;X[1]=A.y;P=0;U.fog&&Q.fog&&(P=L);J!==P&&(x.uniform1i(q,P),J=P);null!==Q.map?(x.uniform2f(c,Q.map.offset.x,Q.map.offset.y),x.uniform2f(d,Q.map.repeat.x,Q.map.repeat.y)):(x.uniform2f(c,
 0,0),x.uniform2f(d,1,1));x.uniform1f(k,Q.opacity);x.uniform3f(g,Q.color.r,Q.color.g,Q.color.b);x.uniform1f(e,Q.rotation);x.uniform2fv(f,X);a.setBlending(Q.blending,Q.blendEquation,Q.blendSrc,Q.blendDst);a.setDepthTest(Q.depthTest);a.setDepthWrite(Q.depthWrite);Q.map&&Q.map.image&&Q.map.image.width?a.setTexture(Q.map,0):a.setTexture(D,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}x.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 f=new THREE.Texture(void 0,b);e.load(a,function(a){f.image=a;f.needsUpdate=!0;c&&c(f)},void 0,function(a){d&&d(a)});f.sourceFile=a;return f},loadTextureCube:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var f=new THREE.CubeTexture([],b);f.flipY=!1;var g=0;b=function(b){e.load(a[b],function(a){f.images[b]=a;g+=1;6===g&&(f.needsUpdate=!0,c&&
@@ -628,13 +629,13 @@ a},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=Stri
 break;case "l":k=b[a++]*c+d;p=b[a++]*c;e.lineTo(k,p);break;case "q":k=b[a++]*c+d;p=b[a++]*c;t=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(t,s,k,p);if(g=f[f.length-1])for(q=g.x,m=g.y,g=1,h=this.divisions;g<=h;g++){var y=g/h;THREE.Shape.Utils.b2(y,q,t,k);THREE.Shape.Utils.b2(y,m,s,p)}break;case "b":if(k=b[a++]*c+d,p=b[a++]*c,t=b[a++]*c+d,s=b[a++]*c,r=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(t,s,r,u,k,p),g=f[f.length-1])for(q=g.x,m=g.y,g=1,h=this.divisions;g<=h;g++)y=g/h,THREE.Shape.Utils.b3(y,q,t,r,k),THREE.Shape.Utils.b3(y,
 m,s,u,p)}return{offset:v.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",f=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=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,n,p;if(0<b(a))for(n=0;n<e;n++)g[n]=n;else for(n=0;n<e;n++)g[n]=e-1-n;var q=2*e;for(n=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}k=n;e<=k&&(k=0);n=k+1;e<=n&&(n=0);p=n+1;e<=p&&(p=0);var m;a:{var t=m=void 0,s=void 0,r=void 0,u=void 0,v=void 0,y=void 0,L=void 0,x=void 0,
-t=a[g[k]].x,s=a[g[k]].y,r=a[g[n]].x,u=a[g[n]].y,v=a[g[p]].x,y=a[g[p]].y;if(1E-10>(r-t)*(y-s)-(u-s)*(v-t))m=!1;else{var E=void 0,z=void 0,F=void 0,D=void 0,w=void 0,C=void 0,A=void 0,U=void 0,M=void 0,I=void 0,M=U=A=x=L=void 0,E=v-r,z=y-u,F=t-v,D=s-y,w=r-t,C=u-s;for(m=0;m<e;m++)if(L=a[g[m]].x,x=a[g[m]].y,!(L===t&&x===s||L===r&&x===u||L===v&&x===y)&&(A=L-t,U=x-s,M=L-r,I=x-u,L-=v,x-=y,M=E*I-z*M,A=w*U-C*A,U=F*x-D*L,-1E-10<=M&&-1E-10<=U&&-1E-10<=A)){m=!1;break a}m=!0}}if(m){f.push([a[g[k]],a[g[n]],a[g[p]]]);
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,n,p;if(0<b(a))for(n=0;n<e;n++)g[n]=n;else for(n=0;n<e;n++)g[n]=e-1-n;var q=2*e;for(n=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}k=n;e<=k&&(k=0);n=k+1;e<=n&&(n=0);p=n+1;e<=p&&(p=0);var m;a:{var t=m=void 0,s=void 0,r=void 0,u=void 0,v=void 0,y=void 0,H=void 0,x=void 0,
+t=a[g[k]].x,s=a[g[k]].y,r=a[g[n]].x,u=a[g[n]].y,v=a[g[p]].x,y=a[g[p]].y;if(1E-10>(r-t)*(y-s)-(u-s)*(v-t))m=!1;else{var E=void 0,z=void 0,F=void 0,D=void 0,w=void 0,C=void 0,A=void 0,U=void 0,M=void 0,J=void 0,M=U=A=x=H=void 0,E=v-r,z=y-u,F=t-v,D=s-y,w=r-t,C=u-s;for(m=0;m<e;m++)if(H=a[g[m]].x,x=a[g[m]].y,!(H===t&&x===s||H===r&&x===u||H===v&&x===y)&&(A=H-t,U=x-s,M=H-r,J=x-u,H-=v,x-=y,M=E*J-z*M,A=w*U-C*A,U=F*x-D*H,-1E-10<=M&&-1E-10<=U&&-1E-10<=A)){m=!1;break a}m=!0}}if(m){f.push([a[g[k]],a[g[n]],a[g[p]]]);
 h.push([g[k],g[n],g[p]]);k=n;for(p=n+1;p<e;k++,p++)g[k]=g[p];e--;q=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;
 THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain)};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.source.connect(b.panner);b.source.start(0)})};c.send();return this};THREE.Audio.prototype.setLoop=function(a){this.source.loop=a};THREE.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};
 THREE.Audio.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3;return function(b){THREE.Object3D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}}();THREE.AudioListener=function(){THREE.Object3D.call(this);this.type="AudioListener";this.context=new (window.AudioContext||window.webkitAudioContext)};THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype);THREE.AudioListener.prototype.constructor=THREE.AudioListener;
-THREE.AudioListener.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g){THREE.Object3D.prototype.updateMatrixWorld.call(this,g);g=this.context.listener;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.subVectors(a,f);g.setPosition(a.x,a.y,a.z);g.setOrientation(d.x,d.y,d.z,this.up.x,this.up.y,this.up.z);g.setVelocity(e.x,e.y,e.z);f.copy(a)}}();
+THREE.AudioListener.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g){THREE.Object3D.prototype.updateMatrixWorld.call(this,g);g=this.context.listener;var h=this.up;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.subVectors(a,f);g.setPosition(a.x,a.y,a.z);g.setOrientation(d.x,d.y,d.z,h.x,h.y,h.z);g.setVelocity(e.x,e.y,e.z);f.copy(a)}}();
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(a){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
 THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
 THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,k;g<=h;)if(d=Math.floor(g+(h-g)/2),k=c[d]-f,0>k)g=d+1;else if(0<k)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
@@ -669,7 +670,7 @@ THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransfor
 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,n=e.y-d.y,p=a.x-d.x,q=a.y-d.y,F=h*k-g*n,D=h*p-g*q;if(1E-10<Math.abs(F)){if(0<F){if(0>D||D>F)return[];k=n*p-k*q;if(0>k||k>F)return[]}else{if(0<D||D<F)return[];k=n*p-k*q;if(0<k||k<F)return[]}if(0==k)return!f||0!=D&&D!=F?[a]:[];if(k==F)return!f||0!=D&&D!=F?[b]:[];if(0==D)return[d];
 if(D==F)return[e];f=k/F;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=D||n*p!=k*q)return[];h=0==g&&0==h;k=0==k&&0==n;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,F=d.x,n=e,d=e.x):(b=e,F=e.x,n=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,F=d.y,n=e,d=e.y):(b=e,F=e.y,n=d,d=d.y));return k<=F?a<F?[]:a==F?f?[]:[b]:a<=d?[b,h]:[b,n]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]:
 [g,n]}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 f,g,h,k,n,p={};h=a.concat();f=0;for(g=b.length;f<g;f++)Array.prototype.push.apply(h,b[f]);f=0;for(g=h.length;f<g;f++)n=h[f].x+":"+h[f].y,void 0!==p[n]&&console.log("Duplicate point",n),p[n]=f;f=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<n.length;e++)for(f=b[n[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,n=[],p,q,z,F,D,w=[],C,A,U,M=0;for(p=b.length;M<p;M++)n.push(M);C=0;for(var I=2*n.length;0<n.length;){I--;if(0>I){console.log("Infinite Loop! Holes left:"+
+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<n.length;e++)for(f=b[n[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,n=[],p,q,z,F,D,w=[],C,A,U,M=0;for(p=b.length;M<p;M++)n.push(M);C=0;for(var J=2*n.length;0<n.length;){J--;if(0>J){console.log("Infinite Loop! Holes left:"+
 n.length+", Probably Hole outside Shape!");break}for(q=C;q<h.length;q++){z=h[q];p=-1;for(M=0;M<n.length;M++)if(F=n[M],D=z.x+":"+z.y+":"+F,void 0===w[D]){k=b[F];for(A=0;A<k.length;A++)if(F=k[A],c(q,A)&&!f(z,F)&&!g(z,F)){p=A;n.splice(M,1);C=h.slice(0,q+1);F=h.slice(q);A=k.slice(p);U=k.slice(0,p+1);h=C.concat(A).concat(U).concat(F);C=q;break}if(0<=p)break;w[D]=!0}if(0<=p)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(k=q[f],h=0;3>h;h++)n=k[h].x+":"+k[h].y,
 n=p[n],void 0!==n&&(k[h]=n);return q.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()};
@@ -709,27 +710,27 @@ f;d.nextKey=g}g.time>=this.currentTime?f.interpolate(g,this.currentTime):f.inter
 THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.MorphAnimation=function(a){this.mesh=a;this.frames=a.morphTargetInfluences.length;this.currentTime=0;this.duration=1E3;this.loop=!0;this.currentFrame=this.lastFrame=0;this.isPlaying=!1};
 THREE.MorphAnimation.prototype={constructor:THREE.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(a){if(!1!==this.isPlaying){this.currentTime+=a;!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);a=this.duration/this.frames;var b=Math.floor(this.currentTime/a);b!=this.currentFrame&&(this.mesh.morphTargetInfluences[this.lastFrame]=0,this.mesh.morphTargetInfluences[this.currentFrame]=
 1,this.mesh.morphTargetInfluences[b]=0,this.lastFrame=this.currentFrame,this.currentFrame=b);this.mesh.morphTargetInfluences[b]=this.currentTime%a/a;this.mesh.morphTargetInfluences[this.lastFrame]=1-this.mesh.morphTargetInfluences[b]}}};
-THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,r){var u,v=h.widthSegments,y=h.heightSegments,L=e/2,x=f/2,E=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)u="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)u="y",y=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",v=h.depthSegments;var z=v+1,F=y+1,D=e/v,w=f/y,C=new THREE.Vector3;C[u]=0<g?1:-1;for(e=0;e<F;e++)for(f=0;f<z;f++){var A=new THREE.Vector3;A[a]=(f*D-L)*c;A[b]=(e*w-x)*d;A[u]=g;h.vertices.push(A)}for(e=
-0;e<y;e++)for(f=0;f<v;f++)x=f+z*e,a=f+z*(e+1),b=f+1+z*(e+1),c=f+1+z*e,d=new THREE.Vector2(f/v,1-e/y),g=new THREE.Vector2(f/v,1-(e+1)/y),u=new THREE.Vector2((f+1)/v,1-(e+1)/y),L=new THREE.Vector2((f+1)/v,1-e/y),x=new THREE.Face3(x+E,a+E,c+E),x.normal.copy(C),x.vertexNormals.push(C.clone(),C.clone(),C.clone()),x.materialIndex=r,h.faces.push(x),h.faceVertexUvs[0].push([d,g,L]),x=new THREE.Face3(a+E,b+E,c+E),x.normal.copy(C),x.vertexNormals.push(C.clone(),C.clone(),C.clone()),x.materialIndex=r,h.faces.push(x),
-h.faceVertexUvs[0].push([g.clone(),u,L.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var h=this;d=a/2;e=b/2;f=c/2;g("z","y",-1,-1,c,b,d,0);g("z","y",1,-1,c,b,-d,1);g("x","z",1,1,a,c,e,2);g("x","z",1,-1,a,c,-e,3);g("x","y",1,-1,a,b,f,4);g("x","y",-1,-1,a,b,-f,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,r){var u,v=h.widthSegments,y=h.heightSegments,H=e/2,x=f/2,E=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)u="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)u="y",y=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",v=h.depthSegments;var z=v+1,F=y+1,D=e/v,w=f/y,C=new THREE.Vector3;C[u]=0<g?1:-1;for(e=0;e<F;e++)for(f=0;f<z;f++){var A=new THREE.Vector3;A[a]=(f*D-H)*c;A[b]=(e*w-x)*d;A[u]=g;h.vertices.push(A)}for(e=
+0;e<y;e++)for(f=0;f<v;f++)x=f+z*e,a=f+z*(e+1),b=f+1+z*(e+1),c=f+1+z*e,d=new THREE.Vector2(f/v,1-e/y),g=new THREE.Vector2(f/v,1-(e+1)/y),u=new THREE.Vector2((f+1)/v,1-(e+1)/y),H=new THREE.Vector2((f+1)/v,1-e/y),x=new THREE.Face3(x+E,a+E,c+E),x.normal.copy(C),x.vertexNormals.push(C.clone(),C.clone(),C.clone()),x.materialIndex=r,h.faces.push(x),h.faceVertexUvs[0].push([d,g,H]),x=new THREE.Face3(a+E,b+E,c+E),x.normal.copy(C),x.vertexNormals.push(C.clone(),C.clone(),C.clone()),x.materialIndex=r,h.faces.push(x),
+h.faceVertexUvs[0].push([g.clone(),u,H.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var h=this;d=a/2;e=b/2;f=c/2;g("z","y",-1,-1,c,b,d,0);g("z","y",1,-1,c,b,-d,1);g("x","z",1,1,a,c,e,2);g("x","z",1,-1,a,c,-e,3);g("x","y",1,-1,a,b,f,4);g("x","y",-1,-1,a,b,-f,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.BoxGeometry.prototype.constructor=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,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(.5,.5);this.vertices.push(e);f.push(g);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);f.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([f[e].clone(),f[e+1].clone(),g.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;
 THREE.CubeGeometry=function(a,b,c,d,e,f){console.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry.");return new THREE.BoxGeometry(a,b,c,d,e,f)};
 THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;f=void 0!==f?f:!1;var g=c/2,h,k,n=[],p=[];for(k=0;k<=e;k++){var q=[],m=[],t=k/e,s=t*(b-a)+a;for(h=0;h<=d;h++){var r=h/d,u=new THREE.Vector3;u.x=s*Math.sin(r*Math.PI*2);u.y=-t*c+g;u.z=s*Math.cos(r*Math.PI*2);this.vertices.push(u);q.push(this.vertices.length-
-1);m.push(new THREE.Vector2(r,1-t))}n.push(q);p.push(m)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[n[0][h]].clone(),m=this.vertices[n[0][h+1]].clone()):(q=this.vertices[n[1][h]].clone(),m=this.vertices[n[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize(),k=0;k<e;k++){var t=n[k][h],s=n[k+1][h],r=n[k+1][h+1],u=n[k][h+1],v=q.clone(),y=q.clone(),L=m.clone(),x=m.clone(),E=p[k][h].clone(),z=p[k+1][h].clone(),F=p[k+1][h+1].clone(),
-D=p[k][h+1].clone();this.faces.push(new THREE.Face3(t,s,u,[v,y,x]));this.faceVertexUvs[0].push([E,z,D]);this.faces.push(new THREE.Face3(s,r,u,[y.clone(),L,x.clone()]));this.faceVertexUvs[0].push([z.clone(),F,D.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)t=n[0][h],s=n[0][h+1],r=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),L=new THREE.Vector3(0,1,0),E=p[0][h].clone(),z=p[0][h+1].clone(),F=new THREE.Vector2(z.x,0),this.faces.push(new THREE.Face3(t,
-s,r,[v,y,L])),this.faceVertexUvs[0].push([E,z,F]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)t=n[k][h+1],s=n[k][h],r=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),L=new THREE.Vector3(0,-1,0),E=p[k][h+1].clone(),z=p[k][h].clone(),F=new THREE.Vector2(z.x,1),this.faces.push(new THREE.Face3(t,s,r,[v,y,L])),this.faceVertexUvs[0].push([E,z,F]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
+1);m.push(new THREE.Vector2(r,1-t))}n.push(q);p.push(m)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[n[0][h]].clone(),m=this.vertices[n[0][h+1]].clone()):(q=this.vertices[n[1][h]].clone(),m=this.vertices[n[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize(),k=0;k<e;k++){var t=n[k][h],s=n[k+1][h],r=n[k+1][h+1],u=n[k][h+1],v=q.clone(),y=q.clone(),H=m.clone(),x=m.clone(),E=p[k][h].clone(),z=p[k+1][h].clone(),F=p[k+1][h+1].clone(),
+D=p[k][h+1].clone();this.faces.push(new THREE.Face3(t,s,u,[v,y,x]));this.faceVertexUvs[0].push([E,z,D]);this.faces.push(new THREE.Face3(s,r,u,[y.clone(),H,x.clone()]));this.faceVertexUvs[0].push([z.clone(),F,D.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)t=n[0][h],s=n[0][h+1],r=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),H=new THREE.Vector3(0,1,0),E=p[0][h].clone(),z=p[0][h+1].clone(),F=new THREE.Vector2(z.x,0),this.faces.push(new THREE.Face3(t,
+s,r,[v,y,H])),this.faceVertexUvs[0].push([E,z,F]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)t=n[k][h+1],s=n[k][h],r=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),H=new THREE.Vector3(0,-1,0),E=p[k][h+1].clone(),z=p[k][h].clone(),F=new THREE.Vector2(z.x,1),this.faces.push(new THREE.Face3(t,s,r,[v,y,H])),this.faceVertexUvs[0].push([E,z,F]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=a instanceof Array?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.log("die");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),m=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/m-h)*g-(c.y+f/m-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(G=a.length;0<=--G;){c=G;d=G-1;0>d&&(d=a.length-1);for(var e=0,f=t+2*p,e=0;e<f;e++){var g=pa*e,h=pa*(e+1),k=b+c+g,g=b+d+g,m=b+d+h,h=b+c+h,k=k+U,g=g+U,m=m+U,h=h+U;A.faces.push(new THREE.Face3(k,g,h,null,null,y));A.faces.push(new THREE.Face3(g,m,h,null,null,y));k=L.generateSideWallUV(A,k,g,m,h);A.faceVertexUvs[0].push([k[0],k[1],k[3]]);A.faceVertexUvs[0].push([k[1],
-k[2],k[3]])}}}function f(a,b,c){A.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=U;b+=U;c+=U;A.faces.push(new THREE.Face3(a,b,c,null,null,v));a=L.generateTopUV(A,a,b,c);A.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,n=void 0!==b.bevelSize?b.bevelSize:k-2,p=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,s=b.extrudePath,
-r,u=!1,v=b.material,y=b.extrudeMaterial,L=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,x,E,z,F;s&&(r=s.getSpacedPoints(t),u=!0,q=!1,x=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,t,!1),E=new THREE.Vector3,z=new THREE.Vector3,F=new THREE.Vector3);q||(n=k=p=0);var D,w,C,A=this,U=this.vertices.length,s=a.extractPoints(m),m=s.shape,M=s.holes;if(s=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();w=0;for(C=M.length;w<C;w++)D=M[w],THREE.Shape.Utils.isClockWise(D)&&
-(M[w]=D.reverse());s=!1}var I=THREE.Shape.Utils.triangulateShape(m,M),K=m;w=0;for(C=M.length;w<C;w++)D=M[w],m=m.concat(D);var N,T,P,X,Q,pa=m.length,ca,Ba=I.length,s=[],G=0;P=K.length;N=P-1;for(T=G+1;G<P;G++,N++,T++)N===P&&(N=0),T===P&&(T=0),s[G]=d(K[G],K[N],K[T]);var wa=[],qa,La=s.concat();w=0;for(C=M.length;w<C;w++){D=M[w];qa=[];G=0;P=D.length;N=P-1;for(T=G+1;G<P;G++,N++,T++)N===P&&(N=0),T===P&&(T=0),qa[G]=d(D[G],D[N],D[T]);wa.push(qa);La=La.concat(qa)}for(N=0;N<p;N++){P=N/p;X=k*(1-P);T=n*Math.sin(P*
-Math.PI/2);G=0;for(P=K.length;G<P;G++)Q=c(K[G],s[G],T),f(Q.x,Q.y,-X);w=0;for(C=M.length;w<C;w++)for(D=M[w],qa=wa[w],G=0,P=D.length;G<P;G++)Q=c(D[G],qa[G],T),f(Q.x,Q.y,-X)}T=n;for(G=0;G<pa;G++)Q=q?c(m[G],La[G],T):m[G],u?(z.copy(x.normals[0]).multiplyScalar(Q.x),E.copy(x.binormals[0]).multiplyScalar(Q.y),F.copy(r[0]).add(z).add(E),f(F.x,F.y,F.z)):f(Q.x,Q.y,0);for(P=1;P<=t;P++)for(G=0;G<pa;G++)Q=q?c(m[G],La[G],T):m[G],u?(z.copy(x.normals[P]).multiplyScalar(Q.x),E.copy(x.binormals[P]).multiplyScalar(Q.y),
-F.copy(r[P]).add(z).add(E),f(F.x,F.y,F.z)):f(Q.x,Q.y,h/t*P);for(N=p-1;0<=N;N--){P=N/p;X=k*(1-P);T=n*Math.sin(P*Math.PI/2);G=0;for(P=K.length;G<P;G++)Q=c(K[G],s[G],T),f(Q.x,Q.y,h+X);w=0;for(C=M.length;w<C;w++)for(D=M[w],qa=wa[w],G=0,P=D.length;G<P;G++)Q=c(D[G],qa[G],T),u?f(Q.x,Q.y+r[t-1].y,r[t-1].x+X):f(Q.x,Q.y,h+X)}(function(){if(q){var a;a=0*pa;for(G=0;G<Ba;G++)ca=I[G],g(ca[2]+a,ca[1]+a,ca[0]+a);a=t+2*p;a*=pa;for(G=0;G<Ba;G++)ca=I[G],g(ca[0]+a,ca[1]+a,ca[2]+a)}else{for(G=0;G<Ba;G++)ca=I[G],g(ca[2],
-ca[1],ca[0]);for(G=0;G<Ba;G++)ca=I[G],g(ca[0]+pa*t,ca[1]+pa*t,ca[2]+pa*t)}})();(function(){var a=0;e(K,a);a+=K.length;w=0;for(C=M.length;w<C;w++)D=M[w],e(D,a),a+=D.length})()};
+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(G=a.length;0<=--G;){c=G;d=G-1;0>d&&(d=a.length-1);for(var e=0,f=t+2*p,e=0;e<f;e++){var g=pa*e,h=pa*(e+1),k=b+c+g,g=b+d+g,m=b+d+h,h=b+c+h,k=k+U,g=g+U,m=m+U,h=h+U;A.faces.push(new THREE.Face3(k,g,h,null,null,y));A.faces.push(new THREE.Face3(g,m,h,null,null,y));k=H.generateSideWallUV(A,k,g,m,h);A.faceVertexUvs[0].push([k[0],k[1],k[3]]);A.faceVertexUvs[0].push([k[1],
+k[2],k[3]])}}}function f(a,b,c){A.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=U;b+=U;c+=U;A.faces.push(new THREE.Face3(a,b,c,null,null,v));a=H.generateTopUV(A,a,b,c);A.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,n=void 0!==b.bevelSize?b.bevelSize:k-2,p=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,s=b.extrudePath,
+r,u=!1,v=b.material,y=b.extrudeMaterial,H=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,x,E,z,F;s&&(r=s.getSpacedPoints(t),u=!0,q=!1,x=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,t,!1),E=new THREE.Vector3,z=new THREE.Vector3,F=new THREE.Vector3);q||(n=k=p=0);var D,w,C,A=this,U=this.vertices.length,s=a.extractPoints(m),m=s.shape,M=s.holes;if(s=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();w=0;for(C=M.length;w<C;w++)D=M[w],THREE.Shape.Utils.isClockWise(D)&&
+(M[w]=D.reverse());s=!1}var J=THREE.Shape.Utils.triangulateShape(m,M),L=m;w=0;for(C=M.length;w<C;w++)D=M[w],m=m.concat(D);var N,T,P,X,Q,pa=m.length,ca,Ba=J.length,s=[],G=0;P=L.length;N=P-1;for(T=G+1;G<P;G++,N++,T++)N===P&&(N=0),T===P&&(T=0),s[G]=d(L[G],L[N],L[T]);var wa=[],qa,La=s.concat();w=0;for(C=M.length;w<C;w++){D=M[w];qa=[];G=0;P=D.length;N=P-1;for(T=G+1;G<P;G++,N++,T++)N===P&&(N=0),T===P&&(T=0),qa[G]=d(D[G],D[N],D[T]);wa.push(qa);La=La.concat(qa)}for(N=0;N<p;N++){P=N/p;X=k*(1-P);T=n*Math.sin(P*
+Math.PI/2);G=0;for(P=L.length;G<P;G++)Q=c(L[G],s[G],T),f(Q.x,Q.y,-X);w=0;for(C=M.length;w<C;w++)for(D=M[w],qa=wa[w],G=0,P=D.length;G<P;G++)Q=c(D[G],qa[G],T),f(Q.x,Q.y,-X)}T=n;for(G=0;G<pa;G++)Q=q?c(m[G],La[G],T):m[G],u?(z.copy(x.normals[0]).multiplyScalar(Q.x),E.copy(x.binormals[0]).multiplyScalar(Q.y),F.copy(r[0]).add(z).add(E),f(F.x,F.y,F.z)):f(Q.x,Q.y,0);for(P=1;P<=t;P++)for(G=0;G<pa;G++)Q=q?c(m[G],La[G],T):m[G],u?(z.copy(x.normals[P]).multiplyScalar(Q.x),E.copy(x.binormals[P]).multiplyScalar(Q.y),
+F.copy(r[P]).add(z).add(E),f(F.x,F.y,F.z)):f(Q.x,Q.y,h/t*P);for(N=p-1;0<=N;N--){P=N/p;X=k*(1-P);T=n*Math.sin(P*Math.PI/2);G=0;for(P=L.length;G<P;G++)Q=c(L[G],s[G],T),f(Q.x,Q.y,h+X);w=0;for(C=M.length;w<C;w++)for(D=M[w],qa=wa[w],G=0,P=D.length;G<P;G++)Q=c(D[G],qa[G],T),u?f(Q.x,Q.y+r[t-1].y,r[t-1].x+X):f(Q.x,Q.y,h+X)}(function(){if(q){var a;a=0*pa;for(G=0;G<Ba;G++)ca=J[G],g(ca[2]+a,ca[1]+a,ca[0]+a);a=t+2*p;a*=pa;for(G=0;G<Ba;G++)ca=J[G],g(ca[0]+a,ca[1]+a,ca[2]+a)}else{for(G=0;G<Ba;G++)ca=J[G],g(ca[2],
+ca[1],ca[0]);for(G=0;G<Ba;G++)ca=J[G],g(ca[0]+pa*t,ca[1]+pa*t,ca[2]+pa*t)}})();(function(){var a=0;e(L,a);a+=L.length;w=0;for(C=M.length;w<C;w++)D=M[w],e(D,a),a+=D.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===a instanceof Array&&(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,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,n=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse(),e=0,f=n.length;e<f;e++)g=n[e],THREE.Shape.Utils.isClockWise(g)&&(n[e]=g.reverse());var p=THREE.Shape.Utils.triangulateShape(k,n);e=0;for(f=n.length;e<f;e++)g=n[e],

+ 1 - 2
src/extras/audio/AudioListener.js

@@ -21,8 +21,6 @@ THREE.AudioListener.prototype.updateMatrixWorld = ( function () {
 	var quaternion = new THREE.Quaternion();
 	var scale = new THREE.Vector3();
 
-	var up = this.up;
-
 	var orientation = new THREE.Vector3();
 	var velocity = new THREE.Vector3();
 
@@ -33,6 +31,7 @@ THREE.AudioListener.prototype.updateMatrixWorld = ( function () {
 		THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
 
 		var listener = this.context.listener;
+		var up = this.up;
 
 		this.matrixWorld.decompose( position, quaternion, scale );
 

+ 31 - 31
src/objects/Line.js

@@ -49,7 +49,7 @@ THREE.Line.prototype.raycast = ( function () {
 
 		inverseMatrix.getInverse( this.matrixWorld );
 		ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
-		
+
 		var vStart = new THREE.Vector3();
 		var vEnd = new THREE.Vector3();
 		var interSegment = new THREE.Vector3();
@@ -57,43 +57,43 @@ THREE.Line.prototype.raycast = ( function () {
 		var step = this.mode === THREE.LineStrip ? 1 : 2;
 
 		if ( geometry instanceof THREE.BufferGeometry ) {
-		
+
 			var attributes = geometry.attributes;
-			
-			if ( attributes.index !== undefined) {
-			
+
+			if ( attributes.index !== undefined ) {
+
 				var indices = attributes.index.array;
 				var positions = attributes.position.array;
 				var offsets = geometry.offsets;
-				
+
 				if ( offsets.length === 0 ) {
 
 					offsets = [ { start: 0, count: indices.length, index: 0 } ];
 
 				}
-				
+
 				for ( var oi = 0; oi < offsets.length; oi++){
-				
+
 					var start = offsets[ oi ].start;
 					var count = offsets[ oi ].count;
-				    var index = offsets[ oi ].index;
-					
+					var index = offsets[ oi ].index;
+
 					for ( var i = start; i < start + count - 1; i += step ) {
 
 						var a = index + indices[ i ];
 						var b = index + indices[ i + 1 ];
-						
+
 						vStart.fromArray( positions, a * 3 );
 						vEnd.fromArray( positions, b * 3 );
-						
+
 						var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
-					
+
 						if ( distSq > precisionSq ) continue;
-						
+
 						var distance = ray.origin.distanceTo( interRay );
-						
+
 						if ( distance < raycaster.near || distance > raycaster.far ) continue;
-						
+
 						intersects.push( {
 
 							distance: distance,
@@ -105,28 +105,28 @@ THREE.Line.prototype.raycast = ( function () {
 							object: this
 
 						} );
-					
+
 					}
-					
+
 				}
-			
+
 			} else {
-			
+
 				var positions = attributes.position.array;
-				
-				for ( var i = 0; i < positions.length / 3 - 1; i += step) {
-				
+
+				for ( var i = 0; i < positions.length / 3 - 1; i += step ) {
+
 					vStart.fromArray( positions, 3 * i );
 					vEnd.fromArray( positions, 3 * i + 3 );
-					
+
 					var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
-					
+
 					if ( distSq > precisionSq ) continue;
-					
+
 					var distance = ray.origin.distanceTo( interRay );
-					
+
 					if ( distance < raycaster.near || distance > raycaster.far ) continue;
-					
+
 					intersects.push( {
 
 						distance: distance,
@@ -138,9 +138,9 @@ THREE.Line.prototype.raycast = ( function () {
 						object: this
 
 					} );
-				
+
 				}
-				
+
 			}
 
 		} else if ( geometry instanceof THREE.Geometry ) {
@@ -148,7 +148,7 @@ THREE.Line.prototype.raycast = ( function () {
 			var vertices = geometry.vertices;
 			var nbVertices = vertices.length;
 
-			for ( var i = 0; i < nbVertices - 1; i = i + step ) {
+			for ( var i = 0; i < nbVertices - 1; i += step ) {
 
 				var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );