Przeglądaj źródła

Updated builds.

Mr.doob 10 lat temu
rodzic
commit
034e44cca5
4 zmienionych plików z 254 dodań i 185 usunięć
  1. 105 39
      build/three.js
  2. 128 127
      build/three.min.js
  3. 20 18
      src/extras/animation/MorphAnimation.js
  4. 1 1
      src/renderers/WebGLRenderer.js

+ 105 - 39
build/three.js

@@ -17869,11 +17869,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.domElement = _canvas;
 	this.context = null;
-	this.devicePixelRatio = parameters.devicePixelRatio !== undefined
-				 ? parameters.devicePixelRatio
-				 : self.devicePixelRatio !== undefined
-					 ? self.devicePixelRatio
-					 : 1;
+	this.devicePixelRatio = self.devicePixelRatio !== undefined ? self.devicePixelRatio : 1;
 
 	// clearing
 
@@ -20597,20 +20593,92 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			// render particles
 
-			if ( updateBuffers ) {
+			var mode = _gl.POINTS;
 
-				setupVertexAttributes( material, program, geometry, 0 );
+			var index = geometry.attributes.index;
 
-			}
+			if ( index ) {
 
-			var position = geometry.attributes.position;
+				// indexed points
 
-			// render particles
+				var type, size;
 
-			_gl.drawArrays( _gl.POINTS, 0, position.array.length / 3 );
+				if ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) {
 
-			_this.info.render.calls ++;
-			_this.info.render.points += position.array.length / 3;
+					type = _gl.UNSIGNED_INT;
+					size = 4;
+
+				} else {
+
+					type = _gl.UNSIGNED_SHORT;
+					size = 2;
+
+				}
+
+				var offsets = geometry.offsets;
+
+				if ( offsets.length === 0 ) {
+
+					if ( updateBuffers ) {
+
+						setupVertexAttributes( material, program, geometry, 0 );
+						_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );
+
+					}
+
+					_gl.drawElements( mode, index.array.length, type, 0);
+
+					_this.info.render.calls ++;
+					_this.info.render.points += index.array.length;
+
+				} else {
+
+					// if there is more than 1 chunk
+					// must set attribute pointers to use new offsets for each chunk
+					// even if geometry and materials didn't change
+
+					if ( offsets.length > 1 ) updateBuffers = true;
+
+					for ( var i = 0, il = offsets.length; i < il; i ++ ) {
+
+						var startIndex = offsets[ i ].index;
+
+						if ( updateBuffers ) {
+
+							setupVertexAttributes( material, program, geometry, startIndex );
+							_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );
+
+						}
+
+						// render indexed points
+
+						_gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size );
+
+						_this.info.render.calls ++;
+						_this.info.render.points += offsets[ i ].count;
+
+					}
+
+				}
+
+			} else {
+
+				// non-indexed points
+
+				if ( updateBuffers ) {
+
+					setupVertexAttributes( material, program, geometry, 0 );
+
+				}
+
+				var position = geometry.attributes.position;
+
+				_gl.drawArrays( mode, 0, position.array.length / 3 );
+
+				_this.info.render.calls ++;
+				_this.info.render.points += position.array.length / 3;
+
+			}
 
 		} else if ( object instanceof THREE.Line ) {
 
@@ -30448,6 +30516,7 @@ THREE.KeyFrameAnimation.prototype.getPrevKeyWith = function( sid, h, key ) {
 
 /**
  * @author mrdoob / http://mrdoob.com
+ * @author willy-vvu / http://willy-vvu.github.io
  */
 
 THREE.MorphAnimation = function ( mesh ) {
@@ -30457,6 +30526,8 @@ THREE.MorphAnimation = function ( mesh ) {
 	this.currentTime = 0;
 	this.duration = 1000;
 	this.loop = true;
+	this.lastFrame = 0;
+	this.currentFrame = 0;
 
 	this.isPlaying = false;
 
@@ -30464,6 +30535,8 @@ THREE.MorphAnimation = function ( mesh ) {
 
 THREE.MorphAnimation.prototype = {
 
+	constructor: THREE.MorphAnimation,
+
 	play: function () {
 
 		this.isPlaying = true;
@@ -30476,45 +30549,38 @@ THREE.MorphAnimation.prototype = {
 
 	},
 
-	update: ( function () {
-
-		var lastFrame = 0;
-		var currentFrame = 0;
-
-		return function ( delta ) {
+	update: function ( delta ) {
 
-			if ( this.isPlaying === false ) return;
-
-			this.currentTime += delta;
+		if ( this.isPlaying === false ) return;
 
-			if ( this.loop === true && this.currentTime > this.duration ) {
+		this.currentTime += delta;
 
-				this.currentTime %= this.duration;
+		if ( this.loop === true && this.currentTime > this.duration ) {
 
-			}
+			this.currentTime %= this.duration;
 
-			this.currentTime = Math.min( this.currentTime, this.duration );
-
-			var interpolation = this.duration / this.frames;
-			var frame = Math.floor( this.currentTime / interpolation );
+		}
 
-			if ( frame != currentFrame ) {
+		this.currentTime = Math.min( this.currentTime, this.duration );
 
-				this.mesh.morphTargetInfluences[ lastFrame ] = 0;
-				this.mesh.morphTargetInfluences[ currentFrame ] = 1;
-				this.mesh.morphTargetInfluences[ frame ] = 0;
+		var interpolation = this.duration / this.frames;
+		var frame = Math.floor( this.currentTime / interpolation );
 
-				lastFrame = currentFrame;
-				currentFrame = frame;
+		if ( frame != this.currentFrame ) {
 
-			}
+			this.mesh.morphTargetInfluences[ this.lastFrame ] = 0;
+			this.mesh.morphTargetInfluences[ this.currentFrame ] = 1;
+			this.mesh.morphTargetInfluences[ frame ] = 0;
 
-			this.mesh.morphTargetInfluences[ frame ] = ( this.currentTime % interpolation ) / interpolation;
-			this.mesh.morphTargetInfluences[ lastFrame ] = 1 - this.mesh.morphTargetInfluences[ frame ];
+			this.lastFrame = this.currentFrame;
+			this.currentFrame = frame;
 
 		}
 
-	} )()
+		this.mesh.morphTargetInfluences[ frame ] = ( this.currentTime % interpolation ) / interpolation;
+		this.mesh.morphTargetInfluences[ this.lastFrame ] = 1 - this.mesh.morphTargetInfluences[ frame ];
+
+	}
 
 };
 

+ 128 - 127
build/three.min.js

@@ -99,8 +99,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],r=c[2],t=c[6],s=c[10],u=c[14],v=c[3],y=c[7],E=c[11],c=c[15],w=d[0],M=d[4],x=d[8],C=d[12],D=d[1],A=d[5],B=d[9],G=d[13],S=d[2],J=d[6],H=d[10],V=d[14],L=d[3],
-I=d[7],R=d[11],d=d[15];e[0]=f*w+g*D+h*S+k*L;e[4]=f*M+g*A+h*J+k*I;e[8]=f*x+g*B+h*H+k*R;e[12]=f*C+g*G+h*V+k*d;e[1]=n*w+p*D+q*S+m*L;e[5]=n*M+p*A+q*J+m*I;e[9]=n*x+p*B+q*H+m*R;e[13]=n*C+p*G+q*V+m*d;e[2]=r*w+t*D+s*S+u*L;e[6]=r*M+t*A+s*J+u*I;e[10]=r*x+t*B+s*H+u*R;e[14]=r*C+t*G+s*V+u*d;e[3]=v*w+y*D+E*S+c*L;e[7]=v*M+y*A+E*J+c*I;e[11]=v*x+y*B+E*H+c*R;e[15]=v*C+y*G+E*V+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],r=c[2],t=c[6],s=c[10],u=c[14],v=c[3],y=c[7],E=c[11],c=c[15],w=d[0],M=d[4],x=d[8],C=d[12],D=d[1],A=d[5],B=d[9],G=d[13],S=d[2],K=d[6],I=d[10],V=d[14],L=d[3],
+J=d[7],R=d[11],d=d[15];e[0]=f*w+g*D+h*S+k*L;e[4]=f*M+g*A+h*K+k*J;e[8]=f*x+g*B+h*I+k*R;e[12]=f*C+g*G+h*V+k*d;e[1]=n*w+p*D+q*S+m*L;e[5]=n*M+p*A+q*K+m*J;e[9]=n*x+p*B+q*I+m*R;e[13]=n*C+p*G+q*V+m*d;e[2]=r*w+t*D+s*S+u*L;e[6]=r*M+t*A+s*K+u*J;e[10]=r*x+t*B+s*I+u*R;e[14]=r*C+t*G+s*V+u*d;e[3]=v*w+y*D+E*S+c*L;e[7]=v*M+y*A+E*K+c*J;e[11]=v*x+y*B+E*I+c*R;e[15]=v*C+y*G+E*V+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=
@@ -190,10 +190,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 r=a.index.array,t=0<this.offsets.length?this.offsets:[{start:0,count:r.length,index:0}],s=0,u=t.length;s<u;++s){e=t[s].start;f=t[s].count;
 for(var v=t[s].index,d=e,e=e+f;d<e;d+=3)f=3*(v+r[d]),g=3*(v+r[d+1]),h=3*(v+r[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);r.fromArray(d,3*c);t.fromArray(f,2*a);s.fromArray(f,2*b);u.fromArray(f,2*c);v=m.x-q.x;y=r.x-q.x;E=m.y-q.y;w=r.y-q.y;M=m.z-q.z;x=r.z-q.z;C=s.x-t.x;D=u.x-t.x;A=s.y-t.y;B=u.y-t.y;G=1/(C*B-D*A);S.set((B*v-A*y)*G,(B*E-A*w)*G,(B*M-A*x)*G);J.set((C*y-D*v)*G,(C*w-D*E)*G,(C*x-D*M)*G);k[a].add(S);k[b].add(S);k[c].add(S);n[a].add(J);n[b].add(J);n[c].add(J)}function b(a){Ca.fromArray(e,
-3*a);O.copy(Ca);xa=k[a];ya.copy(xa);ya.sub(Ca.multiplyScalar(Ca.dot(xa))).normalize();ia.crossVectors(O,xa);za=ia.dot(n[a]);Ga=0>za?-1:1;h[4*a]=ya.x;h[4*a+1]=ya.y;h[4*a+2]=ya.z;h[4*a+3]=Ga}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,r=new THREE.Vector3,t=new THREE.Vector2,s=new THREE.Vector2,u=new THREE.Vector2,v,y,E,w,M,x,C,D,A,B,G,S=new THREE.Vector3,J=new THREE.Vector3,H,V,L,I,R;0===this.drawcalls.length&&
-this.addDrawCall(0,c.length,0);var Y=this.drawcalls,p=0;for(V=Y.length;p<V;++p){H=Y[p].start;L=Y[p].count;var T=Y[p].index,g=H;for(H+=L;g<H;g+=3)L=T+c[g],I=T+c[g+1],R=T+c[g+2],a(L,I,R)}var ya=new THREE.Vector3,ia=new THREE.Vector3,Ca=new THREE.Vector3,O=new THREE.Vector3,Ga,xa,za,p=0;for(V=Y.length;p<V;++p)for(H=Y[p].start,L=Y[p].count,T=Y[p].index,g=H,H+=L;g<H;g+=3)L=T+c[g],I=T+c[g+1],R=T+c[g+2],b(L),b(I),b(R)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;
+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);r.fromArray(d,3*c);t.fromArray(f,2*a);s.fromArray(f,2*b);u.fromArray(f,2*c);v=m.x-q.x;y=r.x-q.x;E=m.y-q.y;w=r.y-q.y;M=m.z-q.z;x=r.z-q.z;C=s.x-t.x;D=u.x-t.x;A=s.y-t.y;B=u.y-t.y;G=1/(C*B-D*A);S.set((B*v-A*y)*G,(B*E-A*w)*G,(B*M-A*x)*G);K.set((C*y-D*v)*G,(C*w-D*E)*G,(C*x-D*M)*G);k[a].add(S);k[b].add(S);k[c].add(S);n[a].add(K);n[b].add(K);n[c].add(K)}function b(a){Ca.fromArray(e,
+3*a);O.copy(Ca);xa=k[a];ya.copy(xa);ya.sub(Ca.multiplyScalar(Ca.dot(xa))).normalize();oa.crossVectors(O,xa);za=oa.dot(n[a]);Ga=0>za?-1:1;h[4*a]=ya.x;h[4*a+1]=ya.y;h[4*a+2]=ya.z;h[4*a+3]=Ga}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,r=new THREE.Vector3,t=new THREE.Vector2,s=new THREE.Vector2,u=new THREE.Vector2,v,y,E,w,M,x,C,D,A,B,G,S=new THREE.Vector3,K=new THREE.Vector3,I,V,L,J,R;0===this.drawcalls.length&&
+this.addDrawCall(0,c.length,0);var Y=this.drawcalls,p=0;for(V=Y.length;p<V;++p){I=Y[p].start;L=Y[p].count;var T=Y[p].index,g=I;for(I+=L;g<I;g+=3)L=T+c[g],J=T+c[g+1],R=T+c[g+2],a(L,J,R)}var ya=new THREE.Vector3,oa=new THREE.Vector3,Ca=new THREE.Vector3,O=new THREE.Vector3,Ga,xa,za,p=0;for(V=Y.length;p<V;++p)for(I=Y[p].start,L=Y[p].count,T=Y[p].index,g=I,I+=L;g<I;g+=3)L=T+c[g],J=T+c[g+1],R=T+c[g+2],b(L),b(J),b(R)}},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),r=new Int32Array(c.length),t=0;t<c.length;t++)m[t]=-1,r[t]=-1;for(c=0;c<d;c++){for(var s=p=0;3>s;s++)t=a[3*c+s],-1==m[t]?(q[2*s]=t,q[2*s+1]=-1,p++):m[t]<k.index?(q[2*s]=t,q[2*s+1]=-1,n++):(q[2*s]=t,q[2*s+1]=m[t]);if(g+p>k.index+b)for(k={start:f,count:0,index:g},h.push(k),p=0;6>p;p+=2)s=q[p+1],-1<s&&s<k.index&&(q[p+1]=
 -1);for(p=0;6>p;p+=2)t=q[p],s=q[p+1],-1===s&&(s=g++),m[t]=s,r[s]=t,e[f++]=s-k.index,k.count++}this.reorderBuffers(e,r,g);return this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},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*k+p]}this.attributes.index.array=a;for(e in this.attributes)"index"!=e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=this.attributes[e].itemSize*c)},toJSON:function(){var a={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},b=this.attributes,
@@ -440,136 +440,137 @@ THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sa
 THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")}};
 THREE.WebGLRenderer=function(a){function b(a){var b=a.geometry;a=a.material;var c=b.vertices.length;if(a.attributes){void 0===b.__webglCustomAttributesList&&(b.__webglCustomAttributesList=[]);for(var d in a.attributes){var e=a.attributes[d];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=!0;var f=1;"v2"===e.type?f=2:"v3"===e.type?f=3:"v4"===e.type?f=4:"c"===e.type&&(f=3);e.size=f;e.array=new Float32Array(c*f);e.buffer=l.createBuffer();e.buffer.belongsToAttribute=d;e.needsUpdate=
 !0}b.__webglCustomAttributesList.push(e)}}}function c(a,b){var c=b.geometry,e=a.faces3,f=3*e.length,g=1*e.length,h=3*e.length,e=d(b,a);a.__vertexArray=new Float32Array(3*f);a.__normalArray=new Float32Array(3*f);a.__colorArray=new Float32Array(3*f);a.__uvArray=new Float32Array(2*f);1<c.faceVertexUvs.length&&(a.__uv2Array=new Float32Array(2*f));c.hasTangents&&(a.__tangentArray=new Float32Array(4*f));b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*
-f),a.__skinWeightArray=new Float32Array(4*f));c=null!==oa.get("OES_element_index_uint")&&21845<g?Uint32Array:Uint16Array;a.__typeArray=c;a.__faceArray=new c(3*g);a.__lineArray=new c(2*h);var k;if(a.numMorphTargets)for(a.__morphTargetsArrays=[],c=0,k=a.numMorphTargets;c<k;c++)a.__morphTargetsArrays.push(new Float32Array(3*f));if(a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0,k=a.numMorphNormals;c<k;c++)a.__morphNormalsArrays.push(new Float32Array(3*f));a.__webglFaceCount=3*g;a.__webglLineCount=
+f),a.__skinWeightArray=new Float32Array(4*f));c=null!==ha.get("OES_element_index_uint")&&21845<g?Uint32Array:Uint16Array;a.__typeArray=c;a.__faceArray=new c(3*g);a.__lineArray=new c(2*h);var k;if(a.numMorphTargets)for(a.__morphTargetsArrays=[],c=0,k=a.numMorphTargets;c<k;c++)a.__morphTargetsArrays.push(new Float32Array(3*f));if(a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0,k=a.numMorphNormals;c<k;c++)a.__morphNormalsArrays.push(new Float32Array(3*f));a.__webglFaceCount=3*g;a.__webglLineCount=
 2*h;if(e.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var m in e.attributes){var g=e.attributes[m],h={},n;for(n in g)h[n]=g[n];if(!h.__webglInitialized||h.createUniqueBuffers)h.__webglInitialized=!0,c=1,"v2"===h.type?c=2:"v3"===h.type?c=3:"v4"===h.type?c=4:"c"===h.type&&(c=3),h.size=c,h.array=new Float32Array(f*c),h.buffer=l.createBuffer(),h.buffer.belongsToAttribute=m,g.needsUpdate=!0,h.__original=g;a.__webglCustomAttributesList.push(h)}}a.__inittedArrays=
 !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=wb.length;a<b;a++)wb[a]=0}function g(a){wb[a]=1;0===jb[a]&&(l.enableVertexAttribArray(a),jb[a]=1)}function h(){for(var a=0,b=jb.length;a<b;a++)jb[a]!==wb[a]&&(l.disableVertexAttribArray(a),jb[a]=0)}function k(a,b){return a.material.id!==b.material.id?b.material.id-a.material.id:a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return a.z!==b.z?a.z-b.z:a.id-b.id}function p(a,b){return b[0]-
 a[0]}function q(a,e){if(!1!==e.visible){if(!(e instanceof THREE.Scene||e instanceof THREE.Group)){void 0===e.__webglInit&&(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrix=new THREE.Matrix3,e.addEventListener("removed",Hc));var f=e.geometry;if(void 0!==f&&void 0===f.__webglInit&&(f.__webglInit=!0,f.addEventListener("dispose",Ic),!(f instanceof THREE.BufferGeometry)))if(e instanceof THREE.Mesh)s(a,e,f);else if(e instanceof THREE.Line){if(void 0===f.__webglVertexBuffer){f.__webglVertexBuffer=
-l.createBuffer();f.__webglColorBuffer=l.createBuffer();f.__webglLineDistanceBuffer=l.createBuffer();K.info.memory.geometries++;var g=f.vertices.length;f.__vertexArray=new Float32Array(3*g);f.__colorArray=new Float32Array(3*g);f.__lineDistanceArray=new Float32Array(1*g);f.__webglLineCount=g;b(e);f.verticesNeedUpdate=!0;f.colorsNeedUpdate=!0;f.lineDistancesNeedUpdate=!0}}else if(e instanceof THREE.PointCloud&&void 0===f.__webglVertexBuffer){f.__webglVertexBuffer=l.createBuffer();f.__webglColorBuffer=
-l.createBuffer();K.info.memory.geometries++;var h=f.vertices.length;f.__vertexArray=new Float32Array(3*h);f.__colorArray=new Float32Array(3*h);f.__sortArray=[];f.__webglParticleCount=h;b(e);f.verticesNeedUpdate=!0;f.colorsNeedUpdate=!0}if(void 0===e.__webglActive)if(e.__webglActive=!0,e instanceof THREE.Mesh)if(f instanceof THREE.BufferGeometry)u(eb,f,e);else{if(f instanceof THREE.Geometry)for(var k=xb[f.id],m=0,n=k.length;m<n;m++)u(eb,k[m],e)}else e instanceof THREE.Line||e instanceof THREE.PointCloud?
+l.createBuffer();f.__webglColorBuffer=l.createBuffer();f.__webglLineDistanceBuffer=l.createBuffer();H.info.memory.geometries++;var g=f.vertices.length;f.__vertexArray=new Float32Array(3*g);f.__colorArray=new Float32Array(3*g);f.__lineDistanceArray=new Float32Array(1*g);f.__webglLineCount=g;b(e);f.verticesNeedUpdate=!0;f.colorsNeedUpdate=!0;f.lineDistancesNeedUpdate=!0}}else if(e instanceof THREE.PointCloud&&void 0===f.__webglVertexBuffer){f.__webglVertexBuffer=l.createBuffer();f.__webglColorBuffer=
+l.createBuffer();H.info.memory.geometries++;var h=f.vertices.length;f.__vertexArray=new Float32Array(3*h);f.__colorArray=new Float32Array(3*h);f.__sortArray=[];f.__webglParticleCount=h;b(e);f.verticesNeedUpdate=!0;f.colorsNeedUpdate=!0}if(void 0===e.__webglActive)if(e.__webglActive=!0,e instanceof THREE.Mesh)if(f instanceof THREE.BufferGeometry)u(eb,f,e);else{if(f instanceof THREE.Geometry)for(var k=xb[f.id],m=0,n=k.length;m<n;m++)u(eb,k[m],e)}else e instanceof THREE.Line||e instanceof THREE.PointCloud?
 u(eb,f,e):(e instanceof THREE.ImmediateRenderObject||e.immediateRenderCallback)&&ob.push({id:null,object:e,opaque:null,transparent:null,z:0});if(e instanceof THREE.Light)db.push(e);else if(e instanceof THREE.Sprite)yb.push(e);else if(e instanceof THREE.LensFlare)Ra.push(e);else{var t=eb[e.id];if(t&&(!1===e.frustumCulled||!0===Ec.intersectsObject(e))){var r=e.geometry,w,E;if(r instanceof THREE.BufferGeometry)for(var x=r.attributes,C=r.attributesKeys,D=0,B=C.length;D<B;D++){var A=C[D],M=x[A];void 0===
-M.buffer&&(M.buffer=l.createBuffer(),M.needsUpdate=!0);if(!0===M.needsUpdate){var G="index"===A?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER;l.bindBuffer(G,M.buffer);l.bufferData(G,M.array,l.STATIC_DRAW);M.needsUpdate=!1}}else if(e instanceof THREE.Mesh){!0===r.groupsNeedUpdate&&s(a,e,r);for(var L=xb[r.id],J=0,H=L.length;J<H;J++){var R=L[J];E=d(e,R);!0===r.groupsNeedUpdate&&c(R,e);w=E.attributes&&v(E);if(r.verticesNeedUpdate||r.morphTargetsNeedUpdate||r.elementsNeedUpdate||r.uvsNeedUpdate||r.normalsNeedUpdate||
-r.colorsNeedUpdate||r.tangentsNeedUpdate||w){var I=R,O=e,S=l.DYNAMIC_DRAW,T=!r.dynamic,Y=E;if(I.__inittedArrays){var V=Y&&void 0!==Y.shading&&Y.shading===THREE.SmoothShading,P=void 0,Z=void 0,ia=void 0,da=void 0,oa=void 0,ta=void 0,xa=void 0,ya=void 0,cb=void 0,za=void 0,Ca=void 0,ba=void 0,aa=void 0,$=void 0,mc=void 0,pa=void 0,N=void 0,Ga=void 0,ma=void 0,nc=void 0,ja=void 0,oc=void 0,pc=void 0,qc=void 0,Ba=void 0,zb=void 0,Ab=void 0,Ha=void 0,Bb=void 0,Aa=void 0,ua=void 0,Cb=void 0,Oa=void 0,Pb=
-void 0,Ma=void 0,jb=void 0,Ya=void 0,Za=void 0,uc=void 0,Qb=void 0,fb=0,gb=0,qb=0,rb=0,Db=0,Sa=0,Da=0,Pa=0,Ka=0,ka=0,ra=0,F=0,Ia=void 0,Qa=I.__vertexArray,sb=I.__uvArray,hb=I.__uv2Array,Ta=I.__normalArray,qa=I.__tangentArray,La=I.__colorArray,Ua=I.__skinIndexArray,Va=I.__skinWeightArray,Eb=I.__morphTargetsArrays,Jc=I.__morphNormalsArrays,Jb=I.__webglCustomAttributesList,z=void 0,Rb=I.__faceArray,Ja=I.__lineArray,va=O.geometry,$a=va.elementsNeedUpdate,Kc=va.uvsNeedUpdate,dc=va.normalsNeedUpdate,ea=
-va.tangentsNeedUpdate,wb=va.colorsNeedUpdate,U=va.morphTargetsNeedUpdate,fa=va.vertices,Q=I.faces3,wa=va.faces,sa=va.faceVertexUvs[0],Lc=va.faceVertexUvs[1],Fc=va.skinIndices,Sb=va.skinWeights,kb=va.morphTargets,Ea=va.morphNormals;if(va.verticesNeedUpdate){P=0;for(Z=Q.length;P<Z;P++)da=wa[Q[P]],ba=fa[da.a],aa=fa[da.b],$=fa[da.c],Qa[gb]=ba.x,Qa[gb+1]=ba.y,Qa[gb+2]=ba.z,Qa[gb+3]=aa.x,Qa[gb+4]=aa.y,Qa[gb+5]=aa.z,Qa[gb+6]=$.x,Qa[gb+7]=$.y,Qa[gb+8]=$.z,gb+=9;l.bindBuffer(l.ARRAY_BUFFER,I.__webglVertexBuffer);
+M.buffer&&(M.buffer=l.createBuffer(),M.needsUpdate=!0);if(!0===M.needsUpdate){var G="index"===A?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER;l.bindBuffer(G,M.buffer);l.bufferData(G,M.array,l.STATIC_DRAW);M.needsUpdate=!1}}else if(e instanceof THREE.Mesh){!0===r.groupsNeedUpdate&&s(a,e,r);for(var L=xb[r.id],K=0,I=L.length;K<I;K++){var R=L[K];E=d(e,R);!0===r.groupsNeedUpdate&&c(R,e);w=E.attributes&&v(E);if(r.verticesNeedUpdate||r.morphTargetsNeedUpdate||r.elementsNeedUpdate||r.uvsNeedUpdate||r.normalsNeedUpdate||
+r.colorsNeedUpdate||r.tangentsNeedUpdate||w){var J=R,O=e,S=l.DYNAMIC_DRAW,T=!r.dynamic,Y=E;if(J.__inittedArrays){var V=Y&&void 0!==Y.shading&&Y.shading===THREE.SmoothShading,P=void 0,Z=void 0,ha=void 0,da=void 0,oa=void 0,ta=void 0,xa=void 0,ya=void 0,cb=void 0,za=void 0,Ca=void 0,ba=void 0,aa=void 0,$=void 0,mc=void 0,pa=void 0,N=void 0,Ga=void 0,ma=void 0,nc=void 0,ja=void 0,oc=void 0,pc=void 0,qc=void 0,Ba=void 0,zb=void 0,Ab=void 0,Ha=void 0,Bb=void 0,Aa=void 0,ua=void 0,Cb=void 0,Oa=void 0,Pb=
+void 0,Ma=void 0,jb=void 0,Ya=void 0,Za=void 0,uc=void 0,Qb=void 0,fb=0,gb=0,qb=0,rb=0,Db=0,Sa=0,Da=0,Pa=0,Ka=0,ka=0,ra=0,F=0,Ia=void 0,Qa=J.__vertexArray,sb=J.__uvArray,hb=J.__uv2Array,Ta=J.__normalArray,qa=J.__tangentArray,La=J.__colorArray,Ua=J.__skinIndexArray,Va=J.__skinWeightArray,Eb=J.__morphTargetsArrays,Jc=J.__morphNormalsArrays,Jb=J.__webglCustomAttributesList,z=void 0,Rb=J.__faceArray,Ja=J.__lineArray,va=O.geometry,$a=va.elementsNeedUpdate,Kc=va.uvsNeedUpdate,dc=va.normalsNeedUpdate,ea=
+va.tangentsNeedUpdate,wb=va.colorsNeedUpdate,U=va.morphTargetsNeedUpdate,fa=va.vertices,Q=J.faces3,wa=va.faces,sa=va.faceVertexUvs[0],Lc=va.faceVertexUvs[1],Fc=va.skinIndices,Sb=va.skinWeights,kb=va.morphTargets,Ea=va.morphNormals;if(va.verticesNeedUpdate){P=0;for(Z=Q.length;P<Z;P++)da=wa[Q[P]],ba=fa[da.a],aa=fa[da.b],$=fa[da.c],Qa[gb]=ba.x,Qa[gb+1]=ba.y,Qa[gb+2]=ba.z,Qa[gb+3]=aa.x,Qa[gb+4]=aa.y,Qa[gb+5]=aa.z,Qa[gb+6]=$.x,Qa[gb+7]=$.y,Qa[gb+8]=$.z,gb+=9;l.bindBuffer(l.ARRAY_BUFFER,J.__webglVertexBuffer);
 l.bufferData(l.ARRAY_BUFFER,Qa,S)}if(U)for(Ma=0,jb=kb.length;Ma<jb;Ma++){P=ra=0;for(Z=Q.length;P<Z;P++)uc=Q[P],da=wa[uc],ba=kb[Ma].vertices[da.a],aa=kb[Ma].vertices[da.b],$=kb[Ma].vertices[da.c],Ya=Eb[Ma],Ya[ra]=ba.x,Ya[ra+1]=ba.y,Ya[ra+2]=ba.z,Ya[ra+3]=aa.x,Ya[ra+4]=aa.y,Ya[ra+5]=aa.z,Ya[ra+6]=$.x,Ya[ra+7]=$.y,Ya[ra+8]=$.z,Y.morphNormals&&(V?(Qb=Ea[Ma].vertexNormals[uc],Ga=Qb.a,ma=Qb.b,nc=Qb.c):nc=ma=Ga=Ea[Ma].faceNormals[uc],Za=Jc[Ma],Za[ra]=Ga.x,Za[ra+1]=Ga.y,Za[ra+2]=Ga.z,Za[ra+3]=ma.x,Za[ra+
-4]=ma.y,Za[ra+5]=ma.z,Za[ra+6]=nc.x,Za[ra+7]=nc.y,Za[ra+8]=nc.z),ra+=9;l.bindBuffer(l.ARRAY_BUFFER,I.__webglMorphTargetsBuffers[Ma]);l.bufferData(l.ARRAY_BUFFER,Eb[Ma],S);Y.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,I.__webglMorphNormalsBuffers[Ma]),l.bufferData(l.ARRAY_BUFFER,Jc[Ma],S))}if(Sb.length){P=0;for(Z=Q.length;P<Z;P++)da=wa[Q[P]],qc=Sb[da.a],Ba=Sb[da.b],zb=Sb[da.c],Va[ka]=qc.x,Va[ka+1]=qc.y,Va[ka+2]=qc.z,Va[ka+3]=qc.w,Va[ka+4]=Ba.x,Va[ka+5]=Ba.y,Va[ka+6]=Ba.z,Va[ka+7]=Ba.w,Va[ka+8]=zb.x,
-Va[ka+9]=zb.y,Va[ka+10]=zb.z,Va[ka+11]=zb.w,Ab=Fc[da.a],Ha=Fc[da.b],Bb=Fc[da.c],Ua[ka]=Ab.x,Ua[ka+1]=Ab.y,Ua[ka+2]=Ab.z,Ua[ka+3]=Ab.w,Ua[ka+4]=Ha.x,Ua[ka+5]=Ha.y,Ua[ka+6]=Ha.z,Ua[ka+7]=Ha.w,Ua[ka+8]=Bb.x,Ua[ka+9]=Bb.y,Ua[ka+10]=Bb.z,Ua[ka+11]=Bb.w,ka+=12;0<ka&&(l.bindBuffer(l.ARRAY_BUFFER,I.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,Ua,S),l.bindBuffer(l.ARRAY_BUFFER,I.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,Va,S))}if(wb){P=0;for(Z=Q.length;P<Z;P++)da=wa[Q[P]],xa=da.vertexColors,
-ya=da.color,3===xa.length&&Y.vertexColors===THREE.VertexColors?(ja=xa[0],oc=xa[1],pc=xa[2]):pc=oc=ja=ya,La[Ka]=ja.r,La[Ka+1]=ja.g,La[Ka+2]=ja.b,La[Ka+3]=oc.r,La[Ka+4]=oc.g,La[Ka+5]=oc.b,La[Ka+6]=pc.r,La[Ka+7]=pc.g,La[Ka+8]=pc.b,Ka+=9;0<Ka&&(l.bindBuffer(l.ARRAY_BUFFER,I.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,La,S))}if(ea&&va.hasTangents){P=0;for(Z=Q.length;P<Z;P++)da=wa[Q[P]],cb=da.vertexTangents,mc=cb[0],pa=cb[1],N=cb[2],qa[Da]=mc.x,qa[Da+1]=mc.y,qa[Da+2]=mc.z,qa[Da+3]=mc.w,qa[Da+4]=pa.x,
-qa[Da+5]=pa.y,qa[Da+6]=pa.z,qa[Da+7]=pa.w,qa[Da+8]=N.x,qa[Da+9]=N.y,qa[Da+10]=N.z,qa[Da+11]=N.w,Da+=12;l.bindBuffer(l.ARRAY_BUFFER,I.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,qa,S)}if(dc){P=0;for(Z=Q.length;P<Z;P++)if(da=wa[Q[P]],oa=da.vertexNormals,ta=da.normal,3===oa.length&&V)for(Aa=0;3>Aa;Aa++)Cb=oa[Aa],Ta[Sa]=Cb.x,Ta[Sa+1]=Cb.y,Ta[Sa+2]=Cb.z,Sa+=3;else for(Aa=0;3>Aa;Aa++)Ta[Sa]=ta.x,Ta[Sa+1]=ta.y,Ta[Sa+2]=ta.z,Sa+=3;l.bindBuffer(l.ARRAY_BUFFER,I.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,
-Ta,S)}if(Kc&&sa){P=0;for(Z=Q.length;P<Z;P++)if(ia=Q[P],za=sa[ia],void 0!==za)for(Aa=0;3>Aa;Aa++)Oa=za[Aa],sb[qb]=Oa.x,sb[qb+1]=Oa.y,qb+=2;0<qb&&(l.bindBuffer(l.ARRAY_BUFFER,I.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,sb,S))}if(Kc&&Lc){P=0;for(Z=Q.length;P<Z;P++)if(ia=Q[P],Ca=Lc[ia],void 0!==Ca)for(Aa=0;3>Aa;Aa++)Pb=Ca[Aa],hb[rb]=Pb.x,hb[rb+1]=Pb.y,rb+=2;0<rb&&(l.bindBuffer(l.ARRAY_BUFFER,I.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,hb,S))}if($a){P=0;for(Z=Q.length;P<Z;P++)Rb[Db]=fb,Rb[Db+1]=
-fb+1,Rb[Db+2]=fb+2,Db+=3,Ja[Pa]=fb,Ja[Pa+1]=fb+1,Ja[Pa+2]=fb,Ja[Pa+3]=fb+2,Ja[Pa+4]=fb+1,Ja[Pa+5]=fb+2,Pa+=6,fb+=3;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,I.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Rb,S);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,I.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Ja,S)}if(Jb)for(Aa=0,ua=Jb.length;Aa<ua;Aa++)if(z=Jb[Aa],z.__original.needsUpdate){F=0;if(1===z.size)if(void 0===z.boundTo||"vertices"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)da=wa[Q[P]],z.array[F]=
+4]=ma.y,Za[ra+5]=ma.z,Za[ra+6]=nc.x,Za[ra+7]=nc.y,Za[ra+8]=nc.z),ra+=9;l.bindBuffer(l.ARRAY_BUFFER,J.__webglMorphTargetsBuffers[Ma]);l.bufferData(l.ARRAY_BUFFER,Eb[Ma],S);Y.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,J.__webglMorphNormalsBuffers[Ma]),l.bufferData(l.ARRAY_BUFFER,Jc[Ma],S))}if(Sb.length){P=0;for(Z=Q.length;P<Z;P++)da=wa[Q[P]],qc=Sb[da.a],Ba=Sb[da.b],zb=Sb[da.c],Va[ka]=qc.x,Va[ka+1]=qc.y,Va[ka+2]=qc.z,Va[ka+3]=qc.w,Va[ka+4]=Ba.x,Va[ka+5]=Ba.y,Va[ka+6]=Ba.z,Va[ka+7]=Ba.w,Va[ka+8]=zb.x,
+Va[ka+9]=zb.y,Va[ka+10]=zb.z,Va[ka+11]=zb.w,Ab=Fc[da.a],Ha=Fc[da.b],Bb=Fc[da.c],Ua[ka]=Ab.x,Ua[ka+1]=Ab.y,Ua[ka+2]=Ab.z,Ua[ka+3]=Ab.w,Ua[ka+4]=Ha.x,Ua[ka+5]=Ha.y,Ua[ka+6]=Ha.z,Ua[ka+7]=Ha.w,Ua[ka+8]=Bb.x,Ua[ka+9]=Bb.y,Ua[ka+10]=Bb.z,Ua[ka+11]=Bb.w,ka+=12;0<ka&&(l.bindBuffer(l.ARRAY_BUFFER,J.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,Ua,S),l.bindBuffer(l.ARRAY_BUFFER,J.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,Va,S))}if(wb){P=0;for(Z=Q.length;P<Z;P++)da=wa[Q[P]],xa=da.vertexColors,
+ya=da.color,3===xa.length&&Y.vertexColors===THREE.VertexColors?(ja=xa[0],oc=xa[1],pc=xa[2]):pc=oc=ja=ya,La[Ka]=ja.r,La[Ka+1]=ja.g,La[Ka+2]=ja.b,La[Ka+3]=oc.r,La[Ka+4]=oc.g,La[Ka+5]=oc.b,La[Ka+6]=pc.r,La[Ka+7]=pc.g,La[Ka+8]=pc.b,Ka+=9;0<Ka&&(l.bindBuffer(l.ARRAY_BUFFER,J.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,La,S))}if(ea&&va.hasTangents){P=0;for(Z=Q.length;P<Z;P++)da=wa[Q[P]],cb=da.vertexTangents,mc=cb[0],pa=cb[1],N=cb[2],qa[Da]=mc.x,qa[Da+1]=mc.y,qa[Da+2]=mc.z,qa[Da+3]=mc.w,qa[Da+4]=pa.x,
+qa[Da+5]=pa.y,qa[Da+6]=pa.z,qa[Da+7]=pa.w,qa[Da+8]=N.x,qa[Da+9]=N.y,qa[Da+10]=N.z,qa[Da+11]=N.w,Da+=12;l.bindBuffer(l.ARRAY_BUFFER,J.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,qa,S)}if(dc){P=0;for(Z=Q.length;P<Z;P++)if(da=wa[Q[P]],oa=da.vertexNormals,ta=da.normal,3===oa.length&&V)for(Aa=0;3>Aa;Aa++)Cb=oa[Aa],Ta[Sa]=Cb.x,Ta[Sa+1]=Cb.y,Ta[Sa+2]=Cb.z,Sa+=3;else for(Aa=0;3>Aa;Aa++)Ta[Sa]=ta.x,Ta[Sa+1]=ta.y,Ta[Sa+2]=ta.z,Sa+=3;l.bindBuffer(l.ARRAY_BUFFER,J.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,
+Ta,S)}if(Kc&&sa){P=0;for(Z=Q.length;P<Z;P++)if(ha=Q[P],za=sa[ha],void 0!==za)for(Aa=0;3>Aa;Aa++)Oa=za[Aa],sb[qb]=Oa.x,sb[qb+1]=Oa.y,qb+=2;0<qb&&(l.bindBuffer(l.ARRAY_BUFFER,J.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,sb,S))}if(Kc&&Lc){P=0;for(Z=Q.length;P<Z;P++)if(ha=Q[P],Ca=Lc[ha],void 0!==Ca)for(Aa=0;3>Aa;Aa++)Pb=Ca[Aa],hb[rb]=Pb.x,hb[rb+1]=Pb.y,rb+=2;0<rb&&(l.bindBuffer(l.ARRAY_BUFFER,J.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,hb,S))}if($a){P=0;for(Z=Q.length;P<Z;P++)Rb[Db]=fb,Rb[Db+1]=
+fb+1,Rb[Db+2]=fb+2,Db+=3,Ja[Pa]=fb,Ja[Pa+1]=fb+1,Ja[Pa+2]=fb,Ja[Pa+3]=fb+2,Ja[Pa+4]=fb+1,Ja[Pa+5]=fb+2,Pa+=6,fb+=3;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,J.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Rb,S);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,J.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Ja,S)}if(Jb)for(Aa=0,ua=Jb.length;Aa<ua;Aa++)if(z=Jb[Aa],z.__original.needsUpdate){F=0;if(1===z.size)if(void 0===z.boundTo||"vertices"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)da=wa[Q[P]],z.array[F]=
 z.value[da.a],z.array[F+1]=z.value[da.b],z.array[F+2]=z.value[da.c],F+=3;else{if("faces"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)Ia=z.value[Q[P]],z.array[F]=Ia,z.array[F+1]=Ia,z.array[F+2]=Ia,F+=3}else if(2===z.size)if(void 0===z.boundTo||"vertices"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)da=wa[Q[P]],ba=z.value[da.a],aa=z.value[da.b],$=z.value[da.c],z.array[F]=ba.x,z.array[F+1]=ba.y,z.array[F+2]=aa.x,z.array[F+3]=aa.y,z.array[F+4]=$.x,z.array[F+5]=$.y,F+=6;else{if("faces"===z.boundTo)for(P=0,Z=Q.length;P<
 Z;P++)$=aa=ba=Ia=z.value[Q[P]],z.array[F]=ba.x,z.array[F+1]=ba.y,z.array[F+2]=aa.x,z.array[F+3]=aa.y,z.array[F+4]=$.x,z.array[F+5]=$.y,F+=6}else if(3===z.size){var la;la="c"===z.type?["r","g","b"]:["x","y","z"];if(void 0===z.boundTo||"vertices"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)da=wa[Q[P]],ba=z.value[da.a],aa=z.value[da.b],$=z.value[da.c],z.array[F]=ba[la[0]],z.array[F+1]=ba[la[1]],z.array[F+2]=ba[la[2]],z.array[F+3]=aa[la[0]],z.array[F+4]=aa[la[1]],z.array[F+5]=aa[la[2]],z.array[F+6]=$[la[0]],
 z.array[F+7]=$[la[1]],z.array[F+8]=$[la[2]],F+=9;else if("faces"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)$=aa=ba=Ia=z.value[Q[P]],z.array[F]=ba[la[0]],z.array[F+1]=ba[la[1]],z.array[F+2]=ba[la[2]],z.array[F+3]=aa[la[0]],z.array[F+4]=aa[la[1]],z.array[F+5]=aa[la[2]],z.array[F+6]=$[la[0]],z.array[F+7]=$[la[1]],z.array[F+8]=$[la[2]],F+=9;else if("faceVertices"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)Ia=z.value[Q[P]],ba=Ia[0],aa=Ia[1],$=Ia[2],z.array[F]=ba[la[0]],z.array[F+1]=ba[la[1]],z.array[F+2]=ba[la[2]],
 z.array[F+3]=aa[la[0]],z.array[F+4]=aa[la[1]],z.array[F+5]=aa[la[2]],z.array[F+6]=$[la[0]],z.array[F+7]=$[la[1]],z.array[F+8]=$[la[2]],F+=9}else if(4===z.size)if(void 0===z.boundTo||"vertices"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)da=wa[Q[P]],ba=z.value[da.a],aa=z.value[da.b],$=z.value[da.c],z.array[F]=ba.x,z.array[F+1]=ba.y,z.array[F+2]=ba.z,z.array[F+3]=ba.w,z.array[F+4]=aa.x,z.array[F+5]=aa.y,z.array[F+6]=aa.z,z.array[F+7]=aa.w,z.array[F+8]=$.x,z.array[F+9]=$.y,z.array[F+10]=$.z,z.array[F+11]=
 $.w,F+=12;else if("faces"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)$=aa=ba=Ia=z.value[Q[P]],z.array[F]=ba.x,z.array[F+1]=ba.y,z.array[F+2]=ba.z,z.array[F+3]=ba.w,z.array[F+4]=aa.x,z.array[F+5]=aa.y,z.array[F+6]=aa.z,z.array[F+7]=aa.w,z.array[F+8]=$.x,z.array[F+9]=$.y,z.array[F+10]=$.z,z.array[F+11]=$.w,F+=12;else if("faceVertices"===z.boundTo)for(P=0,Z=Q.length;P<Z;P++)Ia=z.value[Q[P]],ba=Ia[0],aa=Ia[1],$=Ia[2],z.array[F]=ba.x,z.array[F+1]=ba.y,z.array[F+2]=ba.z,z.array[F+3]=ba.w,z.array[F+4]=aa.x,
-z.array[F+5]=aa.y,z.array[F+6]=aa.z,z.array[F+7]=aa.w,z.array[F+8]=$.x,z.array[F+9]=$.y,z.array[F+10]=$.z,z.array[F+11]=$.w,F+=12;l.bindBuffer(l.ARRAY_BUFFER,z.buffer);l.bufferData(l.ARRAY_BUFFER,z.array,S)}T&&(delete I.__inittedArrays,delete I.__colorArray,delete I.__normalArray,delete I.__tangentArray,delete I.__uvArray,delete I.__uv2Array,delete I.__faceArray,delete I.__vertexArray,delete I.__lineArray,delete I.__skinIndexArray,delete I.__skinWeightArray)}}}r.verticesNeedUpdate=!1;r.morphTargetsNeedUpdate=
+z.array[F+5]=aa.y,z.array[F+6]=aa.z,z.array[F+7]=aa.w,z.array[F+8]=$.x,z.array[F+9]=$.y,z.array[F+10]=$.z,z.array[F+11]=$.w,F+=12;l.bindBuffer(l.ARRAY_BUFFER,z.buffer);l.bufferData(l.ARRAY_BUFFER,z.array,S)}T&&(delete J.__inittedArrays,delete J.__colorArray,delete J.__normalArray,delete J.__tangentArray,delete J.__uvArray,delete J.__uv2Array,delete J.__faceArray,delete J.__vertexArray,delete J.__lineArray,delete J.__skinIndexArray,delete J.__skinWeightArray)}}}r.verticesNeedUpdate=!1;r.morphTargetsNeedUpdate=
 !1;r.elementsNeedUpdate=!1;r.uvsNeedUpdate=!1;r.normalsNeedUpdate=!1;r.colorsNeedUpdate=!1;r.tangentsNeedUpdate=!1;E.attributes&&y(E)}else if(e instanceof THREE.Line){E=d(e,r);w=E.attributes&&v(E);if(r.verticesNeedUpdate||r.colorsNeedUpdate||r.lineDistancesNeedUpdate||w){var Yb=l.DYNAMIC_DRAW,ab,Fb,ib,Zb,ga,vc,cc=r.vertices,ec=r.colors,Ob=r.lineDistances,jc=cc.length,kc=ec.length,lc=Ob.length,wc=r.__vertexArray,xc=r.__colorArray,ic=r.__lineDistanceArray,sc=r.colorsNeedUpdate,tc=r.lineDistancesNeedUpdate,
 fc=r.__webglCustomAttributesList,yc,Kb,Fa,gc,Wa,na;if(r.verticesNeedUpdate){for(ab=0;ab<jc;ab++)Zb=cc[ab],ga=3*ab,wc[ga]=Zb.x,wc[ga+1]=Zb.y,wc[ga+2]=Zb.z;l.bindBuffer(l.ARRAY_BUFFER,r.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,wc,Yb)}if(sc){for(Fb=0;Fb<kc;Fb++)vc=ec[Fb],ga=3*Fb,xc[ga]=vc.r,xc[ga+1]=vc.g,xc[ga+2]=vc.b;l.bindBuffer(l.ARRAY_BUFFER,r.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,xc,Yb)}if(tc){for(ib=0;ib<lc;ib++)ic[ib]=Ob[ib];l.bindBuffer(l.ARRAY_BUFFER,r.__webglLineDistanceBuffer);
 l.bufferData(l.ARRAY_BUFFER,ic,Yb)}if(fc)for(yc=0,Kb=fc.length;yc<Kb;yc++)if(na=fc[yc],na.needsUpdate&&(void 0===na.boundTo||"vertices"===na.boundTo)){ga=0;gc=na.value.length;if(1===na.size)for(Fa=0;Fa<gc;Fa++)na.array[Fa]=na.value[Fa];else if(2===na.size)for(Fa=0;Fa<gc;Fa++)Wa=na.value[Fa],na.array[ga]=Wa.x,na.array[ga+1]=Wa.y,ga+=2;else if(3===na.size)if("c"===na.type)for(Fa=0;Fa<gc;Fa++)Wa=na.value[Fa],na.array[ga]=Wa.r,na.array[ga+1]=Wa.g,na.array[ga+2]=Wa.b,ga+=3;else for(Fa=0;Fa<gc;Fa++)Wa=
 na.value[Fa],na.array[ga]=Wa.x,na.array[ga+1]=Wa.y,na.array[ga+2]=Wa.z,ga+=3;else if(4===na.size)for(Fa=0;Fa<gc;Fa++)Wa=na.value[Fa],na.array[ga]=Wa.x,na.array[ga+1]=Wa.y,na.array[ga+2]=Wa.z,na.array[ga+3]=Wa.w,ga+=4;l.bindBuffer(l.ARRAY_BUFFER,na.buffer);l.bufferData(l.ARRAY_BUFFER,na.array,Yb)}}r.verticesNeedUpdate=!1;r.colorsNeedUpdate=!1;r.lineDistancesNeedUpdate=!1;E.attributes&&y(E)}else if(e instanceof THREE.PointCloud){E=d(e,r);w=E.attributes&&v(E);if(r.verticesNeedUpdate||r.colorsNeedUpdate||
-e.sortParticles||w){var Lb=l.DYNAMIC_DRAW,Xa,tb,ub,X,vb,Tb,zc=r.vertices,pb=zc.length,Mb=r.colors,Nb=Mb.length,$b=r.__vertexArray,ac=r.__colorArray,Gb=r.__sortArray,Wb=r.verticesNeedUpdate,Xb=r.colorsNeedUpdate,Hb=r.__webglCustomAttributesList,lb,hc,ca,mb,ha,W;if(e.sortParticles){Gc.copy(Ac);Gc.multiply(e.matrixWorld);for(Xa=0;Xa<pb;Xa++)ub=zc[Xa],Na.copy(ub),Na.applyProjection(Gc),Gb[Xa]=[Na.z,Xa];Gb.sort(p);for(Xa=0;Xa<pb;Xa++)ub=zc[Gb[Xa][1]],X=3*Xa,$b[X]=ub.x,$b[X+1]=ub.y,$b[X+2]=ub.z;for(tb=
-0;tb<Nb;tb++)X=3*tb,Tb=Mb[Gb[tb][1]],ac[X]=Tb.r,ac[X+1]=Tb.g,ac[X+2]=Tb.b;if(Hb)for(lb=0,hc=Hb.length;lb<hc;lb++)if(W=Hb[lb],void 0===W.boundTo||"vertices"===W.boundTo)if(X=0,mb=W.value.length,1===W.size)for(ca=0;ca<mb;ca++)vb=Gb[ca][1],W.array[ca]=W.value[vb];else if(2===W.size)for(ca=0;ca<mb;ca++)vb=Gb[ca][1],ha=W.value[vb],W.array[X]=ha.x,W.array[X+1]=ha.y,X+=2;else if(3===W.size)if("c"===W.type)for(ca=0;ca<mb;ca++)vb=Gb[ca][1],ha=W.value[vb],W.array[X]=ha.r,W.array[X+1]=ha.g,W.array[X+2]=ha.b,
-X+=3;else for(ca=0;ca<mb;ca++)vb=Gb[ca][1],ha=W.value[vb],W.array[X]=ha.x,W.array[X+1]=ha.y,W.array[X+2]=ha.z,X+=3;else if(4===W.size)for(ca=0;ca<mb;ca++)vb=Gb[ca][1],ha=W.value[vb],W.array[X]=ha.x,W.array[X+1]=ha.y,W.array[X+2]=ha.z,W.array[X+3]=ha.w,X+=4}else{if(Wb)for(Xa=0;Xa<pb;Xa++)ub=zc[Xa],X=3*Xa,$b[X]=ub.x,$b[X+1]=ub.y,$b[X+2]=ub.z;if(Xb)for(tb=0;tb<Nb;tb++)Tb=Mb[tb],X=3*tb,ac[X]=Tb.r,ac[X+1]=Tb.g,ac[X+2]=Tb.b;if(Hb)for(lb=0,hc=Hb.length;lb<hc;lb++)if(W=Hb[lb],W.needsUpdate&&(void 0===W.boundTo||
-"vertices"===W.boundTo))if(mb=W.value.length,X=0,1===W.size)for(ca=0;ca<mb;ca++)W.array[ca]=W.value[ca];else if(2===W.size)for(ca=0;ca<mb;ca++)ha=W.value[ca],W.array[X]=ha.x,W.array[X+1]=ha.y,X+=2;else if(3===W.size)if("c"===W.type)for(ca=0;ca<mb;ca++)ha=W.value[ca],W.array[X]=ha.r,W.array[X+1]=ha.g,W.array[X+2]=ha.b,X+=3;else for(ca=0;ca<mb;ca++)ha=W.value[ca],W.array[X]=ha.x,W.array[X+1]=ha.y,W.array[X+2]=ha.z,X+=3;else if(4===W.size)for(ca=0;ca<mb;ca++)ha=W.value[ca],W.array[X]=ha.x,W.array[X+
-1]=ha.y,W.array[X+2]=ha.z,W.array[X+3]=ha.w,X+=4}if(Wb||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,r.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,$b,Lb);if(Xb||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,r.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,ac,Lb);if(Hb)for(lb=0,hc=Hb.length;lb<hc;lb++)if(W=Hb[lb],W.needsUpdate||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,W.buffer),l.bufferData(l.ARRAY_BUFFER,W.array,Lb)}r.verticesNeedUpdate=!1;r.colorsNeedUpdate=!1;E.attributes&&y(E)}for(var bc=
-0,nb=t.length;bc<nb;bc++){var Bc=t[bc],Ub=Bc,rc=Ub.object,Cc=Ub.buffer,Dc=rc.geometry,Vb=rc.material;Vb instanceof THREE.MeshFaceMaterial?(Vb=Vb.materials[Dc instanceof THREE.BufferGeometry?0:Cc.materialIndex],Ub.material=Vb,Vb.transparent?Ib.push(Ub):bb.push(Ub)):Vb&&(Ub.material=Vb,Vb.transparent?Ib.push(Ub):bb.push(Ub));Bc.render=!0;!0===K.sortObjects&&(null!==e.renderDepth?Bc.z=e.renderDepth:(Na.setFromMatrixPosition(e.matrixWorld),Na.applyProjection(Ac),Bc.z=Na.z))}}}}bc=0;for(nb=e.children.length;bc<
-nb;bc++)q(a,e.children[bc])}}function m(a,b,c,d,e,f){for(var g,h=a.length-1;-1!==h;h--){g=a[h];var k=g.object,l=g.buffer;x(k,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);B(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}K.setMaterialFaces(g);l instanceof THREE.BufferGeometry?K.renderBufferDirect(b,c,d,g,l,k):K.renderBuffer(b,c,d,g,l,k)}}function r(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);B(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,h,m)}}}function t(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function s(a,b,d){var e=b.material,f=!1;if(void 0===xb[d.id]||!0===
-d.groupsNeedUpdate){delete eb[b.id];a=xb;for(var g=d.id,e=e instanceof THREE.MeshFaceMaterial,h=oa.get("OES_element_index_uint")?4294967296:65535,k,f={},m=d.morphTargets.length,n=d.morphNormals.length,p,r={},q=[],t=0,s=d.faces.length;t<s;t++){k=d.faces[t];var v=e?k.materialIndex:0;v in f||(f[v]={hash:v,counter:0});k=f[v].hash+"_"+f[v].counter;k in r||(p={id:rc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},r[k]=p,q.push(p));r[k].vertices+3>h&&(f[v].counter+=1,k=f[v].hash+
+e.sortParticles||w){var Lb=l.DYNAMIC_DRAW,Xa,tb,ub,X,vb,Tb,zc=r.vertices,pb=zc.length,Mb=r.colors,Nb=Mb.length,$b=r.__vertexArray,ac=r.__colorArray,Gb=r.__sortArray,Wb=r.verticesNeedUpdate,Xb=r.colorsNeedUpdate,Hb=r.__webglCustomAttributesList,lb,hc,ca,mb,ia,W;if(e.sortParticles){Gc.copy(Ac);Gc.multiply(e.matrixWorld);for(Xa=0;Xa<pb;Xa++)ub=zc[Xa],Na.copy(ub),Na.applyProjection(Gc),Gb[Xa]=[Na.z,Xa];Gb.sort(p);for(Xa=0;Xa<pb;Xa++)ub=zc[Gb[Xa][1]],X=3*Xa,$b[X]=ub.x,$b[X+1]=ub.y,$b[X+2]=ub.z;for(tb=
+0;tb<Nb;tb++)X=3*tb,Tb=Mb[Gb[tb][1]],ac[X]=Tb.r,ac[X+1]=Tb.g,ac[X+2]=Tb.b;if(Hb)for(lb=0,hc=Hb.length;lb<hc;lb++)if(W=Hb[lb],void 0===W.boundTo||"vertices"===W.boundTo)if(X=0,mb=W.value.length,1===W.size)for(ca=0;ca<mb;ca++)vb=Gb[ca][1],W.array[ca]=W.value[vb];else if(2===W.size)for(ca=0;ca<mb;ca++)vb=Gb[ca][1],ia=W.value[vb],W.array[X]=ia.x,W.array[X+1]=ia.y,X+=2;else if(3===W.size)if("c"===W.type)for(ca=0;ca<mb;ca++)vb=Gb[ca][1],ia=W.value[vb],W.array[X]=ia.r,W.array[X+1]=ia.g,W.array[X+2]=ia.b,
+X+=3;else for(ca=0;ca<mb;ca++)vb=Gb[ca][1],ia=W.value[vb],W.array[X]=ia.x,W.array[X+1]=ia.y,W.array[X+2]=ia.z,X+=3;else if(4===W.size)for(ca=0;ca<mb;ca++)vb=Gb[ca][1],ia=W.value[vb],W.array[X]=ia.x,W.array[X+1]=ia.y,W.array[X+2]=ia.z,W.array[X+3]=ia.w,X+=4}else{if(Wb)for(Xa=0;Xa<pb;Xa++)ub=zc[Xa],X=3*Xa,$b[X]=ub.x,$b[X+1]=ub.y,$b[X+2]=ub.z;if(Xb)for(tb=0;tb<Nb;tb++)Tb=Mb[tb],X=3*tb,ac[X]=Tb.r,ac[X+1]=Tb.g,ac[X+2]=Tb.b;if(Hb)for(lb=0,hc=Hb.length;lb<hc;lb++)if(W=Hb[lb],W.needsUpdate&&(void 0===W.boundTo||
+"vertices"===W.boundTo))if(mb=W.value.length,X=0,1===W.size)for(ca=0;ca<mb;ca++)W.array[ca]=W.value[ca];else if(2===W.size)for(ca=0;ca<mb;ca++)ia=W.value[ca],W.array[X]=ia.x,W.array[X+1]=ia.y,X+=2;else if(3===W.size)if("c"===W.type)for(ca=0;ca<mb;ca++)ia=W.value[ca],W.array[X]=ia.r,W.array[X+1]=ia.g,W.array[X+2]=ia.b,X+=3;else for(ca=0;ca<mb;ca++)ia=W.value[ca],W.array[X]=ia.x,W.array[X+1]=ia.y,W.array[X+2]=ia.z,X+=3;else if(4===W.size)for(ca=0;ca<mb;ca++)ia=W.value[ca],W.array[X]=ia.x,W.array[X+
+1]=ia.y,W.array[X+2]=ia.z,W.array[X+3]=ia.w,X+=4}if(Wb||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,r.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,$b,Lb);if(Xb||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,r.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,ac,Lb);if(Hb)for(lb=0,hc=Hb.length;lb<hc;lb++)if(W=Hb[lb],W.needsUpdate||e.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,W.buffer),l.bufferData(l.ARRAY_BUFFER,W.array,Lb)}r.verticesNeedUpdate=!1;r.colorsNeedUpdate=!1;E.attributes&&y(E)}for(var bc=
+0,nb=t.length;bc<nb;bc++){var Bc=t[bc],Ub=Bc,rc=Ub.object,Cc=Ub.buffer,Dc=rc.geometry,Vb=rc.material;Vb instanceof THREE.MeshFaceMaterial?(Vb=Vb.materials[Dc instanceof THREE.BufferGeometry?0:Cc.materialIndex],Ub.material=Vb,Vb.transparent?Ib.push(Ub):bb.push(Ub)):Vb&&(Ub.material=Vb,Vb.transparent?Ib.push(Ub):bb.push(Ub));Bc.render=!0;!0===H.sortObjects&&(null!==e.renderDepth?Bc.z=e.renderDepth:(Na.setFromMatrixPosition(e.matrixWorld),Na.applyProjection(Ac),Bc.z=Na.z))}}}}bc=0;for(nb=e.children.length;bc<
+nb;bc++)q(a,e.children[bc])}}function m(a,b,c,d,e,f){for(var g,h=a.length-1;-1!==h;h--){g=a[h];var k=g.object,l=g.buffer;x(k,b);if(f)g=f;else{g=g.material;if(!g)continue;e&&H.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);H.setDepthTest(g.depthTest);H.setDepthWrite(g.depthWrite);B(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}H.setMaterialFaces(g);l instanceof THREE.BufferGeometry?H.renderBufferDirect(b,c,d,g,l,k):H.renderBuffer(b,c,d,g,l,k)}}function r(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&&H.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);H.setDepthTest(h.depthTest);H.setDepthWrite(h.depthWrite);B(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}H.renderImmediateObject(c,d,e,h,m)}}}function t(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function s(a,b,d){var e=b.material,f=!1;if(void 0===xb[d.id]||!0===
+d.groupsNeedUpdate){delete eb[b.id];a=xb;for(var g=d.id,e=e instanceof THREE.MeshFaceMaterial,h=ha.get("OES_element_index_uint")?4294967296:65535,k,f={},m=d.morphTargets.length,n=d.morphNormals.length,p,r={},q=[],t=0,s=d.faces.length;t<s;t++){k=d.faces[t];var v=e?k.materialIndex:0;v in f||(f[v]={hash:v,counter:0});k=f[v].hash+"_"+f[v].counter;k in r||(p={id:rc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},r[k]=p,q.push(p));r[k].vertices+3>h&&(f[v].counter+=1,k=f[v].hash+
 "_"+f[v].counter,k in r||(p={id:rc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},r[k]=p,q.push(p)));r[k].faces3.push(t);r[k].vertices+=3}a[g]=q;d.groupsNeedUpdate=!1}a=xb[d.id];g=0;for(e=a.length;g<e;g++){h=a[g];if(void 0===h.__webglVertexBuffer){f=h;f.__webglVertexBuffer=l.createBuffer();f.__webglNormalBuffer=l.createBuffer();f.__webglTangentBuffer=l.createBuffer();f.__webglColorBuffer=l.createBuffer();f.__webglUVBuffer=l.createBuffer();f.__webglUV2Buffer=l.createBuffer();
-f.__webglSkinIndicesBuffer=l.createBuffer();f.__webglSkinWeightsBuffer=l.createBuffer();f.__webglFaceBuffer=l.createBuffer();f.__webglLineBuffer=l.createBuffer();n=m=void 0;if(f.numMorphTargets)for(f.__webglMorphTargetsBuffers=[],m=0,n=f.numMorphTargets;m<n;m++)f.__webglMorphTargetsBuffers.push(l.createBuffer());if(f.numMorphNormals)for(f.__webglMorphNormalsBuffers=[],m=0,n=f.numMorphNormals;m<n;m++)f.__webglMorphNormalsBuffers.push(l.createBuffer());K.info.memory.geometries++;c(h,b);d.verticesNeedUpdate=
+f.__webglSkinIndicesBuffer=l.createBuffer();f.__webglSkinWeightsBuffer=l.createBuffer();f.__webglFaceBuffer=l.createBuffer();f.__webglLineBuffer=l.createBuffer();n=m=void 0;if(f.numMorphTargets)for(f.__webglMorphTargetsBuffers=[],m=0,n=f.numMorphTargets;m<n;m++)f.__webglMorphTargetsBuffers.push(l.createBuffer());if(f.numMorphNormals)for(f.__webglMorphNormalsBuffers=[],m=0,n=f.numMorphNormals;m<n;m++)f.__webglMorphNormalsBuffers.push(l.createBuffer());H.info.memory.geometries++;c(h,b);d.verticesNeedUpdate=
 !0;d.morphTargetsNeedUpdate=!0;d.elementsNeedUpdate=!0;d.uvsNeedUpdate=!0;d.normalsNeedUpdate=!0;d.tangentsNeedUpdate=!0;f=d.colorsNeedUpdate=!0}else f=!1;(f||void 0===b.__webglActive)&&u(eb,h,b)}b.__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){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function y(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function E(a,b,c,d,e){var f,g,
 h,k;cc=0;if(d.needsUpdate){d.program&&Cc(d);d.addEventListener("dispose",Dc);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,r=0,q=0,t=0,s=0,u=b.length;s<u;s++){var v=b[s];v.onlyShadow||!1===v.visible||(v instanceof THREE.DirectionalLight&&p++,v instanceof THREE.PointLight&&r++,v instanceof THREE.SpotLight&&q++,v instanceof THREE.HemisphereLight&&t++)}f=p;g=r;h=q;k=t;for(var y,E=0,x=
-0,B=b.length;x<B;x++){var A=b[x];A.castShadow&&(A instanceof THREE.SpotLight&&E++,A instanceof THREE.DirectionalLight&&!A.shadowCascade&&E++)}y=E;var Z;if(ic&&e&&e.skeleton&&e.skeleton.useVertexTexture)Z=1024;else{var J=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),H=Math.floor((J-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(H=Math.min(e.skeleton.bones.length,H),H<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+H+" (try OpenGL instead of ANGLE)"));
-Z=H}var R={precision:Y,supportsVertexTextures:sc,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:xa,skinning:d.skinning,maxBones:Z,useVertexTexture:ic&&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:y,shadowMapEnabled:K.shadowMapEnabled&&e.receiveShadow&&0<y,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},O=[];m?O.push(m):(O.push(d.fragmentShader),O.push(d.vertexShader));if(void 0!==d.defines)for(var T in d.defines)O.push(T),
-O.push(d.defines[T]);for(T in R)O.push(T),O.push(R[T]);for(var P=O.join(),V,eb=0,da=cb.length;eb<da;eb++){var ob=cb[eb];if(ob.code===P){V=ob;V.usedTimes++;break}}void 0===V&&(V=new THREE.WebGLProgram(K,P,d,R),cb.push(V),K.info.memory.programs=cb.length);d.program=V;var db=V.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var ia,oa="morphTarget",bb=0;bb<K.maxMorphTargets;bb++)ia=oa+bb,0<=db[ia]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,oa="morphNormal",
-bb=0;bb<K.maxMorphNormals;bb++)ia=oa+bb,0<=db[ia]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var ya in d.__webglShader.uniforms){var za=d.program.uniforms[ya];za&&d.uniformsList.push([d.__webglShader.uniforms[ya],za])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var ba=!1,aa=!1,$=!1,yb=d.program,pa=yb.uniforms,N=d.__webglShader.uniforms;yb.id!==tc&&(l.useProgram(yb.program),tc=yb.id,$=aa=ba=!0);d.id!==
+0,B=b.length;x<B;x++){var A=b[x];A.castShadow&&(A instanceof THREE.SpotLight&&E++,A instanceof THREE.DirectionalLight&&!A.shadowCascade&&E++)}y=E;var Z;if(ic&&e&&e.skeleton&&e.skeleton.useVertexTexture)Z=1024;else{var K=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),I=Math.floor((K-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(I=Math.min(e.skeleton.bones.length,I),I<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+I+" (try OpenGL instead of ANGLE)"));
+Z=I}var R={precision:Y,supportsVertexTextures:sc,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:xa,skinning:d.skinning,maxBones:Z,useVertexTexture:ic&&e&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:H.maxMorphTargets,
+maxMorphNormals:H.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:y,shadowMapEnabled:H.shadowMapEnabled&&e.receiveShadow&&0<y,shadowMapType:H.shadowMapType,shadowMapDebug:H.shadowMapDebug,shadowMapCascade:H.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},O=[];m?O.push(m):(O.push(d.fragmentShader),O.push(d.vertexShader));if(void 0!==d.defines)for(var T in d.defines)O.push(T),
+O.push(d.defines[T]);for(T in R)O.push(T),O.push(R[T]);for(var P=O.join(),V,eb=0,da=cb.length;eb<da;eb++){var ob=cb[eb];if(ob.code===P){V=ob;V.usedTimes++;break}}void 0===V&&(V=new THREE.WebGLProgram(H,P,d,R),cb.push(V),H.info.memory.programs=cb.length);d.program=V;var db=V.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var ha,oa="morphTarget",bb=0;bb<H.maxMorphTargets;bb++)ha=oa+bb,0<=db[ha]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,oa="morphNormal",
+bb=0;bb<H.maxMorphNormals;bb++)ha=oa+bb,0<=db[ha]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var ya in d.__webglShader.uniforms){var za=d.program.uniforms[ya];za&&d.uniformsList.push([d.__webglShader.uniforms[ya],za])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(H.maxMorphTargets));var ba=!1,aa=!1,$=!1,yb=d.program,pa=yb.uniforms,N=d.__webglShader.uniforms;yb.id!==tc&&(l.useProgram(yb.program),tc=yb.id,$=aa=ba=!0);d.id!==
 Jb&&(-1===Jb&&($=!0),Jb=d.id,aa=!0);if(ba||a!==dc)l.uniformMatrix4fv(pa.projectionMatrix,!1,a.projectionMatrix.elements),xa&&l.uniform1f(pa.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==dc&&(dc=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==pa.cameraPosition&&(Na.setFromMatrixPosition(a.matrixWorld),l.uniform3f(pa.cameraPosition,Na.x,Na.y,Na.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
-d.skinning)&&null!==pa.viewMatrix&&l.uniformMatrix4fv(pa.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==pa.bindMatrix&&l.uniformMatrix4fv(pa.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&null!==pa.bindMatrixInverse&&l.uniformMatrix4fv(pa.bindMatrixInverse,!1,e.bindMatrixInverse.elements),ic&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==pa.boneTexture){var Ib=M();l.uniform1i(pa.boneTexture,Ib);K.setTexture(e.skeleton.boneTexture,Ib)}null!==pa.boneTextureWidth&&
+d.skinning)&&null!==pa.viewMatrix&&l.uniformMatrix4fv(pa.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==pa.bindMatrix&&l.uniformMatrix4fv(pa.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&null!==pa.bindMatrixInverse&&l.uniformMatrix4fv(pa.bindMatrixInverse,!1,e.bindMatrixInverse.elements),ic&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==pa.boneTexture){var Ib=M();l.uniform1i(pa.boneTexture,Ib);H.setTexture(e.skeleton.boneTexture,Ib)}null!==pa.boneTextureWidth&&
 l.uniform1i(pa.boneTextureWidth,e.skeleton.boneTextureWidth);null!==pa.boneTextureHeight&&l.uniform1i(pa.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==pa.boneGlobalMatrices&&l.uniformMatrix4fv(pa.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(aa){c&&d.fog&&(N.fogColor.value=c.color,c instanceof THREE.Fog?(N.fogNear.value=c.near,N.fogFar.value=c.far):c instanceof THREE.FogExp2&&(N.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||
 d instanceof THREE.MeshLambertMaterial||d.lights){if(ec){var $=!0,ma,Ra,ja,Ca=0,Ga=0,Oa=0,Ba,zb,Ab,Ha,Bb,Aa,ua=Mc,Cb=ua.directional.colors,jb=ua.directional.positions,Pb=ua.point.colors,Ma=ua.point.positions,xb=ua.point.distances,Ya=ua.spot.colors,Za=ua.spot.positions,Lb=ua.spot.distances,Qb=ua.spot.directions,fb=ua.spot.anglesCos,gb=ua.spot.exponents,qb=ua.hemi.skyColors,rb=ua.hemi.groundColors,Db=ua.hemi.positions,Sa=0,Da=0,Pa=0,Ka=0,ka=0,ra=0,F=0,Ia=0,Qa=0,sb=0,hb=0,Ta=0;ma=0;for(Ra=b.length;ma<
-Ra;ma++)ja=b[ma],ja.onlyShadow||(Ba=ja.color,Ha=ja.intensity,Aa=ja.distance,ja instanceof THREE.AmbientLight?ja.visible&&(K.gammaInput?(Ca+=Ba.r*Ba.r,Ga+=Ba.g*Ba.g,Oa+=Ba.b*Ba.b):(Ca+=Ba.r,Ga+=Ba.g,Oa+=Ba.b)):ja instanceof THREE.DirectionalLight?(ka+=1,ja.visible&&(ta.setFromMatrixPosition(ja.matrixWorld),Na.setFromMatrixPosition(ja.target.matrixWorld),ta.sub(Na),ta.normalize(),Qa=3*Sa,jb[Qa]=ta.x,jb[Qa+1]=ta.y,jb[Qa+2]=ta.z,K.gammaInput?C(Cb,Qa,Ba,Ha*Ha):D(Cb,Qa,Ba,Ha),Sa+=1)):ja instanceof THREE.PointLight?
-(ra+=1,ja.visible&&(sb=3*Da,K.gammaInput?C(Pb,sb,Ba,Ha*Ha):D(Pb,sb,Ba,Ha),Na.setFromMatrixPosition(ja.matrixWorld),Ma[sb]=Na.x,Ma[sb+1]=Na.y,Ma[sb+2]=Na.z,xb[Da]=Aa,Da+=1)):ja instanceof THREE.SpotLight?(F+=1,ja.visible&&(hb=3*Pa,K.gammaInput?C(Ya,hb,Ba,Ha*Ha):D(Ya,hb,Ba,Ha),ta.setFromMatrixPosition(ja.matrixWorld),Za[hb]=ta.x,Za[hb+1]=ta.y,Za[hb+2]=ta.z,Lb[Pa]=Aa,Na.setFromMatrixPosition(ja.target.matrixWorld),ta.sub(Na),ta.normalize(),Qb[hb]=ta.x,Qb[hb+1]=ta.y,Qb[hb+2]=ta.z,fb[Pa]=Math.cos(ja.angle),
-gb[Pa]=ja.exponent,Pa+=1)):ja instanceof THREE.HemisphereLight&&(Ia+=1,ja.visible&&(ta.setFromMatrixPosition(ja.matrixWorld),ta.normalize(),Ta=3*Ka,Db[Ta]=ta.x,Db[Ta+1]=ta.y,Db[Ta+2]=ta.z,zb=ja.color,Ab=ja.groundColor,K.gammaInput?(Bb=Ha*Ha,C(qb,Ta,zb,Bb),C(rb,Ta,Ab,Bb)):(D(qb,Ta,zb,Ha),D(rb,Ta,Ab,Ha)),Ka+=1)));ma=3*Sa;for(Ra=Math.max(Cb.length,3*ka);ma<Ra;ma++)Cb[ma]=0;ma=3*Da;for(Ra=Math.max(Pb.length,3*ra);ma<Ra;ma++)Pb[ma]=0;ma=3*Pa;for(Ra=Math.max(Ya.length,3*F);ma<Ra;ma++)Ya[ma]=0;ma=3*Ka;for(Ra=
+Ra;ma++)ja=b[ma],ja.onlyShadow||(Ba=ja.color,Ha=ja.intensity,Aa=ja.distance,ja instanceof THREE.AmbientLight?ja.visible&&(H.gammaInput?(Ca+=Ba.r*Ba.r,Ga+=Ba.g*Ba.g,Oa+=Ba.b*Ba.b):(Ca+=Ba.r,Ga+=Ba.g,Oa+=Ba.b)):ja instanceof THREE.DirectionalLight?(ka+=1,ja.visible&&(ta.setFromMatrixPosition(ja.matrixWorld),Na.setFromMatrixPosition(ja.target.matrixWorld),ta.sub(Na),ta.normalize(),Qa=3*Sa,jb[Qa]=ta.x,jb[Qa+1]=ta.y,jb[Qa+2]=ta.z,H.gammaInput?C(Cb,Qa,Ba,Ha*Ha):D(Cb,Qa,Ba,Ha),Sa+=1)):ja instanceof THREE.PointLight?
+(ra+=1,ja.visible&&(sb=3*Da,H.gammaInput?C(Pb,sb,Ba,Ha*Ha):D(Pb,sb,Ba,Ha),Na.setFromMatrixPosition(ja.matrixWorld),Ma[sb]=Na.x,Ma[sb+1]=Na.y,Ma[sb+2]=Na.z,xb[Da]=Aa,Da+=1)):ja instanceof THREE.SpotLight?(F+=1,ja.visible&&(hb=3*Pa,H.gammaInput?C(Ya,hb,Ba,Ha*Ha):D(Ya,hb,Ba,Ha),ta.setFromMatrixPosition(ja.matrixWorld),Za[hb]=ta.x,Za[hb+1]=ta.y,Za[hb+2]=ta.z,Lb[Pa]=Aa,Na.setFromMatrixPosition(ja.target.matrixWorld),ta.sub(Na),ta.normalize(),Qb[hb]=ta.x,Qb[hb+1]=ta.y,Qb[hb+2]=ta.z,fb[Pa]=Math.cos(ja.angle),
+gb[Pa]=ja.exponent,Pa+=1)):ja instanceof THREE.HemisphereLight&&(Ia+=1,ja.visible&&(ta.setFromMatrixPosition(ja.matrixWorld),ta.normalize(),Ta=3*Ka,Db[Ta]=ta.x,Db[Ta+1]=ta.y,Db[Ta+2]=ta.z,zb=ja.color,Ab=ja.groundColor,H.gammaInput?(Bb=Ha*Ha,C(qb,Ta,zb,Bb),C(rb,Ta,Ab,Bb)):(D(qb,Ta,zb,Ha),D(rb,Ta,Ab,Ha)),Ka+=1)));ma=3*Sa;for(Ra=Math.max(Cb.length,3*ka);ma<Ra;ma++)Cb[ma]=0;ma=3*Da;for(Ra=Math.max(Pb.length,3*ra);ma<Ra;ma++)Pb[ma]=0;ma=3*Pa;for(Ra=Math.max(Ya.length,3*F);ma<Ra;ma++)Ya[ma]=0;ma=3*Ka;for(Ra=
 Math.max(qb.length,3*Ia);ma<Ra;ma++)qb[ma]=0;ma=3*Ka;for(Ra=Math.max(rb.length,3*Ia);ma<Ra;ma++)rb[ma]=0;ua.directional.length=Sa;ua.point.length=Da;ua.spot.length=Pa;ua.hemi.length=Ka;ua.ambient[0]=Ca;ua.ambient[1]=Ga;ua.ambient[2]=Oa;ec=!1}if($){var qa=Mc;N.ambientLightColor.value=qa.ambient;N.directionalLightColor.value=qa.directional.colors;N.directionalLightDirection.value=qa.directional.positions;N.pointLightColor.value=qa.point.colors;N.pointLightPosition.value=qa.point.positions;N.pointLightDistance.value=
 qa.point.distances;N.spotLightColor.value=qa.spot.colors;N.spotLightPosition.value=qa.spot.positions;N.spotLightDistance.value=qa.spot.distances;N.spotLightDirection.value=qa.spot.directions;N.spotLightAngleCos.value=qa.spot.anglesCos;N.spotLightExponent.value=qa.spot.exponents;N.hemisphereLightSkyColor.value=qa.hemi.skyColors;N.hemisphereLightGroundColor.value=qa.hemi.groundColors;N.hemisphereLightDirection.value=qa.hemi.positions;w(N,!0)}else w(N,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof
-THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){N.opacity.value=d.opacity;K.gammaInput?N.diffuse.value.copyGammaToLinear(d.color):N.diffuse.value=d.color;N.map.value=d.map;N.lightMap.value=d.lightMap;N.specularMap.value=d.specularMap;N.alphaMap.value=d.alphaMap;d.bumpMap&&(N.bumpMap.value=d.bumpMap,N.bumpScale.value=d.bumpScale);d.normalMap&&(N.normalMap.value=d.normalMap,N.normalScale.value.copy(d.normalScale));var La;d.map?La=d.map:d.specularMap?La=d.specularMap:d.normalMap?La=
+THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){N.opacity.value=d.opacity;H.gammaInput?N.diffuse.value.copyGammaToLinear(d.color):N.diffuse.value=d.color;N.map.value=d.map;N.lightMap.value=d.lightMap;N.specularMap.value=d.specularMap;N.alphaMap.value=d.alphaMap;d.bumpMap&&(N.bumpMap.value=d.bumpMap,N.bumpScale.value=d.bumpScale);d.normalMap&&(N.normalMap.value=d.normalMap,N.normalScale.value.copy(d.normalScale));var La;d.map?La=d.map:d.specularMap?La=d.specularMap:d.normalMap?La=
 d.normalMap:d.bumpMap?La=d.bumpMap:d.alphaMap&&(La=d.alphaMap);if(void 0!==La){var Ua=La.offset,Va=La.repeat;N.offsetRepeat.value.set(Ua.x,Ua.y,Va.x,Va.y)}N.envMap.value=d.envMap;N.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;N.reflectivity.value=d.reflectivity;N.refractionRatio.value=d.refractionRatio;N.combine.value=d.combine;N.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(N.diffuse.value=d.color,
-N.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(N.diffuse.value=d.color,N.opacity.value=d.opacity,N.dashSize.value=d.dashSize,N.totalSize.value=d.dashSize+d.gapSize,N.scale.value=d.scale):d instanceof THREE.PointCloudMaterial?(N.psColor.value=d.color,N.opacity.value=d.opacity,N.size.value=d.size,N.scale.value=I.height/2,N.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(N.shininess.value=d.shininess,K.gammaInput?(N.ambient.value.copyGammaToLinear(d.ambient),N.emissive.value.copyGammaToLinear(d.emissive),
-N.specular.value.copyGammaToLinear(d.specular)):(N.ambient.value=d.ambient,N.emissive.value=d.emissive,N.specular.value=d.specular),d.wrapAround&&N.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(K.gammaInput?(N.ambient.value.copyGammaToLinear(d.ambient),N.emissive.value.copyGammaToLinear(d.emissive)):(N.ambient.value=d.ambient,N.emissive.value=d.emissive),d.wrapAround&&N.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(N.mNear.value=a.near,N.mFar.value=
+N.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(N.diffuse.value=d.color,N.opacity.value=d.opacity,N.dashSize.value=d.dashSize,N.totalSize.value=d.dashSize+d.gapSize,N.scale.value=d.scale):d instanceof THREE.PointCloudMaterial?(N.psColor.value=d.color,N.opacity.value=d.opacity,N.size.value=d.size,N.scale.value=J.height/2,N.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(N.shininess.value=d.shininess,H.gammaInput?(N.ambient.value.copyGammaToLinear(d.ambient),N.emissive.value.copyGammaToLinear(d.emissive),
+N.specular.value.copyGammaToLinear(d.specular)):(N.ambient.value=d.ambient,N.emissive.value=d.emissive,N.specular.value=d.specular),d.wrapAround&&N.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(H.gammaInput?(N.ambient.value.copyGammaToLinear(d.ambient),N.emissive.value.copyGammaToLinear(d.emissive)):(N.ambient.value=d.ambient,N.emissive.value=d.emissive),d.wrapAround&&N.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(N.mNear.value=a.near,N.mFar.value=
 a.far,N.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(N.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&N.shadowMatrix)for(var Eb=0,pb=0,Mb=b.length;pb<Mb;pb++){var z=b[pb];z.castShadow&&(z instanceof THREE.SpotLight||z instanceof THREE.DirectionalLight&&!z.shadowCascade)&&(N.shadowMap.value[Eb]=z.shadowMap,N.shadowMapSize.value[Eb]=z.shadowMapSize,N.shadowMatrix.value[Eb]=z.shadowMatrix,N.shadowDarkness.value[Eb]=z.shadowDarkness,N.shadowBias.value[Eb]=z.shadowBias,
 Eb++)}for(var Rb=d.uniformsList,Ja,va,$a,nb=0,Ob=Rb.length;nb<Ob;nb++){var ea=Rb[nb][0];if(!1!==ea.needsUpdate){var wb=ea.type,U=ea.value,fa=Rb[nb][1];switch(wb){case "1i":l.uniform1i(fa,U);break;case "1f":l.uniform1f(fa,U);break;case "2f":l.uniform2f(fa,U[0],U[1]);break;case "3f":l.uniform3f(fa,U[0],U[1],U[2]);break;case "4f":l.uniform4f(fa,U[0],U[1],U[2],U[3]);break;case "1iv":l.uniform1iv(fa,U);break;case "3iv":l.uniform3iv(fa,U);break;case "1fv":l.uniform1fv(fa,U);break;case "2fv":l.uniform2fv(fa,
 U);break;case "3fv":l.uniform3fv(fa,U);break;case "4fv":l.uniform4fv(fa,U);break;case "Matrix3fv":l.uniformMatrix3fv(fa,!1,U);break;case "Matrix4fv":l.uniformMatrix4fv(fa,!1,U);break;case "i":l.uniform1i(fa,U);break;case "f":l.uniform1f(fa,U);break;case "v2":l.uniform2f(fa,U.x,U.y);break;case "v3":l.uniform3f(fa,U.x,U.y,U.z);break;case "v4":l.uniform4f(fa,U.x,U.y,U.z,U.w);break;case "c":l.uniform3f(fa,U.r,U.g,U.b);break;case "iv1":l.uniform1iv(fa,U);break;case "iv":l.uniform3iv(fa,U);break;case "fv1":l.uniform1fv(fa,
 U);break;case "fv":l.uniform3fv(fa,U);break;case "v2v":void 0===ea._array&&(ea._array=new Float32Array(2*U.length));for(var Q=0,wa=U.length;Q<wa;Q++)$a=2*Q,ea._array[$a]=U[Q].x,ea._array[$a+1]=U[Q].y;l.uniform2fv(fa,ea._array);break;case "v3v":void 0===ea._array&&(ea._array=new Float32Array(3*U.length));Q=0;for(wa=U.length;Q<wa;Q++)$a=3*Q,ea._array[$a]=U[Q].x,ea._array[$a+1]=U[Q].y,ea._array[$a+2]=U[Q].z;l.uniform3fv(fa,ea._array);break;case "v4v":void 0===ea._array&&(ea._array=new Float32Array(4*
 U.length));Q=0;for(wa=U.length;Q<wa;Q++)$a=4*Q,ea._array[$a]=U[Q].x,ea._array[$a+1]=U[Q].y,ea._array[$a+2]=U[Q].z,ea._array[$a+3]=U[Q].w;l.uniform4fv(fa,ea._array);break;case "m3":l.uniformMatrix3fv(fa,!1,U.elements);break;case "m3v":void 0===ea._array&&(ea._array=new Float32Array(9*U.length));Q=0;for(wa=U.length;Q<wa;Q++)U[Q].flattenToArrayOffset(ea._array,9*Q);l.uniformMatrix3fv(fa,!1,ea._array);break;case "m4":l.uniformMatrix4fv(fa,!1,U.elements);break;case "m4v":void 0===ea._array&&(ea._array=
-new Float32Array(16*U.length));Q=0;for(wa=U.length;Q<wa;Q++)U[Q].flattenToArrayOffset(ea._array,16*Q);l.uniformMatrix4fv(fa,!1,ea._array);break;case "t":Ja=U;va=M();l.uniform1i(fa,va);if(!Ja)continue;if(Ja instanceof THREE.CubeTexture||Ja.image instanceof Array&&6===Ja.image.length){var sa=Ja,Kb=va;if(6===sa.image.length)if(sa.needsUpdate){sa.image.__webglTextureCube||(sa.addEventListener("dispose",fc),sa.image.__webglTextureCube=l.createTexture(),K.info.memory.textures++);l.activeTexture(l.TEXTURE0+
-Kb);l.bindTexture(l.TEXTURE_CUBE_MAP,sa.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,sa.flipY);for(var Nb=sa instanceof THREE.CompressedTexture,Sb=sa.image[0]instanceof THREE.DataTexture,kb=[],Ea=0;6>Ea;Ea++)kb[Ea]=!K.autoScaleCubemaps||Nb||Sb?Sb?sa.image[Ea].image:sa.image[Ea]:S(sa.image[Ea],bd);var la=kb[0],Yb=THREE.Math.isPowerOfTwo(la.width)&&THREE.Math.isPowerOfTwo(la.height),ab=L(sa.format),Fb=L(sa.type);G(l.TEXTURE_CUBE_MAP,sa,Yb);for(Ea=0;6>Ea;Ea++)if(Nb)for(var ib,Zb=kb[Ea].mipmaps,
+new Float32Array(16*U.length));Q=0;for(wa=U.length;Q<wa;Q++)U[Q].flattenToArrayOffset(ea._array,16*Q);l.uniformMatrix4fv(fa,!1,ea._array);break;case "t":Ja=U;va=M();l.uniform1i(fa,va);if(!Ja)continue;if(Ja instanceof THREE.CubeTexture||Ja.image instanceof Array&&6===Ja.image.length){var sa=Ja,Kb=va;if(6===sa.image.length)if(sa.needsUpdate){sa.image.__webglTextureCube||(sa.addEventListener("dispose",fc),sa.image.__webglTextureCube=l.createTexture(),H.info.memory.textures++);l.activeTexture(l.TEXTURE0+
+Kb);l.bindTexture(l.TEXTURE_CUBE_MAP,sa.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,sa.flipY);for(var Nb=sa instanceof THREE.CompressedTexture,Sb=sa.image[0]instanceof THREE.DataTexture,kb=[],Ea=0;6>Ea;Ea++)kb[Ea]=!H.autoScaleCubemaps||Nb||Sb?Sb?sa.image[Ea].image:sa.image[Ea]:S(sa.image[Ea],bd);var la=kb[0],Yb=THREE.Math.isPowerOfTwo(la.width)&&THREE.Math.isPowerOfTwo(la.height),ab=L(sa.format),Fb=L(sa.type);G(l.TEXTURE_CUBE_MAP,sa,Yb);for(Ea=0;6>Ea;Ea++)if(Nb)for(var ib,Zb=kb[Ea].mipmaps,
 ga=0,Wb=Zb.length;ga<Wb;ga++)ib=Zb[ga],sa.format!==THREE.RGBAFormat&&sa.format!==THREE.RGBFormat?-1<Nc().indexOf(ab)?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+Ea,ga,ab,ib.width,ib.height,0,ib.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+Ea,ga,ab,ib.width,ib.height,0,ab,Fb,ib.data);else Sb?l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+Ea,0,ab,kb[Ea].width,kb[Ea].height,0,ab,Fb,kb[Ea].data):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
-Ea,0,ab,ab,Fb,kb[Ea]);sa.generateMipmaps&&Yb&&l.generateMipmap(l.TEXTURE_CUBE_MAP);sa.needsUpdate=!1;if(sa.onUpdate)sa.onUpdate()}else l.activeTexture(l.TEXTURE0+Kb),l.bindTexture(l.TEXTURE_CUBE_MAP,sa.image.__webglTextureCube)}else if(Ja instanceof THREE.WebGLRenderTargetCube){var Xb=Ja;l.activeTexture(l.TEXTURE0+va);l.bindTexture(l.TEXTURE_CUBE_MAP,Xb.__webglTexture)}else K.setTexture(Ja,va);break;case "tv":void 0===ea._array&&(ea._array=[]);Q=0;for(wa=ea.value.length;Q<wa;Q++)ea._array[Q]=M();
-l.uniform1iv(fa,ea._array);Q=0;for(wa=ea.value.length;Q<wa;Q++)Ja=ea.value[Q],va=ea._array[Q],Ja&&K.setTexture(Ja,va);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+wb)}}}}l.uniformMatrix4fv(pa.modelViewMatrix,!1,e._modelViewMatrix.elements);pa.normalMatrix&&l.uniformMatrix3fv(pa.normalMatrix,!1,e._normalMatrix.elements);null!==pa.modelMatrix&&l.uniformMatrix4fv(pa.modelMatrix,!1,e.matrixWorld.elements);return yb}function w(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=
+Ea,0,ab,ab,Fb,kb[Ea]);sa.generateMipmaps&&Yb&&l.generateMipmap(l.TEXTURE_CUBE_MAP);sa.needsUpdate=!1;if(sa.onUpdate)sa.onUpdate()}else l.activeTexture(l.TEXTURE0+Kb),l.bindTexture(l.TEXTURE_CUBE_MAP,sa.image.__webglTextureCube)}else if(Ja instanceof THREE.WebGLRenderTargetCube){var Xb=Ja;l.activeTexture(l.TEXTURE0+va);l.bindTexture(l.TEXTURE_CUBE_MAP,Xb.__webglTexture)}else H.setTexture(Ja,va);break;case "tv":void 0===ea._array&&(ea._array=[]);Q=0;for(wa=ea.value.length;Q<wa;Q++)ea._array[Q]=M();
+l.uniform1iv(fa,ea._array);Q=0;for(wa=ea.value.length;Q<wa;Q++)Ja=ea.value[Q],va=ea._array[Q],Ja&&H.setTexture(Ja,va);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+wb)}}}}l.uniformMatrix4fv(pa.modelViewMatrix,!1,e._modelViewMatrix.elements);pa.normalMatrix&&l.uniformMatrix3fv(pa.normalMatrix,!1,e._normalMatrix.elements);null!==pa.modelMatrix&&l.uniformMatrix4fv(pa.modelMatrix,!1,e.matrixWorld.elements);return yb}function w(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=
 b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.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 M(){var a=cc;a>=Oc&&
 console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Oc);cc+=1;return a}function x(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function C(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 D(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a){a!==Pc&&(l.lineWidth(a),Pc=a)}function B(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 G(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,L(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,L(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,L(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,L(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,V(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,V(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=oa.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 S(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 H(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,
+b.sourceFile+" )"),l.texParameteri(a,l.TEXTURE_MAG_FILTER,V(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,V(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=ha.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,H.getMaxAnisotropy())),b.__oldAnisotropy=b.anisotropy)}function S(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 K(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 I(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 V(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:l.LINEAR}function L(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===THREE.SrcColorFactor)return l.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return l.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return l.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return l.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return l.DST_ALPHA;
-if(a===THREE.OneMinusDstAlphaFactor)return l.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return l.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return l.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return l.SRC_ALPHA_SATURATE;b=oa.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=oa.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=oa.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 I=void 0!==a.canvas?a.canvas:document.createElement("canvas"),R=void 0!==a.context?a.context:null,Y=void 0!==a.precision?a.precision:"highp",T=void 0!==a.alpha?a.alpha:!1,ya=void 0!==a.depth?a.depth:!0,ia=void 0!==a.stencil?a.stencil:!0,Ca=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Ga=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:
-!1,xa=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,za=new THREE.Color(0),Z=0,db=[],eb={},ob=[],bb=[],Ib=[],yb=[],Ra=[];this.domElement=I;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.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 K=this,cb=[],tc=null,Tc=null,Jb=-1,Oa=-1,dc=null,cc=0,Kb=-1,Lb=-1,pb=-1,Mb=-1,Nb=-1,Wb=-1,Xb=-1,nb=-1,Qc=null,Rc=null,Sc=null,Pc=null,Ob=0,jc=0,kc=I.width,lc=I.height,Uc=0,Vc=0,wb=new Uint8Array(16),jb=new Uint8Array(16),Ec=new THREE.Frustum,Ac=new THREE.Matrix4,
-Gc=new THREE.Matrix4,Na=new THREE.Vector3,ta=new THREE.Vector3,ec=!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:T,depth:ya,stencil:ia,antialias:Ca,premultipliedAlpha:O,preserveDrawingBuffer:Ga};l=R||I.getContext("webgl",Wc)||I.getContext("experimental-webgl",
-Wc);if(null===l){if(null!==I.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}I.addEventListener("webglcontextlost",function(a){a.preventDefault();Xc();Yc();eb={}},!1)}catch(cd){console.error(cd)}void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var oa=new THREE.WebGLExtensions(l);oa.get("OES_texture_float");oa.get("OES_texture_float_linear");oa.get("OES_standard_derivatives");
-xa&&oa.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);l.viewport(Ob,jc,kc,lc);l.clearColor(za.r,za.g,za.b,Z)},Xc=function(){dc=tc=null;Jb=Oa=Lb=Kb=nb=Xb=pb=-1;ec=!0};Yc();this.context=l;var Oc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),dd=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
-ed=l.getParameter(l.MAX_TEXTURE_SIZE),bd=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),sc=0<dd,ic=sc&&oa.get("OES_texture_float"),fd=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),gd=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var hd=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),id=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var Nc=
-function(){var a;return function(){if(void 0!==a)return a;a=[];if(oa.get("WEBGL_compressed_texture_pvrtc")||oa.get("WEBGL_compressed_texture_s3tc"))for(var b=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);return a}}(),jd=0<fd.precision&&0<hd.precision,Zc=0<gd.precision&&0<id.precision;"highp"!==Y||jd||(Zc?(Y="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(Y="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));
-"mediump"!==Y||Zc||(Y="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var kd=new THREE.ShadowMapPlugin(this,db,eb,ob),ld=new THREE.SpritePlugin(this,yb),md=new THREE.LensFlarePlugin(this,Ra);this.getContext=function(){return l};this.forceContextLoss=function(){oa.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return sc};this.supportsFloatTextures=function(){return oa.get("OES_texture_float")};this.supportsStandardDerivatives=function(){return oa.get("OES_standard_derivatives")};
-this.supportsCompressedTextureS3TC=function(){return oa.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){return oa.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){return oa.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=oa.get("EXT_texture_filter_anisotropic");return a=null!==b?l.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return Y};this.setSize=
-function(a,b,c){I.width=a*this.devicePixelRatio;I.height=b*this.devicePixelRatio;!1!==c&&(I.style.width=a+"px",I.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){Ob=a*this.devicePixelRatio;jc=b*this.devicePixelRatio;kc=c*this.devicePixelRatio;lc=d*this.devicePixelRatio;l.viewport(Ob,jc,kc,lc)};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){za.set(a);Z=void 0!==b?b:1;l.clearColor(za.r,za.g,za.b,Z)};this.setClearColorHex=function(a,b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return za};this.getClearAlpha=function(){return Z};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 eb[a.id];
-else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=ob,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)}K.info.memory.geometries--}else if(b=
-xb[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}$c(e)}delete xb[a.id]}else $c(a);Oa=-1},fc=function(a){a=a.target;a.removeEventListener("dispose",fc);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);K.info.memory.textures--},ad=function(a){a=a.target;a.removeEventListener("dispose",ad);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--},Dc=function(a){a=a.target;a.removeEventListener("dispose",Dc);Cc(a)},$c=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}K.info.memory.geometries--},Cc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=cb.length;a<c;a++)if(d=cb[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=cb.length;a<
-c;a++)d=cb[a],d.program!==b&&e.push(d);cb=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,r,q,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],q=s[v+5],n=s[v+6],r=s[v+7],t=s[v+8],d=(d+m+n)/3,e=(e+p+r)/3,k=(k+q+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(a=E(a,b,c,d,h),b=!1,c=16777215*g.id+2*a.id+(d.wireframe?1:0),c!==Oa&&(Oa=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&&oa.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,r=n.length;p<r;p++){var q=n[p].index;b&&(e(d,a,g,q),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)b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(l.POINTS,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,A(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,r=n.length;p<r;p++)q=n[p].index,b&&(e(d,a,g,q),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){c=E(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Oa&&(Oa=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,r=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]=r[n[m]],m++;else{var n=[],r=k.morphTargetInfluences,q,t=r.length;for(q=0;q<t;q++)m=r[q],0<m&&n.push([m,q]);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]?(q=n[m][1],0<=c["morphTarget"+m]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[q]),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[q]),g(c["morphNormal"+m]),l.vertexAttribPointer(c["morphNormal"+m],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=r[q]):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,r=e.__webglCustomAttributesList.length;c<r;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?(A(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,A(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;Jb=Oa=-1;dc=null;ec=!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);Ac.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ec.setFromMatrix(Ac);
-db.length=0;bb.length=0;Ib.length=0;yb.length=0;Ra.length=0;q(a,a);!0===K.sortObjects&&(bb.sort(k),Ib.sort(n));kd.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=ob.length;d<f;d++){var g=ob[d],h=g.object;h.visible&&(x(h,b),t(g))}a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,
-d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),B(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(bb,b,db,e,!0,d),m(Ib,b,db,e,!0,d),r(ob,"",b,db,e,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(bb,b,db,e,!1,d),r(ob,"opaque",b,db,e,!1,d),m(Ib,b,db,e,!0,d),r(ob,"transparent",b,db,e,!0,d));ld.render(a,b);md.render(a,b,Uc,Vc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&H(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};
-this.renderImmediateObject=function(a,b,c,d,e){var f=E(a,b,c,d,e);Oa=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,Ec):e.render(function(a){K.renderBufferImmediate(a,f,d)})};var xb={},rc=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;Kb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),Kb=b);Lb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),Lb=a)};this.setDepthTest=function(a){Xb!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),Xb=a)};this.setDepthWrite=function(a){nb!==a&&(l.depthMask(a),nb=a)};this.setBlending=function(a,b,c,d){a!==pb&&(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)),pb=a);if(a===THREE.CustomBlending){if(b!==Mb&&(l.blendEquation(L(b)),
-Mb=b),c!==Nb||d!==Wb)l.blendFunc(L(c),L(d)),Nb=c,Wb=d}else Wb=Nb=Mb=null};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",fc),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=S(a.image,ed);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&
+if(a===THREE.OneMinusDstAlphaFactor)return l.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return l.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return l.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return l.SRC_ALPHA_SATURATE;b=ha.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=ha.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=ha.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;
+if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var J=void 0!==a.canvas?a.canvas:document.createElement("canvas"),R=void 0!==a.context?a.context:null,Y=void 0!==a.precision?a.precision:"highp",T=void 0!==a.alpha?a.alpha:!1,ya=void 0!==a.depth?a.depth:!0,oa=void 0!==a.stencil?a.stencil:!0,Ca=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Ga=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:
+!1,xa=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,za=new THREE.Color(0),Z=0,db=[],eb={},ob=[],bb=[],Ib=[],yb=[],Ra=[];this.domElement=J;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 H=this,cb=[],tc=null,Tc=null,Jb=-1,Oa=-1,dc=null,cc=0,Kb=-1,Lb=-1,pb=-1,Mb=-1,Nb=-1,Wb=-1,Xb=-1,nb=-1,Qc=null,Rc=null,Sc=null,Pc=null,Ob=0,jc=0,kc=J.width,lc=J.height,Uc=0,Vc=0,wb=new Uint8Array(16),jb=new Uint8Array(16),Ec=new THREE.Frustum,Ac=new THREE.Matrix4,Gc=new THREE.Matrix4,Na=new THREE.Vector3,
+ta=new THREE.Vector3,ec=!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:T,depth:ya,stencil:oa,antialias:Ca,premultipliedAlpha:O,preserveDrawingBuffer:Ga};l=R||J.getContext("webgl",Wc)||J.getContext("experimental-webgl",Wc);if(null===l){if(null!==J.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";
+throw"Error creating WebGL context.";}J.addEventListener("webglcontextlost",function(a){a.preventDefault();Xc();Yc();eb={}},!1)}catch(cd){console.error(cd)}void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var ha=new THREE.WebGLExtensions(l);ha.get("OES_texture_float");ha.get("OES_texture_float_linear");ha.get("OES_standard_derivatives");xa&&ha.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);l.viewport(Ob,jc,kc,lc);l.clearColor(za.r,za.g,za.b,Z)},Xc=function(){dc=tc=null;Jb=Oa=Lb=Kb=nb=Xb=pb=-1;ec=!0};Yc();this.context=l;var Oc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),dd=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ed=l.getParameter(l.MAX_TEXTURE_SIZE),bd=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),
+sc=0<dd,ic=sc&&ha.get("OES_texture_float"),fd=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),gd=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var hd=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),id=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var Nc=function(){var a;return function(){if(void 0!==a)return a;a=[];if(ha.get("WEBGL_compressed_texture_pvrtc")||
+ha.get("WEBGL_compressed_texture_s3tc"))for(var b=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);return a}}(),jd=0<fd.precision&&0<hd.precision,Zc=0<gd.precision&&0<id.precision;"highp"!==Y||jd||(Zc?(Y="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(Y="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==Y||Zc||(Y="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));
+var kd=new THREE.ShadowMapPlugin(this,db,eb,ob),ld=new THREE.SpritePlugin(this,yb),md=new THREE.LensFlarePlugin(this,Ra);this.getContext=function(){return l};this.forceContextLoss=function(){ha.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return sc};this.supportsFloatTextures=function(){return ha.get("OES_texture_float")};this.supportsStandardDerivatives=function(){return ha.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return ha.get("WEBGL_compressed_texture_s3tc")};
+this.supportsCompressedTexturePVRTC=function(){return ha.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){return ha.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=ha.get("EXT_texture_filter_anisotropic");return a=null!==b?l.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return Y};this.setSize=function(a,b,c){J.width=a*this.devicePixelRatio;J.height=b*this.devicePixelRatio;!1!==
+c&&(J.style.width=a+"px",J.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){Ob=a*this.devicePixelRatio;jc=b*this.devicePixelRatio;kc=c*this.devicePixelRatio;lc=d*this.devicePixelRatio;l.viewport(Ob,jc,kc,lc)};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){za.set(a);Z=void 0!==b?b:1;l.clearColor(za.r,za.g,za.b,Z)};this.setClearColorHex=function(a,b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return za};this.getClearAlpha=function(){return Z};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 eb[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=ob,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)}H.info.memory.geometries--}else if(b=xb[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}$c(e)}delete xb[a.id]}else $c(a);Oa=-1},fc=function(a){a=a.target;a.removeEventListener("dispose",fc);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);H.info.memory.textures--},ad=function(a){a=a.target;a.removeEventListener("dispose",ad);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}H.info.memory.textures--},Dc=function(a){a=a.target;a.removeEventListener("dispose",Dc);Cc(a)},$c=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}H.info.memory.geometries--},Cc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=cb.length;a<c;a++)if(d=cb[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=cb.length;a<c;a++)d=cb[a],d.program!==b&&e.push(d);cb=e;l.deleteProgram(b);H.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,r,q,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],q=s[v+5],n=s[v+6],r=s[v+7],t=s[v+8],d=(d+m+n)/3,e=(e+p+r)/3,k=(k+q+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(a=E(a,b,c,d,h),b=!1,c=16777215*g.id+2*a.id+(d.wireframe?1:0),c!==Oa&&(Oa=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&&ha.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),H.info.render.calls++,H.info.render.vertices+=c.array.length,H.info.render.faces+=c.array.length/3;else{b=!0;for(var p=0,r=n.length;p<r;p++){var q=n[p].index;b&&(e(d,a,g,q),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);H.info.render.calls++;H.info.render.vertices+=n[p].count;H.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),H.info.render.calls++,H.info.render.vertices+=d.array.length/
+3,H.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&&ha.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),H.info.render.calls++,H.info.render.points+=c.array.length;else for(1<n.length&&(b=!0),p=0,r=n.length;p<r;p++)q=n[p].index,b&&(e(d,a,g,q),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
+c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),H.info.render.calls++,H.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),H.info.render.calls++,H.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,A(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),H.info.render.calls++,H.info.render.vertices+=c.array.length;else for(1<n.length&&(b=!0),p=0,r=n.length;p<r;p++)q=n[p].index,b&&(e(d,a,g,q),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),H.info.render.calls++,H.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),H.info.render.calls++,H.info.render.points+=d.array.length/3};this.renderBuffer=function(a,
+b,c,d,e,k){if(!1!==d.visible){c=E(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Oa&&(Oa=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,r=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]=r[n[m]],m++;else{var n=[],r=k.morphTargetInfluences,q,t=r.length;for(q=0;q<t;q++)m=r[q],0<m&&n.push([m,q]);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]?(q=n[m][1],0<=
+c["morphTarget"+m]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[q]),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[q]),g(c["morphNormal"+m]),l.vertexAttribPointer(c["morphNormal"+m],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=r[q]):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,r=e.__webglCustomAttributesList.length;c<r;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?(A(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)),H.info.render.calls++,H.info.render.vertices+=e.__webglFaceCount,H.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,A(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),H.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),H.info.render.calls++,H.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;Jb=Oa=-1;dc=null;ec=!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);Ac.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ec.setFromMatrix(Ac);db.length=0;bb.length=0;Ib.length=0;yb.length=
+0;Ra.length=0;q(a,a);!0===H.sortObjects&&(bb.sort(k),Ib.sort(n));kd.render(a,b);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;H.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var f=ob.length;d<f;d++){var g=ob[d],h=g.object;h.visible&&(x(h,b),t(g))}a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),
+this.setDepthWrite(d.depthWrite),B(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(bb,b,db,e,!0,d),m(Ib,b,db,e,!0,d),r(ob,"",b,db,e,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(bb,b,db,e,!1,d),r(ob,"opaque",b,db,e,!1,d),m(Ib,b,db,e,!0,d),r(ob,"transparent",b,db,e,!0,d));ld.render(a,b);md.render(a,b,Uc,Vc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&I(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,
+b,c,d,e){var f=E(a,b,c,d,e);Oa=-1;H.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,Ec):e.render(function(a){H.renderBufferImmediate(a,f,d)})};var xb={},rc=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;Kb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),Kb=b);Lb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),Lb=a)};this.setDepthTest=function(a){Xb!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),Xb=a)};this.setDepthWrite=function(a){nb!==a&&(l.depthMask(a),nb=a)};this.setBlending=function(a,b,c,d){a!==pb&&(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)),pb=a);if(a===THREE.CustomBlending){if(b!==Mb&&(l.blendEquation(L(b)),Mb=b),
+c!==Nb||d!==Wb)l.blendFunc(L(c),L(d)),Nb=c,Wb=d}else Wb=Nb=Mb=null};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",fc),a.__webglTexture=l.createTexture(),H.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=S(a.image,ed);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&
 THREE.Math.isPowerOfTwo(b.height),d=L(a.format),e=L(a.type);G(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?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",ad);a.__webglTexture=l.createTexture();K.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=L(a.format),e=L(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];
-l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);G(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=
+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?H.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",ad);a.__webglTexture=l.createTexture();H.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=L(a.format),e=L(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];
+l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);G(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);K(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),G(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):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=kc,a=lc,
+l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):K(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=kc,a=lc,
 d=Ob,e=jc);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};
@@ -588,35 +589,35 @@ console.error("gl.VALIDATE_STATUS",f.getProgramParameter(g,f.VALIDATE_STATUS)),c
 q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&q.push("logDepthBufFC");for(var u in h)q.push(u);h=q;u={};q=0;for(b=h.length;q<b;q++)m=h[q],u[m]=f.getUniformLocation(g,m);this.uniforms=u;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 v in k)q.push(v);e=q;k={};v=0;for(h=e.length;v<h;v++)u=e[v],k[u]=f.getAttribLocation(g,u);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,r,t,s,u,v,y;this.render=function(E,w,M,x){if(0!==b.length){E=new THREE.Vector3;var C=x/M,D=.5*M,A=.5*x,B=16/x,G=new THREE.Vector2(B*C,B),S=new THREE.Vector3(1,1,0),J=new THREE.Vector2(1,1);if(void 0===s){var B=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),H=new Uint16Array([0,1,2,0,2,3]);r=m.createBuffer();t=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,r);m.bufferData(m.ARRAY_BUFFER,B,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
-t);m.bufferData(m.ELEMENT_ARRAY_BUFFER,H,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,r,t,s,u,v,y;this.render=function(E,w,M,x){if(0!==b.length){E=new THREE.Vector3;var C=x/M,D=.5*M,A=.5*x,B=16/x,G=new THREE.Vector2(B*C,B),S=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1);if(void 0===s){var B=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]);r=m.createBuffer();t=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,r);m.bufferData(m.ARRAY_BUFFER,B,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
+t);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,
 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 B=(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}"},
-H=m.createProgram(),V=m.createShader(m.FRAGMENT_SHADER),L=m.createShader(m.VERTEX_SHADER),I="precision "+a.getPrecision()+" float;\n";m.shaderSource(V,I+B.fragmentShader);m.shaderSource(L,I+B.vertexShader);m.compileShader(V);m.compileShader(L);m.attachShader(H,V);m.attachShader(H,L);m.linkProgram(H);s=H;p=m.getAttribLocation(s,"position");q=m.getAttribLocation(s,"uv");c=m.getUniformLocation(s,"renderType");d=m.getUniformLocation(s,"map");e=m.getUniformLocation(s,"occlusionMap");f=m.getUniformLocation(s,
-"opacity");g=m.getUniformLocation(s,"color");h=m.getUniformLocation(s,"scale");k=m.getUniformLocation(s,"rotation");n=m.getUniformLocation(s,"screenPosition")}m.useProgram(s);m.enableVertexAttribArray(p);m.enableVertexAttribArray(q);m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,r);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(q,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,t);m.disable(m.CULL_FACE);m.depthMask(!1);H=0;for(V=b.length;H<V;H++)if(B=16/x,G.set(B*
-C,B),L=b[H],E.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),E.applyMatrix4(w.matrixWorldInverse),E.applyProjection(w.projectionMatrix),S.copy(E),J.x=S.x*D+D,J.y=S.y*A+A,u||0<J.x&&J.x<M&&0<J.y&&J.y<x){m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,J.x-8,J.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,G.x,G.y);m.uniform3f(n,S.x,S.y,S.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,J.x-8,J.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);L.positionScreen.copy(S);L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares();m.uniform1i(c,2);m.enable(m.BLEND);for(var I=0,R=L.lensFlares.length;I<R;I++){var Y=L.lensFlares[I];.001<Y.opacity&&.001<Y.scale&&(S.x=Y.x,
+I=m.createProgram(),V=m.createShader(m.FRAGMENT_SHADER),L=m.createShader(m.VERTEX_SHADER),J="precision "+a.getPrecision()+" float;\n";m.shaderSource(V,J+B.fragmentShader);m.shaderSource(L,J+B.vertexShader);m.compileShader(V);m.compileShader(L);m.attachShader(I,V);m.attachShader(I,L);m.linkProgram(I);s=I;p=m.getAttribLocation(s,"position");q=m.getAttribLocation(s,"uv");c=m.getUniformLocation(s,"renderType");d=m.getUniformLocation(s,"map");e=m.getUniformLocation(s,"occlusionMap");f=m.getUniformLocation(s,
+"opacity");g=m.getUniformLocation(s,"color");h=m.getUniformLocation(s,"scale");k=m.getUniformLocation(s,"rotation");n=m.getUniformLocation(s,"screenPosition")}m.useProgram(s);m.enableVertexAttribArray(p);m.enableVertexAttribArray(q);m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,r);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(q,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,t);m.disable(m.CULL_FACE);m.depthMask(!1);I=0;for(V=b.length;I<V;I++)if(B=16/x,G.set(B*
+C,B),L=b[I],E.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),E.applyMatrix4(w.matrixWorldInverse),E.applyProjection(w.projectionMatrix),S.copy(E),K.x=S.x*D+D,K.y=S.y*A+A,u||0<K.x&&K.x<M&&0<K.y&&K.y<x){m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,K.x-8,K.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,G.x,G.y);m.uniform3f(n,S.x,S.y,S.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,K.x-8,K.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);L.positionScreen.copy(S);L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares();m.uniform1i(c,2);m.enable(m.BLEND);for(var J=0,R=L.lensFlares.length;J<R;J++){var Y=L.lensFlares[J];.001<Y.opacity&&.001<Y.scale&&(S.x=Y.x,
 S.y=Y.y,S.z=Y.z,B=Y.size*Y.scale/x,G.x=B*C,G.y=B,m.uniform3f(n,S.x,S.y,S.z),m.uniform2f(h,G.x,G.y),m.uniform1f(k,Y.rotation),m.uniform1f(f,Y.opacity),m.uniform3f(g,Y.color.r,Y.color.g,Y.color.b),a.setBlending(Y.blending,Y.blendEquation,Y.blendSrc,Y.blendDst),a.setTexture(Y.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);s.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,r=new THREE.Vector3,t=new THREE.Vector3,s=[],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,M,x,C,D,A,B,G,S=[];C=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(M=b.length;u<M;u++)if(x=b[u],x.castShadow)if(x instanceof THREE.DirectionalLight&&x.shadowCascade)for(D=0;D<x.shadowCascadeCount;D++){var J;if(x.shadowCascadeArray[D])J=x.shadowCascadeArray[D];else{B=x;var H=
-D;J=new THREE.DirectionalLight;J.isVirtual=!0;J.onlyShadow=!0;J.castShadow=!0;J.shadowCameraNear=B.shadowCameraNear;J.shadowCameraFar=B.shadowCameraFar;J.shadowCameraLeft=B.shadowCameraLeft;J.shadowCameraRight=B.shadowCameraRight;J.shadowCameraBottom=B.shadowCameraBottom;J.shadowCameraTop=B.shadowCameraTop;J.shadowCameraVisible=B.shadowCameraVisible;J.shadowDarkness=B.shadowDarkness;J.shadowBias=B.shadowCascadeBias[H];J.shadowMapWidth=B.shadowCascadeWidth[H];J.shadowMapHeight=B.shadowCascadeHeight[H];
-J.pointsWorld=[];J.pointsFrustum=[];G=J.pointsWorld;A=J.pointsFrustum;for(var V=0;8>V;V++)G[V]=new THREE.Vector3,A[V]=new THREE.Vector3;G=B.shadowCascadeNearZ[H];B=B.shadowCascadeFarZ[H];A[0].set(-1,-1,G);A[1].set(1,-1,G);A[2].set(-1,1,G);A[3].set(1,1,G);A[4].set(-1,-1,B);A[5].set(1,-1,B);A[6].set(-1,1,B);A[7].set(1,1,B);J.originalCamera=v;A=new THREE.Gyroscope;A.position.copy(x.shadowCascadeOffset);A.add(J);A.add(J.target);v.add(A);x.shadowCascadeArray[D]=J;console.log("Created virtualLight",J)}H=
-x;G=D;B=H.shadowCascadeArray[G];B.position.copy(H.position);B.target.position.copy(H.target.position);B.lookAt(B.target);B.shadowCameraVisible=H.shadowCameraVisible;B.shadowDarkness=H.shadowDarkness;B.shadowBias=H.shadowCascadeBias[G];A=H.shadowCascadeNearZ[G];H=H.shadowCascadeFarZ[G];B=B.pointsFrustum;B[0].z=A;B[1].z=A;B[2].z=A;B[3].z=A;B[4].z=H;B[5].z=H;B[6].z=H;B[7].z=H;S[C]=J;C++}else S[C]=x,C++;u=0;for(M=S.length;u<M;u++){x=S[u];x.shadowMap||(D=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&
+!0;n._shadowPass=!0;this.render=function(c,v){if(!1!==a.shadowMapEnabled){var u,M,x,C,D,A,B,G,S=[];C=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(M=b.length;u<M;u++)if(x=b[u],x.castShadow)if(x instanceof THREE.DirectionalLight&&x.shadowCascade)for(D=0;D<x.shadowCascadeCount;D++){var K;if(x.shadowCascadeArray[D])K=x.shadowCascadeArray[D];else{B=x;var I=
+D;K=new THREE.DirectionalLight;K.isVirtual=!0;K.onlyShadow=!0;K.castShadow=!0;K.shadowCameraNear=B.shadowCameraNear;K.shadowCameraFar=B.shadowCameraFar;K.shadowCameraLeft=B.shadowCameraLeft;K.shadowCameraRight=B.shadowCameraRight;K.shadowCameraBottom=B.shadowCameraBottom;K.shadowCameraTop=B.shadowCameraTop;K.shadowCameraVisible=B.shadowCameraVisible;K.shadowDarkness=B.shadowDarkness;K.shadowBias=B.shadowCascadeBias[I];K.shadowMapWidth=B.shadowCascadeWidth[I];K.shadowMapHeight=B.shadowCascadeHeight[I];
+K.pointsWorld=[];K.pointsFrustum=[];G=K.pointsWorld;A=K.pointsFrustum;for(var V=0;8>V;V++)G[V]=new THREE.Vector3,A[V]=new THREE.Vector3;G=B.shadowCascadeNearZ[I];B=B.shadowCascadeFarZ[I];A[0].set(-1,-1,G);A[1].set(1,-1,G);A[2].set(-1,1,G);A[3].set(1,1,G);A[4].set(-1,-1,B);A[5].set(1,-1,B);A[6].set(-1,1,B);A[7].set(1,1,B);K.originalCamera=v;A=new THREE.Gyroscope;A.position.copy(x.shadowCascadeOffset);A.add(K);A.add(K.target);v.add(A);x.shadowCascadeArray[D]=K;console.log("Created virtualLight",K)}I=
+x;G=D;B=I.shadowCascadeArray[G];B.position.copy(I.position);B.target.position.copy(I.target.position);B.lookAt(B.target);B.shadowCameraVisible=I.shadowCameraVisible;B.shadowDarkness=I.shadowDarkness;B.shadowBias=I.shadowCascadeBias[G];A=I.shadowCascadeNearZ[G];I=I.shadowCascadeFarZ[G];B=B.pointsFrustum;B[0].z=A;B[1].z=A;B[2].z=A;B[3].z=A;B[4].z=I;B[5].z=I;B[6].z=I;B[7].z=I;S[C]=K;C++}else S[C]=x,C++;u=0;for(M=S.length;u<M;u++){x=S[u];x.shadowMap||(D=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&
 (D=THREE.NearestFilter),x.shadowMap=new THREE.WebGLRenderTarget(x.shadowMapWidth,x.shadowMapHeight,{minFilter:D,magFilter:D,format:THREE.RGBAFormat}),x.shadowMapSize=new THREE.Vector2(x.shadowMapWidth,x.shadowMapHeight),x.shadowMatrix=new THREE.Matrix4);if(!x.shadowCamera){if(x instanceof THREE.SpotLight)x.shadowCamera=new THREE.PerspectiveCamera(x.shadowCameraFov,x.shadowMapWidth/x.shadowMapHeight,x.shadowCameraNear,x.shadowCameraFar);else if(x instanceof THREE.DirectionalLight)x.shadowCamera=new THREE.OrthographicCamera(x.shadowCameraLeft,
-x.shadowCameraRight,x.shadowCameraTop,x.shadowCameraBottom,x.shadowCameraNear,x.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}c.add(x.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}x.shadowCameraVisible&&!x.cameraHelper&&(x.cameraHelper=new THREE.CameraHelper(x.shadowCamera),c.add(x.cameraHelper));if(x.isVirtual&&J.originalCamera==v){D=v;C=x.shadowCamera;A=x.pointsFrustum;B=x.pointsWorld;m.set(Infinity,Infinity,Infinity);r.set(-Infinity,-Infinity,-Infinity);
-for(H=0;8>H;H++)G=B[H],G.copy(A[H]),G.unproject(D),G.applyMatrix4(C.matrixWorldInverse),G.x<m.x&&(m.x=G.x),G.x>r.x&&(r.x=G.x),G.y<m.y&&(m.y=G.y),G.y>r.y&&(r.y=G.y),G.z<m.z&&(m.z=G.z),G.z>r.z&&(r.z=G.z);C.left=m.x;C.right=r.x;C.top=r.y;C.bottom=m.y;C.updateProjectionMatrix()}C=x.shadowMap;A=x.shadowMatrix;D=x.shadowCamera;D.position.setFromMatrixPosition(x.matrixWorld);t.setFromMatrixPosition(x.target.matrixWorld);D.lookAt(t);D.updateMatrixWorld();D.matrixWorldInverse.getInverse(D.matrixWorld);x.cameraHelper&&
-(x.cameraHelper.visible=x.shadowCameraVisible);x.shadowCameraVisible&&x.cameraHelper.update();A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);A.multiply(D.projectionMatrix);A.multiply(D.matrixWorldInverse);q.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(C);a.clear();s.length=0;e(c,c,D);x=0;for(C=s.length;x<C;x++)B=s[x],A=B.object,B=B.buffer,H=A.material instanceof THREE.MeshFaceMaterial?A.material.materials[0]:A.material,G=void 0!==A.geometry.morphTargets&&
-0<A.geometry.morphTargets.length&&H.morphTargets,V=A instanceof THREE.SkinnedMesh&&H.skinning,G=A.customDepthMaterial?A.customDepthMaterial:V?G?n:k:G?h:g,a.setMaterialFaces(H),B instanceof THREE.BufferGeometry?a.renderBufferDirect(D,b,null,G,B,A):a.renderBuffer(D,b,null,G,B,A);x=0;for(C=d.length;x<C;x++)B=d[x],A=B.object,A.visible&&A.castShadow&&(A._modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,A.matrixWorld),a.renderImmediateObject(D,b,null,g,A))}u=a.getClearColor();M=a.getClearAlpha();f.clearColor(u.r,
+x.shadowCameraRight,x.shadowCameraTop,x.shadowCameraBottom,x.shadowCameraNear,x.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}c.add(x.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}x.shadowCameraVisible&&!x.cameraHelper&&(x.cameraHelper=new THREE.CameraHelper(x.shadowCamera),c.add(x.cameraHelper));if(x.isVirtual&&K.originalCamera==v){D=v;C=x.shadowCamera;A=x.pointsFrustum;B=x.pointsWorld;m.set(Infinity,Infinity,Infinity);r.set(-Infinity,-Infinity,-Infinity);
+for(I=0;8>I;I++)G=B[I],G.copy(A[I]),G.unproject(D),G.applyMatrix4(C.matrixWorldInverse),G.x<m.x&&(m.x=G.x),G.x>r.x&&(r.x=G.x),G.y<m.y&&(m.y=G.y),G.y>r.y&&(r.y=G.y),G.z<m.z&&(m.z=G.z),G.z>r.z&&(r.z=G.z);C.left=m.x;C.right=r.x;C.top=r.y;C.bottom=m.y;C.updateProjectionMatrix()}C=x.shadowMap;A=x.shadowMatrix;D=x.shadowCamera;D.position.setFromMatrixPosition(x.matrixWorld);t.setFromMatrixPosition(x.target.matrixWorld);D.lookAt(t);D.updateMatrixWorld();D.matrixWorldInverse.getInverse(D.matrixWorld);x.cameraHelper&&
+(x.cameraHelper.visible=x.shadowCameraVisible);x.shadowCameraVisible&&x.cameraHelper.update();A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);A.multiply(D.projectionMatrix);A.multiply(D.matrixWorldInverse);q.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(C);a.clear();s.length=0;e(c,c,D);x=0;for(C=s.length;x<C;x++)B=s[x],A=B.object,B=B.buffer,I=A.material instanceof THREE.MeshFaceMaterial?A.material.materials[0]:A.material,G=void 0!==A.geometry.morphTargets&&
+0<A.geometry.morphTargets.length&&I.morphTargets,V=A instanceof THREE.SkinnedMesh&&I.skinning,G=A.customDepthMaterial?A.customDepthMaterial:V?G?n:k:G?h:g,a.setMaterialFaces(I),B instanceof THREE.BufferGeometry?a.renderBufferDirect(D,b,null,G,B,A):a.renderBuffer(D,b,null,G,B,A);x=0;for(C=d.length;x<C;x++)B=d[x],A=B.object,A.visible&&A.castShadow&&(A._modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,A.matrixWorld),a.renderImmediateObject(D,b,null,g,A))}u=a.getClearColor();M=a.getClearAlpha();f.clearColor(u.r,
 u.g,u.b,M);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,r,t,s,u,v,y;function E(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var w=a.context,M,x,C,D,A=new THREE.Vector3,B=new THREE.Quaternion,G=new THREE.Vector3;this.render=function(S,J){if(0!==b.length){if(void 0===C){var H=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),V=new Uint16Array([0,1,2,0,2,3]);M=w.createBuffer();x=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,M);w.bufferData(w.ARRAY_BUFFER,H,w.STATIC_DRAW);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,
-x);w.bufferData(w.ELEMENT_ARRAY_BUFFER,V,w.STATIC_DRAW);var H=w.createProgram(),V=w.createShader(w.VERTEX_SHADER),L=w.createShader(w.FRAGMENT_SHADER);w.shaderSource(V,["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,r,t,s,u,v,y;function E(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var w=a.context,M,x,C,D,A=new THREE.Vector3,B=new THREE.Quaternion,G=new THREE.Vector3;this.render=function(S,K){if(0!==b.length){if(void 0===C){var I=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),V=new Uint16Array([0,1,2,0,2,3]);M=w.createBuffer();x=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,M);w.bufferData(w.ARRAY_BUFFER,I,w.STATIC_DRAW);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,
+x);w.bufferData(w.ELEMENT_ARRAY_BUFFER,V,w.STATIC_DRAW);var I=w.createProgram(),V=w.createShader(w.VERTEX_SHADER),L=w.createShader(w.FRAGMENT_SHADER);w.shaderSource(V,["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"));
 w.shaderSource(L,["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"));
-w.compileShader(V);w.compileShader(L);w.attachShader(H,V);w.attachShader(H,L);w.linkProgram(H);C=H;v=w.getAttribLocation(C,"position");y=w.getAttribLocation(C,"uv");c=w.getUniformLocation(C,"uvOffset");d=w.getUniformLocation(C,"uvScale");e=w.getUniformLocation(C,"rotation");f=w.getUniformLocation(C,"scale");g=w.getUniformLocation(C,"color");h=w.getUniformLocation(C,"map");k=w.getUniformLocation(C,"opacity");n=w.getUniformLocation(C,"modelViewMatrix");p=w.getUniformLocation(C,"projectionMatrix");q=
-w.getUniformLocation(C,"fogType");m=w.getUniformLocation(C,"fogDensity");r=w.getUniformLocation(C,"fogNear");t=w.getUniformLocation(C,"fogFar");s=w.getUniformLocation(C,"fogColor");u=w.getUniformLocation(C,"alphaTest");H=document.createElement("canvas");H.width=8;H.height=8;V=H.getContext("2d");V.fillStyle="white";V.fillRect(0,0,8,8);D=new THREE.Texture(H);D.needsUpdate=!0}w.useProgram(C);w.enableVertexAttribArray(v);w.enableVertexAttribArray(y);w.disable(w.CULL_FACE);w.enable(w.BLEND);w.bindBuffer(w.ARRAY_BUFFER,
-M);w.vertexAttribPointer(v,2,w.FLOAT,!1,16,0);w.vertexAttribPointer(y,2,w.FLOAT,!1,16,8);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,x);w.uniformMatrix4fv(p,!1,J.projectionMatrix.elements);w.activeTexture(w.TEXTURE0);w.uniform1i(h,0);V=H=0;(L=S.fog)?(w.uniform3f(s,L.color.r,L.color.g,L.color.b),L instanceof THREE.Fog?(w.uniform1f(r,L.near),w.uniform1f(t,L.far),w.uniform1i(q,1),V=H=1):L instanceof THREE.FogExp2&&(w.uniform1f(m,L.density),w.uniform1i(q,2),V=H=2)):(w.uniform1i(q,0),V=H=0);for(var L=0,I=b.length;L<
-I;L++){var R=b[L];R._modelViewMatrix.multiplyMatrices(J.matrixWorldInverse,R.matrixWorld);R.z=null===R.renderDepth?-R._modelViewMatrix.elements[14]:R.renderDepth}b.sort(E);for(var Y=[],L=0,I=b.length;L<I;L++){var R=b[L],T=R.material;w.uniform1f(u,T.alphaTest);w.uniformMatrix4fv(n,!1,R._modelViewMatrix.elements);R.matrixWorld.decompose(A,B,G);Y[0]=G.x;Y[1]=G.y;R=0;S.fog&&T.fog&&(R=V);H!==R&&(w.uniform1i(q,R),H=R);null!==T.map?(w.uniform2f(c,T.map.offset.x,T.map.offset.y),w.uniform2f(d,T.map.repeat.x,
+w.compileShader(V);w.compileShader(L);w.attachShader(I,V);w.attachShader(I,L);w.linkProgram(I);C=I;v=w.getAttribLocation(C,"position");y=w.getAttribLocation(C,"uv");c=w.getUniformLocation(C,"uvOffset");d=w.getUniformLocation(C,"uvScale");e=w.getUniformLocation(C,"rotation");f=w.getUniformLocation(C,"scale");g=w.getUniformLocation(C,"color");h=w.getUniformLocation(C,"map");k=w.getUniformLocation(C,"opacity");n=w.getUniformLocation(C,"modelViewMatrix");p=w.getUniformLocation(C,"projectionMatrix");q=
+w.getUniformLocation(C,"fogType");m=w.getUniformLocation(C,"fogDensity");r=w.getUniformLocation(C,"fogNear");t=w.getUniformLocation(C,"fogFar");s=w.getUniformLocation(C,"fogColor");u=w.getUniformLocation(C,"alphaTest");I=document.createElement("canvas");I.width=8;I.height=8;V=I.getContext("2d");V.fillStyle="white";V.fillRect(0,0,8,8);D=new THREE.Texture(I);D.needsUpdate=!0}w.useProgram(C);w.enableVertexAttribArray(v);w.enableVertexAttribArray(y);w.disable(w.CULL_FACE);w.enable(w.BLEND);w.bindBuffer(w.ARRAY_BUFFER,
+M);w.vertexAttribPointer(v,2,w.FLOAT,!1,16,0);w.vertexAttribPointer(y,2,w.FLOAT,!1,16,8);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,x);w.uniformMatrix4fv(p,!1,K.projectionMatrix.elements);w.activeTexture(w.TEXTURE0);w.uniform1i(h,0);V=I=0;(L=S.fog)?(w.uniform3f(s,L.color.r,L.color.g,L.color.b),L instanceof THREE.Fog?(w.uniform1f(r,L.near),w.uniform1f(t,L.far),w.uniform1i(q,1),V=I=1):L instanceof THREE.FogExp2&&(w.uniform1f(m,L.density),w.uniform1i(q,2),V=I=2)):(w.uniform1i(q,0),V=I=0);for(var L=0,J=b.length;L<
+J;L++){var R=b[L];R._modelViewMatrix.multiplyMatrices(K.matrixWorldInverse,R.matrixWorld);R.z=null===R.renderDepth?-R._modelViewMatrix.elements[14]:R.renderDepth}b.sort(E);for(var Y=[],L=0,J=b.length;L<J;L++){var R=b[L],T=R.material;w.uniform1f(u,T.alphaTest);w.uniformMatrix4fv(n,!1,R._modelViewMatrix.elements);R.matrixWorld.decompose(A,B,G);Y[0]=G.x;Y[1]=G.y;R=0;S.fog&&T.fog&&(R=V);I!==R&&(w.uniform1i(q,R),I=R);null!==T.map?(w.uniform2f(c,T.map.offset.x,T.map.offset.y),w.uniform2f(d,T.map.repeat.x,
 T.map.repeat.y)):(w.uniform2f(c,0,0),w.uniform2f(d,1,1));w.uniform1f(k,T.opacity);w.uniform3f(g,T.color.r,T.color.g,T.color.b);w.uniform1f(e,T.rotation);w.uniform2fv(f,Y);a.setBlending(T.blending,T.blendEquation,T.blendSrc,T.blendDst);a.setDepthTest(T.depthTest);a.setDepthWrite(T.depthWrite);T.map&&T.map.image&&T.map.image.width?a.setTexture(T.map,0):a.setTexture(D,0);w.drawElements(w.TRIANGLES,6,w.UNSIGNED_SHORT,0)}w.enable(w.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&&
@@ -631,7 +632,7 @@ break;case "l":k=b[a++]*c+d;p=b[a++]*c;e.lineTo(k,p);break;case "q":k=b[a++]*c+d
 m,t,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 r=m=void 0,t=void 0,s=void 0,u=void 0,v=void 0,y=void 0,E=void 0,w=void 0,
-r=a[g[k]].x,t=a[g[k]].y,s=a[g[n]].x,u=a[g[n]].y,v=a[g[p]].x,y=a[g[p]].y;if(1E-10>(s-r)*(y-t)-(u-t)*(v-r))m=!1;else{var M=void 0,x=void 0,C=void 0,D=void 0,A=void 0,B=void 0,G=void 0,S=void 0,J=void 0,H=void 0,J=S=G=w=E=void 0,M=v-s,x=y-u,C=r-v,D=t-y,A=s-r,B=u-t;for(m=0;m<e;m++)if(E=a[g[m]].x,w=a[g[m]].y,!(E===r&&w===t||E===s&&w===u||E===v&&w===y)&&(G=E-r,S=w-t,J=E-s,H=w-u,E-=v,w-=y,J=M*H-x*J,G=A*S-B*G,S=C*w-D*E,-1E-10<=J&&-1E-10<=S&&-1E-10<=G)){m=!1;break a}m=!0}}if(m){f.push([a[g[k]],a[g[n]],a[g[p]]]);
+r=a[g[k]].x,t=a[g[k]].y,s=a[g[n]].x,u=a[g[n]].y,v=a[g[p]].x,y=a[g[p]].y;if(1E-10>(s-r)*(y-t)-(u-t)*(v-r))m=!1;else{var M=void 0,x=void 0,C=void 0,D=void 0,A=void 0,B=void 0,G=void 0,S=void 0,K=void 0,I=void 0,K=S=G=w=E=void 0,M=v-s,x=y-u,C=r-v,D=t-y,A=s-r,B=u-t;for(m=0;m<e;m++)if(E=a[g[m]].x,w=a[g[m]].y,!(E===r&&w===t||E===s&&w===u||E===v&&w===y)&&(G=E-r,S=w-t,K=E-s,I=w-u,E-=v,w-=y,K=M*I-x*K,G=A*S-B*G,S=C*w-D*E,-1E-10<=K&&-1E-10<=S&&-1E-10<=G)){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};
@@ -671,8 +672,8 @@ 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,C=h*k-g*n,D=h*p-g*q;if(1E-10<Math.abs(C)){if(0<C){if(0>D||D>C)return[];k=n*p-k*q;if(0>k||k>C)return[]}else{if(0<D||D<C)return[];k=n*p-k*q;if(0<k||k<C)return[]}if(0==k)return!f||0!=D&&D!=C?[a]:[];if(k==C)return!f||0!=D&&D!=C?[b]:[];if(0==D)return[d];
 if(D==C)return[e];f=k/C;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,C=d.x,n=e,d=e.x):(b=e,C=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,C=d.y,n=e,d=e.y):(b=e,C=e.y,n=d,d=d.y));return k<=C?a<C?[]:a==C?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,x,C,D,A=[],B,G,S,J=0;for(p=b.length;J<p;J++)n.push(J);B=0;for(var H=2*n.length;0<n.length;){H--;if(0>H){console.log("Infinite Loop! Holes left:"+
-n.length+", Probably Hole outside Shape!");break}for(q=B;q<h.length;q++){x=h[q];p=-1;for(J=0;J<n.length;J++)if(C=n[J],D=x.x+":"+x.y+":"+C,void 0===A[D]){k=b[C];for(G=0;G<k.length;G++)if(C=k[G],c(q,G)&&!f(x,C)&&!g(x,C)){p=G;n.splice(J,1);B=h.slice(0,q+1);C=h.slice(q);G=k.slice(p);S=k.slice(0,p+1);h=B.concat(G).concat(S).concat(C);B=q;break}if(0<=p)break;A[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,
+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,x,C,D,A=[],B,G,S,K=0;for(p=b.length;K<p;K++)n.push(K);B=0;for(var I=2*n.length;0<n.length;){I--;if(0>I){console.log("Infinite Loop! Holes left:"+
+n.length+", Probably Hole outside Shape!");break}for(q=B;q<h.length;q++){x=h[q];p=-1;for(K=0;K<n.length;K++)if(C=n[K],D=x.x+":"+x.y+":"+C,void 0===A[D]){k=b[C];for(G=0;G<k.length;G++)if(C=k[G],c(q,G)&&!f(x,C)&&!g(x,C)){p=G;n.splice(K,1);B=h.slice(0,q+1);C=h.slice(q);G=k.slice(p);S=k.slice(0,p+1);h=B.concat(G).concat(S).concat(C);B=q;break}if(0<=p)break;A[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()};
 THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return b};
@@ -708,9 +709,9 @@ THREE.KeyFrameAnimation.prototype.play=function(a){this.currentTime=void 0!==a?a
 this.startTime),this.endTime=Math.max(c[c.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.play(this)};THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.stop(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;d.copy(b.matrix);b.matrix=d;delete c.animationCache}}};
 THREE.KeyFrameAnimation.prototype.update=function(a){if(!1!==this.isPlaying){this.currentTime+=a*this.timeScale;a=this.data.length;!0===this.loop&&this.currentTime>a&&(this.currentTime%=a);this.currentTime=Math.min(this.currentTime,a);a=0;for(var b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a],d=this.data.hierarchy[a],e=d.keys,d=d.animationCache;if(e.length){var f=d.prevKey,g=d.nextKey;if(g.time<=this.currentTime){for(;g.time<this.currentTime&&g.index>f.index;)f=g,g=e[f.index+1];d.prevKey=
 f;d.nextKey=g}g.time>=this.currentTime?f.interpolate(g,this.currentTime):f.interpolate(g,g.time);this.data.hierarchy[a].node.updateMatrix();c.matrixWorldNeedsUpdate=!0}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
-THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=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.isPlaying=!1};
-THREE.MorphAnimation.prototype={play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(){var a=0,b=0;return function(c){if(!1!==this.isPlaying){this.currentTime+=c;!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);c=this.duration/this.frames;var d=Math.floor(this.currentTime/c);d!=b&&(this.mesh.morphTargetInfluences[a]=0,this.mesh.morphTargetInfluences[b]=1,this.mesh.morphTargetInfluences[d]=
-0,a=b,b=d);this.mesh.morphTargetInfluences[d]=this.currentTime%c/c;this.mesh.morphTargetInfluences[a]=1-this.mesh.morphTargetInfluences[d]}}}()};
+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,s){var u,v=h.widthSegments,y=h.heightSegments,E=e/2,w=f/2,M=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 x=v+1,C=y+1,D=e/v,A=f/y,B=new THREE.Vector3;B[u]=0<g?1:-1;for(e=0;e<C;e++)for(f=0;f<x;f++){var G=new THREE.Vector3;G[a]=(f*D-E)*c;G[b]=(e*A-w)*d;G[u]=g;h.vertices.push(G)}for(e=
 0;e<y;e++)for(f=0;f<v;f++)w=f+x*e,a=f+x*(e+1),b=f+1+x*(e+1),c=f+1+x*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),E=new THREE.Vector2((f+1)/v,1-e/y),w=new THREE.Face3(w+M,a+M,c+M),w.normal.copy(B),w.vertexNormals.push(B.clone(),B.clone(),B.clone()),w.materialIndex=s,h.faces.push(w),h.faceVertexUvs[0].push([d,g,E]),w=new THREE.Face3(a+M,b+M,c+M),w.normal.copy(B),w.vertexNormals.push(B.clone(),B.clone(),B.clone()),w.materialIndex=s,h.faces.push(w),
 h.faceVertexUvs[0].push([g.clone(),u,E.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);
@@ -727,11 +728,11 @@ THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=
 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(O=a.length;0<=--O;){c=O;d=O-1;0>d&&(d=a.length-1);for(var e=0,f=r+2*p,e=0;e<f;e++){var g=ya*e,h=ya*(e+1),k=b+c+g,g=b+d+g,m=b+d+h,h=b+c+h,k=k+S,g=g+S,m=m+S,h=h+S;G.faces.push(new THREE.Face3(k,g,h,null,null,y));G.faces.push(new THREE.Face3(g,m,h,null,null,y));k=E.generateSideWallUV(G,k,g,m,h);G.faceVertexUvs[0].push([k[0],k[1],k[3]]);G.faceVertexUvs[0].push([k[1],
 k[2],k[3]])}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=S;b+=S;c+=S;G.faces.push(new THREE.Face3(a,b,c,null,null,v));a=E.generateTopUV(G,a,b,c);G.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,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,r=void 0!==b.steps?b.steps:1,t=b.extrudePath,
-s,u=!1,v=b.material,y=b.extrudeMaterial,E=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,M,x,C;t&&(s=t.getSpacedPoints(r),u=!0,q=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,r,!1),M=new THREE.Vector3,x=new THREE.Vector3,C=new THREE.Vector3);q||(n=k=p=0);var D,A,B,G=this,S=this.vertices.length,t=a.extractPoints(m),m=t.shape,J=t.holes;if(t=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();A=0;for(B=J.length;A<B;A++)D=J[A],THREE.Shape.Utils.isClockWise(D)&&
-(J[A]=D.reverse());t=!1}var H=THREE.Shape.Utils.triangulateShape(m,J),V=m;A=0;for(B=J.length;A<B;A++)D=J[A],m=m.concat(D);var L,I,R,Y,T,ya=m.length,ia,Ca=H.length,t=[],O=0;R=V.length;L=R-1;for(I=O+1;O<R;O++,L++,I++)L===R&&(L=0),I===R&&(I=0),t[O]=d(V[O],V[L],V[I]);var Ga=[],xa,za=t.concat();A=0;for(B=J.length;A<B;A++){D=J[A];xa=[];O=0;R=D.length;L=R-1;for(I=O+1;O<R;O++,L++,I++)L===R&&(L=0),I===R&&(I=0),xa[O]=d(D[O],D[L],D[I]);Ga.push(xa);za=za.concat(xa)}for(L=0;L<p;L++){R=L/p;Y=k*(1-R);I=n*Math.sin(R*
-Math.PI/2);O=0;for(R=V.length;O<R;O++)T=c(V[O],t[O],I),f(T.x,T.y,-Y);A=0;for(B=J.length;A<B;A++)for(D=J[A],xa=Ga[A],O=0,R=D.length;O<R;O++)T=c(D[O],xa[O],I),f(T.x,T.y,-Y)}I=n;for(O=0;O<ya;O++)T=q?c(m[O],za[O],I):m[O],u?(x.copy(w.normals[0]).multiplyScalar(T.x),M.copy(w.binormals[0]).multiplyScalar(T.y),C.copy(s[0]).add(x).add(M),f(C.x,C.y,C.z)):f(T.x,T.y,0);for(R=1;R<=r;R++)for(O=0;O<ya;O++)T=q?c(m[O],za[O],I):m[O],u?(x.copy(w.normals[R]).multiplyScalar(T.x),M.copy(w.binormals[R]).multiplyScalar(T.y),
-C.copy(s[R]).add(x).add(M),f(C.x,C.y,C.z)):f(T.x,T.y,h/r*R);for(L=p-1;0<=L;L--){R=L/p;Y=k*(1-R);I=n*Math.sin(R*Math.PI/2);O=0;for(R=V.length;O<R;O++)T=c(V[O],t[O],I),f(T.x,T.y,h+Y);A=0;for(B=J.length;A<B;A++)for(D=J[A],xa=Ga[A],O=0,R=D.length;O<R;O++)T=c(D[O],xa[O],I),u?f(T.x,T.y+s[r-1].y,s[r-1].x+Y):f(T.x,T.y,h+Y)}(function(){if(q){var a;a=0*ya;for(O=0;O<Ca;O++)ia=H[O],g(ia[2]+a,ia[1]+a,ia[0]+a);a=r+2*p;a*=ya;for(O=0;O<Ca;O++)ia=H[O],g(ia[0]+a,ia[1]+a,ia[2]+a)}else{for(O=0;O<Ca;O++)ia=H[O],g(ia[2],
-ia[1],ia[0]);for(O=0;O<Ca;O++)ia=H[O],g(ia[0]+ya*r,ia[1]+ya*r,ia[2]+ya*r)}})();(function(){var a=0;e(V,a);a+=V.length;A=0;for(B=J.length;A<B;A++)D=J[A],e(D,a),a+=D.length})()};
+s,u=!1,v=b.material,y=b.extrudeMaterial,E=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,M,x,C;t&&(s=t.getSpacedPoints(r),u=!0,q=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,r,!1),M=new THREE.Vector3,x=new THREE.Vector3,C=new THREE.Vector3);q||(n=k=p=0);var D,A,B,G=this,S=this.vertices.length,t=a.extractPoints(m),m=t.shape,K=t.holes;if(t=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();A=0;for(B=K.length;A<B;A++)D=K[A],THREE.Shape.Utils.isClockWise(D)&&
+(K[A]=D.reverse());t=!1}var I=THREE.Shape.Utils.triangulateShape(m,K),V=m;A=0;for(B=K.length;A<B;A++)D=K[A],m=m.concat(D);var L,J,R,Y,T,ya=m.length,oa,Ca=I.length,t=[],O=0;R=V.length;L=R-1;for(J=O+1;O<R;O++,L++,J++)L===R&&(L=0),J===R&&(J=0),t[O]=d(V[O],V[L],V[J]);var Ga=[],xa,za=t.concat();A=0;for(B=K.length;A<B;A++){D=K[A];xa=[];O=0;R=D.length;L=R-1;for(J=O+1;O<R;O++,L++,J++)L===R&&(L=0),J===R&&(J=0),xa[O]=d(D[O],D[L],D[J]);Ga.push(xa);za=za.concat(xa)}for(L=0;L<p;L++){R=L/p;Y=k*(1-R);J=n*Math.sin(R*
+Math.PI/2);O=0;for(R=V.length;O<R;O++)T=c(V[O],t[O],J),f(T.x,T.y,-Y);A=0;for(B=K.length;A<B;A++)for(D=K[A],xa=Ga[A],O=0,R=D.length;O<R;O++)T=c(D[O],xa[O],J),f(T.x,T.y,-Y)}J=n;for(O=0;O<ya;O++)T=q?c(m[O],za[O],J):m[O],u?(x.copy(w.normals[0]).multiplyScalar(T.x),M.copy(w.binormals[0]).multiplyScalar(T.y),C.copy(s[0]).add(x).add(M),f(C.x,C.y,C.z)):f(T.x,T.y,0);for(R=1;R<=r;R++)for(O=0;O<ya;O++)T=q?c(m[O],za[O],J):m[O],u?(x.copy(w.normals[R]).multiplyScalar(T.x),M.copy(w.binormals[R]).multiplyScalar(T.y),
+C.copy(s[R]).add(x).add(M),f(C.x,C.y,C.z)):f(T.x,T.y,h/r*R);for(L=p-1;0<=L;L--){R=L/p;Y=k*(1-R);J=n*Math.sin(R*Math.PI/2);O=0;for(R=V.length;O<R;O++)T=c(V[O],t[O],J),f(T.x,T.y,h+Y);A=0;for(B=K.length;A<B;A++)for(D=K[A],xa=Ga[A],O=0,R=D.length;O<R;O++)T=c(D[O],xa[O],J),u?f(T.x,T.y+s[r-1].y,s[r-1].x+Y):f(T.x,T.y,h+Y)}(function(){if(q){var a;a=0*ya;for(O=0;O<Ca;O++)oa=I[O],g(oa[2]+a,oa[1]+a,oa[0]+a);a=r+2*p;a*=ya;for(O=0;O<Ca;O++)oa=I[O],g(oa[0]+a,oa[1]+a,oa[2]+a)}else{for(O=0;O<Ca;O++)oa=I[O],g(oa[2],
+oa[1],oa[0]);for(O=0;O<Ca;O++)oa=I[O],g(oa[0]+ya*r,oa[1]+ya*r,oa[2]+ya*r)}})();(function(){var a=0;e(V,a);a+=V.length;A=0;for(B=K.length;A<B;A++)D=K[A],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],

+ 20 - 18
src/extras/animation/MorphAnimation.js

@@ -19,6 +19,8 @@ THREE.MorphAnimation = function ( mesh ) {
 
 THREE.MorphAnimation.prototype = {
 
+	constructor: THREE.MorphAnimation,
+
 	play: function () {
 
 		this.isPlaying = true;
@@ -33,35 +35,35 @@ THREE.MorphAnimation.prototype = {
 
 	update: function ( delta ) {
 
-			if ( this.isPlaying === false ) return;
+		if ( this.isPlaying === false ) return;
 
-			this.currentTime += delta;
+		this.currentTime += delta;
 
-			if ( this.loop === true && this.currentTime > this.duration ) {
+		if ( this.loop === true && this.currentTime > this.duration ) {
 
-				this.currentTime %= this.duration;
+			this.currentTime %= this.duration;
 
-			}
+		}
 
-			this.currentTime = Math.min( this.currentTime, this.duration );
+		this.currentTime = Math.min( this.currentTime, this.duration );
 
-			var interpolation = this.duration / this.frames;
-			var frame = Math.floor( this.currentTime / interpolation );
+		var interpolation = this.duration / this.frames;
+		var frame = Math.floor( this.currentTime / interpolation );
 
-			if ( frame != this.currentFrame ) {
+		if ( frame != this.currentFrame ) {
 
-				this.mesh.morphTargetInfluences[ this.lastFrame ] = 0;
-				this.mesh.morphTargetInfluences[ this.currentFrame ] = 1;
-				this.mesh.morphTargetInfluences[ frame ] = 0;
+			this.mesh.morphTargetInfluences[ this.lastFrame ] = 0;
+			this.mesh.morphTargetInfluences[ this.currentFrame ] = 1;
+			this.mesh.morphTargetInfluences[ frame ] = 0;
 
-				this.lastFrame = this.currentFrame;
-				this.currentFrame = frame;
+			this.lastFrame = this.currentFrame;
+			this.currentFrame = frame;
 
-			}
+		}
 
-			this.mesh.morphTargetInfluences[ frame ] = ( this.currentTime % interpolation ) / interpolation;
-			this.mesh.morphTargetInfluences[ this.lastFrame ] = 1 - this.mesh.morphTargetInfluences[ frame ];
+		this.mesh.morphTargetInfluences[ frame ] = ( this.currentTime % interpolation ) / interpolation;
+		this.mesh.morphTargetInfluences[ this.lastFrame ] = 1 - this.mesh.morphTargetInfluences[ frame ];
 
-		}
+	}
 
 };

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -2825,7 +2825,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 						// render indexed points
 
-						_gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size ); 
+						_gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size );
 
 						_this.info.render.calls ++;
 						_this.info.render.points += offsets[ i ].count;