Browse Source

Updated builds.

Mr.doob 12 years ago
parent
commit
5f66353848
3 changed files with 321 additions and 310 deletions
  1. 30 20
      build/three.js
  2. 290 289
      build/three.min.js
  3. 1 1
      editor/index.html

+ 30 - 20
build/three.js

@@ -4026,6 +4026,8 @@ THREE.extend( THREE.Matrix4.prototype, {
 
 		return function () {
 
+			console.warn( 'DEPRECATED: Matrix4\'s .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.' );
+
 			var te = this.elements;
 			return v1.set( te[12], te[13], te[14] );
 
@@ -5890,6 +5892,7 @@ THREE.EventDispatcher = function () {
 	var localRay = new THREE.Ray();
 	var facePlane = new THREE.Plane();
 	var intersectPoint = new THREE.Vector3();
+	var matrixPosition = new THREE.Vector3();
 
 	var inverseMatrix = new THREE.Matrix4();
 
@@ -5903,7 +5906,8 @@ THREE.EventDispatcher = function () {
 
 		if ( object instanceof THREE.Particle ) {
 
-			var distance = raycaster.ray.distanceToPoint( object.matrixWorld.getPosition() );
+			matrixPosition.getPositionFromMatrix( object.matrixWorld );
+			var distance = raycaster.ray.distanceToPoint( matrixPosition );
 
 			if ( distance > object.scale.x ) {
 
@@ -5923,8 +5927,9 @@ THREE.EventDispatcher = function () {
 		} else if ( object instanceof THREE.Mesh ) {
 
 			// Checking boundingSphere distance to ray
+			matrixPosition.getPositionFromMatrix( object.matrixWorld );
 			sphere.set(
-				object.matrixWorld.getPosition(),
+				matrixPosition,
 				object.geometry.boundingSphere.radius * object.matrixWorld.getMaxScaleOnAxis() );
 
 			if ( ! raycaster.ray.isIntersectionSphere( sphere ) ) {
@@ -21970,7 +21975,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 						} else {
 
-							_vector3.copy( object.matrixWorld.getPosition() );
+							_vector3.getPositionFromMatrix( object.matrixWorld );
 							_vector3.applyProjection( _projScreenMatrix );
 
 							webglObject.z = _vector3.z;
@@ -23180,8 +23185,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( p_uniforms.cameraPosition !== null ) {
 
-					var position = camera.matrixWorld.getPosition();
-					_gl.uniform3f( p_uniforms.cameraPosition, position.x, position.y, position.z );
+					_vector3.getPositionFromMatrix( camera.matrixWorld );
+					_gl.uniform3f( p_uniforms.cameraPosition, _vector3.x, _vector3.y, _vector3.z );
 
 				}
 
@@ -23782,8 +23787,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( ! light.visible ) continue;
 
-				_direction.copy( light.matrixWorld.getPosition() );
-				_direction.sub( light.target.matrixWorld.getPosition() );
+				_direction.getPositionFromMatrix( light.matrixWorld );
+				_vector3.getPositionFromMatrix( light.target.matrixWorld );
+				_direction.sub( _vector3 );
 				_direction.normalize();
 
 				// skip lights with undefined direction
@@ -23827,11 +23833,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				}
 
-				position = light.matrixWorld.getPosition();
+				_vector3.getPositionFromMatrix( light.matrixWorld );
 
-				pointPositions[ pointOffset ]     = position.x;
-				pointPositions[ pointOffset + 1 ] = position.y;
-				pointPositions[ pointOffset + 2 ] = position.z;
+				pointPositions[ pointOffset ]     = _vector3.x;
+				pointPositions[ pointOffset + 1 ] = _vector3.y;
+				pointPositions[ pointOffset + 2 ] = _vector3.z;
 
 				pointDistances[ pointLength ] = distance;
 
@@ -23855,16 +23861,17 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				}
 
-				position = light.matrixWorld.getPosition();
+				_vector3.getPositionFromMatrix( light.matrixWorld );
 
-				spotPositions[ spotOffset ]     = position.x;
-				spotPositions[ spotOffset + 1 ] = position.y;
-				spotPositions[ spotOffset + 2 ] = position.z;
+				spotPositions[ spotOffset ]     = _vector3.x;
+				spotPositions[ spotOffset + 1 ] = _vector3.y;
+				spotPositions[ spotOffset + 2 ] = _vector3.z;
 
 				spotDistances[ spotLength ] = distance;
 
-				_direction.copy( position );
-				_direction.sub( light.target.matrixWorld.getPosition() );
+				_direction.copy( _vector3 );
+				_vector3.getPositionFromMatrix( light.target.matrixWorld );
+				_direction.sub( _vector3 );
 				_direction.normalize();
 
 				spotDirections[ spotOffset ]     = _direction.x;
@@ -23882,7 +23889,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( ! light.visible ) continue;
 
-				_direction.copy( light.matrixWorld.getPosition() );
+				_direction.getPositionFromMatrix( light.matrixWorld );
 				_direction.normalize();
 
 				// skip lights with undefined direction
@@ -34769,7 +34776,9 @@ THREE.ShadowMapPlugin = function () {
 	_projScreenMatrix = new THREE.Matrix4(),
 
 	_min = new THREE.Vector3(),
-	_max = new THREE.Vector3();
+	_max = new THREE.Vector3(),
+
+	_matrixPosition = new THREE.Vector3();
 
 	this.init = function ( renderer ) {
 
@@ -34954,7 +34963,8 @@ THREE.ShadowMapPlugin = function () {
 			shadowCamera = light.shadowCamera;
 
 			shadowCamera.position.getPositionFromMatrix( light.matrixWorld );
-			shadowCamera.lookAt( light.target.matrixWorld.getPosition() );
+			_matrixPosition.getPositionFromMatrix( light.target.matrixWorld );
+			shadowCamera.lookAt( _matrixPosition );
 			shadowCamera.updateMatrixWorld();
 
 			shadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld );

+ 290 - 289
build/three.min.js

@@ -70,38 +70,39 @@ this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z
 THREE.extend(THREE.Matrix3.prototype,{set:function(a,b,c,d,e,f,g,h,i){var k=this.elements;k[0]=a;k[3]=b;k[6]=c;k[1]=d;k[4]=e;k[7]=f;k[2]=g;k[5]=h;k[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},multiplyVector3Array:function(){var a=
 new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],a=a[8];return b*f*a-b*g*i-c*e*a+c*g*h+d*e*i-d*f*h},getInverse:function(a,b){var c=a.elements,d=this.elements;
 d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},transpose:function(){var a,
-b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}});THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,l,n,m,s,q,r){var p=this.elements=new Float32Array(16);p[0]=void 0!==a?a:1;p[4]=b||0;p[8]=c||0;p[12]=d||0;p[1]=e||0;p[5]=void 0!==f?f:1;p[9]=g||0;p[13]=h||0;p[2]=i||0;p[6]=k||0;p[10]=void 0!==l?l:1;p[14]=n||0;p[3]=m||0;p[7]=s||0;p[11]=q||0;p[15]=void 0!==r?r:1};
-THREE.extend(THREE.Matrix4.prototype,{set:function(a,b,c,d,e,f,g,h,i,k,l,n,m,s,q,r){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=h;p[2]=i;p[6]=k;p[10]=l;p[14]=n;p[3]=m;p[7]=s;p[11]=q;p[15]=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},setRotationFromEuler:function(a,b){var c=this.elements,
+b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}});THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,l,n,m,s,r,p){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=g||0;q[13]=h||0;q[2]=i||0;q[6]=k||0;q[10]=void 0!==l?l:1;q[14]=n||0;q[3]=m||0;q[7]=s||0;q[11]=r||0;q[15]=void 0!==p?p:1};
+THREE.extend(THREE.Matrix4.prototype,{set:function(a,b,c,d,e,f,g,h,i,k,l,n,m,s,r,p){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=k;q[10]=l;q[14]=n;q[3]=m;q[7]=s;q[11]=r;q[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},setRotationFromEuler:function(a,b){var c=this.elements,
 d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var k=g*i,l=g*f,n=d*i,m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+n*e;c[5]=k-m*e;c[9]=-d*h;c[2]=m-k*e;c[6]=n+l*e;c[10]=g*h}else"YXZ"===b?(k=h*i,l=h*f,n=e*i,m=e*f,c[0]=k+m*d,c[4]=n*d-l,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=l*d-n,c[6]=m+k*d,c[10]=g*h):"ZXY"===b?(k=h*i,l=h*f,n=e*i,m=e*f,c[0]=k-m*d,c[4]=-g*f,c[8]=n+l*d,c[1]=l+n*d,c[5]=g*i,c[9]=m-k*d,c[2]=-g*e,c[6]=d,c[10]=g*h):
 "ZYX"===b?(k=g*i,l=g*f,n=d*i,m=d*f,c[0]=h*i,c[4]=n*e-l,c[8]=k*e+m,c[1]=h*f,c[5]=m*e+k,c[9]=l*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(k=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=m-k*f,c[8]=n*f+l,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=l*f+n,c[10]=k-m*f):"XZY"===b&&(k=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=k*f+m,c[5]=g*i,c[9]=l*f-n,c[2]=n*f-l,c[6]=d*i,c[10]=m*f+k);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,k=c*h,
 c=c*i,l=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},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("DEPRECATED: Matrix4's .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],i=c[12],k=c[1],l=c[5],n=c[9],m=c[13],s=c[2],q=c[6],r=c[10],p=c[14],t=c[3],x=c[7],w=c[11],c=c[15],v=d[0],H=d[4],F=d[8],A=d[12],z=d[1],K=d[5],I=d[9],
-E=d[13],V=d[2],B=d[6],T=d[10],C=d[14],G=d[3],M=d[7],W=d[11],d=d[15];e[0]=f*v+g*z+h*V+i*G;e[4]=f*H+g*K+h*B+i*M;e[8]=f*F+g*I+h*T+i*W;e[12]=f*A+g*E+h*C+i*d;e[1]=k*v+l*z+n*V+m*G;e[5]=k*H+l*K+n*B+m*M;e[9]=k*F+l*I+n*T+m*W;e[13]=k*A+l*E+n*C+m*d;e[2]=s*v+q*z+r*V+p*G;e[6]=s*H+q*K+r*B+p*M;e[10]=s*F+q*I+r*T+p*W;e[14]=s*A+q*E+r*C+p*d;e[3]=t*v+x*z+w*V+c*G;e[7]=t*H+x*K+w*B+c*M;e[11]=t*F+x*I+w*T+c*W;e[15]=t*A+x*E+w*C+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);
+g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .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],i=c[12],k=c[1],l=c[5],n=c[9],m=c[13],s=c[2],r=c[6],p=c[10],q=c[14],x=c[3],t=c[7],v=c[11],c=c[15],w=d[0],D=d[4],K=d[8],A=d[12],z=d[1],F=d[5],H=d[9],
+G=d[13],V=d[2],B=d[6],T=d[10],C=d[14],I=d[3],M=d[7],W=d[11],d=d[15];e[0]=f*w+g*z+h*V+i*I;e[4]=f*D+g*F+h*B+i*M;e[8]=f*K+g*H+h*T+i*W;e[12]=f*A+g*G+h*C+i*d;e[1]=k*w+l*z+n*V+m*I;e[5]=k*D+l*F+n*B+m*M;e[9]=k*K+l*H+n*T+m*W;e[13]=k*A+l*G+n*C+m*d;e[2]=s*w+r*z+p*V+q*I;e[6]=s*D+r*F+p*B+q*M;e[10]=s*K+r*H+p*T+q*W;e[14]=s*A+r*G+p*C+q*d;e[3]=x*w+t*z+v*V+c*I;e[7]=x*D+t*F+v*B+c*M;e[11]=x*K+t*H+v*T+c*W;e[15]=x*A+t*G+v*C+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("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
 return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=
 c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],l=a[6],n=a[10],m=a[14];return a[3]*(+e*h*l-d*i*l-e*g*n+c*i*n+d*g*m-c*h*m)+a[7]*
 (+b*h*m-b*i*n+e*f*n-d*f*m+d*i*k-e*h*k)+a[11]*(+b*i*l-b*g*m-e*f*l+c*f*m+e*g*k-c*i*k)+a[15]*(-d*g*k-b*h*l+b*g*n+d*f*l-c*f*n+c*h*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=
-b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;b[12]=
-a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],i=d[1],k=d[5],l=d[9],n=d[13],m=d[2],s=d[6],q=d[10],r=d[14],p=d[3],t=d[7],x=d[11],w=d[15];c[0]=l*r*t-n*q*t+n*s*x-k*r*x-l*s*w+k*q*w;c[4]=h*q*t-g*r*t-h*s*x+f*r*x+g*s*w-f*q*w;c[8]=g*n*t-h*l*t+h*k*x-f*n*x-g*k*w+f*l*w;c[12]=h*l*s-g*n*s-h*k*q+f*n*q+g*k*r-f*l*r;c[1]=n*q*p-l*r*p-n*m*x+i*r*x+l*m*w-i*q*w;c[5]=g*r*p-h*q*p+h*m*x-e*r*x-g*m*w+e*q*w;c[9]=h*l*p-g*n*p-h*i*x+e*n*x+g*i*w-e*l*w;
-c[13]=g*n*m-h*l*m+h*i*q-e*n*q-g*i*r+e*l*r;c[2]=k*r*p-n*s*p+n*m*t-i*r*t-k*m*w+i*s*w;c[6]=h*s*p-f*r*p-h*m*t+e*r*t+f*m*w-e*s*w;c[10]=f*n*p-h*k*p+h*i*t-e*n*t-f*i*w+e*k*w;c[14]=h*k*m-f*n*m-h*i*s+e*n*s+f*i*r-e*k*r;c[3]=l*s*p-k*q*p-l*m*t+i*q*t+k*m*x-i*s*x;c[7]=f*q*p-g*s*p+g*m*t-e*q*t-f*m*x+e*s*x;c[11]=g*k*p-f*l*p-g*i*t+e*l*t+f*i*x-e*k*x;c[15]=f*l*m-g*k*m+g*i*s-e*l*s-f*i*q+e*k*q;c=d[0]*c[0]+d[1]*c[4]+d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");
-console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},compose:function(){var a=new THREE.Matrix4,b=new THREE.Matrix4;return function(c,d,e){var f=this.elements;a.identity();a.setRotationFromQuaternion(d);b.makeScale(e.x,e.y,e.z);this.multiplyMatrices(a,b);f[12]=c.x;f[13]=c.y;f[14]=c.z;return this}}(),decompose:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Matrix4;return function(e,
-f,g){var h=this.elements;a.set(h[0],h[1],h[2]);b.set(h[4],h[5],h[6]);c.set(h[8],h[9],h[10]);e=e instanceof THREE.Vector3?e:new THREE.Vector3;f=f instanceof THREE.Quaternion?f:new THREE.Quaternion;g=g instanceof THREE.Vector3?g:new THREE.Vector3;g.x=a.length();g.y=b.length();g.z=c.length();e.x=h[12];e.y=h[13];e.z=h[14];d.copy(this);d.elements[0]/=g.x;d.elements[1]/=g.x;d.elements[2]/=g.x;d.elements[4]/=g.y;d.elements[5]/=g.y;d.elements[6]/=g.y;d.elements[8]/=g.z;d.elements[9]/=g.z;d.elements[10]/=
-g.z;f.setFromRotationMatrix(d);return[e,f,g]}}(),extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),translate:function(a){var b=
-this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=
-b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*i+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);
-if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),l=Math.sin(b),n=1-k,m=d*e*n,s=d*f*n,n=e*f*n,d=d*l,q=e*l,l=f*l,f=g+(1-g)*k,g=m+l,e=s-q,m=m-l,h=h+(1-h)*k,l=n+d,s=s+q,n=n-d,i=i+(1-i)*k,k=c[0],d=c[1],q=c[2],r=c[3],p=c[4],t=c[5],x=c[6],w=c[7],v=c[8],H=c[9],F=c[10],A=c[11];c[0]=f*k+g*p+e*v;c[1]=f*d+g*t+e*H;c[2]=f*q+g*x+e*F;c[3]=f*r+g*w+e*A;c[4]=m*k+h*p+
-l*v;c[5]=m*d+h*t+l*H;c[6]=m*q+h*x+l*F;c[7]=m*r+h*w+l*A;c[8]=s*k+n*p+i*v;c[9]=s*d+n*t+i*H;c[10]=s*q+n*x+i*F;c[11]=s*r+n*w+i*A;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,
-b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;
-this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*
-a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
+b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");
+var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],i=d[1],k=d[5],l=d[9],n=d[13],m=d[2],s=d[6],r=d[10],p=d[14],q=d[3],x=d[7],t=d[11],v=d[15];c[0]=l*p*x-n*r*x+n*s*t-k*p*t-l*s*v+k*r*v;c[4]=h*r*x-g*p*x-h*s*t+f*p*t+g*s*v-f*r*v;c[8]=g*n*x-h*l*x+h*k*t-f*n*t-g*k*v+f*l*v;c[12]=h*l*s-g*n*s-h*k*r+f*n*r+g*k*p-f*l*p;c[1]=n*r*q-l*p*q-
+n*m*t+i*p*t+l*m*v-i*r*v;c[5]=g*p*q-h*r*q+h*m*t-e*p*t-g*m*v+e*r*v;c[9]=h*l*q-g*n*q-h*i*t+e*n*t+g*i*v-e*l*v;c[13]=g*n*m-h*l*m+h*i*r-e*n*r-g*i*p+e*l*p;c[2]=k*p*q-n*s*q+n*m*x-i*p*x-k*m*v+i*s*v;c[6]=h*s*q-f*p*q-h*m*x+e*p*x+f*m*v-e*s*v;c[10]=f*n*q-h*k*q+h*i*x-e*n*x-f*i*v+e*k*v;c[14]=h*k*m-f*n*m-h*i*s+e*n*s+f*i*p-e*k*p;c[3]=l*s*q-k*r*q-l*m*x+i*r*x+k*m*t-i*s*t;c[7]=f*r*q-g*s*q+g*m*x-e*r*x-f*m*t+e*s*t;c[11]=g*k*q-f*l*q-g*i*x+e*l*x+f*i*t-e*k*t;c[15]=f*l*m-g*k*m+g*i*s-e*l*s-f*i*r+e*k*r;c=d[0]*c[0]+d[1]*c[4]+
+d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},compose:function(){var a=new THREE.Matrix4,b=new THREE.Matrix4;return function(c,d,e){var f=this.elements;a.identity();a.setRotationFromQuaternion(d);b.makeScale(e.x,e.y,e.z);this.multiplyMatrices(a,b);f[12]=c.x;f[13]=c.y;f[14]=c.z;return this}}(),decompose:function(){var a=
+new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Matrix4;return function(e,f,g){var h=this.elements;a.set(h[0],h[1],h[2]);b.set(h[4],h[5],h[6]);c.set(h[8],h[9],h[10]);e=e instanceof THREE.Vector3?e:new THREE.Vector3;f=f instanceof THREE.Quaternion?f:new THREE.Quaternion;g=g instanceof THREE.Vector3?g:new THREE.Vector3;g.x=a.length();g.y=b.length();g.z=c.length();e.x=h[12];e.y=h[13];e.z=h[14];d.copy(this);d.elements[0]/=g.x;d.elements[1]/=g.x;d.elements[2]/=g.x;d.elements[4]/=
+g.y;d.elements[5]/=g.y;d.elements[6]/=g.y;d.elements[8]/=g.z;d.elements[9]/=g.z;d.elements[10]/=g.z;f.setFromRotationMatrix(d);return[e,f,g]}}(),extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=
+b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=
+l*i-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*i+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*
+k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),l=Math.sin(b),n=1-k,m=d*e*n,s=d*f*n,n=e*f*n,d=d*l,r=e*l,l=f*l,f=g+(1-g)*k,g=m+l,e=s-r,m=m-l,h=h+(1-h)*k,l=n+d,s=s+r,n=n-d,i=i+(1-i)*k,k=c[0],d=c[1],r=c[2],p=c[3],q=c[4],x=c[5],t=c[6],
+v=c[7],w=c[8],D=c[9],K=c[10],A=c[11];c[0]=f*k+g*q+e*w;c[1]=f*d+g*x+e*D;c[2]=f*r+g*t+e*K;c[3]=f*p+g*v+e*A;c[4]=m*k+h*q+l*w;c[5]=m*d+h*x+l*D;c[6]=m*r+h*t+l*K;c[7]=m*p+h*v+l*A;c[8]=s*k+n*q+i*w;c[9]=s*d+n*x+i*D;c[10]=s*r+n*t+i*K;c[11]=s*p+n*v+i*A;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*
+a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,
+0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*
+f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],
+a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
 THREE.extend(THREE.Ray.prototype,{set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);var d=
 c.dot(this.direction);return c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){return 0!=a.normal.dot(this.direction)||0==a.distanceToPoint(this.origin)?!0:!1},distanceToPlane:function(a){var b=
 a.normal.dot(this.direction);if(0==b){if(0==a.distanceToPoint(this.origin))return 0}else return-(this.origin.dot(a.normal)+a.constant)/b},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return void 0===c?void 0:this.at(c,b)},transform:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}});THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};
 THREE.extend(THREE.Sphere.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromCenterAndPoints:function(a,b){for(var c=0,d=0,e=b.length;d<e;d++)var f=a.distanceToSquared(b[d]),c=Math.max(c,f);this.center=a;this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
 this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},transform:function(a){this.center.applyMatrix4(a);
 this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}});THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
-THREE.extend(THREE.Frustum.prototype,{set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],k=c[7],l=c[8],n=c[9],m=c[10],s=c[11],q=c[12],r=c[13],p=c[14],c=c[15];b[0].setComponents(f-a,k-g,s-l,c-q).normalize();b[1].setComponents(f+
-a,k+g,s+l,c+q).normalize();b[2].setComponents(f+d,k+h,s+n,c+r).normalize();b[3].setComponents(f-d,k-h,s-n,c-r).normalize();b[4].setComponents(f-e,k-i,s-m,c-p).normalize();b[5].setComponents(f+e,k+i,s+m,c+p).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)<b)return!1;return!0}}(),intersectsSphere:function(a){for(var b=
+THREE.extend(THREE.Frustum.prototype,{set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],k=c[7],l=c[8],n=c[9],m=c[10],s=c[11],r=c[12],p=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,k-g,s-l,c-r).normalize();b[1].setComponents(f+
+a,k+g,s+l,c+r).normalize();b[2].setComponents(f+d,k+h,s+n,c+p).normalize();b[3].setComponents(f-d,k-h,s-n,c-p).normalize();b[4].setComponents(f-e,k-i,s-m,c-q).normalize();b[5].setComponents(f+e,k+i,s+m,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)<b)return!1;return!0}}(),intersectsSphere:function(a){for(var b=
 this.planes,c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}});THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
 THREE.extend(THREE.Plane.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),
 copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,
@@ -118,11 +119,11 @@ THREE.extend(THREE.Triangle.prototype,{constructor:THREE.Triangle,set:function(a
 midpoint:function(a){return(a||new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&
 a.b.equals(this.b)&&a.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}});THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};
 THREE.extend(THREE.Clock.prototype,{start:function(){this.oldTime=this.startTime=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now(),
-a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}});THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.lengthSq()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Matrix4,g=function(a,b){return a.distance-b.distance},h=function(g,h,i){if(g instanceof a.Particle){h=h.ray.distanceToPoint(g.matrixWorld.getPosition());if(h>g.scale.x)return i;i.push({distance:h,point:g.position,face:null,object:g})}else if(g instanceof a.Mesh){b.set(g.matrixWorld.getPosition(),
-g.geometry.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!h.ray.isIntersectionSphere(b))return i;var m=g.geometry,s=m.vertices,q=g.material instanceof a.MeshFaceMaterial,r=!0===q?g.material.materials:null,p=g.material.side,t,x,w,v=h.precision;g.matrixRotationWorld.extractRotation(g.matrixWorld);f.getInverse(g.matrixWorld);c.copy(h.ray).transform(f);for(var H=0,F=m.faces.length;H<F;H++){var A=m.faces[H],p=!0===q?r[A.materialIndex]:g.material;if(void 0!==p){d.setFromNormalAndCoplanarPoint(A.normal,
-s[A.a]);var z=c.distanceToPlane(d);if(!(Math.abs(z)<v)&&!(0>z)){p=p.side;if(p!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(p===a.FrontSide?0>t:0<t)))continue;if(!(z<h.near||z>h.far)){e=c.at(z,e);if(A instanceof a.Face3){if(p=s[A.a],t=s[A.b],x=s[A.c],!a.Triangle.containsPoint(e,p,t,x))continue}else if(A instanceof a.Face4){if(p=s[A.a],t=s[A.b],x=s[A.c],w=s[A.d],!a.Triangle.containsPoint(e,p,t,w)&&!a.Triangle.containsPoint(e,t,x,w))continue}else throw Error("face type not supported");i.push({distance:z,
-point:h.ray.at(z),face:A,faceIndex:H,object:g})}}}}}},i=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)h(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&i(a,this,c);h(a,this,c);c.sort(g);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)h(a[d],
-this,c),!0===b&&i(a[d],this,c);c.sort(g);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
+a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}});THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.lengthSq()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=function(h,i,k){if(h instanceof a.Particle){f.getPositionFromMatrix(h.matrixWorld);i=i.ray.distanceToPoint(f);if(i>h.scale.x)return k;k.push({distance:i,point:h.position,face:null,object:h})}else if(h instanceof
+a.Mesh){f.getPositionFromMatrix(h.matrixWorld);b.set(f,h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis());if(!i.ray.isIntersectionSphere(b))return k;var s=h.geometry,r=s.vertices,p=h.material instanceof a.MeshFaceMaterial,q=!0===p?h.material.materials:null,x=h.material.side,t,v,w,D=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);g.getInverse(h.matrixWorld);c.copy(i.ray).transform(g);for(var K=0,A=s.faces.length;K<A;K++){var z=s.faces[K],x=!0===p?q[z.materialIndex]:
+h.material;if(void 0!==x){d.setFromNormalAndCoplanarPoint(z.normal,r[z.a]);var F=c.distanceToPlane(d);if(!(Math.abs(F)<D)&&!(0>F)){x=x.side;if(x!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(x===a.FrontSide?0>t:0<t)))continue;if(!(F<i.near||F>i.far)){e=c.at(F,e);if(z instanceof a.Face3){if(x=r[z.a],t=r[z.b],v=r[z.c],!a.Triangle.containsPoint(e,x,t,v))continue}else if(z instanceof a.Face4){if(x=r[z.a],t=r[z.b],v=r[z.c],w=r[z.d],!a.Triangle.containsPoint(e,x,t,w)&&!a.Triangle.containsPoint(e,t,v,w))continue}else throw Error("face type not supported");
+k.push({distance:F,point:i.ray.at(F),face:z,faceIndex:K,object:h})}}}}}},k=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)i(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&k(a,this,c);i(a,this,c);c.sort(h);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<
+e;d++)i(a[d],this,c),!0===b&&k(a[d],this,c);c.sort(h);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);a=(new THREE.Matrix4).extractRotation(this.matrix);this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.add(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(a){return a.applyMatrix4(THREE.Object3D.__m1.getInverse(this.matrixWorld))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))},add:function(a){if(a===
@@ -131,19 +132,19 @@ traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.chi
 !1===this.useQuaternion?this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder):this.matrix.setRotationFromQuaternion(this.quaternion);(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),
 this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){void 0===a&&(a=new THREE.Object3D);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(this.rotation);a.eulerOrder=this.eulerOrder;a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);
 a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());return a}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(k===n){var a=new THREE.RenderableVertex;l.push(a);n++;k++;return a}return l[k++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
-c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,k,l=[],n=0,m,s,q=[],r=0,p,t=[],x=0,w,v,H=[],F=0,A,z,K=[],I=0,E={objects:[],sprites:[],lights:[],elements:[]},V=new THREE.Vector3,B=new THREE.Vector4,T=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,G=Array(3),M=Array(4),W=new THREE.Matrix4,ua=new THREE.Matrix4,Ha,oa=new THREE.Matrix4,J=new THREE.Matrix3,da=new THREE.Matrix3,ka=new THREE.Vector3,Y=new THREE.Frustum,L=new THREE.Vector4,va=new THREE.Vector4;
+c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,k,l=[],n=0,m,s,r=[],p=0,q,x=[],t=0,v,w,D=[],K=0,A,z,F=[],H=0,G={objects:[],sprites:[],lights:[],elements:[]},V=new THREE.Vector3,B=new THREE.Vector4,T=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,I=Array(3),M=Array(4),W=new THREE.Matrix4,ua=new THREE.Matrix4,Ha,oa=new THREE.Matrix4,J=new THREE.Matrix3,da=new THREE.Matrix3,ka=new THREE.Vector3,Y=new THREE.Frustum,L=new THREE.Vector4,va=new THREE.Vector4;
 this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);ua.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(ua)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);ua.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(ua)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,
-c)};this.projectScene=function(g,h,n,ta){var Ma=!1,ga,ja,ma,X,ha,ra,fa,Da,Ya,Za,ia,Qa,Ta;z=v=p=s=0;E.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();W.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));ua.multiplyMatrices(h.projectionMatrix,W);da.getInverse(W);da.transpose();Y.setFromMatrix(ua);f=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var Ra=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof
-THREE.Light)E.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===Y.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),E.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),E.sprites.push(e)):(e=a(),e.object=
-f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),E.objects.push(e));Ra(f)}}};Ra(g);!0===n&&E.objects.sort(c);g=0;for(n=E.objects.length;g<n;g++)if(Da=E.objects[g].object,Ha=Da.matrixWorld,k=0,Da instanceof THREE.Mesh){Ya=Da.geometry;ma=Ya.vertices;Za=Ya.faces;Ya=Ya.faceVertexUvs;J.getInverse(Ha);J.transpose();Qa=Da.material instanceof THREE.MeshFaceMaterial;Ta=!0===Qa?Da.material:null;ga=0;for(ja=ma.length;ga<ja;ga++)i=b(),i.positionWorld.copy(ma[ga]).applyMatrix4(Ha),
-i.positionScreen.copy(i.positionWorld).applyMatrix4(ua),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.positionScreen.z/=i.positionScreen.w,i.visible=!(-1>i.positionScreen.x||1<i.positionScreen.x||-1>i.positionScreen.y||1<i.positionScreen.y||-1>i.positionScreen.z||1<i.positionScreen.z);ma=0;for(ga=Za.length;ma<ga;ma++){ja=Za[ma];var eb=!0===Qa?Ta.materials[ja.materialIndex]:Da.material;if(void 0!==eb){ra=eb.side;if(ja instanceof THREE.Face3)if(X=l[ja.a],ha=l[ja.b],
-fa=l[ja.c],G[0]=X.positionScreen,G[1]=ha.positionScreen,G[2]=fa.positionScreen,!0===X.visible||!0===ha.visible||!0===fa.visible||T.isIntersectionBox(C.setFromPoints(G)))if(Ma=0>(fa.positionScreen.x-X.positionScreen.x)*(ha.positionScreen.y-X.positionScreen.y)-(fa.positionScreen.y-X.positionScreen.y)*(ha.positionScreen.x-X.positionScreen.x),ra===THREE.DoubleSide||Ma===(ra===THREE.FrontSide))s===r?(ia=new THREE.RenderableFace3,q.push(ia),r++,s++,m=ia):m=q[s++],m.v1.copy(X),m.v2.copy(ha),m.v3.copy(fa);
+c)};this.projectScene=function(g,h,n,ta){var Ma=!1,ga,ja,ma,X,ha,ra,fa,Da,Za,$a,ia,Ra,Ua;z=w=q=s=0;G.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();W.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));ua.multiplyMatrices(h.projectionMatrix,W);da.getInverse(W);da.transpose();Y.setFromMatrix(ua);f=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var Sa=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof
+THREE.Light)G.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===Y.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),G.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),G.sprites.push(e)):(e=a(),e.object=
+f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),G.objects.push(e));Sa(f)}}};Sa(g);!0===n&&G.objects.sort(c);g=0;for(n=G.objects.length;g<n;g++)if(Da=G.objects[g].object,Ha=Da.matrixWorld,k=0,Da instanceof THREE.Mesh){Za=Da.geometry;ma=Za.vertices;$a=Za.faces;Za=Za.faceVertexUvs;J.getInverse(Ha);J.transpose();Ra=Da.material instanceof THREE.MeshFaceMaterial;Ua=!0===Ra?Da.material:null;ga=0;for(ja=ma.length;ga<ja;ga++)i=b(),i.positionWorld.copy(ma[ga]).applyMatrix4(Ha),
+i.positionScreen.copy(i.positionWorld).applyMatrix4(ua),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.positionScreen.z/=i.positionScreen.w,i.visible=!(-1>i.positionScreen.x||1<i.positionScreen.x||-1>i.positionScreen.y||1<i.positionScreen.y||-1>i.positionScreen.z||1<i.positionScreen.z);ma=0;for(ga=$a.length;ma<ga;ma++){ja=$a[ma];var fb=!0===Ra?Ua.materials[ja.materialIndex]:Da.material;if(void 0!==fb){ra=fb.side;if(ja instanceof THREE.Face3)if(X=l[ja.a],ha=l[ja.b],
+fa=l[ja.c],I[0]=X.positionScreen,I[1]=ha.positionScreen,I[2]=fa.positionScreen,!0===X.visible||!0===ha.visible||!0===fa.visible||T.isIntersectionBox(C.setFromPoints(I)))if(Ma=0>(fa.positionScreen.x-X.positionScreen.x)*(ha.positionScreen.y-X.positionScreen.y)-(fa.positionScreen.y-X.positionScreen.y)*(ha.positionScreen.x-X.positionScreen.x),ra===THREE.DoubleSide||Ma===(ra===THREE.FrontSide))s===p?(ia=new THREE.RenderableFace3,r.push(ia),p++,s++,m=ia):m=r[s++],m.v1.copy(X),m.v2.copy(ha),m.v3.copy(fa);
 else continue;else continue;else if(ja instanceof THREE.Face4)if(X=l[ja.a],ha=l[ja.b],fa=l[ja.c],ia=l[ja.d],M[0]=X.positionScreen,M[1]=ha.positionScreen,M[2]=fa.positionScreen,M[3]=ia.positionScreen,!0===X.visible||!0===ha.visible||!0===fa.visible||!0===ia.visible||T.isIntersectionBox(C.setFromPoints(M)))if(Ma=0>(ia.positionScreen.x-X.positionScreen.x)*(ha.positionScreen.y-X.positionScreen.y)-(ia.positionScreen.y-X.positionScreen.y)*(ha.positionScreen.x-X.positionScreen.x)||0>(ha.positionScreen.x-
-fa.positionScreen.x)*(ia.positionScreen.y-fa.positionScreen.y)-(ha.positionScreen.y-fa.positionScreen.y)*(ia.positionScreen.x-fa.positionScreen.x),ra===THREE.DoubleSide||Ma===(ra===THREE.FrontSide)){if(p===x){var ob=new THREE.RenderableFace4;t.push(ob);x++;p++;m=ob}else m=t[p++];m.v1.copy(X);m.v2.copy(ha);m.v3.copy(fa);m.v4.copy(ia)}else continue;else continue;m.normalModel.copy(ja.normal);!1===Ma&&(ra===THREE.BackSide||ra===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(J).normalize();
-m.normalModelView.copy(m.normalModel).applyMatrix3(da);m.centroidModel.copy(ja.centroid).applyMatrix4(Ha);fa=ja.vertexNormals;X=0;for(ha=fa.length;X<ha;X++)ia=m.vertexNormalsModel[X],ia.copy(fa[X]),!1===Ma&&(ra===THREE.BackSide||ra===THREE.DoubleSide)&&ia.negate(),ia.applyMatrix3(J).normalize(),m.vertexNormalsModelView[X].copy(ia).applyMatrix3(da);m.vertexNormalsLength=fa.length;X=0;for(ha=Ya.length;X<ha;X++)if(ia=Ya[X][ma],void 0!==ia){ra=0;for(fa=ia.length;ra<fa;ra++)m.uvs[X][ra]=ia[ra]}m.color=
-ja.color;m.material=eb;ka.copy(m.centroidModel).applyProjection(ua);m.z=ka.z;E.elements.push(m)}}}else if(Da instanceof THREE.Line){oa.multiplyMatrices(ua,Ha);ma=Da.geometry.vertices;X=b();X.positionScreen.copy(ma[0]).applyMatrix4(oa);Za=Da.type===THREE.LinePieces?2:1;ga=1;for(ja=ma.length;ga<ja;ga++)X=b(),X.positionScreen.copy(ma[ga]).applyMatrix4(oa),0<(ga+1)%Za||(ha=l[k-2],L.copy(X.positionScreen),va.copy(ha.positionScreen),!0===d(L,va)&&(L.multiplyScalar(1/L.w),va.multiplyScalar(1/va.w),v===F?
-(Ya=new THREE.RenderableLine,H.push(Ya),F++,v++,w=Ya):w=H[v++],w.v1.positionScreen.copy(L),w.v2.positionScreen.copy(va),w.z=Math.max(L.z,va.z),w.material=Da.material,E.elements.push(w)))}g=0;for(n=E.sprites.length;g<n;g++)Da=E.sprites[g].object,Ha=Da.matrixWorld,Da instanceof THREE.Particle&&(B.set(Ha.elements[12],Ha.elements[13],Ha.elements[14],1),B.applyMatrix4(ua),B.z/=B.w,0<B.z&&1>B.z&&(z===I?(Ma=new THREE.RenderableParticle,K.push(Ma),I++,z++,A=Ma):A=K[z++],A.object=Da,A.x=B.x/B.w,A.y=B.y/B.w,
-A.z=B.z,A.rotation=Da.rotation.z,A.scale.x=Da.scale.x*Math.abs(A.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),A.scale.y=Da.scale.y*Math.abs(A.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),A.material=Da.material,E.elements.push(A)));!0===ta&&E.elements.sort(c);return E}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
+fa.positionScreen.x)*(ia.positionScreen.y-fa.positionScreen.y)-(ha.positionScreen.y-fa.positionScreen.y)*(ia.positionScreen.x-fa.positionScreen.x),ra===THREE.DoubleSide||Ma===(ra===THREE.FrontSide)){if(q===t){var pb=new THREE.RenderableFace4;x.push(pb);t++;q++;m=pb}else m=x[q++];m.v1.copy(X);m.v2.copy(ha);m.v3.copy(fa);m.v4.copy(ia)}else continue;else continue;m.normalModel.copy(ja.normal);!1===Ma&&(ra===THREE.BackSide||ra===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(J).normalize();
+m.normalModelView.copy(m.normalModel).applyMatrix3(da);m.centroidModel.copy(ja.centroid).applyMatrix4(Ha);fa=ja.vertexNormals;X=0;for(ha=fa.length;X<ha;X++)ia=m.vertexNormalsModel[X],ia.copy(fa[X]),!1===Ma&&(ra===THREE.BackSide||ra===THREE.DoubleSide)&&ia.negate(),ia.applyMatrix3(J).normalize(),m.vertexNormalsModelView[X].copy(ia).applyMatrix3(da);m.vertexNormalsLength=fa.length;X=0;for(ha=Za.length;X<ha;X++)if(ia=Za[X][ma],void 0!==ia){ra=0;for(fa=ia.length;ra<fa;ra++)m.uvs[X][ra]=ia[ra]}m.color=
+ja.color;m.material=fb;ka.copy(m.centroidModel).applyProjection(ua);m.z=ka.z;G.elements.push(m)}}}else if(Da instanceof THREE.Line){oa.multiplyMatrices(ua,Ha);ma=Da.geometry.vertices;X=b();X.positionScreen.copy(ma[0]).applyMatrix4(oa);$a=Da.type===THREE.LinePieces?2:1;ga=1;for(ja=ma.length;ga<ja;ga++)X=b(),X.positionScreen.copy(ma[ga]).applyMatrix4(oa),0<(ga+1)%$a||(ha=l[k-2],L.copy(X.positionScreen),va.copy(ha.positionScreen),!0===d(L,va)&&(L.multiplyScalar(1/L.w),va.multiplyScalar(1/va.w),w===K?
+(Za=new THREE.RenderableLine,D.push(Za),K++,w++,v=Za):v=D[w++],v.v1.positionScreen.copy(L),v.v2.positionScreen.copy(va),v.z=Math.max(L.z,va.z),v.material=Da.material,G.elements.push(v)))}g=0;for(n=G.sprites.length;g<n;g++)Da=G.sprites[g].object,Ha=Da.matrixWorld,Da instanceof THREE.Particle&&(B.set(Ha.elements[12],Ha.elements[13],Ha.elements[14],1),B.applyMatrix4(ua),B.z/=B.w,0<B.z&&1>B.z&&(z===H?(Ma=new THREE.RenderableParticle,F.push(Ma),H++,z++,A=Ma):A=F[z++],A.object=Da,A.x=B.x/B.w,A.y=B.y/B.w,
+A.z=B.z,A.rotation=Da.rotation.z,A.scale.x=Da.scale.x*Math.abs(A.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),A.scale.y=Da.scale.y*Math.abs(A.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),A.material=Da.material,G.elements.push(A)));!0===ta&&G.elements.sort(c);return G}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==g?g:0;this.centroid=new THREE.Vector3};
 THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
@@ -158,9 +159,9 @@ e[d.b].add(d.normal),e[d.c].add(d.normal),e[d.d].add(d.normal))}b=0;for(c=this.v
 for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]=
 {};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
 f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],k=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
-b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];l=g[e];n=g[f];m=g[z];s=i.x-h.x;q=k.x-h.x;r=i.y-h.y;p=k.y-h.y;t=i.z-h.z;x=k.z-h.z;w=n.x-l.x;v=m.x-l.x;H=n.y-l.y;F=m.y-l.y;A=1/(w*F-v*H);E.set((F*s-H*q)*A,(F*r-H*p)*A,(F*t-H*x)*A);V.set((w*q-v*s)*A,(w*p-v*r)*A,(w*x-v*t)*A);K[b].add(E);K[c].add(E);K[d].add(E);I[b].add(V);I[c].add(V);I[d].add(V)}var b,c,d,e,f,g,h,i,k,l,n,m,s,q,r,p,t,x,w,v,H,F,A,z,K=[],I=[],E=new THREE.Vector3,V=new THREE.Vector3,B=new THREE.Vector3,T=new THREE.Vector3,C=new THREE.Vector3;
-b=0;for(c=this.vertices.length;b<c;b++)K[b]=new THREE.Vector3,I[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var G=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)C.copy(f.vertexNormals[d]),e=f[G[d]],z=K[e],B.copy(z),B.sub(C.multiplyScalar(C.dot(z))).normalize(),
-T.crossVectors(f.vertexNormals[d],z),e=T.dot(I[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
+b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];l=g[e];n=g[f];m=g[z];s=i.x-h.x;r=k.x-h.x;p=i.y-h.y;q=k.y-h.y;x=i.z-h.z;t=k.z-h.z;v=n.x-l.x;w=m.x-l.x;D=n.y-l.y;K=m.y-l.y;A=1/(v*K-w*D);G.set((K*s-D*r)*A,(K*p-D*q)*A,(K*x-D*t)*A);V.set((v*r-w*s)*A,(v*q-w*p)*A,(v*t-w*x)*A);F[b].add(G);F[c].add(G);F[d].add(G);H[b].add(V);H[c].add(V);H[d].add(V)}var b,c,d,e,f,g,h,i,k,l,n,m,s,r,p,q,x,t,v,w,D,K,A,z,F=[],H=[],G=new THREE.Vector3,V=new THREE.Vector3,B=new THREE.Vector3,T=new THREE.Vector3,C=new THREE.Vector3;
+b=0;for(c=this.vertices.length;b<c;b++)F[b]=new THREE.Vector3,H[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)C.copy(f.vertexNormals[d]),e=f[I[d]],z=F[e],B.copy(z),B.sub(C.multiplyScalar(C.dot(z))).normalize(),
+T.crossVectors(f.vertexNormals[d],z),e=T.dot(H[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
 this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i,k;this.__tmpVertices=void 0;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];
 h=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(h[i]==h[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];h=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)h[i]==h[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=d){h.splice(d,1);var l=new THREE.Face3(h[0],h[1],h[2],a.normal,a.color,a.materialIndex);h=0;for(i=this.faceVertexUvs.length;h<i;h++)(k=this.faceVertexUvs[h][f])&&k.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(l.vertexNormals=a.vertexNormals,l.vertexNormals.splice(d,
 1));a.vertexColors&&0<a.vertexColors.length&&(l.vertexColors=a.vertexColors,l.vertexColors.splice(d,1));this.faces[f]=l}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);h=0;for(i=this.faceVertexUvs.length;h<i;h++)this.faceVertexUvs[h].splice(f,1)}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];
@@ -168,20 +169,20 @@ c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(ne
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);
 var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,g=a.length;f<g;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=
 new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
-0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,k,l,n,m=new THREE.Vector3,s=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector3,p=new THREE.Vector3;if(this.attributes.index){var t=this.attributes.index.array,x=this.offsets;c=0;for(d=x.length;c<d;++c){b=x[c].start;g=x[c].count;var w=x[c].index;a=b;for(b+=g;a<b;a+=3)g=w+t[a],h=w+t[a+1],i=w+t[a+2],k=e[3*g],l=e[3*g+1],n=e[3*g+2],m.set(k,l,n),k=e[3*h],l=e[3*h+1],n=e[3*h+2],s.set(k,l,n),k=e[3*i],l=e[3*i+1],n=e[3*i+2],q.set(k,
-l,n),r.subVectors(q,s),p.subVectors(m,s),r.cross(p),f[3*g]+=r.x,f[3*g+1]+=r.y,f[3*g+2]+=r.z,f[3*h]+=r.x,f[3*h+1]+=r.y,f[3*h+2]+=r.z,f[3*i]+=r.x,f[3*i+1]+=r.y,f[3*i+2]+=r.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],n=e[a+2],m.set(k,l,n),k=e[a+3],l=e[a+4],n=e[a+5],s.set(k,l,n),k=e[a+6],l=e[a+7],n=e[a+8],q.set(k,l,n),r.subVectors(q,s),p.subVectors(m,s),r.cross(p),f[a]=r.x,f[a+1]=r.y,f[a+2]=r.z,f[a+3]=r.x,f[a+4]=r.y,f[a+5]=r.z,f[a+6]=r.x,f[a+7]=r.y,f[a+8]=r.z}this.normalizeNormals();this.normalsNeedUpdate=
+0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,k,l,n,m=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var x=this.attributes.index.array,t=this.offsets;c=0;for(d=t.length;c<d;++c){b=t[c].start;g=t[c].count;var v=t[c].index;a=b;for(b+=g;a<b;a+=3)g=v+x[a],h=v+x[a+1],i=v+x[a+2],k=e[3*g],l=e[3*g+1],n=e[3*g+2],m.set(k,l,n),k=e[3*h],l=e[3*h+1],n=e[3*h+2],s.set(k,l,n),k=e[3*i],l=e[3*i+1],n=e[3*i+2],r.set(k,
+l,n),p.subVectors(r,s),q.subVectors(m,s),p.cross(q),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],n=e[a+2],m.set(k,l,n),k=e[a+3],l=e[a+4],n=e[a+5],s.set(k,l,n),k=e[a+6],l=e[a+7],n=e[a+8],r.set(k,l,n),p.subVectors(r,s),q.subVectors(m,s),p.cross(q),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z}this.normalizeNormals();this.normalsNeedUpdate=
 !0}},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},computeTangents:function(){function a(a){Ha.x=d[3*a];Ha.y=d[3*a+1];Ha.z=d[3*a+2];oa.copy(Ha);da=i[a];W.copy(da);W.sub(Ha.multiplyScalar(Ha.dot(da))).normalize();ua.crossVectors(oa,da);ka=ua.dot(k[a]);J=0>ka?-1:1;h[4*a]=W.x;h[4*a+1]=W.y;h[4*a+2]=W.z;h[4*a+3]=J}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 b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],k=[],g=0;g<f;g++)i[g]=
-new THREE.Vector3,k[g]=new THREE.Vector3;var l,n,m,s,q,r,p,t,x,w,v,H,F,A,z,f=new THREE.Vector3,g=new THREE.Vector3,K,I,E,V,B,T,C,G=this.offsets;E=0;for(V=G.length;E<V;++E){I=G[E].start;B=G[E].count;var M=G[E].index;K=I;for(I+=B;K<I;K+=3)B=M+b[K],T=M+b[K+1],C=M+b[K+2],l=c[3*B],n=c[3*B+1],m=c[3*B+2],s=c[3*T],q=c[3*T+1],r=c[3*T+2],p=c[3*C],t=c[3*C+1],x=c[3*C+2],w=e[2*B],v=e[2*B+1],H=e[2*T],F=e[2*T+1],A=e[2*C],z=e[2*C+1],s-=l,l=p-l,q-=n,n=t-n,r-=m,m=x-m,H-=w,w=A-w,F-=v,v=z-v,z=1/(H*v-w*F),f.set((v*s-
-F*l)*z,(v*q-F*n)*z,(v*r-F*m)*z),g.set((H*l-w*s)*z,(H*n-w*q)*z,(H*m-w*r)*z),i[B].add(f),i[T].add(f),i[C].add(f),k[B].add(g),k[T].add(g),k[C].add(g)}var W=new THREE.Vector3,ua=new THREE.Vector3,Ha=new THREE.Vector3,oa=new THREE.Vector3,J,da,ka;E=0;for(V=G.length;E<V;++E){I=G[E].start;B=G[E].count;M=G[E].index;K=I;for(I+=B;K<I;K+=3)B=M+b[K],T=M+b[K+1],C=M+b[K+2],a(B),a(T),a(C)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
+new THREE.Vector3,k[g]=new THREE.Vector3;var l,n,m,s,r,p,q,x,t,v,w,D,K,A,z,f=new THREE.Vector3,g=new THREE.Vector3,F,H,G,V,B,T,C,I=this.offsets;G=0;for(V=I.length;G<V;++G){H=I[G].start;B=I[G].count;var M=I[G].index;F=H;for(H+=B;F<H;F+=3)B=M+b[F],T=M+b[F+1],C=M+b[F+2],l=c[3*B],n=c[3*B+1],m=c[3*B+2],s=c[3*T],r=c[3*T+1],p=c[3*T+2],q=c[3*C],x=c[3*C+1],t=c[3*C+2],v=e[2*B],w=e[2*B+1],D=e[2*T],K=e[2*T+1],A=e[2*C],z=e[2*C+1],s-=l,l=q-l,r-=n,n=x-n,p-=m,m=t-m,D-=v,v=A-v,K-=w,w=z-w,z=1/(D*w-v*K),f.set((w*s-
+K*l)*z,(w*r-K*n)*z,(w*p-K*m)*z),g.set((D*l-v*s)*z,(D*n-v*r)*z,(D*m-v*p)*z),i[B].add(f),i[T].add(f),i[C].add(f),k[B].add(g),k[T].add(g),k[C].add(g)}var W=new THREE.Vector3,ua=new THREE.Vector3,Ha=new THREE.Vector3,oa=new THREE.Vector3,J,da,ka;G=0;for(V=I.length;G<V;++G){H=I[G].start;B=I[G].count;M=I[G].index;F=H;for(H+=B;F<H;F+=3)B=M+b[F],T=M+b[F+1],C=M+b[F+2],a(B),a(T),a(C)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=
 new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.groundColor=new THREE.Color(b);this.position=new THREE.Vector3(0,100,0);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/2;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=
 this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,k,p){var t=f.toLowerCase().endsWith(".dds"),x=b+"/"+f;if(t){var w=THREE.ImageUtils.loadCompressedTexture(x);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
-void 0!==f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));p&&(a[e].anisotropy=p);if(!t){var v=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);v.image.width=a;v.image.height=b;v.image.getContext("2d").drawImage(this,0,0,a,b)}else v.image=this;v.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=x}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,k,q){var x=f.toLowerCase().endsWith(".dds"),t=b+"/"+f;if(x){var v=THREE.ImageUtils.loadCompressedTexture(t);a[e]=v}else v=document.createElement("canvas"),a[e]=new THREE.Texture(v);a[e].sourceFile=f;h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
+void 0!==f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));q&&(a[e].anisotropy=q);if(!x){var w=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);w.image.width=a;w.image.height=b;w.image.getContext("2d").drawImage(this,0,0,a,b)}else w.image=this;w.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=t}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,
 map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?h="MeshPhongMaterial":"basic"===k&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
 void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
 b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
@@ -189,34 +190,34 @@ a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(
 k.uSpecularColor.value.setHex(i.specular),k.uAmbientColor.value.setHex(i.ambient),k.uShininess.value=i.shininess,void 0!==i.opacity&&(k.uOpacity.value=i.opacity),h=new THREE.ShaderMaterial({fragmentShader:h.fragmentShader,vertexShader:h.vertexShader,uniforms:k,lights:!0,fog:!0}),i.transparent&&(h.transparent=!0)):h=new THREE[h](i);void 0!==a.DbgName&&(h.name=a.DbgName);return h}};THREE.ImageLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),
 e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,k,l,n,m,s,q,r,p,t,x,w,v=a.faces;q=a.vertices;var H=a.normals,F=a.colors,A=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&A++;for(f=0;f<A;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(k=q.length;i<k;)l=new THREE.Vector3,l.x=q[i++]*e,l.y=q[i++]*e,l.z=q[i++]*e,d.vertices.push(l);i=0;for(k=v.length;i<k;){q=v[i++];l=q&1;h=q&2;f=q&4;g=q&8;m=q&16;n=q&32;r=q&64;q&=128;l?(p=new THREE.Face4,
-p.a=v[i++],p.b=v[i++],p.c=v[i++],p.d=v[i++],l=4):(p=new THREE.Face3,p.a=v[i++],p.b=v[i++],p.c=v[i++],l=3);h&&(h=v[i++],p.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<A;f++)t=a.uvs[f],s=v[i++],w=t[2*s],s=t[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(w,s);if(g)for(f=0;f<A;f++){t=a.uvs[f];x=[];for(g=0;g<l;g++)s=v[i++],w=t[2*s],s=t[2*s+1],x[g]=new THREE.Vector2(w,s);d.faceVertexUvs[f][h]=x}m&&(m=3*v[i++],g=new THREE.Vector3,g.x=H[m++],g.y=H[m++],g.z=H[m],p.normal=g);if(n)for(f=0;f<l;f++)m=3*v[i++],g=
-new THREE.Vector3,g.x=H[m++],g.y=H[m++],g.z=H[m],p.vertexNormals.push(g);r&&(n=v[i++],n=new THREE.Color(F[n]),p.color=n);if(q)for(f=0;f<l;f++)n=v[i++],n=new THREE.Color(F[n]),p.vertexColors.push(n);d.faces.push(p)}if(a.skinWeights){i=0;for(k=a.skinWeights.length;i<k;i+=2)v=a.skinWeights[i],H=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(v,H,0,0))}if(a.skinIndices){i=0;for(k=a.skinIndices.length;i<k;i+=2)v=a.skinIndices[i],H=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(v,H,0,0))}d.bones=
-a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(k=a.morphTargets.length;i<k;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];F=d.morphTargets[i].vertices;A=a.morphTargets[i].vertices;v=0;for(H=A.length;v<H;v+=3)q=new THREE.Vector3,q.x=A[v]*e,q.y=A[v+1]*e,q.z=A[v+2]*e,F.push(q)}}if(void 0!==a.morphColors){i=0;for(k=a.morphColors.length;i<k;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
-[];H=d.morphColors[i].colors;F=a.morphColors[i].colors;e=0;for(v=F.length;e<v;e+=3)A=new THREE.Color(16755200),A.setRGB(F[e],F[e+1],F[e+2]),H.push(A)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,k,l,n,m,s,r,p,q,x,t,v,w=a.faces;r=a.vertices;var D=a.normals,K=a.colors,A=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&A++;for(f=0;f<A;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(k=r.length;i<k;)l=new THREE.Vector3,l.x=r[i++]*e,l.y=r[i++]*e,l.z=r[i++]*e,d.vertices.push(l);i=0;for(k=w.length;i<k;){r=w[i++];l=r&1;h=r&2;f=r&4;g=r&8;m=r&16;n=r&32;p=r&64;r&=128;l?(q=new THREE.Face4,
+q.a=w[i++],q.b=w[i++],q.c=w[i++],q.d=w[i++],l=4):(q=new THREE.Face3,q.a=w[i++],q.b=w[i++],q.c=w[i++],l=3);h&&(h=w[i++],q.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<A;f++)x=a.uvs[f],s=w[i++],v=x[2*s],s=x[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(v,s);if(g)for(f=0;f<A;f++){x=a.uvs[f];t=[];for(g=0;g<l;g++)s=w[i++],v=x[2*s],s=x[2*s+1],t[g]=new THREE.Vector2(v,s);d.faceVertexUvs[f][h]=t}m&&(m=3*w[i++],g=new THREE.Vector3,g.x=D[m++],g.y=D[m++],g.z=D[m],q.normal=g);if(n)for(f=0;f<l;f++)m=3*w[i++],g=
+new THREE.Vector3,g.x=D[m++],g.y=D[m++],g.z=D[m],q.vertexNormals.push(g);p&&(n=w[i++],n=new THREE.Color(K[n]),q.color=n);if(r)for(f=0;f<l;f++)n=w[i++],n=new THREE.Color(K[n]),q.vertexColors.push(n);d.faces.push(q)}if(a.skinWeights){i=0;for(k=a.skinWeights.length;i<k;i+=2)w=a.skinWeights[i],D=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(w,D,0,0))}if(a.skinIndices){i=0;for(k=a.skinIndices.length;i<k;i+=2)w=a.skinIndices[i],D=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(w,D,0,0))}d.bones=
+a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(k=a.morphTargets.length;i<k;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];K=d.morphTargets[i].vertices;A=a.morphTargets[i].vertices;w=0;for(D=A.length;w<D;w+=3)r=new THREE.Vector3,r.x=A[w]*e,r.y=A[w+1]*e,r.z=A[w+2]*e,K.push(r)}}if(void 0!==a.morphColors){i=0;for(k=a.morphColors.length;i<k;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
+[];D=d.morphColors[i].colors;K=a.morphColors[i].colors;e=0;for(w=K.length;e<w;e+=3)A=new THREE.Color(16755200),A.setRGB(K[e],K[e+1],K[e+2]),D.push(A)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState)if(200===d.status||0===d.status){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
 THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(z.scene,I.objects)}function f(a,b){var c,e,g,i,k,n,r;for(r in b)if(void 0===z.objects[r]){var p=b[r],v=null;if(p.type&&p.type in l.hierarchyHandlerMap){if(void 0===p.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,properties:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var C in p)C in e||(g[C]=p[C]);s=z.materials[p.material];p.loading=
-!0;e=l.hierarchyHandlerMap[p.type].loaderObject;e.options?e.load(d(p.url,I.urlBaseType),h(r,a,s,p)):e.load(d(p.url,I.urlBaseType),h(r,a,s,p),g)}}else if(void 0!==p.geometry){if(m=z.geometries[p.geometry]){v=!1;s=z.materials[p.material];v=s instanceof THREE.ShaderMaterial;g=p.position;i=p.rotation;k=p.scale;c=p.matrix;n=p.quaternion;p.material||(s=new THREE.MeshFaceMaterial(z.face_materials[p.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(z.face_materials[p.geometry]));
-if(s instanceof THREE.MeshFaceMaterial)for(e=0;e<s.materials.length;e++)v=v||s.materials[e]instanceof THREE.ShaderMaterial;v&&m.computeTangents();p.skin?v=new THREE.SkinnedMesh(m,s):p.morph?(v=new THREE.MorphAnimMesh(m,s),void 0!==p.duration&&(v.duration=p.duration),void 0!==p.time&&(v.time=p.time),void 0!==p.mirroredLoop&&(v.mirroredLoop=p.mirroredLoop),s.morphNormals&&m.computeMorphNormals()):v=new THREE.Mesh(m,s);v.name=r;c?(v.matrixAutoUpdate=!1,v.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],
-c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(v.position.set(g[0],g[1],g[2]),n?(v.quaternion.set(n[0],n[1],n[2],n[3]),v.useQuaternion=!0):v.rotation.set(i[0],i[1],i[2]),v.scale.set(k[0],k[1],k[2]));v.visible=p.visible;v.castShadow=p.castShadow;v.receiveShadow=p.receiveShadow;a.add(v);z.objects[r]=v}}else"DirectionalLight"===p.type||"PointLight"===p.type||"AmbientLight"===p.type?(x=void 0!==p.color?p.color:16777215,w=void 0!==p.intensity?p.intensity:1,"DirectionalLight"===p.type?(g=p.direction,
-t=new THREE.DirectionalLight(x,w),t.position.set(g[0],g[1],g[2]),p.target&&(K.push({object:t,targetName:p.target}),t.target=null)):"PointLight"===p.type?(g=p.position,e=p.distance,t=new THREE.PointLight(x,w,e),t.position.set(g[0],g[1],g[2])):"AmbientLight"===p.type&&(t=new THREE.AmbientLight(x)),a.add(t),t.name=r,z.lights[r]=t,z.objects[r]=t):"PerspectiveCamera"===p.type||"OrthographicCamera"===p.type?("PerspectiveCamera"===p.type?q=new THREE.PerspectiveCamera(p.fov,p.aspect,p.near,p.far):"OrthographicCamera"===
-p.type&&(q=new THREE.OrthographicCamera(p.left,p.right,p.top,p.bottom,p.near,p.far)),g=p.position,q.position.set(g[0],g[1],g[2]),a.add(q),q.name=r,z.cameras[r]=q,z.objects[r]=q):(g=p.position,i=p.rotation,k=p.scale,n=p.quaternion,v=new THREE.Object3D,v.name=r,v.position.set(g[0],g[1],g[2]),n?(v.quaternion.set(n[0],n[1],n[2],n[3]),v.useQuaternion=!0):v.rotation.set(i[0],i[1],i[2]),v.scale.set(k[0],k[1],k[2]),v.visible=void 0!==p.visible?p.visible:!1,a.add(v),z.objects[r]=v,z.empties[r]=v);if(v){if(void 0!==
-p.properties)for(var B in p.properties)v.properties[B]=p.properties[B];if(void 0!==p.groups)for(e=0;e<p.groups.length;e++)g=p.groups[e],void 0===z.groups[g]&&(z.groups[g]=[]),z.groups[g].push(r);void 0!==p.children&&f(v,p.children)}}}function g(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c;e();v-=1;l.onLoadComplete();k()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,m=d.scale;f.position.set(g[0],g[1],g[2]);
-i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(m[0],m[1],m[2]);c&&f.traverse(function(a){a.material=c});var n=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=n});b.add(f);f.name=a;z.objects[a]=f;e();v-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:F,totalTextures:A,loadedModels:F-v,loadedTextures:A-H},z);l.onLoadProgress();if(0===
-v&&0===H){for(var a=0;a<K.length;a++){var c=K[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,z.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(z)}}var l=this,n=THREE.Loader.prototype.extractUrlBase(c),m,s,q,r,p,t,x,w,v,H,F,A,z,K=[],I=a,E;for(E in this.geometryHandlerMap)a=this.geometryHandlerMap[E].loaderClass,this.geometryHandlerMap[E].loaderObject=new a;for(E in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[E].loaderClass,
-this.hierarchyHandlerMap[E].loaderObject=new a;H=v=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(I.transform&&(E=I.transform.position,a=I.transform.rotation,c=I.transform.scale,E&&z.scene.position.set(E[0],E[1],E[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),E||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();E=function(a){return function(){H-=a;k();l.onLoadComplete()}};
-for(var V in I.fogs)a=I.fogs[V],"linear"===a.type?r=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(r=new THREE.FogExp2(0,a.density)),a=a.color,r.color.setRGB(a[0],a[1],a[2]),z.fogs[V]=r;for(var B in I.geometries)r=I.geometries[B],r.type in this.geometryHandlerMap&&(v+=1,l.onLoadStart());for(var T in I.objects)r=I.objects[T],r.type&&r.type in this.hierarchyHandlerMap&&(v+=1,l.onLoadStart());F=v;for(B in I.geometries)if(r=I.geometries[B],"cube"===r.type)m=new THREE.CubeGeometry(r.width,r.height,r.depth,
-r.widthSegments,r.heightSegments,r.depthSegments),z.geometries[B]=m;else if("plane"===r.type)m=new THREE.PlaneGeometry(r.width,r.height,r.widthSegments,r.heightSegments),z.geometries[B]=m;else if("sphere"===r.type)m=new THREE.SphereGeometry(r.radius,r.widthSegments,r.heightSegments),z.geometries[B]=m;else if("cylinder"===r.type)m=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),z.geometries[B]=m;else if("torus"===r.type)m=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,
-r.segmentsT),z.geometries[B]=m;else if("icosahedron"===r.type)m=new THREE.IcosahedronGeometry(r.radius,r.subdivisions),z.geometries[B]=m;else if(r.type in this.geometryHandlerMap){T={};for(p in r)"type"!==p&&"url"!==p&&(T[p]=r[p]);this.geometryHandlerMap[r.type].loaderObject.load(d(r.url,I.urlBaseType),g(B),T)}else"embedded"===r.type&&(T=I.embeds[r.id],T.metadata=I.metadata,T&&this.geometryHandlerMap.ascii.loaderObject.createModel(T,i(B),""));for(var C in I.textures)if(B=I.textures[C],B.url instanceof
-Array){H+=B.url.length;for(p=0;p<B.url.length;p++)l.onLoadStart()}else H+=1,l.onLoadStart();A=H;for(C in I.textures){B=I.textures[C];void 0!==B.mapping&&void 0!==THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){T=B.url.length;r=[];for(p=0;p<T;p++)r[p]=d(B.url[p],I.urlBaseType);p=(p=r[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(r,B.mapping,E(T)):THREE.ImageUtils.loadTextureCube(r,B.mapping,E(T))}else p=B.url.toLowerCase().endsWith(".dds"),T=d(B.url,
-I.urlBaseType),r=E(1),p=p?THREE.ImageUtils.loadCompressedTexture(T,B.mapping,r):THREE.ImageUtils.loadTexture(T,B.mapping,r),void 0!==THREE[B.minFilter]&&(p.minFilter=THREE[B.minFilter]),void 0!==THREE[B.magFilter]&&(p.magFilter=THREE[B.magFilter]),B.anisotropy&&(p.anisotropy=B.anisotropy),B.repeat&&(p.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(p.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(p.wrapT=THREE.RepeatWrapping)),B.offset&&p.offset.set(B.offset[0],B.offset[1]),B.wrap&&(T={repeat:THREE.RepeatWrapping,
-mirror:THREE.MirroredRepeatWrapping},void 0!==T[B.wrap[0]]&&(p.wrapS=T[B.wrap[0]]),void 0!==T[B.wrap[1]]&&(p.wrapT=T[B.wrap[1]]));z.textures[C]=p}var G,M;for(G in I.materials){C=I.materials[G];for(M in C.parameters)"envMap"===M||"map"===M||"lightMap"===M||"bumpMap"===M?C.parameters[M]=z.textures[C.parameters[M]]:"shading"===M?C.parameters[M]="flat"===C.parameters[M]?THREE.FlatShading:THREE.SmoothShading:"side"===M?C.parameters[M]="double"==C.parameters[M]?THREE.DoubleSide:"back"==C.parameters[M]?
-THREE.BackSide:THREE.FrontSide:"blending"===M?C.parameters[M]=C.parameters[M]in THREE?THREE[C.parameters[M]]:THREE.NormalBlending:"combine"===M?C.parameters[M]=C.parameters[M]in THREE?THREE[C.parameters[M]]:THREE.MultiplyOperation:"vertexColors"===M?"face"==C.parameters[M]?C.parameters[M]=THREE.FaceColors:C.parameters[M]&&(C.parameters[M]=THREE.VertexColors):"wrapRGB"===M&&(E=C.parameters[M],C.parameters[M]=new THREE.Vector3(E[0],E[1],E[2]));void 0!==C.parameters.opacity&&1>C.parameters.opacity&&
-(C.parameters.transparent=!0);C.parameters.normalMap?(E=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(E.uniforms),p=C.parameters.color,T=C.parameters.specular,r=C.parameters.ambient,V=C.parameters.shininess,B.tNormal.value=z.textures[C.parameters.normalMap],C.parameters.normalScale&&B.uNormalScale.value.set(C.parameters.normalScale[0],C.parameters.normalScale[1]),C.parameters.map&&(B.tDiffuse.value=C.parameters.map,B.enableDiffuse.value=!0),C.parameters.envMap&&(B.tCube.value=C.parameters.envMap,
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(z.scene,H.objects)}function f(a,b){var c,e,g,i,k,n,p;for(p in b)if(void 0===z.objects[p]){var q=b[p],w=null;if(q.type&&q.type in l.hierarchyHandlerMap){if(void 0===q.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,properties:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var C in q)C in e||(g[C]=q[C]);s=z.materials[q.material];q.loading=
+!0;e=l.hierarchyHandlerMap[q.type].loaderObject;e.options?e.load(d(q.url,H.urlBaseType),h(p,a,s,q)):e.load(d(q.url,H.urlBaseType),h(p,a,s,q),g)}}else if(void 0!==q.geometry){if(m=z.geometries[q.geometry]){w=!1;s=z.materials[q.material];w=s instanceof THREE.ShaderMaterial;g=q.position;i=q.rotation;k=q.scale;c=q.matrix;n=q.quaternion;q.material||(s=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));
+if(s instanceof THREE.MeshFaceMaterial)for(e=0;e<s.materials.length;e++)w=w||s.materials[e]instanceof THREE.ShaderMaterial;w&&m.computeTangents();q.skin?w=new THREE.SkinnedMesh(m,s):q.morph?(w=new THREE.MorphAnimMesh(m,s),void 0!==q.duration&&(w.duration=q.duration),void 0!==q.time&&(w.time=q.time),void 0!==q.mirroredLoop&&(w.mirroredLoop=q.mirroredLoop),s.morphNormals&&m.computeMorphNormals()):w=new THREE.Mesh(m,s);w.name=p;c?(w.matrixAutoUpdate=!1,w.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],
+c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(w.position.set(g[0],g[1],g[2]),n?(w.quaternion.set(n[0],n[1],n[2],n[3]),w.useQuaternion=!0):w.rotation.set(i[0],i[1],i[2]),w.scale.set(k[0],k[1],k[2]));w.visible=q.visible;w.castShadow=q.castShadow;w.receiveShadow=q.receiveShadow;a.add(w);z.objects[p]=w}}else"DirectionalLight"===q.type||"PointLight"===q.type||"AmbientLight"===q.type?(t=void 0!==q.color?q.color:16777215,v=void 0!==q.intensity?q.intensity:1,"DirectionalLight"===q.type?(g=q.direction,
+x=new THREE.DirectionalLight(t,v),x.position.set(g[0],g[1],g[2]),q.target&&(F.push({object:x,targetName:q.target}),x.target=null)):"PointLight"===q.type?(g=q.position,e=q.distance,x=new THREE.PointLight(t,v,e),x.position.set(g[0],g[1],g[2])):"AmbientLight"===q.type&&(x=new THREE.AmbientLight(t)),a.add(x),x.name=p,z.lights[p]=x,z.objects[p]=x):"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?("PerspectiveCamera"===q.type?r=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===
+q.type&&(r=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),g=q.position,r.position.set(g[0],g[1],g[2]),a.add(r),r.name=p,z.cameras[p]=r,z.objects[p]=r):(g=q.position,i=q.rotation,k=q.scale,n=q.quaternion,w=new THREE.Object3D,w.name=p,w.position.set(g[0],g[1],g[2]),n?(w.quaternion.set(n[0],n[1],n[2],n[3]),w.useQuaternion=!0):w.rotation.set(i[0],i[1],i[2]),w.scale.set(k[0],k[1],k[2]),w.visible=void 0!==q.visible?q.visible:!1,a.add(w),z.objects[p]=w,z.empties[p]=w);if(w){if(void 0!==
+q.properties)for(var B in q.properties)w.properties[B]=q.properties[B];if(void 0!==q.groups)for(e=0;e<q.groups.length;e++)g=q.groups[e],void 0===z.groups[g]&&(z.groups[g]=[]),z.groups[g].push(p);void 0!==q.children&&f(w,q.children)}}}function g(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c;e();w-=1;l.onLoadComplete();k()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,m=d.scale;f.position.set(g[0],g[1],g[2]);
+i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(m[0],m[1],m[2]);c&&f.traverse(function(a){a.material=c});var n=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=n});b.add(f);f.name=a;z.objects[a]=f;e();w-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:K,totalTextures:A,loadedModels:K-w,loadedTextures:A-D},z);l.onLoadProgress();if(0===
+w&&0===D){for(var a=0;a<F.length;a++){var c=F[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,z.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(z)}}var l=this,n=THREE.Loader.prototype.extractUrlBase(c),m,s,r,p,q,x,t,v,w,D,K,A,z,F=[],H=a,G;for(G in this.geometryHandlerMap)a=this.geometryHandlerMap[G].loaderClass,this.geometryHandlerMap[G].loaderObject=new a;for(G in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[G].loaderClass,
+this.hierarchyHandlerMap[G].loaderObject=new a;D=w=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(H.transform&&(G=H.transform.position,a=H.transform.rotation,c=H.transform.scale,G&&z.scene.position.set(G[0],G[1],G[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),G||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();G=function(a){return function(){D-=a;k();l.onLoadComplete()}};
+for(var V in H.fogs)a=H.fogs[V],"linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),z.fogs[V]=p;for(var B in H.geometries)p=H.geometries[B],p.type in this.geometryHandlerMap&&(w+=1,l.onLoadStart());for(var T in H.objects)p=H.objects[T],p.type&&p.type in this.hierarchyHandlerMap&&(w+=1,l.onLoadStart());K=w;for(B in H.geometries)if(p=H.geometries[B],"cube"===p.type)m=new THREE.CubeGeometry(p.width,p.height,p.depth,
+p.widthSegments,p.heightSegments,p.depthSegments),z.geometries[B]=m;else if("plane"===p.type)m=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),z.geometries[B]=m;else if("sphere"===p.type)m=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),z.geometries[B]=m;else if("cylinder"===p.type)m=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),z.geometries[B]=m;else if("torus"===p.type)m=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,
+p.segmentsT),z.geometries[B]=m;else if("icosahedron"===p.type)m=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),z.geometries[B]=m;else if(p.type in this.geometryHandlerMap){T={};for(q in p)"type"!==q&&"url"!==q&&(T[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,H.urlBaseType),g(B),T)}else"embedded"===p.type&&(T=H.embeds[p.id],T.metadata=H.metadata,T&&this.geometryHandlerMap.ascii.loaderObject.createModel(T,i(B),""));for(var C in H.textures)if(B=H.textures[C],B.url instanceof
+Array){D+=B.url.length;for(q=0;q<B.url.length;q++)l.onLoadStart()}else D+=1,l.onLoadStart();A=D;for(C in H.textures){B=H.textures[C];void 0!==B.mapping&&void 0!==THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){T=B.url.length;p=[];for(q=0;q<T;q++)p[q]=d(B.url[q],H.urlBaseType);q=(q=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,G(T)):THREE.ImageUtils.loadTextureCube(p,B.mapping,G(T))}else q=B.url.toLowerCase().endsWith(".dds"),T=d(B.url,
+H.urlBaseType),p=G(1),q=q?THREE.ImageUtils.loadCompressedTexture(T,B.mapping,p):THREE.ImageUtils.loadTexture(T,B.mapping,p),void 0!==THREE[B.minFilter]&&(q.minFilter=THREE[B.minFilter]),void 0!==THREE[B.magFilter]&&(q.magFilter=THREE[B.magFilter]),B.anisotropy&&(q.anisotropy=B.anisotropy),B.repeat&&(q.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),B.offset&&q.offset.set(B.offset[0],B.offset[1]),B.wrap&&(T={repeat:THREE.RepeatWrapping,
+mirror:THREE.MirroredRepeatWrapping},void 0!==T[B.wrap[0]]&&(q.wrapS=T[B.wrap[0]]),void 0!==T[B.wrap[1]]&&(q.wrapT=T[B.wrap[1]]));z.textures[C]=q}var I,M;for(I in H.materials){C=H.materials[I];for(M in C.parameters)"envMap"===M||"map"===M||"lightMap"===M||"bumpMap"===M?C.parameters[M]=z.textures[C.parameters[M]]:"shading"===M?C.parameters[M]="flat"===C.parameters[M]?THREE.FlatShading:THREE.SmoothShading:"side"===M?C.parameters[M]="double"==C.parameters[M]?THREE.DoubleSide:"back"==C.parameters[M]?
+THREE.BackSide:THREE.FrontSide:"blending"===M?C.parameters[M]=C.parameters[M]in THREE?THREE[C.parameters[M]]:THREE.NormalBlending:"combine"===M?C.parameters[M]=C.parameters[M]in THREE?THREE[C.parameters[M]]:THREE.MultiplyOperation:"vertexColors"===M?"face"==C.parameters[M]?C.parameters[M]=THREE.FaceColors:C.parameters[M]&&(C.parameters[M]=THREE.VertexColors):"wrapRGB"===M&&(G=C.parameters[M],C.parameters[M]=new THREE.Vector3(G[0],G[1],G[2]));void 0!==C.parameters.opacity&&1>C.parameters.opacity&&
+(C.parameters.transparent=!0);C.parameters.normalMap?(G=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(G.uniforms),q=C.parameters.color,T=C.parameters.specular,p=C.parameters.ambient,V=C.parameters.shininess,B.tNormal.value=z.textures[C.parameters.normalMap],C.parameters.normalScale&&B.uNormalScale.value.set(C.parameters.normalScale[0],C.parameters.normalScale[1]),C.parameters.map&&(B.tDiffuse.value=C.parameters.map,B.enableDiffuse.value=!0),C.parameters.envMap&&(B.tCube.value=C.parameters.envMap,
 B.enableReflection.value=!0,B.uReflectivity.value=C.parameters.reflectivity),C.parameters.lightMap&&(B.tAO.value=C.parameters.lightMap,B.enableAO.value=!0),C.parameters.specularMap&&(B.tSpecular.value=z.textures[C.parameters.specularMap],B.enableSpecular.value=!0),C.parameters.displacementMap&&(B.tDisplacement.value=z.textures[C.parameters.displacementMap],B.enableDisplacement.value=!0,B.uDisplacementBias.value=C.parameters.displacementBias,B.uDisplacementScale.value=C.parameters.displacementScale),
-B.uDiffuseColor.value.setHex(p),B.uSpecularColor.value.setHex(T),B.uAmbientColor.value.setHex(r),B.uShininess.value=V,C.parameters.opacity&&(B.uOpacity.value=C.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:E.fragmentShader,vertexShader:E.vertexShader,uniforms:B,lights:!0,fog:!0})):s=new THREE[C.type](C.parameters);z.materials[G]=s}for(G in I.materials)if(C=I.materials[G],C.parameters.materials){M=[];for(p=0;p<C.parameters.materials.length;p++)M.push(z.materials[C.parameters.materials[p]]);
-z.materials[G].materials=M}e();z.cameras&&I.defaults.camera&&(z.currentCamera=z.cameras[I.defaults.camera]);z.fogs&&I.defaults.fog&&(z.scene.fog=z.fogs[I.defaults.fog]);l.callbackSync(z);k()};THREE.TextureLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){THREE.EventDispatcher.call(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
+B.uDiffuseColor.value.setHex(q),B.uSpecularColor.value.setHex(T),B.uAmbientColor.value.setHex(p),B.uShininess.value=V,C.parameters.opacity&&(B.uOpacity.value=C.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:G.fragmentShader,vertexShader:G.vertexShader,uniforms:B,lights:!0,fog:!0})):s=new THREE[C.type](C.parameters);z.materials[I]=s}for(I in H.materials)if(C=H.materials[I],C.parameters.materials){M=[];for(q=0;q<C.parameters.materials.length;q++)M.push(z.materials[C.parameters.materials[q]]);
+z.materials[I].materials=M}e();z.cameras&&H.defaults.camera&&(z.currentCamera=z.cameras[H.defaults.camera]);z.fogs&&H.defaults.fog&&(z.scene.fog=z.fogs[H.defaults.fog]);l.callbackSync(z);k()};THREE.TextureLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){THREE.EventDispatcher.call(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
 THREE.Material.prototype.setValues=function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
 THREE.Material.prototype.clone=function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;
 a.visible=this.visible;return a};THREE.Material.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.MaterialIdCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
@@ -259,37 +260,37 @@ THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInver
 !1}};THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial;this.rotation3d=this.rotation;this.rotation=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);(1!==this.scale.x||1!==this.scale.y)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0};
 THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
-THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){F!==a&&(F=w.globalAlpha=a)}function c(a){A!==a&&(a===THREE.NormalBlending?w.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?w.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(w.globalCompositeOperation="darker"),A=a)}function d(a){I!==a&&(I=w.lineWidth=a)}function e(a){E!==a&&(E=w.lineCap=a)}function f(a){V!==a&&(V=w.lineJoin=a)}function g(a){z!==a&&(z=w.strokeStyle=a)}function h(a){K!==a&&(K=w.fillStyle=a)}function i(a,
-b){if(B!==a||T!==b)w.setLineDash([a,b]),B=a,T=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},k=this,l,n,m,s=new THREE.Projector,q=void 0!==a.canvas?a.canvas:document.createElement("canvas"),r,p,t,x,w=q.getContext("2d"),v=new THREE.Color(0),H=0,F=1,A=0,z=null,K=null,I=null,E=null,V=null,B=null,T=0,C,G,M,W,ua=new THREE.RenderableVertex,Ha=new THREE.RenderableVertex,oa,J,da,ka,Y,L,va,Xa,lb,Gb,ta,Ma,ga=new THREE.Color,ja=new THREE.Color,ma=new THREE.Color,X=new THREE.Color,ha=new THREE.Color,
-ra=new THREE.Color,fa=new THREE.Color,Da=new THREE.Color,Ya={},Za={},ia,Qa,Ta,Ra,eb,ob,Hb,Ib,ec,mc,pb=new THREE.Box2,qa=new THREE.Box2,Ea=new THREE.Box2,fc=!1,ub=new THREE.Color,gc=new THREE.Color,Na=new THREE.Color,$a=new THREE.Vector3,wb,j,xb,ab,nb,Ua,yb=16;wb=document.createElement("canvas");wb.width=wb.height=2;j=wb.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);xb=j.getImageData(0,0,2,2);ab=xb.data;nb=document.createElement("canvas");nb.width=nb.height=yb;Ua=nb.getContext("2d");
-Ua.translate(-yb/2,-yb/2);Ua.scale(yb,yb);yb--;void 0===w.setLineDash&&(w.setLineDash=void 0!==w.mozDash?function(a){w.mozDash=null!==a[0]?a:null}:function(){});this.domElement=q;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b){r=
-a*this.devicePixelRatio;p=b*this.devicePixelRatio;t=Math.floor(r/2);x=Math.floor(p/2);q.width=r;q.height=p;q.style.width=a+"px";q.style.height=b+"px";pb.set(new THREE.Vector2(-t,-x),new THREE.Vector2(t,x));qa.set(new THREE.Vector2(-t,-x),new THREE.Vector2(t,x));F=1;A=0;V=E=I=K=z=null};this.setClearColor=function(a,b){v.copy(a);H=void 0!==b?b:1;qa.set(new THREE.Vector2(-t,-x),new THREE.Vector2(t,x))};this.setClearColorHex=function(a,b){v.setHex(a);H=void 0!==b?b:1;qa.set(new THREE.Vector2(-t,-x),new THREE.Vector2(t,
-x))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){w.setTransform(1,0,0,-1,t,x);!1===qa.empty()&&(qa.intersect(pb),qa.expandByScalar(2),1>H&&w.clearRect(qa.min.x|0,qa.min.y|0,qa.max.x-qa.min.x|0,qa.max.y-qa.min.y|0),0<H&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*v.r)+","+Math.floor(255*v.g)+","+Math.floor(255*v.b)+","+H+")"),w.fillRect(qa.min.x|0,qa.min.y|0,qa.max.x-qa.min.x|0,qa.max.y-qa.min.y|0)),qa.makeEmpty())};this.render=function(a,p){function q(a,b,c){for(var d=
-0,e=m.length;d<e;d++){var f=m[d];Da.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=$a.getPositionFromMatrix(f.matrixWorld).normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(Da.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=$a.getPositionFromMatrix(f.matrixWorld),j=b.dot($a.subVectors(g,a).normalize()),0>=j||(j*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=j&&(j*=f.intensity,c.add(Da.multiplyScalar(j)))))}}function r(a,d,e,f,g,j,h,i){k.info.render.vertices+=
-3;k.info.render.faces++;b(i.opacity);c(i.blending);oa=a.positionScreen.x;J=a.positionScreen.y;da=d.positionScreen.x;ka=d.positionScreen.y;Y=e.positionScreen.x;L=e.positionScreen.y;v(oa,J,da,ka,Y,L);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(ra.copy(i.color),fa.copy(i.emissive),i.vertexColors===THREE.FaceColors&&ra.multiply(h.color),!0===fc?!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(ja.copy(ub),ma.copy(ub),X.copy(ub),
-q(h.v1.positionWorld,h.vertexNormalsModel[0],ja),q(h.v2.positionWorld,h.vertexNormalsModel[1],ma),q(h.v3.positionWorld,h.vertexNormalsModel[2],X),ja.multiply(ra).add(fa),ma.multiply(ra).add(fa),X.multiply(ra).add(fa),ha.addColors(ma,X).multiplyScalar(0.5),Ta=H(ja,ma,X,ha),E(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ta)):(ga.copy(ub),q(h.centroidModel,h.normalModel,ga),ga.multiply(ra).add(fa),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):!0===i.wireframe?B(i.color,i.wireframeLinewidth,
-i.wireframeLinecap,i.wireframeLinejoin):A(i.color)):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Ra=h.uvs[0],F(oa,J,da,ka,Y,L,Ra[f].x,Ra[f].y,Ra[g].x,Ra[g].y,Ra[j].x,Ra[j].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&($a.copy(h.vertexNormalsModelView[f]),eb=0.5*$a.x+0.5,ob=0.5*$a.y+0.5,$a.copy(h.vertexNormalsModelView[g]),Hb=0.5*$a.x+
-0.5,Ib=0.5*$a.y+0.5,$a.copy(h.vertexNormalsModelView[j]),ec=0.5*$a.x+0.5,mc=0.5*$a.y+0.5,F(oa,J,da,ka,Y,L,eb,ob,Hb,Ib,ec,mc,i.envMap)):(ga.copy(i.color),i.vertexColors===THREE.FaceColors&&ga.multiply(h.color),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):i instanceof THREE.MeshDepthMaterial?(ia=p.near,Qa=p.far,g=1-K(a.positionScreen.z*a.positionScreen.w,ia,Qa),ja.setRGB(g,g,g),g=1-K(d.positionScreen.z*d.positionScreen.w,ia,Qa),ma.setRGB(g,g,g),g=1-K(e.positionScreen.z*
-e.positionScreen.w,ia,Qa),X.setRGB(g,g,g),ha.addColors(ma,X).multiplyScalar(0.5),Ta=H(ja,ma,X,ha),E(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ta)):i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(d=h.normalModelView,ga.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):i.shading==THREE.SmoothShading&&(d=h.vertexNormalsModelView[f],ja.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[g],
-ma.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[j],X.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),ha.addColors(ma,X).multiplyScalar(0.5),Ta=H(ja,ma,X,ha),E(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ta)))}function v(a,b,c,d,e,f){w.beginPath();w.moveTo(a,b);w.lineTo(c,d);w.lineTo(e,f);w.closePath()}function z(a,b,c,d,e,f,g,j){w.beginPath();w.moveTo(a,b);w.lineTo(c,d);w.lineTo(e,f);w.lineTo(g,j);w.closePath()}function B(a,b,c,j){d(b);e(c);f(j);g(a.getStyle());w.stroke();
-Ea.expandByScalar(2*b)}function A(a){h(a.getStyle());w.fill()}function F(a,b,c,d,e,f,g,j,i,ea,k,l,m){if(!(m instanceof THREE.DataTexture||void 0===m.image||0==m.image.width)){if(!0===m.needsUpdate){var n=m.wrapS==THREE.RepeatWrapping,fb=m.wrapT==THREE.RepeatWrapping;Ya[m.id]=w.createPattern(m.image,!0===n&&!0===fb?"repeat":!0===n&&!1===fb?"repeat-x":!1===n&&!0===fb?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===Ya[m.id]?h("rgba(0,0,0,1)"):h(Ya[m.id]);var n=m.offset.x/m.repeat.x,fb=m.offset.y/m.repeat.y,
-q=m.image.width*m.repeat.x,p=m.image.height*m.repeat.y,g=(g+n)*q,j=(1-j+fb)*p,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+n)*q-g,ea=(1-ea+fb)*p-j,k=(k+n)*q-g,l=(1-l+fb)*p-j,n=i*l-k*ea;0===n?(void 0===Za[m.id]&&(b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),Za[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=Za[m.id],g=4*(Math.floor(g)+Math.floor(j)*m.image.width),ga.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),A(ga)):(n=1/n,
-m=(l*c-ea*e)*n,ea=(l*d-ea*f)*n,c=(i*e-k*c)*n,d=(i*f-k*d)*n,a=a-m*g-c*j,g=b-ea*g-d*j,w.save(),w.transform(m,ea,c,d,a,g),w.fill(),w.restore())}}function E(a,b,c,d,e,f,g,j,h,i,ea,k,m){var l,n;l=m.width-1;n=m.height-1;g*=l;j*=n;c-=a;d-=b;e-=a;f-=b;h=h*l-g;i=i*n-j;ea=ea*l-g;k=k*n-j;n=1/(h*k-ea*i);l=(k*c-i*e)*n;i=(k*d-i*f)*n;c=(h*e-ea*c)*n;d=(h*f-ea*d)*n;a=a-l*g-c*j;b=b-i*g-d*j;w.save();w.transform(l,i,c,d,a,b);w.clip();w.drawImage(m,0,0);w.restore()}function H(a,b,c,d){ab[0]=255*a.r|0;ab[1]=255*a.g|0;
-ab[2]=255*a.b|0;ab[4]=255*b.r|0;ab[5]=255*b.g|0;ab[6]=255*b.b|0;ab[8]=255*c.r|0;ab[9]=255*c.g|0;ab[10]=255*c.b|0;ab[12]=255*d.r|0;ab[13]=255*d.g|0;ab[14]=255*d.b|0;j.putImageData(xb,0,0);Ua.drawImage(wb,0,0);return nb}function K(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function I(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===p instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
-else{!0===this.autoClear&&this.clear();w.setTransform(1,0,0,-1,t,x);k.info.render.vertices=0;k.info.render.faces=0;l=s.projectScene(a,p,this.sortObjects,this.sortElements);n=l.elements;m=l.lights;fc=0<m.length;if(!0===fc){ub.setRGB(0,0,0);gc.setRGB(0,0,0);Na.setRGB(0,0,0);for(var T=0,V=m.length;T<V;T++){var O=m[T],aa=O.color;O instanceof THREE.AmbientLight?ub.add(aa):O instanceof THREE.DirectionalLight?gc.add(aa):O instanceof THREE.PointLight&&Na.add(aa)}}T=0;for(V=n.length;T<V;T++){var ea=n[T],O=
-ea.material;if(!(void 0===O||!1===O.visible)){Ea.makeEmpty();if(ea instanceof THREE.RenderableParticle){C=ea;C.x*=t;C.y*=x;var aa=C,ib=ea;b(O.opacity);c(O.blending);var fb=void 0,zb=void 0,Ab=void 0,Bb=void 0,yc=ea=void 0,od=void 0;O instanceof THREE.ParticleBasicMaterial?null===O.map?(Ab=ib.object.scale.x,Bb=ib.object.scale.y,Ab*=ib.scale.x*t,Bb*=ib.scale.y*x,Ea.min.set(aa.x-Ab,aa.y-Bb),Ea.max.set(aa.x+Ab,aa.y+Bb),!1!==pb.isIntersectionBox(Ea)&&(h(O.color.getStyle()),w.save(),w.translate(aa.x,aa.y),
-w.rotate(-ib.rotation),w.scale(Ab,Bb),w.fillRect(-1,-1,2,2),w.restore())):(ea=O.map.image,yc=ea.width>>1,od=ea.height>>1,Ab=ib.scale.x*t,Bb=ib.scale.y*x,fb=Ab*yc,zb=Bb*od,Ea.min.set(aa.x-fb,aa.y-zb),Ea.max.set(aa.x+fb,aa.y+zb),!1!==pb.isIntersectionBox(Ea)&&(w.save(),w.translate(aa.x,aa.y),w.rotate(-ib.rotation),w.scale(Ab,-Bb),w.translate(-yc,-od),w.drawImage(ea,0,0),w.restore())):O instanceof THREE.ParticleCanvasMaterial&&(fb=ib.scale.x*t,zb=ib.scale.y*x,Ea.min.set(aa.x-fb,aa.y-zb),Ea.max.set(aa.x+
-fb,aa.y+zb),!1!==pb.isIntersectionBox(Ea)&&(g(O.color.getStyle()),h(O.color.getStyle()),w.save(),w.translate(aa.x,aa.y),w.rotate(-ib.rotation),w.scale(fb,zb),O.program(w),w.restore()))}else if(ea instanceof THREE.RenderableLine)C=ea.v1,G=ea.v2,C.positionScreen.x*=t,C.positionScreen.y*=x,G.positionScreen.x*=t,G.positionScreen.y*=x,Ea.setFromPoints([C.positionScreen,G.positionScreen]),!0===pb.isIntersectionBox(Ea)&&(aa=C,ib=G,b(O.opacity),c(O.blending),w.beginPath(),w.moveTo(aa.positionScreen.x,aa.positionScreen.y),
-w.lineTo(ib.positionScreen.x,ib.positionScreen.y),O instanceof THREE.LineBasicMaterial?(d(O.linewidth),e(O.linecap),f(O.linejoin),g(O.color.getStyle()),i(null,null),w.stroke(),Ea.expandByScalar(2*O.linewidth)):O instanceof THREE.LineDashedMaterial&&(d(O.linewidth),e(O.linecap),f(O.linejoin),g(O.color.getStyle()),i(O.dashSize,O.gapSize),w.stroke(),Ea.expandByScalar(2*O.linewidth)));else if(ea instanceof THREE.RenderableFace3){C=ea.v1;G=ea.v2;M=ea.v3;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;
-if(-1>G.positionScreen.z||1<G.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;C.positionScreen.x*=t;C.positionScreen.y*=x;G.positionScreen.x*=t;G.positionScreen.y*=x;M.positionScreen.x*=t;M.positionScreen.y*=x;!0===O.overdraw&&(I(C.positionScreen,G.positionScreen),I(G.positionScreen,M.positionScreen),I(M.positionScreen,C.positionScreen));Ea.setFromPoints([C.positionScreen,G.positionScreen,M.positionScreen]);r(C,G,M,0,1,2,ea,O,a)}else if(ea instanceof THREE.RenderableFace4){C=
-ea.v1;G=ea.v2;M=ea.v3;W=ea.v4;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;if(-1>G.positionScreen.z||1<G.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;C.positionScreen.x*=t;C.positionScreen.y*=x;G.positionScreen.x*=t;G.positionScreen.y*=x;M.positionScreen.x*=t;M.positionScreen.y*=x;W.positionScreen.x*=t;W.positionScreen.y*=x;ua.positionScreen.copy(G.positionScreen);Ha.positionScreen.copy(W.positionScreen);
-!0===O.overdraw&&(I(C.positionScreen,G.positionScreen),I(G.positionScreen,W.positionScreen),I(W.positionScreen,C.positionScreen),I(M.positionScreen,ua.positionScreen),I(M.positionScreen,Ha.positionScreen));Ea.setFromPoints([C.positionScreen,G.positionScreen,M.positionScreen,W.positionScreen]);aa=C;ib=G;fb=M;zb=W;Ab=ua;Bb=Ha;yc=a;k.info.render.vertices+=4;k.info.render.faces++;b(O.opacity);c(O.blending);void 0!==O.map&&null!==O.map||void 0!==O.envMap&&null!==O.envMap?(r(aa,ib,zb,0,1,3,ea,O,yc),r(Ab,
-fb,Bb,1,2,3,ea,O,yc)):(oa=aa.positionScreen.x,J=aa.positionScreen.y,da=ib.positionScreen.x,ka=ib.positionScreen.y,Y=fb.positionScreen.x,L=fb.positionScreen.y,va=zb.positionScreen.x,Xa=zb.positionScreen.y,lb=Ab.positionScreen.x,Gb=Ab.positionScreen.y,ta=Bb.positionScreen.x,Ma=Bb.positionScreen.y,O instanceof THREE.MeshLambertMaterial||O instanceof THREE.MeshPhongMaterial?(ra.copy(O.color),fa.copy(O.emissive),O.vertexColors===THREE.FaceColors&&ra.multiply(ea.color),!0===fc?!1===O.wireframe&&O.shading==
-THREE.SmoothShading&&4==ea.vertexNormalsLength?(ja.copy(ub),ma.copy(ub),X.copy(ub),ha.copy(ub),q(ea.v1.positionWorld,ea.vertexNormalsModel[0],ja),q(ea.v2.positionWorld,ea.vertexNormalsModel[1],ma),q(ea.v4.positionWorld,ea.vertexNormalsModel[3],X),q(ea.v3.positionWorld,ea.vertexNormalsModel[2],ha),ja.multiply(ra).add(fa),ma.multiply(ra).add(fa),X.multiply(ra).add(fa),ha.multiply(ra).add(fa),Ta=H(ja,ma,X,ha),v(oa,J,da,ka,va,Xa),E(oa,J,da,ka,va,Xa,0,0,1,0,0,1,Ta),v(lb,Gb,Y,L,ta,Ma),E(lb,Gb,Y,L,ta,Ma,
-1,0,1,1,0,1,Ta)):(ga.copy(ub),q(ea.centroidModel,ea.normalModel,ga),ga.multiply(ra).add(fa),z(oa,J,da,ka,Y,L,va,Xa),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga)):(ga.addColors(ra,fa),z(oa,J,da,ka,Y,L,va,Xa),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga))):O instanceof THREE.MeshBasicMaterial?(ga.copy(O.color),O.vertexColors===THREE.FaceColors&&ga.multiply(ea.color),z(oa,J,da,ka,Y,L,va,Xa),!0===O.wireframe?B(ga,O.wireframeLinewidth,
-O.wireframeLinecap,O.wireframeLinejoin):A(ga)):O instanceof THREE.MeshNormalMaterial?(aa=void 0,O.shading==THREE.FlatShading?(aa=ea.normalModelView,ga.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),z(oa,J,da,ka,Y,L,va,Xa),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga)):O.shading==THREE.SmoothShading&&(aa=ea.vertexNormalsModelView[0],ja.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[1],ma.setRGB(aa.x,aa.y,
-aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[3],X.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[2],ha.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),Ta=H(ja,ma,X,ha),v(oa,J,da,ka,va,Xa),E(oa,J,da,ka,va,Xa,0,0,1,0,0,1,Ta),v(lb,Gb,Y,L,ta,Ma),E(lb,Gb,Y,L,ta,Ma,1,0,1,1,0,1,Ta))):O instanceof THREE.MeshDepthMaterial&&(ia=p.near,Qa=p.far,ja.r=ja.g=ja.b=1-K(aa.positionScreen.z*aa.positionScreen.w,ia,Qa),ma.r=ma.g=ma.b=1-K(ib.positionScreen.z*
-ib.positionScreen.w,ia,Qa),X.r=X.g=X.b=1-K(zb.positionScreen.z*zb.positionScreen.w,ia,Qa),ha.r=ha.g=ha.b=1-K(fb.positionScreen.z*fb.positionScreen.w,ia,Qa),Ta=H(ja,ma,X,ha),v(oa,J,da,ka,va,Xa),E(oa,J,da,ka,va,Xa,0,0,1,0,0,1,Ta),v(lb,Gb,Y,L,ta,Ma),E(lb,Gb,Y,L,ta,Ma,1,0,1,1,0,1,Ta)))}qa.union(Ea)}}w.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
+THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){K!==a&&(K=v.globalAlpha=a)}function c(a){A!==a&&(a===THREE.NormalBlending?v.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?v.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(v.globalCompositeOperation="darker"),A=a)}function d(a){H!==a&&(H=v.lineWidth=a)}function e(a){G!==a&&(G=v.lineCap=a)}function f(a){V!==a&&(V=v.lineJoin=a)}function g(a){z!==a&&(z=v.strokeStyle=a)}function h(a){F!==a&&(F=v.fillStyle=a)}function i(a,
+b){if(B!==a||T!==b)v.setLineDash([a,b]),B=a,T=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},k=this,l,n,m,s=new THREE.Projector,r=void 0!==a.canvas?a.canvas:document.createElement("canvas"),p,q,x,t,v=r.getContext("2d"),w=new THREE.Color(0),D=0,K=1,A=0,z=null,F=null,H=null,G=null,V=null,B=null,T=0,C,I,M,W,ua=new THREE.RenderableVertex,Ha=new THREE.RenderableVertex,oa,J,da,ka,Y,L,va,Ya,mb,Hb,ta,Ma,ga=new THREE.Color,ja=new THREE.Color,ma=new THREE.Color,X=new THREE.Color,ha=new THREE.Color,
+ra=new THREE.Color,fa=new THREE.Color,Da=new THREE.Color,Za={},$a={},ia,Ra,Ua,Sa,fb,pb,Ib,Jb,fc,mc,qb=new THREE.Box2,qa=new THREE.Box2,Ea=new THREE.Box2,gc=!1,vb=new THREE.Color,Pa=new THREE.Color,Na=new THREE.Color,ab=new THREE.Vector3,xb,j,yb,bb,ob,Va,zb=16;xb=document.createElement("canvas");xb.width=xb.height=2;j=xb.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);yb=j.getImageData(0,0,2,2);bb=yb.data;ob=document.createElement("canvas");ob.width=ob.height=zb;Va=ob.getContext("2d");
+Va.translate(-zb/2,-zb/2);Va.scale(zb,zb);zb--;void 0===v.setLineDash&&(v.setLineDash=void 0!==v.mozDash?function(a){v.mozDash=null!==a[0]?a:null}:function(){});this.domElement=r;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b){p=
+a*this.devicePixelRatio;q=b*this.devicePixelRatio;x=Math.floor(p/2);t=Math.floor(q/2);r.width=p;r.height=q;r.style.width=a+"px";r.style.height=b+"px";qb.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t));qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t));K=1;A=0;V=G=H=F=z=null};this.setClearColor=function(a,b){w.copy(a);D=void 0!==b?b:1;qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t))};this.setClearColorHex=function(a,b){w.setHex(a);D=void 0!==b?b:1;qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,
+t))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){v.setTransform(1,0,0,-1,x,t);!1===qa.empty()&&(qa.intersect(qb),qa.expandByScalar(2),1>D&&v.clearRect(qa.min.x|0,qa.min.y|0,qa.max.x-qa.min.x|0,qa.max.y-qa.min.y|0),0<D&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*w.r)+","+Math.floor(255*w.g)+","+Math.floor(255*w.b)+","+D+")"),v.fillRect(qa.min.x|0,qa.min.y|0,qa.max.x-qa.min.x|0,qa.max.y-qa.min.y|0)),qa.makeEmpty())};this.render=function(a,p){function q(a,b,c){for(var d=
+0,e=m.length;d<e;d++){var f=m[d];Da.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ab.getPositionFromMatrix(f.matrixWorld).normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(Da.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=ab.getPositionFromMatrix(f.matrixWorld),j=b.dot(ab.subVectors(g,a).normalize()),0>=j||(j*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=j&&(j*=f.intensity,c.add(Da.multiplyScalar(j)))))}}function r(a,d,e,f,g,j,h,i){k.info.render.vertices+=
+3;k.info.render.faces++;b(i.opacity);c(i.blending);oa=a.positionScreen.x;J=a.positionScreen.y;da=d.positionScreen.x;ka=d.positionScreen.y;Y=e.positionScreen.x;L=e.positionScreen.y;z(oa,J,da,ka,Y,L);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(ra.copy(i.color),fa.copy(i.emissive),i.vertexColors===THREE.FaceColors&&ra.multiply(h.color),!0===gc?!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(ja.copy(vb),ma.copy(vb),X.copy(vb),
+q(h.v1.positionWorld,h.vertexNormalsModel[0],ja),q(h.v2.positionWorld,h.vertexNormalsModel[1],ma),q(h.v3.positionWorld,h.vertexNormalsModel[2],X),ja.multiply(ra).add(fa),ma.multiply(ra).add(fa),X.multiply(ra).add(fa),ha.addColors(ma,X).multiplyScalar(0.5),Ua=G(ja,ma,X,ha),F(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ua)):(ga.copy(vb),q(h.centroidModel,h.normalModel,ga),ga.multiply(ra).add(fa),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):!0===i.wireframe?B(i.color,i.wireframeLinewidth,
+i.wireframeLinecap,i.wireframeLinejoin):A(i.color)):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Sa=h.uvs[0],D(oa,J,da,ka,Y,L,Sa[f].x,Sa[f].y,Sa[g].x,Sa[g].y,Sa[j].x,Sa[j].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ab.copy(h.vertexNormalsModelView[f]),fb=0.5*ab.x+0.5,pb=0.5*ab.y+0.5,ab.copy(h.vertexNormalsModelView[g]),Ib=0.5*ab.x+
+0.5,Jb=0.5*ab.y+0.5,ab.copy(h.vertexNormalsModelView[j]),fc=0.5*ab.x+0.5,mc=0.5*ab.y+0.5,D(oa,J,da,ka,Y,L,fb,pb,Ib,Jb,fc,mc,i.envMap)):(ga.copy(i.color),i.vertexColors===THREE.FaceColors&&ga.multiply(h.color),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):i instanceof THREE.MeshDepthMaterial?(ia=p.near,Ra=p.far,g=1-K(a.positionScreen.z*a.positionScreen.w,ia,Ra),ja.setRGB(g,g,g),g=1-K(d.positionScreen.z*d.positionScreen.w,ia,Ra),ma.setRGB(g,g,g),g=1-K(e.positionScreen.z*
+e.positionScreen.w,ia,Ra),X.setRGB(g,g,g),ha.addColors(ma,X).multiplyScalar(0.5),Ua=G(ja,ma,X,ha),F(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ua)):i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(d=h.normalModelView,ga.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):i.shading==THREE.SmoothShading&&(d=h.vertexNormalsModelView[f],ja.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[g],
+ma.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[j],X.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),ha.addColors(ma,X).multiplyScalar(0.5),Ua=G(ja,ma,X,ha),F(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ua)))}function z(a,b,c,d,e,f){v.beginPath();v.moveTo(a,b);v.lineTo(c,d);v.lineTo(e,f);v.closePath()}function w(a,b,c,d,e,f,g,j){v.beginPath();v.moveTo(a,b);v.lineTo(c,d);v.lineTo(e,f);v.lineTo(g,j);v.closePath()}function B(a,b,c,j){d(b);e(c);f(j);g(a.getStyle());v.stroke();
+Ea.expandByScalar(2*b)}function A(a){h(a.getStyle());v.fill()}function D(a,b,c,d,e,f,g,j,i,ea,k,m,l){if(!(l instanceof THREE.DataTexture||void 0===l.image||0==l.image.width)){if(!0===l.needsUpdate){var n=l.wrapS==THREE.RepeatWrapping,gb=l.wrapT==THREE.RepeatWrapping;Za[l.id]=v.createPattern(l.image,!0===n&&!0===gb?"repeat":!0===n&&!1===gb?"repeat-x":!1===n&&!0===gb?"repeat-y":"no-repeat");l.needsUpdate=!1}void 0===Za[l.id]?h("rgba(0,0,0,1)"):h(Za[l.id]);var n=l.offset.x/l.repeat.x,gb=l.offset.y/l.repeat.y,
+p=l.image.width*l.repeat.x,q=l.image.height*l.repeat.y,g=(g+n)*p,j=(1-j+gb)*q,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+n)*p-g,ea=(1-ea+gb)*q-j,k=(k+n)*p-g,m=(1-m+gb)*q-j,n=i*m-k*ea;0===n?(void 0===$a[l.id]&&(b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,b=b.getContext("2d"),b.drawImage(l.image,0,0),$a[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data),b=$a[l.id],g=4*(Math.floor(g)+Math.floor(j)*l.image.width),ga.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),A(ga)):(n=1/n,
+l=(m*c-ea*e)*n,ea=(m*d-ea*f)*n,c=(i*e-k*c)*n,d=(i*f-k*d)*n,a=a-l*g-c*j,g=b-ea*g-d*j,v.save(),v.transform(l,ea,c,d,a,g),v.fill(),v.restore())}}function F(a,b,c,d,e,f,g,j,h,i,ea,k,l){var n,m;n=l.width-1;m=l.height-1;g*=n;j*=m;c-=a;d-=b;e-=a;f-=b;h=h*n-g;i=i*m-j;ea=ea*n-g;k=k*m-j;m=1/(h*k-ea*i);n=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-ea*c)*m;d=(h*f-ea*d)*m;a=a-n*g-c*j;b=b-i*g-d*j;v.save();v.transform(n,i,c,d,a,b);v.clip();v.drawImage(l,0,0);v.restore()}function G(a,b,c,d){bb[0]=255*a.r|0;bb[1]=255*a.g|0;
+bb[2]=255*a.b|0;bb[4]=255*b.r|0;bb[5]=255*b.g|0;bb[6]=255*b.b|0;bb[8]=255*c.r|0;bb[9]=255*c.g|0;bb[10]=255*c.b|0;bb[12]=255*d.r|0;bb[13]=255*d.g|0;bb[14]=255*d.b|0;j.putImageData(yb,0,0);Va.drawImage(xb,0,0);return ob}function K(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function H(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===p instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
+else{!0===this.autoClear&&this.clear();v.setTransform(1,0,0,-1,x,t);k.info.render.vertices=0;k.info.render.faces=0;l=s.projectScene(a,p,this.sortObjects,this.sortElements);n=l.elements;m=l.lights;gc=0<m.length;if(!0===gc){vb.setRGB(0,0,0);Pa.setRGB(0,0,0);Na.setRGB(0,0,0);for(var T=0,V=m.length;T<V;T++){var O=m[T],aa=O.color;O instanceof THREE.AmbientLight?vb.add(aa):O instanceof THREE.DirectionalLight?Pa.add(aa):O instanceof THREE.PointLight&&Na.add(aa)}}T=0;for(V=n.length;T<V;T++){var ea=n[T],O=
+ea.material;if(!(void 0===O||!1===O.visible)){Ea.makeEmpty();if(ea instanceof THREE.RenderableParticle){C=ea;C.x*=x;C.y*=t;var aa=C,jb=ea;b(O.opacity);c(O.blending);var gb=void 0,Ab=void 0,Bb=void 0,Cb=void 0,yc=ea=void 0,od=void 0;O instanceof THREE.ParticleBasicMaterial?null===O.map?(Bb=jb.object.scale.x,Cb=jb.object.scale.y,Bb*=jb.scale.x*x,Cb*=jb.scale.y*t,Ea.min.set(aa.x-Bb,aa.y-Cb),Ea.max.set(aa.x+Bb,aa.y+Cb),!1!==qb.isIntersectionBox(Ea)&&(h(O.color.getStyle()),v.save(),v.translate(aa.x,aa.y),
+v.rotate(-jb.rotation),v.scale(Bb,Cb),v.fillRect(-1,-1,2,2),v.restore())):(ea=O.map.image,yc=ea.width>>1,od=ea.height>>1,Bb=jb.scale.x*x,Cb=jb.scale.y*t,gb=Bb*yc,Ab=Cb*od,Ea.min.set(aa.x-gb,aa.y-Ab),Ea.max.set(aa.x+gb,aa.y+Ab),!1!==qb.isIntersectionBox(Ea)&&(v.save(),v.translate(aa.x,aa.y),v.rotate(-jb.rotation),v.scale(Bb,-Cb),v.translate(-yc,-od),v.drawImage(ea,0,0),v.restore())):O instanceof THREE.ParticleCanvasMaterial&&(gb=jb.scale.x*x,Ab=jb.scale.y*t,Ea.min.set(aa.x-gb,aa.y-Ab),Ea.max.set(aa.x+
+gb,aa.y+Ab),!1!==qb.isIntersectionBox(Ea)&&(g(O.color.getStyle()),h(O.color.getStyle()),v.save(),v.translate(aa.x,aa.y),v.rotate(-jb.rotation),v.scale(gb,Ab),O.program(v),v.restore()))}else if(ea instanceof THREE.RenderableLine)C=ea.v1,I=ea.v2,C.positionScreen.x*=x,C.positionScreen.y*=t,I.positionScreen.x*=x,I.positionScreen.y*=t,Ea.setFromPoints([C.positionScreen,I.positionScreen]),!0===qb.isIntersectionBox(Ea)&&(aa=C,jb=I,b(O.opacity),c(O.blending),v.beginPath(),v.moveTo(aa.positionScreen.x,aa.positionScreen.y),
+v.lineTo(jb.positionScreen.x,jb.positionScreen.y),O instanceof THREE.LineBasicMaterial?(d(O.linewidth),e(O.linecap),f(O.linejoin),g(O.color.getStyle()),i(null,null),v.stroke(),Ea.expandByScalar(2*O.linewidth)):O instanceof THREE.LineDashedMaterial&&(d(O.linewidth),e(O.linecap),f(O.linejoin),g(O.color.getStyle()),i(O.dashSize,O.gapSize),v.stroke(),Ea.expandByScalar(2*O.linewidth)));else if(ea instanceof THREE.RenderableFace3){C=ea.v1;I=ea.v2;M=ea.v3;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;
+if(-1>I.positionScreen.z||1<I.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;C.positionScreen.x*=x;C.positionScreen.y*=t;I.positionScreen.x*=x;I.positionScreen.y*=t;M.positionScreen.x*=x;M.positionScreen.y*=t;!0===O.overdraw&&(H(C.positionScreen,I.positionScreen),H(I.positionScreen,M.positionScreen),H(M.positionScreen,C.positionScreen));Ea.setFromPoints([C.positionScreen,I.positionScreen,M.positionScreen]);r(C,I,M,0,1,2,ea,O,a)}else if(ea instanceof THREE.RenderableFace4){C=
+ea.v1;I=ea.v2;M=ea.v3;W=ea.v4;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;if(-1>I.positionScreen.z||1<I.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;C.positionScreen.x*=x;C.positionScreen.y*=t;I.positionScreen.x*=x;I.positionScreen.y*=t;M.positionScreen.x*=x;M.positionScreen.y*=t;W.positionScreen.x*=x;W.positionScreen.y*=t;ua.positionScreen.copy(I.positionScreen);Ha.positionScreen.copy(W.positionScreen);
+!0===O.overdraw&&(H(C.positionScreen,I.positionScreen),H(I.positionScreen,W.positionScreen),H(W.positionScreen,C.positionScreen),H(M.positionScreen,ua.positionScreen),H(M.positionScreen,Ha.positionScreen));Ea.setFromPoints([C.positionScreen,I.positionScreen,M.positionScreen,W.positionScreen]);aa=C;jb=I;gb=M;Ab=W;Bb=ua;Cb=Ha;yc=a;k.info.render.vertices+=4;k.info.render.faces++;b(O.opacity);c(O.blending);void 0!==O.map&&null!==O.map||void 0!==O.envMap&&null!==O.envMap?(r(aa,jb,Ab,0,1,3,ea,O,yc),r(Bb,
+gb,Cb,1,2,3,ea,O,yc)):(oa=aa.positionScreen.x,J=aa.positionScreen.y,da=jb.positionScreen.x,ka=jb.positionScreen.y,Y=gb.positionScreen.x,L=gb.positionScreen.y,va=Ab.positionScreen.x,Ya=Ab.positionScreen.y,mb=Bb.positionScreen.x,Hb=Bb.positionScreen.y,ta=Cb.positionScreen.x,Ma=Cb.positionScreen.y,O instanceof THREE.MeshLambertMaterial||O instanceof THREE.MeshPhongMaterial?(ra.copy(O.color),fa.copy(O.emissive),O.vertexColors===THREE.FaceColors&&ra.multiply(ea.color),!0===gc?!1===O.wireframe&&O.shading==
+THREE.SmoothShading&&4==ea.vertexNormalsLength?(ja.copy(vb),ma.copy(vb),X.copy(vb),ha.copy(vb),q(ea.v1.positionWorld,ea.vertexNormalsModel[0],ja),q(ea.v2.positionWorld,ea.vertexNormalsModel[1],ma),q(ea.v4.positionWorld,ea.vertexNormalsModel[3],X),q(ea.v3.positionWorld,ea.vertexNormalsModel[2],ha),ja.multiply(ra).add(fa),ma.multiply(ra).add(fa),X.multiply(ra).add(fa),ha.multiply(ra).add(fa),Ua=G(ja,ma,X,ha),z(oa,J,da,ka,va,Ya),F(oa,J,da,ka,va,Ya,0,0,1,0,0,1,Ua),z(mb,Hb,Y,L,ta,Ma),F(mb,Hb,Y,L,ta,Ma,
+1,0,1,1,0,1,Ua)):(ga.copy(vb),q(ea.centroidModel,ea.normalModel,ga),ga.multiply(ra).add(fa),w(oa,J,da,ka,Y,L,va,Ya),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga)):(ga.addColors(ra,fa),w(oa,J,da,ka,Y,L,va,Ya),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga))):O instanceof THREE.MeshBasicMaterial?(ga.copy(O.color),O.vertexColors===THREE.FaceColors&&ga.multiply(ea.color),w(oa,J,da,ka,Y,L,va,Ya),!0===O.wireframe?B(ga,O.wireframeLinewidth,
+O.wireframeLinecap,O.wireframeLinejoin):A(ga)):O instanceof THREE.MeshNormalMaterial?(aa=void 0,O.shading==THREE.FlatShading?(aa=ea.normalModelView,ga.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),w(oa,J,da,ka,Y,L,va,Ya),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga)):O.shading==THREE.SmoothShading&&(aa=ea.vertexNormalsModelView[0],ja.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[1],ma.setRGB(aa.x,aa.y,
+aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[3],X.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[2],ha.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),Ua=G(ja,ma,X,ha),z(oa,J,da,ka,va,Ya),F(oa,J,da,ka,va,Ya,0,0,1,0,0,1,Ua),z(mb,Hb,Y,L,ta,Ma),F(mb,Hb,Y,L,ta,Ma,1,0,1,1,0,1,Ua))):O instanceof THREE.MeshDepthMaterial&&(ia=p.near,Ra=p.far,ja.r=ja.g=ja.b=1-K(aa.positionScreen.z*aa.positionScreen.w,ia,Ra),ma.r=ma.g=ma.b=1-K(jb.positionScreen.z*
+jb.positionScreen.w,ia,Ra),X.r=X.g=X.b=1-K(Ab.positionScreen.z*Ab.positionScreen.w,ia,Ra),ha.r=ha.g=ha.b=1-K(gb.positionScreen.z*gb.positionScreen.w,ia,Ra),Ua=G(ja,ma,X,ha),z(oa,J,da,ka,va,Ya),F(oa,J,da,ka,va,Ya,0,0,1,0,0,1,Ua),z(mb,Hb,Y,L,ta,Ma),F(mb,Hb,Y,L,ta,Ma,1,0,1,1,0,1,Ua)))}qa.union(Ea)}}v.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
 envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
 envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -340,164 +341,164 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
 THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
 cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
 depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a){if(a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer)}function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?
-g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}function d(a,b){var c=b.geometry,d=a.faces3,h=a.faces4,i=3*d.length+4*h.length,k=1*d.length+2*h.length,h=3*d.length+4*h.length,d=e(b,a),m=g(d),l=f(d),n=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);l&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));n&&
-(a.__colorArray=new Float32Array(3*i));if(m){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*i);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*i)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*i),a.__skinWeightArray=new Float32Array(4*i));a.__faceArray=new Uint16Array(3*k);a.__lineArray=new Uint16Array(2*h);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<
-m;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*i))}a.__webglFaceCount=3*k;a.__webglLineCount=2*h;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var q in d.attributes){var k=d.attributes[q],c={},p;for(p in k)c[p]=k[p];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,h=1,"v2"===c.type?h=2:
-"v3"===c.type?h=3:"v4"===c.type?h=4:"c"===c.type&&(h=3),c.size=h,c.array=new Float32Array(i*h),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=q,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===
+g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}function d(a,b){var c=b.geometry,d=a.faces3,h=a.faces4,i=3*d.length+4*h.length,k=1*d.length+2*h.length,h=3*d.length+4*h.length,d=e(b,a),l=g(d),m=f(d),n=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);m&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));n&&
+(a.__colorArray=new Float32Array(3*i));if(l){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*i);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*i)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*i),a.__skinWeightArray=new Float32Array(4*i));a.__faceArray=new Uint16Array(3*k);a.__lineArray=new Uint16Array(2*h);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(l=a.numMorphTargets;c<
+l;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(l=a.numMorphNormals;c<l;c++)a.__morphNormalsArrays.push(new Float32Array(3*i))}a.__webglFaceCount=3*k;a.__webglLineCount=2*h;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in d.attributes){var k=d.attributes[p],c={},q;for(q in k)c[q]=k[q];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,h=1,"v2"===c.type?h=2:
+"v3"===c.type?h=3:"v4"===c.type?h=4:"c"===c.type&&(h=3),c.size=h,c.array=new Float32Array(i*h),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===
 THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){var b,c,d;for(b in a.attributes)d="index"===b?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,c=a.attributes[b],c.buffer=j.createBuffer(),j.bindBuffer(d,c.buffer),j.bufferData(d,c.array,j.STATIC_DRAW)}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;a.elementsNeedUpdate&&
 void 0!==e&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(j.bindBuffer(j.ARRAY_BUFFER,g.buffer),j.bufferData(j.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==h&&(j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.colorsNeedUpdate&&void 0!==i&&(j.bindBuffer(j.ARRAY_BUFFER,
 i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){qa[a]||(j.enableVertexAttribArray(a),qa[a]=!0)}function l(){for(var a in qa)qa[a]&&(j.disableVertexAttribArray(a),qa[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function m(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ga=
-lb=null,ta=Ma=ha=X=ia=Za=ra=-1,$a=!0,a[d].render(b,c,mc,pb),ga=lb=null,ta=Ma=ha=X=ia=Za=ra=-1,$a=!0}function q(a,b,c,d,e,f,g,j){var h,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(h=a[l],h.render){i=h.object;k=h.buffer;if(j)h=j;else{h=h[c];if(!h)continue;g&&L.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);L.setDepthTest(h.depthTest);L.setDepthWrite(h.depthWrite);I(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}L.setMaterialFaces(h);k instanceof
-THREE.BufferGeometry?L.renderBufferDirect(d,e,f,h,k,i):L.renderBuffer(d,e,f,h,k,i)}}function r(a,b,c,d,e,f,g){for(var j,h,i=0,k=a.length;i<k;i++)if(j=a[i],h=j.object,h.visible){if(g)j=g;else{j=j[b];if(!j)continue;f&&L.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);L.setDepthTest(j.depthTest);L.setDepthWrite(j.depthWrite);I(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,j,h)}}function p(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
-function t(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function x(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function H(a,b,c,d,e){ma=0;d.needsUpdate&&(d.program&&aa(d),L.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets));
-var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==lb&&(j.useProgram(g),lb=g,f=!0);d.id!==ta&&(ta=d.id,f=!0);if(f||a!==ga)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ga&&(ga=a);if(d.skinning)if(tc&&e.useVertexTexture){if(null!==h.boneTexture){var k=F();j.uniform1i(h.boneTexture,k);L.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?
-(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if($a){for(var m,l=k=0,n=0,q,p,r,s=wb,t=s.directional.colors,w=s.directional.positions,v=s.point.colors,x=s.point.positions,C=s.point.distances,A=s.spot.colors,E=s.spot.positions,I=s.spot.distances,H=s.spot.directions,J=s.spot.anglesCos,O=s.spot.exponents,T=s.hemi.skyColors,X=s.hemi.groundColors,va=s.hemi.positions,
-W=0,V=0,ja=0,da=0,ha=0,ka=0,fa=0,Xa=0,N=m=0,c=r=N=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(q=m.color,p=m.intensity,r=m.distance,m instanceof THREE.AmbientLight?m.visible&&(L.gammaInput?(k+=q.r*q.r,l+=q.g*q.g,n+=q.b*q.b):(k+=q.r,l+=q.g,n+=q.b)):m instanceof THREE.DirectionalLight?(ha+=1,m.visible&&(Na.copy(m.matrixWorld.getPosition()),Na.sub(m.target.matrixWorld.getPosition()),Na.normalize(),0===Na.x&&0===Na.y&&0===Na.z||(m=3*W,w[m]=Na.x,w[m+1]=Na.y,w[m+2]=Na.z,L.gammaInput?z(t,m,q,p*p):K(t,m,q,
-p),W+=1))):m instanceof THREE.PointLight?(ka+=1,m.visible&&(N=3*V,L.gammaInput?z(v,N,q,p*p):K(v,N,q,p),p=m.matrixWorld.getPosition(),x[N]=p.x,x[N+1]=p.y,x[N+2]=p.z,C[V]=r,V+=1)):m instanceof THREE.SpotLight?(fa+=1,m.visible&&(N=3*ja,L.gammaInput?z(A,N,q,p*p):K(A,N,q,p),p=m.matrixWorld.getPosition(),E[N]=p.x,E[N+1]=p.y,E[N+2]=p.z,I[ja]=r,Na.copy(p),Na.sub(m.target.matrixWorld.getPosition()),Na.normalize(),H[N]=Na.x,H[N+1]=Na.y,H[N+2]=Na.z,J[ja]=Math.cos(m.angle),O[ja]=m.exponent,ja+=1)):m instanceof
-THREE.HemisphereLight&&(Xa+=1,m.visible&&(Na.copy(m.matrixWorld.getPosition()),Na.normalize(),0===Na.x&&0===Na.y&&0===Na.z||(r=3*da,va[r]=Na.x,va[r+1]=Na.y,va[r+2]=Na.z,q=m.color,m=m.groundColor,L.gammaInput?(p*=p,z(T,r,q,p),z(X,r,m,p)):(K(T,r,q,p),K(X,r,m,p)),da+=1))));c=3*W;for(f=Math.max(t.length,3*ha);c<f;c++)t[c]=0;c=3*V;for(f=Math.max(v.length,3*ka);c<f;c++)v[c]=0;c=3*ja;for(f=Math.max(A.length,3*fa);c<f;c++)A[c]=0;c=3*da;for(f=Math.max(T.length,3*Xa);c<f;c++)T[c]=0;c=3*da;for(f=Math.max(X.length,
-3*Xa);c<f;c++)X[c]=0;s.directional.length=W;s.point.length=V;s.spot.length=ja;s.hemi.length=da;s.ambient[0]=k;s.ambient[1]=l;s.ambient[2]=n;$a=!1}c=wb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;
-i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;L.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):
-i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Y;d.map?Y=d.map:d.specularMap?Y=d.specularMap:d.normalMap?Y=d.normalMap:d.bumpMap&&(Y=d.bumpMap);void 0!==Y&&(c=Y.offset,Y=Y.repeat,i.offsetRepeat.value.set(c.x,c.y,Y.x,Y.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
-1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?
-(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=M.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
-(L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Y=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof
-THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Y]=k.shadowMap,i.shadowMapSize.value[Y]=k.shadowMapSize,i.shadowMatrix.value[Y]=k.shadowMatrix,i.shadowDarkness.value[Y]=k.shadowDarkness,i.shadowBias.value[Y]=k.shadowBias,Y++}b=d.uniformsList;i=0;for(Y=b.length;i<Y;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,
-k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)s=2*l,c._array[s]=k[l].x,c._array[s+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=
-k.length;l<n;l++)s=3*l,c._array[s]=k[l].x,c._array[s+1]=k[l].y,c._array[s+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)s=4*l,c._array[s]=k[l].x,c._array[s+1]=k[l].y,c._array[s+2]=k[l].z,c._array[s+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=
-new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(s=k,k=F(),j.uniform1i(f,k),s)if(s.image instanceof Array&&6===s.image.length){if(c=s,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,
-c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)L.autoScaleCubemaps&&!f?(n=k,s=l,t=c.image[l],v=id,t.width<=v&&t.height<=v||(x=Math.max(t.width,t.height),w=Math.floor(t.width*v/x),v=Math.floor(t.height*v/x),x=document.createElement("canvas"),x.width=w,x.height=v,x.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,w,v),t=x),n[s]=t):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);s=G(c.format);t=G(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){v=
-k[l].mipmaps;x=0;for(C=v.length;x<C;x++)w=v[x],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,x,s,w.width,w.height,0,w.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,s,s,t,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else s instanceof THREE.WebGLRenderTargetCube?(c=s,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,
-c.__webglTexture)):L.setTexture(s,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=F();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)s=c.value[l],k=c._array[l],s&&L.setTexture(s,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(h.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||
-d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function F(){var a=ma;a>=Oc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Oc);
-ma+=1;return a}function A(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(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 K(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function I(a,b,c){Qa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Qa=a);if(a&&(Ta!==b||Ra!==c))j.polygonOffset(b,c),Ta=b,Ra=c}function E(a){for(var a=a.split("\n"),b=0,c=
-a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function V(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(E(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,G(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,G(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,G(b.magFilter)),
-j.texParameteri(a,j.TEXTURE_MIN_FILTER,G(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,C(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,C(b.minFilter)));if(nb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,nb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ec)),b.__oldAnisotropy=b.anisotropy}function T(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&
-!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function C(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||
-a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function G(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;
-if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;
-if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===
-THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;
-if(void 0!==Ua){if(a===THREE.RGB_S3TC_DXT1_Format)return Ua.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ua.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Ua.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ua.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},M=void 0!==a.canvas?a.canvas:document.createElement("canvas"),W=void 0!==a.precision?a.precision:"highp",ua=void 0!==
-a.alpha?a.alpha:!0,Ha=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,oa=void 0!==a.antialias?a.antialias:!1,J=void 0!==a.stencil?a.stencil:!0,da=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ka=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Y=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=M;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateScene=
-this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,
-geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var L=this,va=[],Xa=0,lb=null,Gb=null,ta=-1,Ma=null,ga=null,ja=0,ma=0,X=-1,ha=-1,ra=-1,fa=-1,Da=-1,Ya=-1,Za=-1,ia=-1,Qa=null,Ta=null,Ra=null,eb=null,ob=0,Hb=0,Ib=0,ec=0,mc=0,pb=0,qa={},Ea=new THREE.Frustum,fc=new THREE.Matrix4,ub=new THREE.Matrix4,gc=new THREE.Vector3,Na=new THREE.Vector3,$a=!0,wb={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:[]}},j,xb,ab,nb,Ua;try{if(!(j=M.getContext("experimental-webgl",{alpha:ua,premultipliedAlpha:Ha,antialias:oa,stencil:J,preserveDrawingBuffer:da})))throw"Error creating WebGL context.";}catch(yb){console.error(yb)}xb=j.getExtension("OES_texture_float");ab=j.getExtension("OES_standard_derivatives");nb=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||
-j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ua=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");xb||console.log("THREE.WebGLRenderer: Float textures not supported.");ab||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");nb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Ua||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");
-void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ka.r,ka.g,ka.b,Y);this.context=j;var Oc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),hd=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
-j.getParameter(j.MAX_TEXTURE_SIZE);var id=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Ec=nb?j.getParameter(nb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,sc=0<hd,tc=sc&&xb;Ua&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var ld=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),md=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var nd=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),kd=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
-j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var jd=0<ld.precision&&0<nd.precision,Pc=0<md.precision&&0<kd.precision;"highp"===W&&!jd&&
-(Pc?(W="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(W="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===W&&!Pc&&(W="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return sc};this.supportsFloatTextures=function(){return xb};this.supportsStandardDerivatives=function(){return ab};this.supportsCompressedTextureS3TC=function(){return Ua};
-this.getMaxAnisotropy=function(){return Ec};this.getPrecision=function(){return W};this.setSize=function(a,b){M.width=a*this.devicePixelRatio;M.height=b*this.devicePixelRatio;M.style.width=a+"px";M.style.height=b+"px";this.setViewport(0,0,M.width,M.height)};this.setViewport=function(a,b,c,d){ob=void 0!==a?a:0;Hb=void 0!==b?b:0;Ib=void 0!==c?c:M.width;ec=void 0!==d?d:M.height;j.viewport(ob,Hb,Ib,ec)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):
-j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ka.setHex(a);Y=b;j.clearColor(ka.r,ka.g,ka.b,Y)};this.setClearColor=function(a,b){ka.copy(a);Y=b;j.clearColor(ka.r,ka.g,ka.b,Y)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return Y};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,
-c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){lb=null;ta=Ma=ia=Za=ra=-1;$a=!0;ha=X=-1;this.shadowMapPlugin.update(a,b)};var xd=function(a){a=a.target;a.removeEventListener("dispose",xd);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==
-a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&
-j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)j.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)j.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);L.info.memory.geometries--},Qc=function(a){a=a.target;
-a.removeEventListener("dispose",Qc);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));L.info.memory.textures--},Rc=function(a){a=a.target;a.removeEventListener("dispose",Rc);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);else j.deleteFramebuffer(a.__webglFramebuffer),
-j.deleteRenderbuffer(a.__webglRenderbuffer);L.info.memory.textures--},O=function(a){a=a.target;a.removeEventListener("dispose",O);aa(a)},aa=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=va.length;a<c;a++)if(d=va[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=va.length;a<c;a++)d=va[a],d.program!==b&&e.push(d);va=e;j.deleteProgram(b);L.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&
-(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));
-if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,i,h,k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],h=n[p+4],l=n[p+5],i=n[p+6],k=n[p+7],m=n[p+8],d=(d+g+i)/3,e=(e+h+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
+mb=null,ta=Ma=ha=X=ia=$a=ra=-1,ab=!0,a[d].render(b,c,mc,qb),ga=mb=null,ta=Ma=ha=X=ia=$a=ra=-1,ab=!0}function r(a,b,c,d,e,f,g,j){var h,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(h=a[m],h.render){i=h.object;k=h.buffer;if(j)h=j;else{h=h[c];if(!h)continue;g&&L.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);L.setDepthTest(h.depthTest);L.setDepthWrite(h.depthWrite);H(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}L.setMaterialFaces(h);k instanceof
+THREE.BufferGeometry?L.renderBufferDirect(d,e,f,h,k,i):L.renderBuffer(d,e,f,h,k,i)}}function p(a,b,c,d,e,f,g){for(var j,h,i=0,k=a.length;i<k;i++)if(j=a[i],h=j.object,h.visible){if(g)j=g;else{j=j[b];if(!j)continue;f&&L.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);L.setDepthTest(j.depthTest);L.setDepthWrite(j.depthWrite);H(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,j,h)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
+function x(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function D(a,b,c,d,e){ma=0;d.needsUpdate&&(d.program&&aa(d),L.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets));
+var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==mb&&(j.useProgram(g),mb=g,f=!0);d.id!==ta&&(ta=d.id,f=!0);if(f||a!==ga)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ga&&(ga=a);if(d.skinning)if(tc&&e.useVertexTexture){if(null!==h.boneTexture){var k=K();j.uniform1i(h.boneTexture,k);L.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?
+(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ab){for(var l,m=k=0,n=0,p,q,s,r=xb,t=r.directional.colors,v=r.directional.positions,x=r.point.colors,w=r.point.positions,C=r.point.distances,A=r.spot.colors,D=r.spot.positions,G=r.spot.distances,H=r.spot.directions,J=r.spot.anglesCos,O=r.spot.exponents,T=r.hemi.skyColors,X=r.hemi.groundColors,va=r.hemi.positions,
+W=0,V=0,ja=0,da=0,ha=0,ka=0,fa=0,Ya=0,N=l=0,c=s=N=0,f=b.length;c<f;c++)l=b[c],l.onlyShadow||(p=l.color,q=l.intensity,s=l.distance,l instanceof THREE.AmbientLight?l.visible&&(L.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,n+=p.b*p.b):(k+=p.r,m+=p.g,n+=p.b)):l instanceof THREE.DirectionalLight?(ha+=1,l.visible&&(Na.getPositionFromMatrix(l.matrixWorld),Pa.getPositionFromMatrix(l.target.matrixWorld),Na.sub(Pa),Na.normalize(),0===Na.x&&0===Na.y&&0===Na.z||(l=3*W,v[l]=Na.x,v[l+1]=Na.y,v[l+2]=Na.z,L.gammaInput?z(t,
+l,p,q*q):F(t,l,p,q),W+=1))):l instanceof THREE.PointLight?(ka+=1,l.visible&&(N=3*V,L.gammaInput?z(x,N,p,q*q):F(x,N,p,q),Pa.getPositionFromMatrix(l.matrixWorld),w[N]=Pa.x,w[N+1]=Pa.y,w[N+2]=Pa.z,C[V]=s,V+=1)):l instanceof THREE.SpotLight?(fa+=1,l.visible&&(N=3*ja,L.gammaInput?z(A,N,p,q*q):F(A,N,p,q),Pa.getPositionFromMatrix(l.matrixWorld),D[N]=Pa.x,D[N+1]=Pa.y,D[N+2]=Pa.z,G[ja]=s,Na.copy(Pa),Pa.getPositionFromMatrix(l.target.matrixWorld),Na.sub(Pa),Na.normalize(),H[N]=Na.x,H[N+1]=Na.y,H[N+2]=Na.z,
+J[ja]=Math.cos(l.angle),O[ja]=l.exponent,ja+=1)):l instanceof THREE.HemisphereLight&&(Ya+=1,l.visible&&(Na.getPositionFromMatrix(l.matrixWorld),Na.normalize(),0===Na.x&&0===Na.y&&0===Na.z||(s=3*da,va[s]=Na.x,va[s+1]=Na.y,va[s+2]=Na.z,p=l.color,l=l.groundColor,L.gammaInput?(q*=q,z(T,s,p,q),z(X,s,l,q)):(F(T,s,p,q),F(X,s,l,q)),da+=1))));c=3*W;for(f=Math.max(t.length,3*ha);c<f;c++)t[c]=0;c=3*V;for(f=Math.max(x.length,3*ka);c<f;c++)x[c]=0;c=3*ja;for(f=Math.max(A.length,3*fa);c<f;c++)A[c]=0;c=3*da;for(f=
+Math.max(T.length,3*Ya);c<f;c++)T[c]=0;c=3*da;for(f=Math.max(X.length,3*Ya);c<f;c++)X[c]=0;r.directional.length=W;r.point.length=V;r.spot.length=ja;r.hemi.length=da;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;ab=!1}c=xb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=
+c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=
+d.opacity;L.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Y;d.map?Y=d.map:d.specularMap?Y=d.specularMap:d.normalMap?Y=d.normalMap:d.bumpMap&&(Y=d.bumpMap);void 0!==Y&&(c=Y.offset,Y=Y.repeat,i.offsetRepeat.value.set(c.x,c.y,Y.x,Y.y));
+i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=
+d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=M.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),
+d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&
+i.shadowMatrix){c=Y=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Y]=k.shadowMap,i.shadowMapSize.value[Y]=k.shadowMapSize,i.shadowMatrix.value[Y]=k.shadowMatrix,i.shadowDarkness.value[Y]=k.shadowDarkness,i.shadowBias.value[Y]=k.shadowBias,Y++}b=d.uniformsList;i=0;for(Y=b.length;i<Y;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,
+k);else if("v2"===m)j.uniform2f(f,k.x,k.y);else if("v3"===m)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===m)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===m)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===m)j.uniform1iv(f,k);else if("iv"===m)j.uniform3iv(f,k);else if("fv1"===m)j.uniform1fv(f,k);else if("fv"===m)j.uniform3fv(f,k);else if("v2v"===m){void 0===c._array&&(c._array=new Float32Array(2*k.length));m=0;for(n=k.length;m<n;m++)r=2*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y;j.uniform2fv(f,c._array)}else if("v3v"===
+m){void 0===c._array&&(c._array=new Float32Array(3*k.length));m=0;for(n=k.length;m<n;m++)r=3*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z;j.uniform3fv(f,c._array)}else if("v4v"===m){void 0===c._array&&(c._array=new Float32Array(4*k.length));m=0;for(n=k.length;m<n;m++)r=4*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z,c._array[r+3]=k[m].w;j.uniform4fv(f,c._array)}else if("m4"===m)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,
+!1,c._array);else if("m4v"===m){void 0===c._array&&(c._array=new Float32Array(16*k.length));m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=K(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,
+c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(m=0;6>m;m++)L.autoScaleCubemaps&&!f?(n=k,r=m,t=c.image[m],x=id,t.width<=x&&t.height<=x||(w=Math.max(t.width,t.height),v=Math.floor(t.width*x/w),x=Math.floor(t.height*x/w),w=document.createElement("canvas"),w.width=v,w.height=x,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,x),t=w),n[r]=t):k[m]=c.image[m];m=k[0];n=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=I(c.format);
+t=I(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(m=0;6>m;m++)if(f){x=k[m].mipmaps;w=0;for(C=x.length;w<C;w++)v=x[w],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,t,k[m]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?
+(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):L.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=K();j.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)r=c.value[m],k=c._array[m],r&&L.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)Pa.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,Pa.x,Pa.y,
+Pa.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function K(){var a=ma;a>=Oc&&console.warn("WebGLRenderer: trying to use "+
+a+" texture units while this GPU supports only "+Oc);ma+=1;return a}function A(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(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 F(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function H(a,b,c){Ra!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ra=a);if(a&&(Ua!==b||Sa!==c))j.polygonOffset(b,c),
+Ua=b,Sa=c}function G(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function V(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(G(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,I(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,I(b.wrapT)),
+j.texParameteri(a,j.TEXTURE_MAG_FILTER,I(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,I(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,C(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,C(b.minFilter)));if(ob&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,ob.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ec)),b.__oldAnisotropy=b.anisotropy}
+function T(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function C(a){return a===
+THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function I(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;
+if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;
+if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;
+if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;
+if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Va){if(a===THREE.RGB_S3TC_DXT1_Format)return Va.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Va.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Va.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Va.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},M=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
+W=void 0!==a.precision?a.precision:"highp",ua=void 0!==a.alpha?a.alpha:!0,Ha=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,oa=void 0!==a.antialias?a.antialias:!1,J=void 0!==a.stencil?a.stencil:!0,da=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ka=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Y=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=M;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?
+window.devicePixelRatio:1;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=
+[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var L=this,va=[],Ya=0,mb=null,Hb=null,ta=-1,Ma=null,ga=null,ja=0,ma=0,X=-1,ha=-1,ra=-1,fa=-1,Da=-1,Za=-1,$a=-1,ia=-1,Ra=null,Ua=null,Sa=null,fb=null,pb=0,Ib=0,Jb=0,fc=0,mc=0,qb=0,qa={},Ea=new THREE.Frustum,gc=new THREE.Matrix4,vb=new THREE.Matrix4,Pa=new THREE.Vector3,Na=new THREE.Vector3,ab=!0,xb={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:[]}},j,yb,bb,ob,Va;try{if(!(j=M.getContext("experimental-webgl",{alpha:ua,premultipliedAlpha:Ha,antialias:oa,stencil:J,preserveDrawingBuffer:da})))throw"Error creating WebGL context.";}catch(zb){console.error(zb)}yb=j.getExtension("OES_texture_float");bb=j.getExtension("OES_standard_derivatives");ob=j.getExtension("EXT_texture_filter_anisotropic")||
+j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Va=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");yb||console.log("THREE.WebGLRenderer: Float textures not supported.");bb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");ob||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
+Va||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ka.r,ka.g,ka.b,Y);this.context=j;var Oc=
+j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),hd=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var id=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Ec=ob?j.getParameter(ob.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,sc=0<hd,tc=sc&&yb;Va&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var ld=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),md=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var nd=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
+j.HIGH_FLOAT),kd=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var jd=0<ld.precision&&0<nd.precision,
+Pc=0<md.precision&&0<kd.precision;"highp"===W&&!jd&&(Pc?(W="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(W="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===W&&!Pc&&(W="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return sc};this.supportsFloatTextures=function(){return yb};this.supportsStandardDerivatives=function(){return bb};
+this.supportsCompressedTextureS3TC=function(){return Va};this.getMaxAnisotropy=function(){return Ec};this.getPrecision=function(){return W};this.setSize=function(a,b){M.width=a*this.devicePixelRatio;M.height=b*this.devicePixelRatio;M.style.width=a+"px";M.style.height=b+"px";this.setViewport(0,0,M.width,M.height)};this.setViewport=function(a,b,c,d){pb=void 0!==a?a:0;Ib=void 0!==b?b:0;Jb=void 0!==c?c:M.width;fc=void 0!==d?d:M.height;j.viewport(pb,Ib,Jb,fc)};this.setScissor=function(a,b,c,d){j.scissor(a,
+b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ka.setHex(a);Y=b;j.clearColor(ka.r,ka.g,ka.b,Y)};this.setClearColor=function(a,b){ka.copy(a);Y=b;j.clearColor(ka.r,ka.g,ka.b,Y)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return Y};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};
+this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){mb=null;ta=Ma=ia=$a=ra=-1;ab=!0;ha=X=-1;this.shadowMapPlugin.update(a,b)};var xd=function(a){a=a.target;a.removeEventListener("dispose",xd);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==
+a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&
+j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)j.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)j.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);
+L.info.memory.geometries--},Qc=function(a){a=a.target;a.removeEventListener("dispose",Qc);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));L.info.memory.textures--},Rc=function(a){a=a.target;a.removeEventListener("dispose",Rc);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
+else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);L.info.memory.textures--},O=function(a){a=a.target;a.removeEventListener("dispose",O);aa(a)},aa=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=va.length;a<c;a++)if(d=va[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=va.length;a<c;a++)d=va[a],d.program!==b&&e.push(d);va=e;j.deleteProgram(b);L.info.memory.programs--}}};this.renderBufferImmediate=
+function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,
+3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,i,h,k,m,l,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],h=n[p+4],m=n[p+5],i=n[p+6],k=n[p+7],l=n[p+8],d=(d+g+i)/3,e=(e+h+k)/3,f=(f+m+l)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
 3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,
-0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=H(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==Ma&&(Ma=d,b=!0),b&&l(),f instanceof THREE.Mesh)if(f=e.attributes.index){d=e.offsets;1<d.length&&(b=!0);for(var c=0,g=d.length;c<g;c++){var i=d[c].index;if(b){var h=e.attributes.position,m=h.itemSize;j.bindBuffer(j.ARRAY_BUFFER,h.buffer);k(a.position);j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,4*i*m);m=e.attributes.normal;if(0<=
+0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=D(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==Ma&&(Ma=d,b=!0),b&&l(),f instanceof THREE.Mesh)if(f=e.attributes.index){d=e.offsets;1<d.length&&(b=!0);for(var c=0,g=d.length;c<g;c++){var i=d[c].index;if(b){var h=e.attributes.position,m=h.itemSize;j.bindBuffer(j.ARRAY_BUFFER,h.buffer);k(a.position);j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,4*i*m);m=e.attributes.normal;if(0<=
 a.normal&&m){var n=m.itemSize;j.bindBuffer(j.ARRAY_BUFFER,m.buffer);k(a.normal);j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,4*i*n)}m=e.attributes.uv;0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,4*i*n));m=e.attributes.color;0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,4*i*n));m=e.attributes.tangent;0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
 m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,4*i*n));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,d[c].count,j.UNSIGNED_SHORT,2*d[c].start);L.info.render.calls++;L.info.render.vertices+=d[c].count;L.info.render.faces+=d[c].count/3}}else b&&(h=e.attributes.position,m=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.normal,0<=a.normal&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
 m.buffer),k(a.normal),j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,0)),m=e.attributes.uv,0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,0)),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),m=e.attributes.tangent,0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,
 !1,0,0))),j.drawArrays(j.TRIANGLES,0,h.numItems/3),L.info.render.calls++,L.info.render.vertices+=h.numItems/3,L.info.render.faces+=h.numItems/3/3;else f instanceof THREE.ParticleSystem?b&&(h=e.attributes.position,m=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,
 h.numItems/3),L.info.render.calls++,L.info.render.points+=h.numItems/3):f instanceof THREE.Line&&b&&(h=e.attributes.position,m=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.LINE_STRIP,0,h.numItems/3),L.info.render.calls++,L.info.render.points+=h.numItems)};this.renderBuffer=
-function(a,b,c,d,e,f){if(!1!==d.visible){var g,i,c=H(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Ma&&(Ma=c,a=!0);a&&l();if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(b.position),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),j.vertexAttribPointer(c.position,
+function(a,b,c,d,e,f){if(!1!==d.visible){var g,i,c=D(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Ma&&(Ma=c,a=!0);a&&l();if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(b.position),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),j.vertexAttribPointer(c.position,
 3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var h=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<i.length;)0<=c["morphTarget"+h]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[h]]),k(c["morphTarget"+h]),j.vertexAttribPointer(c["morphTarget"+h],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+h]&&d.morphNormals&&
 (j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[h]]),k(c["morphNormal"+h]),j.vertexAttribPointer(c["morphNormal"+h],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[h]=g[i[h]],h++}else{i=[];g=f.morphTargetInfluences;var n,p=g.length;for(n=0;n<p;n++)h=g[n],0<h&&i.push([h,n]);i.length>d.numSupportedMorphTargets?(i.sort(m),i.length=d.numSupportedMorphTargets):i.length>d.numSupportedMorphNormals?i.sort(m):0===i.length&&i.push([0,0]);for(h=0;h<d.numSupportedMorphTargets;)i[h]?(n=i[h][1],0<=
 c["morphTarget"+h]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),k(c["morphTarget"+h]),j.vertexAttribPointer(c["morphTarget"+h],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+h]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),k(c["morphNormal"+h]),j.vertexAttribPointer(c["morphNormal"+h],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[h]=g[n]):f.__webglMorphTargetInfluences[h]=0,h++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
 f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(i=e.__webglCustomAttributesList.length;g<i;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),k(b[c.buffer.belongsToAttribute]),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),k(b.color),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,
 e.__webglNormalBuffer),k(b.normal),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),k(b.tangent),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),k(b.uv),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0));0<=b.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),k(b.uv2),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=b.skinIndex&&0<=b.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,
-e.__webglSkinIndicesBuffer),k(b.skinIndex),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(b.skinWeight),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));0<=b.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(b.lineDistance),j.vertexAttribPointer(b.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==eb&&(j.lineWidth(d),eb=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
-e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==eb&&(j.lineWidth(d),eb=d),j.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof
-THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}};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,f,g,i,h=a.__lights,k=a.fog;ta=-1;$a=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&
-b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);fc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ea.setFromMatrix(fc);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;L.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);i=a.__webglObjects;d=0;for(e=i.length;d<e;d++)if(f=i[d],g=f.object,
-f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||Ea.intersectsObject(g))){A(g,b);var m=f,l=m.buffer,p=void 0,t=p=void 0,t=m.object.material;if(t instanceof THREE.MeshFaceMaterial)p=l.materialIndex,p=t.materials[p],p.transparent?(m.transparent=p,m.opaque=null):(m.opaque=p,m.transparent=null);else if(p=t)p.transparent?(m.transparent=p,m.opaque=null):(m.opaque=p,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:
-(gc.copy(g.matrixWorld.getPosition()),gc.applyProjection(fc),f.z=gc.z),f.id=g.id)}this.sortObjects&&i.sort(n);i=a.__webglObjectsImmediate;d=0;for(e=i.length;d<e;d++)f=i[d],g=f.object,g.visible&&(A(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,
-d.polygonOffsetUnits),q(a.__webglObjects,!1,"",b,h,k,!0,d),r(a.__webglObjectsImmediate,"",b,h,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),q(a.__webglObjects,!0,"opaque",b,h,k,!1,d),r(a.__webglObjectsImmediate,"opaque",b,h,k,!1,d),q(a.__webglObjects,!1,"transparent",b,h,k,!0,d),r(a.__webglObjectsImmediate,"transparent",b,h,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?
-(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=H(a,b,c,d,e);Ma=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ea):e.render(function(a){L.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=
-function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,l=void 0,n=void 0,q=void 0,s=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",xd)),b instanceof THREE.Mesh)if(n=b.geometry,q=b.material,
-n instanceof THREE.Geometry){if(void 0===n.geometryGroups){var r=n,z=void 0,C=void 0,B=void 0,A=void 0,F=void 0,E=void 0,G={},H=r.morphTargets.length,I=r.morphNormals.length,K=q instanceof THREE.MeshFaceMaterial;r.geometryGroups={};z=0;for(C=r.faces.length;z<C;z++)B=r.faces[z],A=K?B.materialIndex:0,void 0===G[A]&&(G[A]={hash:A,counter:0}),E=G[A].hash+"_"+G[A].counter,void 0===r.geometryGroups[E]&&(r.geometryGroups[E]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:H,numMorphNormals:I}),
-F=B instanceof THREE.Face3?3:4,65535<r.geometryGroups[E].vertices+F&&(G[A].counter+=1,E=G[A].hash+"_"+G[A].counter,void 0===r.geometryGroups[E]&&(r.geometryGroups[E]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:H,numMorphNormals:I})),B instanceof THREE.Face3?r.geometryGroups[E].faces3.push(z):r.geometryGroups[E].faces4.push(z),r.geometryGroups[E].vertices+=F;r.geometryGroupsList=[];var M=void 0;for(M in r.geometryGroups)r.geometryGroups[M].id=ja++,r.geometryGroupsList.push(r.geometryGroups[M])}for(l in n.geometryGroups)if(s=
-n.geometryGroups[l],!s.__webglVertexBuffer){var J=s;J.__webglVertexBuffer=j.createBuffer();J.__webglNormalBuffer=j.createBuffer();J.__webglTangentBuffer=j.createBuffer();J.__webglColorBuffer=j.createBuffer();J.__webglUVBuffer=j.createBuffer();J.__webglUV2Buffer=j.createBuffer();J.__webglSkinIndicesBuffer=j.createBuffer();J.__webglSkinWeightsBuffer=j.createBuffer();J.__webglFaceBuffer=j.createBuffer();J.__webglLineBuffer=j.createBuffer();var O=void 0,T=void 0;if(J.numMorphTargets){J.__webglMorphTargetsBuffers=
-[];O=0;for(T=J.numMorphTargets;O<T;O++)J.__webglMorphTargetsBuffers.push(j.createBuffer())}if(J.numMorphNormals){J.__webglMorphNormalsBuffers=[];O=0;for(T=J.numMorphNormals;O<T;O++)J.__webglMorphNormalsBuffers.push(j.createBuffer())}L.info.memory.geometries++;d(s,b);n.verticesNeedUpdate=!0;n.morphTargetsNeedUpdate=!0;n.elementsNeedUpdate=!0;n.uvsNeedUpdate=!0;n.normalsNeedUpdate=!0;n.tangentsNeedUpdate=!0;n.colorsNeedUpdate=!0}}else n instanceof THREE.BufferGeometry&&h(n);else if(b instanceof THREE.Ribbon){if(n=
-b.geometry,!n.__webglVertexBuffer){var X=n;X.__webglVertexBuffer=j.createBuffer();X.__webglColorBuffer=j.createBuffer();X.__webglNormalBuffer=j.createBuffer();L.info.memory.geometries++;var ga=n,W=b,va=ga.vertices.length;ga.__vertexArray=new Float32Array(3*va);ga.__colorArray=new Float32Array(3*va);ga.__normalArray=new Float32Array(3*va);ga.__webglVertexCount=va;c(ga,W);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0;n.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(n=b.geometry,!n.__webglVertexBuffer)if(n instanceof
-THREE.Geometry){var V=n;V.__webglVertexBuffer=j.createBuffer();V.__webglColorBuffer=j.createBuffer();V.__webglLineDistanceBuffer=j.createBuffer();L.info.memory.geometries++;var Y=n,da=b,aa=Y.vertices.length;Y.__vertexArray=new Float32Array(3*aa);Y.__colorArray=new Float32Array(3*aa);Y.__lineDistanceArray=new Float32Array(1*aa);Y.__webglLineCount=aa;c(Y,da);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0;n.lineDistancesNeedUpdate=!0}else n instanceof THREE.BufferGeometry&&h(n)}else if(b instanceof THREE.ParticleSystem&&
-(n=b.geometry,!n.__webglVertexBuffer))if(n instanceof THREE.Geometry){var ma=n;ma.__webglVertexBuffer=j.createBuffer();ma.__webglColorBuffer=j.createBuffer();L.info.memory.geometries++;var ha=n,ka=b,Xa=ha.vertices.length;ha.__vertexArray=new Float32Array(3*Xa);ha.__colorArray=new Float32Array(3*Xa);ha.__sortArray=[];ha.__webglParticleCount=Xa;c(ha,ka);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0}else n instanceof THREE.BufferGeometry&&h(n);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(n=b.geometry,
-n instanceof THREE.BufferGeometry)p(k.__webglObjects,n,b);else{if(n instanceof THREE.Geometry)for(l in n.geometryGroups)s=n.geometryGroups[l],p(k.__webglObjects,s,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(n=b.geometry,p(k.__webglObjects,n,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?k.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?k.__webglSprites.push(b):b instanceof THREE.LensFlare&&
-k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fa=a.__objectsRemoved[0],lb=a;fa instanceof THREE.Mesh||fa instanceof THREE.ParticleSystem||fa instanceof THREE.Ribbon||fa instanceof THREE.Line?w(lb.__webglObjects,fa):fa instanceof THREE.Sprite?v(lb.__webglSprites,fa):fa instanceof THREE.LensFlare?v(lb.__webglFlares,fa):(fa instanceof THREE.ImmediateRenderObject||fa.immediateRenderCallback)&&w(lb.__webglObjectsImmediate,fa);fa.__webglActive=
+e.__webglSkinIndicesBuffer),k(b.skinIndex),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(b.skinWeight),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));0<=b.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(b.lineDistance),j.vertexAttribPointer(b.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==fb&&(j.lineWidth(d),fb=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
+e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==fb&&(j.lineWidth(d),fb=d),j.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof
+THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}};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,f,g,i,h=a.__lights,k=a.fog;ta=-1;ab=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&
+b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);gc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ea.setFromMatrix(gc);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;L.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);i=a.__webglObjects;d=0;for(e=i.length;d<e;d++)if(f=i[d],g=f.object,
+f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||Ea.intersectsObject(g))){A(g,b);var m=f,l=m.buffer,q=void 0,t=q=void 0,t=m.object.material;if(t instanceof THREE.MeshFaceMaterial)q=l.materialIndex,q=t.materials[q],q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);else if(q=t)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:
+(Pa.getPositionFromMatrix(g.matrixWorld),Pa.applyProjection(gc),f.z=Pa.z),f.id=g.id)}this.sortObjects&&i.sort(n);i=a.__webglObjectsImmediate;d=0;for(e=i.length;d<e;d++)f=i[d],g=f.object,g.visible&&(A(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),H(d.polygonOffset,d.polygonOffsetFactor,
+d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,h,k,!0,d),p(a.__webglObjectsImmediate,"",b,h,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,h,k,!1,d),p(a.__webglObjectsImmediate,"opaque",b,h,k,!1,d),r(a.__webglObjects,!1,"transparent",b,h,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,h,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?
+(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=D(a,b,c,d,e);Ma=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ea):e.render(function(a){L.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=
+function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,n=void 0,l=void 0,p=void 0,r=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",xd)),b instanceof THREE.Mesh)if(l=b.geometry,p=b.material,
+l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var s=l,z=void 0,C=void 0,B=void 0,A=void 0,D=void 0,F=void 0,G={},H=s.morphTargets.length,I=s.morphNormals.length,K=p instanceof THREE.MeshFaceMaterial;s.geometryGroups={};z=0;for(C=s.faces.length;z<C;z++)B=s.faces[z],A=K?B.materialIndex:0,void 0===G[A]&&(G[A]={hash:A,counter:0}),F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:H,numMorphNormals:I}),
+D=B instanceof THREE.Face3?3:4,65535<s.geometryGroups[F].vertices+D&&(G[A].counter+=1,F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:H,numMorphNormals:I})),B instanceof THREE.Face3?s.geometryGroups[F].faces3.push(z):s.geometryGroups[F].faces4.push(z),s.geometryGroups[F].vertices+=D;s.geometryGroupsList=[];var M=void 0;for(M in s.geometryGroups)s.geometryGroups[M].id=ja++,s.geometryGroupsList.push(s.geometryGroups[M])}for(n in l.geometryGroups)if(r=
+l.geometryGroups[n],!r.__webglVertexBuffer){var J=r;J.__webglVertexBuffer=j.createBuffer();J.__webglNormalBuffer=j.createBuffer();J.__webglTangentBuffer=j.createBuffer();J.__webglColorBuffer=j.createBuffer();J.__webglUVBuffer=j.createBuffer();J.__webglUV2Buffer=j.createBuffer();J.__webglSkinIndicesBuffer=j.createBuffer();J.__webglSkinWeightsBuffer=j.createBuffer();J.__webglFaceBuffer=j.createBuffer();J.__webglLineBuffer=j.createBuffer();var O=void 0,T=void 0;if(J.numMorphTargets){J.__webglMorphTargetsBuffers=
+[];O=0;for(T=J.numMorphTargets;O<T;O++)J.__webglMorphTargetsBuffers.push(j.createBuffer())}if(J.numMorphNormals){J.__webglMorphNormalsBuffers=[];O=0;for(T=J.numMorphNormals;O<T;O++)J.__webglMorphNormalsBuffers.push(j.createBuffer())}L.info.memory.geometries++;d(r,b);l.verticesNeedUpdate=!0;l.morphTargetsNeedUpdate=!0;l.elementsNeedUpdate=!0;l.uvsNeedUpdate=!0;l.normalsNeedUpdate=!0;l.tangentsNeedUpdate=!0;l.colorsNeedUpdate=!0}}else l instanceof THREE.BufferGeometry&&h(l);else if(b instanceof THREE.Ribbon){if(l=
+b.geometry,!l.__webglVertexBuffer){var X=l;X.__webglVertexBuffer=j.createBuffer();X.__webglColorBuffer=j.createBuffer();X.__webglNormalBuffer=j.createBuffer();L.info.memory.geometries++;var ga=l,W=b,va=ga.vertices.length;ga.__vertexArray=new Float32Array(3*va);ga.__colorArray=new Float32Array(3*va);ga.__normalArray=new Float32Array(3*va);ga.__webglVertexCount=va;c(ga,W);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(l=b.geometry,!l.__webglVertexBuffer)if(l instanceof
+THREE.Geometry){var V=l;V.__webglVertexBuffer=j.createBuffer();V.__webglColorBuffer=j.createBuffer();V.__webglLineDistanceBuffer=j.createBuffer();L.info.memory.geometries++;var Y=l,da=b,aa=Y.vertices.length;Y.__vertexArray=new Float32Array(3*aa);Y.__colorArray=new Float32Array(3*aa);Y.__lineDistanceArray=new Float32Array(1*aa);Y.__webglLineCount=aa;c(Y,da);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.lineDistancesNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&h(l)}else if(b instanceof THREE.ParticleSystem&&
+(l=b.geometry,!l.__webglVertexBuffer))if(l instanceof THREE.Geometry){var ma=l;ma.__webglVertexBuffer=j.createBuffer();ma.__webglColorBuffer=j.createBuffer();L.info.memory.geometries++;var ha=l,ka=b,Ya=ha.vertices.length;ha.__vertexArray=new Float32Array(3*Ya);ha.__colorArray=new Float32Array(3*Ya);ha.__sortArray=[];ha.__webglParticleCount=Ya;c(ha,ka);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&h(l);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(l=b.geometry,
+l instanceof THREE.BufferGeometry)q(k.__webglObjects,l,b);else{if(l instanceof THREE.Geometry)for(n in l.geometryGroups)r=l.geometryGroups[n],q(k.__webglObjects,r,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(l=b.geometry,q(k.__webglObjects,l,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?k.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?k.__webglSprites.push(b):b instanceof THREE.LensFlare&&
+k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fa=a.__objectsRemoved[0],mb=a;fa instanceof THREE.Mesh||fa instanceof THREE.ParticleSystem||fa instanceof THREE.Ribbon||fa instanceof THREE.Line?v(mb.__webglObjects,fa):fa instanceof THREE.Sprite?w(mb.__webglSprites,fa):fa instanceof THREE.LensFlare?w(mb.__webglFlares,fa):(fa instanceof THREE.ImmediateRenderObject||fa.immediateRenderCallback)&&v(mb.__webglObjectsImmediate,fa);fa.__webglActive=
 !1;a.__objectsRemoved.splice(0,1)}for(var ra=0,Ma=a.__webglObjects.length;ra<Ma;ra++){var ia=a.__webglObjects[ra].object,N=ia.geometry,ua=void 0,oa=void 0,ta=void 0;if(ia instanceof THREE.Mesh)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate)&&i(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.elementsNeedUpdate=!1,N.uvsNeedUpdate=!1,N.normalsNeedUpdate=!1,N.colorsNeedUpdate=!1,N.tangentsNeedUpdate=
-!1;else{for(var Da=0,Gb=N.geometryGroupsList.length;Da<Gb;Da++)if(ua=N.geometryGroupsList[Da],ta=e(ia,ua),N.buffersNeedUpdate&&d(ua,ia),oa=ta.attributes&&t(ta),N.verticesNeedUpdate||N.morphTargetsNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate||oa){var sa=ua,Ha=ia,qa=j.DYNAMIC_DRAW,Na=!N.dynamic,Ea=ta;if(sa.__inittedArrays){var Ta=f(Ea),Ya=Ea.vertexColors?Ea.vertexColors:!1,$a=g(Ea),ab=Ta===THREE.SmoothShading,D=void 0,U=void 0,Qa=void 0,
-P=void 0,Za=void 0,Ua=void 0,Ra=void 0,nb=void 0,eb=void 0,ob=void 0,pb=void 0,Q=void 0,R=void 0,S=void 0,pa=void 0,Lb=void 0,Mb=void 0,Nb=void 0,wb=void 0,Ob=void 0,Pb=void 0,Qb=void 0,xb=void 0,Rb=void 0,Sb=void 0,Tb=void 0,yb=void 0,Ub=void 0,Vb=void 0,Wb=void 0,Hb=void 0,Xb=void 0,Yb=void 0,Zb=void 0,Ib=void 0,ya=void 0,ec=void 0,nc=void 0,zc=void 0,Ac=void 0,bb=void 0,mc=void 0,Va=void 0,Wa=void 0,oc=void 0,hc=void 0,Oa=0,Sa=0,ic=0,jc=0,Cb=0,jb=0,Ba=0,mb=0,Pa=0,$=0,la=0,y=0,za=void 0,cb=sa.__vertexArray,
-Fc=sa.__uvArray,Gc=sa.__uv2Array,Db=sa.__normalArray,Ia=sa.__tangentArray,db=sa.__colorArray,Ja=sa.__skinIndexArray,Ka=sa.__skinWeightArray,sc=sa.__morphTargetsArrays,tc=sa.__morphNormalsArrays,pd=sa.__webglCustomAttributesList,u=void 0,$b=sa.__faceArray,vb=sa.__lineArray,qb=Ha.geometry,Oc=qb.elementsNeedUpdate,Ec=qb.uvsNeedUpdate,Pc=qb.normalsNeedUpdate,Qc=qb.tangentsNeedUpdate,Rc=qb.colorsNeedUpdate,hd=qb.morphTargetsNeedUpdate,uc=qb.vertices,wa=sa.faces3,xa=sa.faces4,kb=qb.faces,qd=qb.faceVertexUvs[0],
-rd=qb.faceVertexUvs[1],vc=qb.skinIndices,pc=qb.skinWeights,qc=qb.morphTargets,Sc=qb.morphNormals;if(qb.verticesNeedUpdate){D=0;for(U=wa.length;D<U;D++)P=kb[wa[D]],Q=uc[P.a],R=uc[P.b],S=uc[P.c],cb[Sa]=Q.x,cb[Sa+1]=Q.y,cb[Sa+2]=Q.z,cb[Sa+3]=R.x,cb[Sa+4]=R.y,cb[Sa+5]=R.z,cb[Sa+6]=S.x,cb[Sa+7]=S.y,cb[Sa+8]=S.z,Sa+=9;D=0;for(U=xa.length;D<U;D++)P=kb[xa[D]],Q=uc[P.a],R=uc[P.b],S=uc[P.c],pa=uc[P.d],cb[Sa]=Q.x,cb[Sa+1]=Q.y,cb[Sa+2]=Q.z,cb[Sa+3]=R.x,cb[Sa+4]=R.y,cb[Sa+5]=R.z,cb[Sa+6]=S.x,cb[Sa+7]=S.y,cb[Sa+
-8]=S.z,cb[Sa+9]=pa.x,cb[Sa+10]=pa.y,cb[Sa+11]=pa.z,Sa+=12;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,cb,qa)}if(hd){bb=0;for(mc=qc.length;bb<mc;bb++){D=la=0;for(U=wa.length;D<U;D++)oc=wa[D],P=kb[oc],Q=qc[bb].vertices[P.a],R=qc[bb].vertices[P.b],S=qc[bb].vertices[P.c],Va=sc[bb],Va[la]=Q.x,Va[la+1]=Q.y,Va[la+2]=Q.z,Va[la+3]=R.x,Va[la+4]=R.y,Va[la+5]=R.z,Va[la+6]=S.x,Va[la+7]=S.y,Va[la+8]=S.z,Ea.morphNormals&&(ab?(hc=Sc[bb].vertexNormals[oc],Ob=hc.a,Pb=hc.b,Qb=hc.c):
-Qb=Pb=Ob=Sc[bb].faceNormals[oc],Wa=tc[bb],Wa[la]=Ob.x,Wa[la+1]=Ob.y,Wa[la+2]=Ob.z,Wa[la+3]=Pb.x,Wa[la+4]=Pb.y,Wa[la+5]=Pb.z,Wa[la+6]=Qb.x,Wa[la+7]=Qb.y,Wa[la+8]=Qb.z),la+=9;D=0;for(U=xa.length;D<U;D++)oc=xa[D],P=kb[oc],Q=qc[bb].vertices[P.a],R=qc[bb].vertices[P.b],S=qc[bb].vertices[P.c],pa=qc[bb].vertices[P.d],Va=sc[bb],Va[la]=Q.x,Va[la+1]=Q.y,Va[la+2]=Q.z,Va[la+3]=R.x,Va[la+4]=R.y,Va[la+5]=R.z,Va[la+6]=S.x,Va[la+7]=S.y,Va[la+8]=S.z,Va[la+9]=pa.x,Va[la+10]=pa.y,Va[la+11]=pa.z,Ea.morphNormals&&(ab?
-(hc=Sc[bb].vertexNormals[oc],Ob=hc.a,Pb=hc.b,Qb=hc.c,xb=hc.d):xb=Qb=Pb=Ob=Sc[bb].faceNormals[oc],Wa=tc[bb],Wa[la]=Ob.x,Wa[la+1]=Ob.y,Wa[la+2]=Ob.z,Wa[la+3]=Pb.x,Wa[la+4]=Pb.y,Wa[la+5]=Pb.z,Wa[la+6]=Qb.x,Wa[la+7]=Qb.y,Wa[la+8]=Qb.z,Wa[la+9]=xb.x,Wa[la+10]=xb.y,Wa[la+11]=xb.z),la+=12;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglMorphTargetsBuffers[bb]);j.bufferData(j.ARRAY_BUFFER,sc[bb],qa);Ea.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglMorphNormalsBuffers[bb]),j.bufferData(j.ARRAY_BUFFER,tc[bb],
-qa))}}if(pc.length){D=0;for(U=wa.length;D<U;D++)P=kb[wa[D]],Ub=pc[P.a],Vb=pc[P.b],Wb=pc[P.c],Ka[$]=Ub.x,Ka[$+1]=Ub.y,Ka[$+2]=Ub.z,Ka[$+3]=Ub.w,Ka[$+4]=Vb.x,Ka[$+5]=Vb.y,Ka[$+6]=Vb.z,Ka[$+7]=Vb.w,Ka[$+8]=Wb.x,Ka[$+9]=Wb.y,Ka[$+10]=Wb.z,Ka[$+11]=Wb.w,Xb=vc[P.a],Yb=vc[P.b],Zb=vc[P.c],Ja[$]=Xb.x,Ja[$+1]=Xb.y,Ja[$+2]=Xb.z,Ja[$+3]=Xb.w,Ja[$+4]=Yb.x,Ja[$+5]=Yb.y,Ja[$+6]=Yb.z,Ja[$+7]=Yb.w,Ja[$+8]=Zb.x,Ja[$+9]=Zb.y,Ja[$+10]=Zb.z,Ja[$+11]=Zb.w,$+=12;D=0;for(U=xa.length;D<U;D++)P=kb[xa[D]],Ub=pc[P.a],Vb=pc[P.b],
-Wb=pc[P.c],Hb=pc[P.d],Ka[$]=Ub.x,Ka[$+1]=Ub.y,Ka[$+2]=Ub.z,Ka[$+3]=Ub.w,Ka[$+4]=Vb.x,Ka[$+5]=Vb.y,Ka[$+6]=Vb.z,Ka[$+7]=Vb.w,Ka[$+8]=Wb.x,Ka[$+9]=Wb.y,Ka[$+10]=Wb.z,Ka[$+11]=Wb.w,Ka[$+12]=Hb.x,Ka[$+13]=Hb.y,Ka[$+14]=Hb.z,Ka[$+15]=Hb.w,Xb=vc[P.a],Yb=vc[P.b],Zb=vc[P.c],Ib=vc[P.d],Ja[$]=Xb.x,Ja[$+1]=Xb.y,Ja[$+2]=Xb.z,Ja[$+3]=Xb.w,Ja[$+4]=Yb.x,Ja[$+5]=Yb.y,Ja[$+6]=Yb.z,Ja[$+7]=Yb.w,Ja[$+8]=Zb.x,Ja[$+9]=Zb.y,Ja[$+10]=Zb.z,Ja[$+11]=Zb.w,Ja[$+12]=Ib.x,Ja[$+13]=Ib.y,Ja[$+14]=Ib.z,Ja[$+15]=Ib.w,$+=16;0<$&&
-(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ja,qa),j.bindBuffer(j.ARRAY_BUFFER,sa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Ka,qa))}if(Rc&&Ya){D=0;for(U=wa.length;D<U;D++)P=kb[wa[D]],Ra=P.vertexColors,nb=P.color,3===Ra.length&&Ya===THREE.VertexColors?(Rb=Ra[0],Sb=Ra[1],Tb=Ra[2]):Tb=Sb=Rb=nb,db[Pa]=Rb.r,db[Pa+1]=Rb.g,db[Pa+2]=Rb.b,db[Pa+3]=Sb.r,db[Pa+4]=Sb.g,db[Pa+5]=Sb.b,db[Pa+6]=Tb.r,db[Pa+7]=Tb.g,db[Pa+8]=Tb.b,Pa+=9;D=0;for(U=xa.length;D<U;D++)P=
-kb[xa[D]],Ra=P.vertexColors,nb=P.color,4===Ra.length&&Ya===THREE.VertexColors?(Rb=Ra[0],Sb=Ra[1],Tb=Ra[2],yb=Ra[3]):yb=Tb=Sb=Rb=nb,db[Pa]=Rb.r,db[Pa+1]=Rb.g,db[Pa+2]=Rb.b,db[Pa+3]=Sb.r,db[Pa+4]=Sb.g,db[Pa+5]=Sb.b,db[Pa+6]=Tb.r,db[Pa+7]=Tb.g,db[Pa+8]=Tb.b,db[Pa+9]=yb.r,db[Pa+10]=yb.g,db[Pa+11]=yb.b,Pa+=12;0<Pa&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,db,qa))}if(Qc&&qb.hasTangents){D=0;for(U=wa.length;D<U;D++)P=kb[wa[D]],eb=P.vertexTangents,Lb=eb[0],Mb=eb[1],
-Nb=eb[2],Ia[Ba]=Lb.x,Ia[Ba+1]=Lb.y,Ia[Ba+2]=Lb.z,Ia[Ba+3]=Lb.w,Ia[Ba+4]=Mb.x,Ia[Ba+5]=Mb.y,Ia[Ba+6]=Mb.z,Ia[Ba+7]=Mb.w,Ia[Ba+8]=Nb.x,Ia[Ba+9]=Nb.y,Ia[Ba+10]=Nb.z,Ia[Ba+11]=Nb.w,Ba+=12;D=0;for(U=xa.length;D<U;D++)P=kb[xa[D]],eb=P.vertexTangents,Lb=eb[0],Mb=eb[1],Nb=eb[2],wb=eb[3],Ia[Ba]=Lb.x,Ia[Ba+1]=Lb.y,Ia[Ba+2]=Lb.z,Ia[Ba+3]=Lb.w,Ia[Ba+4]=Mb.x,Ia[Ba+5]=Mb.y,Ia[Ba+6]=Mb.z,Ia[Ba+7]=Mb.w,Ia[Ba+8]=Nb.x,Ia[Ba+9]=Nb.y,Ia[Ba+10]=Nb.z,Ia[Ba+11]=Nb.w,Ia[Ba+12]=wb.x,Ia[Ba+13]=wb.y,Ia[Ba+14]=wb.z,Ia[Ba+15]=
-wb.w,Ba+=16;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ia,qa)}if(Pc&&Ta){D=0;for(U=wa.length;D<U;D++)if(P=kb[wa[D]],Za=P.vertexNormals,Ua=P.normal,3===Za.length&&ab)for(ya=0;3>ya;ya++)nc=Za[ya],Db[jb]=nc.x,Db[jb+1]=nc.y,Db[jb+2]=nc.z,jb+=3;else for(ya=0;3>ya;ya++)Db[jb]=Ua.x,Db[jb+1]=Ua.y,Db[jb+2]=Ua.z,jb+=3;D=0;for(U=xa.length;D<U;D++)if(P=kb[xa[D]],Za=P.vertexNormals,Ua=P.normal,4===Za.length&&ab)for(ya=0;4>ya;ya++)nc=Za[ya],Db[jb]=nc.x,Db[jb+1]=nc.y,Db[jb+
-2]=nc.z,jb+=3;else for(ya=0;4>ya;ya++)Db[jb]=Ua.x,Db[jb+1]=Ua.y,Db[jb+2]=Ua.z,jb+=3;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Db,qa)}if(Ec&&qd&&$a){D=0;for(U=wa.length;D<U;D++)if(Qa=wa[D],ob=qd[Qa],void 0!==ob)for(ya=0;3>ya;ya++)zc=ob[ya],Fc[ic]=zc.x,Fc[ic+1]=zc.y,ic+=2;D=0;for(U=xa.length;D<U;D++)if(Qa=xa[D],ob=qd[Qa],void 0!==ob)for(ya=0;4>ya;ya++)zc=ob[ya],Fc[ic]=zc.x,Fc[ic+1]=zc.y,ic+=2;0<ic&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,
-Fc,qa))}if(Ec&&rd&&$a){D=0;for(U=wa.length;D<U;D++)if(Qa=wa[D],pb=rd[Qa],void 0!==pb)for(ya=0;3>ya;ya++)Ac=pb[ya],Gc[jc]=Ac.x,Gc[jc+1]=Ac.y,jc+=2;D=0;for(U=xa.length;D<U;D++)if(Qa=xa[D],pb=rd[Qa],void 0!==pb)for(ya=0;4>ya;ya++)Ac=pb[ya],Gc[jc]=Ac.x,Gc[jc+1]=Ac.y,jc+=2;0<jc&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Gc,qa))}if(Oc){D=0;for(U=wa.length;D<U;D++)$b[Cb]=Oa,$b[Cb+1]=Oa+1,$b[Cb+2]=Oa+2,Cb+=3,vb[mb]=Oa,vb[mb+1]=Oa+1,vb[mb+2]=Oa,vb[mb+3]=Oa+2,vb[mb+4]=Oa+
-1,vb[mb+5]=Oa+2,mb+=6,Oa+=3;D=0;for(U=xa.length;D<U;D++)$b[Cb]=Oa,$b[Cb+1]=Oa+1,$b[Cb+2]=Oa+3,$b[Cb+3]=Oa+1,$b[Cb+4]=Oa+2,$b[Cb+5]=Oa+3,Cb+=6,vb[mb]=Oa,vb[mb+1]=Oa+1,vb[mb+2]=Oa,vb[mb+3]=Oa+3,vb[mb+4]=Oa+1,vb[mb+5]=Oa+2,vb[mb+6]=Oa+2,vb[mb+7]=Oa+3,mb+=8,Oa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,sa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,$b,qa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,sa.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,vb,qa)}if(pd){ya=0;for(ec=pd.length;ya<ec;ya++)if(u=
-pd[ya],u.__original.needsUpdate){y=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(U=wa.length;D<U;D++)P=kb[wa[D]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],y+=3;D=0;for(U=xa.length;D<U;D++)P=kb[xa[D]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],u.array[y+3]=u.value[P.d],y+=4}else{if("faces"===u.boundTo){D=0;for(U=wa.length;D<U;D++)za=u.value[wa[D]],u.array[y]=za,u.array[y+1]=za,u.array[y+2]=za,y+=3;D=0;for(U=
-xa.length;D<U;D++)za=u.value[xa[D]],u.array[y]=za,u.array[y+1]=za,u.array[y+2]=za,u.array[y+3]=za,y+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(U=wa.length;D<U;D++)P=kb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;D=0;for(U=xa.length;D<U;D++)P=kb[xa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+
-2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=pa.x,u.array[y+7]=pa.y,y+=8}else{if("faces"===u.boundTo){D=0;for(U=wa.length;D<U;D++)S=R=Q=za=u.value[wa[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;D=0;for(U=xa.length;D<U;D++)pa=S=R=Q=za=u.value[xa[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=pa.x,u.array[y+7]=pa.y,y+=8}}else if(3===u.size){var Z;
-Z="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(U=wa.length;D<U;D++)P=kb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;D=0;for(U=xa.length;D<U;D++)P=kb[xa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],
-u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}else if("faces"===u.boundTo){D=0;for(U=wa.length;D<U;D++)S=R=Q=za=u.value[wa[D]],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;D=0;for(U=
-xa.length;D<U;D++)pa=S=R=Q=za=u.value[xa[D]],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}else if("faceVertices"===u.boundTo){D=0;for(U=wa.length;D<U;D++)za=u.value[wa[D]],Q=za[0],R=za[1],S=za[2],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+
-4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;D=0;for(U=xa.length;D<U;D++)za=u.value[xa[D]],Q=za[0],R=za[1],S=za[2],pa=za[3],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=
-0;for(U=wa.length;D<U;D++)P=kb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(U=xa.length;D<U;D++)P=kb[xa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+
-6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}else if("faces"===u.boundTo){D=0;for(U=wa.length;D<U;D++)S=R=Q=za=u.value[wa[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(U=xa.length;D<U;D++)pa=S=R=
-Q=za=u.value[xa[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}else if("faceVertices"===u.boundTo){D=0;for(U=wa.length;D<U;D++)za=u.value[wa[D]],Q=za[0],R=za[1],S=za[2],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+
-5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(U=xa.length;D<U;D++)za=u.value[xa[D]],Q=za[0],R=za[1],S=za[2],pa=za[3],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,
+!1;else{for(var Da=0,Hb=N.geometryGroupsList.length;Da<Hb;Da++)if(ua=N.geometryGroupsList[Da],ta=e(ia,ua),N.buffersNeedUpdate&&d(ua,ia),oa=ta.attributes&&x(ta),N.verticesNeedUpdate||N.morphTargetsNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate||oa){var sa=ua,Ha=ia,qa=j.DYNAMIC_DRAW,Na=!N.dynamic,Ea=ta;if(sa.__inittedArrays){var Ua=f(Ea),Za=Ea.vertexColors?Ea.vertexColors:!1,ab=g(Ea),bb=Ua===THREE.SmoothShading,E=void 0,U=void 0,Ra=void 0,
+P=void 0,$a=void 0,Va=void 0,Sa=void 0,ob=void 0,fb=void 0,pb=void 0,qb=void 0,Q=void 0,R=void 0,S=void 0,pa=void 0,Mb=void 0,Nb=void 0,Ob=void 0,xb=void 0,Pb=void 0,Qb=void 0,Rb=void 0,yb=void 0,Sb=void 0,Tb=void 0,Ub=void 0,zb=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Ib=void 0,Yb=void 0,Zb=void 0,$b=void 0,Jb=void 0,ya=void 0,fc=void 0,nc=void 0,zc=void 0,Ac=void 0,cb=void 0,mc=void 0,Wa=void 0,Xa=void 0,oc=void 0,hc=void 0,Oa=0,Ta=0,ic=0,jc=0,Db=0,kb=0,Ba=0,nb=0,Qa=0,$=0,la=0,y=0,za=void 0,db=sa.__vertexArray,
+Fc=sa.__uvArray,Gc=sa.__uv2Array,Eb=sa.__normalArray,Ia=sa.__tangentArray,eb=sa.__colorArray,Ja=sa.__skinIndexArray,Ka=sa.__skinWeightArray,sc=sa.__morphTargetsArrays,tc=sa.__morphNormalsArrays,pd=sa.__webglCustomAttributesList,u=void 0,ac=sa.__faceArray,wb=sa.__lineArray,rb=Ha.geometry,Oc=rb.elementsNeedUpdate,Ec=rb.uvsNeedUpdate,Pc=rb.normalsNeedUpdate,Qc=rb.tangentsNeedUpdate,Rc=rb.colorsNeedUpdate,hd=rb.morphTargetsNeedUpdate,uc=rb.vertices,wa=sa.faces3,xa=sa.faces4,lb=rb.faces,qd=rb.faceVertexUvs[0],
+rd=rb.faceVertexUvs[1],vc=rb.skinIndices,pc=rb.skinWeights,qc=rb.morphTargets,Sc=rb.morphNormals;if(rb.verticesNeedUpdate){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Q=uc[P.a],R=uc[P.b],S=uc[P.c],db[Ta]=Q.x,db[Ta+1]=Q.y,db[Ta+2]=Q.z,db[Ta+3]=R.x,db[Ta+4]=R.y,db[Ta+5]=R.z,db[Ta+6]=S.x,db[Ta+7]=S.y,db[Ta+8]=S.z,Ta+=9;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Q=uc[P.a],R=uc[P.b],S=uc[P.c],pa=uc[P.d],db[Ta]=Q.x,db[Ta+1]=Q.y,db[Ta+2]=Q.z,db[Ta+3]=R.x,db[Ta+4]=R.y,db[Ta+5]=R.z,db[Ta+6]=S.x,db[Ta+7]=S.y,db[Ta+
+8]=S.z,db[Ta+9]=pa.x,db[Ta+10]=pa.y,db[Ta+11]=pa.z,Ta+=12;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,db,qa)}if(hd){cb=0;for(mc=qc.length;cb<mc;cb++){E=la=0;for(U=wa.length;E<U;E++)oc=wa[E],P=lb[oc],Q=qc[cb].vertices[P.a],R=qc[cb].vertices[P.b],S=qc[cb].vertices[P.c],Wa=sc[cb],Wa[la]=Q.x,Wa[la+1]=Q.y,Wa[la+2]=Q.z,Wa[la+3]=R.x,Wa[la+4]=R.y,Wa[la+5]=R.z,Wa[la+6]=S.x,Wa[la+7]=S.y,Wa[la+8]=S.z,Ea.morphNormals&&(bb?(hc=Sc[cb].vertexNormals[oc],Pb=hc.a,Qb=hc.b,Rb=hc.c):
+Rb=Qb=Pb=Sc[cb].faceNormals[oc],Xa=tc[cb],Xa[la]=Pb.x,Xa[la+1]=Pb.y,Xa[la+2]=Pb.z,Xa[la+3]=Qb.x,Xa[la+4]=Qb.y,Xa[la+5]=Qb.z,Xa[la+6]=Rb.x,Xa[la+7]=Rb.y,Xa[la+8]=Rb.z),la+=9;E=0;for(U=xa.length;E<U;E++)oc=xa[E],P=lb[oc],Q=qc[cb].vertices[P.a],R=qc[cb].vertices[P.b],S=qc[cb].vertices[P.c],pa=qc[cb].vertices[P.d],Wa=sc[cb],Wa[la]=Q.x,Wa[la+1]=Q.y,Wa[la+2]=Q.z,Wa[la+3]=R.x,Wa[la+4]=R.y,Wa[la+5]=R.z,Wa[la+6]=S.x,Wa[la+7]=S.y,Wa[la+8]=S.z,Wa[la+9]=pa.x,Wa[la+10]=pa.y,Wa[la+11]=pa.z,Ea.morphNormals&&(bb?
+(hc=Sc[cb].vertexNormals[oc],Pb=hc.a,Qb=hc.b,Rb=hc.c,yb=hc.d):yb=Rb=Qb=Pb=Sc[cb].faceNormals[oc],Xa=tc[cb],Xa[la]=Pb.x,Xa[la+1]=Pb.y,Xa[la+2]=Pb.z,Xa[la+3]=Qb.x,Xa[la+4]=Qb.y,Xa[la+5]=Qb.z,Xa[la+6]=Rb.x,Xa[la+7]=Rb.y,Xa[la+8]=Rb.z,Xa[la+9]=yb.x,Xa[la+10]=yb.y,Xa[la+11]=yb.z),la+=12;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglMorphTargetsBuffers[cb]);j.bufferData(j.ARRAY_BUFFER,sc[cb],qa);Ea.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglMorphNormalsBuffers[cb]),j.bufferData(j.ARRAY_BUFFER,tc[cb],
+qa))}}if(pc.length){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Vb=pc[P.a],Wb=pc[P.b],Xb=pc[P.c],Ka[$]=Vb.x,Ka[$+1]=Vb.y,Ka[$+2]=Vb.z,Ka[$+3]=Vb.w,Ka[$+4]=Wb.x,Ka[$+5]=Wb.y,Ka[$+6]=Wb.z,Ka[$+7]=Wb.w,Ka[$+8]=Xb.x,Ka[$+9]=Xb.y,Ka[$+10]=Xb.z,Ka[$+11]=Xb.w,Yb=vc[P.a],Zb=vc[P.b],$b=vc[P.c],Ja[$]=Yb.x,Ja[$+1]=Yb.y,Ja[$+2]=Yb.z,Ja[$+3]=Yb.w,Ja[$+4]=Zb.x,Ja[$+5]=Zb.y,Ja[$+6]=Zb.z,Ja[$+7]=Zb.w,Ja[$+8]=$b.x,Ja[$+9]=$b.y,Ja[$+10]=$b.z,Ja[$+11]=$b.w,$+=12;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Vb=pc[P.a],Wb=pc[P.b],
+Xb=pc[P.c],Ib=pc[P.d],Ka[$]=Vb.x,Ka[$+1]=Vb.y,Ka[$+2]=Vb.z,Ka[$+3]=Vb.w,Ka[$+4]=Wb.x,Ka[$+5]=Wb.y,Ka[$+6]=Wb.z,Ka[$+7]=Wb.w,Ka[$+8]=Xb.x,Ka[$+9]=Xb.y,Ka[$+10]=Xb.z,Ka[$+11]=Xb.w,Ka[$+12]=Ib.x,Ka[$+13]=Ib.y,Ka[$+14]=Ib.z,Ka[$+15]=Ib.w,Yb=vc[P.a],Zb=vc[P.b],$b=vc[P.c],Jb=vc[P.d],Ja[$]=Yb.x,Ja[$+1]=Yb.y,Ja[$+2]=Yb.z,Ja[$+3]=Yb.w,Ja[$+4]=Zb.x,Ja[$+5]=Zb.y,Ja[$+6]=Zb.z,Ja[$+7]=Zb.w,Ja[$+8]=$b.x,Ja[$+9]=$b.y,Ja[$+10]=$b.z,Ja[$+11]=$b.w,Ja[$+12]=Jb.x,Ja[$+13]=Jb.y,Ja[$+14]=Jb.z,Ja[$+15]=Jb.w,$+=16;0<$&&
+(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ja,qa),j.bindBuffer(j.ARRAY_BUFFER,sa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Ka,qa))}if(Rc&&Za){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Sa=P.vertexColors,ob=P.color,3===Sa.length&&Za===THREE.VertexColors?(Sb=Sa[0],Tb=Sa[1],Ub=Sa[2]):Ub=Tb=Sb=ob,eb[Qa]=Sb.r,eb[Qa+1]=Sb.g,eb[Qa+2]=Sb.b,eb[Qa+3]=Tb.r,eb[Qa+4]=Tb.g,eb[Qa+5]=Tb.b,eb[Qa+6]=Ub.r,eb[Qa+7]=Ub.g,eb[Qa+8]=Ub.b,Qa+=9;E=0;for(U=xa.length;E<U;E++)P=
+lb[xa[E]],Sa=P.vertexColors,ob=P.color,4===Sa.length&&Za===THREE.VertexColors?(Sb=Sa[0],Tb=Sa[1],Ub=Sa[2],zb=Sa[3]):zb=Ub=Tb=Sb=ob,eb[Qa]=Sb.r,eb[Qa+1]=Sb.g,eb[Qa+2]=Sb.b,eb[Qa+3]=Tb.r,eb[Qa+4]=Tb.g,eb[Qa+5]=Tb.b,eb[Qa+6]=Ub.r,eb[Qa+7]=Ub.g,eb[Qa+8]=Ub.b,eb[Qa+9]=zb.r,eb[Qa+10]=zb.g,eb[Qa+11]=zb.b,Qa+=12;0<Qa&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,eb,qa))}if(Qc&&rb.hasTangents){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],fb=P.vertexTangents,Mb=fb[0],Nb=fb[1],
+Ob=fb[2],Ia[Ba]=Mb.x,Ia[Ba+1]=Mb.y,Ia[Ba+2]=Mb.z,Ia[Ba+3]=Mb.w,Ia[Ba+4]=Nb.x,Ia[Ba+5]=Nb.y,Ia[Ba+6]=Nb.z,Ia[Ba+7]=Nb.w,Ia[Ba+8]=Ob.x,Ia[Ba+9]=Ob.y,Ia[Ba+10]=Ob.z,Ia[Ba+11]=Ob.w,Ba+=12;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],fb=P.vertexTangents,Mb=fb[0],Nb=fb[1],Ob=fb[2],xb=fb[3],Ia[Ba]=Mb.x,Ia[Ba+1]=Mb.y,Ia[Ba+2]=Mb.z,Ia[Ba+3]=Mb.w,Ia[Ba+4]=Nb.x,Ia[Ba+5]=Nb.y,Ia[Ba+6]=Nb.z,Ia[Ba+7]=Nb.w,Ia[Ba+8]=Ob.x,Ia[Ba+9]=Ob.y,Ia[Ba+10]=Ob.z,Ia[Ba+11]=Ob.w,Ia[Ba+12]=xb.x,Ia[Ba+13]=xb.y,Ia[Ba+14]=xb.z,Ia[Ba+15]=
+xb.w,Ba+=16;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ia,qa)}if(Pc&&Ua){E=0;for(U=wa.length;E<U;E++)if(P=lb[wa[E]],$a=P.vertexNormals,Va=P.normal,3===$a.length&&bb)for(ya=0;3>ya;ya++)nc=$a[ya],Eb[kb]=nc.x,Eb[kb+1]=nc.y,Eb[kb+2]=nc.z,kb+=3;else for(ya=0;3>ya;ya++)Eb[kb]=Va.x,Eb[kb+1]=Va.y,Eb[kb+2]=Va.z,kb+=3;E=0;for(U=xa.length;E<U;E++)if(P=lb[xa[E]],$a=P.vertexNormals,Va=P.normal,4===$a.length&&bb)for(ya=0;4>ya;ya++)nc=$a[ya],Eb[kb]=nc.x,Eb[kb+1]=nc.y,Eb[kb+
+2]=nc.z,kb+=3;else for(ya=0;4>ya;ya++)Eb[kb]=Va.x,Eb[kb+1]=Va.y,Eb[kb+2]=Va.z,kb+=3;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Eb,qa)}if(Ec&&qd&&ab){E=0;for(U=wa.length;E<U;E++)if(Ra=wa[E],pb=qd[Ra],void 0!==pb)for(ya=0;3>ya;ya++)zc=pb[ya],Fc[ic]=zc.x,Fc[ic+1]=zc.y,ic+=2;E=0;for(U=xa.length;E<U;E++)if(Ra=xa[E],pb=qd[Ra],void 0!==pb)for(ya=0;4>ya;ya++)zc=pb[ya],Fc[ic]=zc.x,Fc[ic+1]=zc.y,ic+=2;0<ic&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,
+Fc,qa))}if(Ec&&rd&&ab){E=0;for(U=wa.length;E<U;E++)if(Ra=wa[E],qb=rd[Ra],void 0!==qb)for(ya=0;3>ya;ya++)Ac=qb[ya],Gc[jc]=Ac.x,Gc[jc+1]=Ac.y,jc+=2;E=0;for(U=xa.length;E<U;E++)if(Ra=xa[E],qb=rd[Ra],void 0!==qb)for(ya=0;4>ya;ya++)Ac=qb[ya],Gc[jc]=Ac.x,Gc[jc+1]=Ac.y,jc+=2;0<jc&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Gc,qa))}if(Oc){E=0;for(U=wa.length;E<U;E++)ac[Db]=Oa,ac[Db+1]=Oa+1,ac[Db+2]=Oa+2,Db+=3,wb[nb]=Oa,wb[nb+1]=Oa+1,wb[nb+2]=Oa,wb[nb+3]=Oa+2,wb[nb+4]=Oa+
+1,wb[nb+5]=Oa+2,nb+=6,Oa+=3;E=0;for(U=xa.length;E<U;E++)ac[Db]=Oa,ac[Db+1]=Oa+1,ac[Db+2]=Oa+3,ac[Db+3]=Oa+1,ac[Db+4]=Oa+2,ac[Db+5]=Oa+3,Db+=6,wb[nb]=Oa,wb[nb+1]=Oa+1,wb[nb+2]=Oa,wb[nb+3]=Oa+3,wb[nb+4]=Oa+1,wb[nb+5]=Oa+2,wb[nb+6]=Oa+2,wb[nb+7]=Oa+3,nb+=8,Oa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,sa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ac,qa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,sa.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,wb,qa)}if(pd){ya=0;for(fc=pd.length;ya<fc;ya++)if(u=
+pd[ya],u.__original.needsUpdate){y=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],y+=3;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],u.array[y+3]=u.value[P.d],y+=4}else{if("faces"===u.boundTo){E=0;for(U=wa.length;E<U;E++)za=u.value[wa[E]],u.array[y]=za,u.array[y+1]=za,u.array[y+2]=za,y+=3;E=0;for(U=
+xa.length;E<U;E++)za=u.value[xa[E]],u.array[y]=za,u.array[y+1]=za,u.array[y+2]=za,u.array[y+3]=za,y+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+
+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=pa.x,u.array[y+7]=pa.y,y+=8}else{if("faces"===u.boundTo){E=0;for(U=wa.length;E<U;E++)S=R=Q=za=u.value[wa[E]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;E=0;for(U=xa.length;E<U;E++)pa=S=R=Q=za=u.value[xa[E]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=pa.x,u.array[y+7]=pa.y,y+=8}}else if(3===u.size){var Z;
+Z="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],
+u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}else if("faces"===u.boundTo){E=0;for(U=wa.length;E<U;E++)S=R=Q=za=u.value[wa[E]],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;E=0;for(U=
+xa.length;E<U;E++)pa=S=R=Q=za=u.value[xa[E]],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}else if("faceVertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)za=u.value[wa[E]],Q=za[0],R=za[1],S=za[2],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+
+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;E=0;for(U=xa.length;E<U;E++)za=u.value[xa[E]],Q=za[0],R=za[1],S=za[2],pa=za[3],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=
+0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+
+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}else if("faces"===u.boundTo){E=0;for(U=wa.length;E<U;E++)S=R=Q=za=u.value[wa[E]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;E=0;for(U=xa.length;E<U;E++)pa=S=R=
+Q=za=u.value[xa[E]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}else if("faceVertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)za=u.value[wa[E]],Q=za[0],R=za[1],S=za[2],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+
+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;E=0;for(U=xa.length;E<U;E++)za=u.value[xa[E]],Q=za[0],R=za[1],S=za[2],pa=za[3],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,
 u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,qa)}}Na&&(delete sa.__inittedArrays,delete sa.__colorArray,delete sa.__normalArray,delete sa.__tangentArray,delete sa.__uvArray,delete sa.__uv2Array,delete sa.__faceArray,delete sa.__vertexArray,delete sa.__lineArray,delete sa.__skinIndexArray,delete sa.__skinWeightArray)}}N.verticesNeedUpdate=!1;N.morphTargetsNeedUpdate=!1;N.elementsNeedUpdate=!1;N.uvsNeedUpdate=!1;N.normalsNeedUpdate=!1;N.colorsNeedUpdate=!1;N.tangentsNeedUpdate=!1;N.buffersNeedUpdate=
-!1;ta.attributes&&x(ta)}else if(ia instanceof THREE.Ribbon){ta=e(ia,N);oa=ta.attributes&&t(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.normalsNeedUpdate||oa){var Eb=N,Tc=j.DYNAMIC_DRAW,Hc=void 0,Ic=void 0,Jc=void 0,Uc=void 0,Aa=void 0,Vc=void 0,Wc=void 0,Xc=void 0,yd=void 0,gb=void 0,Bc=void 0,Fa=void 0,rb=void 0,zd=Eb.vertices,Ad=Eb.colors,Bd=Eb.normals,id=zd.length,jd=Ad.length,kd=Bd.length,Yc=Eb.__vertexArray,Zc=Eb.__colorArray,$c=Eb.__normalArray,ld=Eb.colorsNeedUpdate,md=Eb.normalsNeedUpdate,
-sd=Eb.__webglCustomAttributesList;if(Eb.verticesNeedUpdate){for(Hc=0;Hc<id;Hc++)Uc=zd[Hc],Aa=3*Hc,Yc[Aa]=Uc.x,Yc[Aa+1]=Uc.y,Yc[Aa+2]=Uc.z;j.bindBuffer(j.ARRAY_BUFFER,Eb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Yc,Tc)}if(ld){for(Ic=0;Ic<jd;Ic++)Vc=Ad[Ic],Aa=3*Ic,Zc[Aa]=Vc.r,Zc[Aa+1]=Vc.g,Zc[Aa+2]=Vc.b;j.bindBuffer(j.ARRAY_BUFFER,Eb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Zc,Tc)}if(md){for(Jc=0;Jc<kd;Jc++)Wc=Bd[Jc],Aa=3*Jc,$c[Aa]=Wc.x,$c[Aa+1]=Wc.y,$c[Aa+2]=Wc.z;j.bindBuffer(j.ARRAY_BUFFER,
-Eb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,$c,Tc)}if(sd){Xc=0;for(yd=sd.length;Xc<yd;Xc++)if(Fa=sd[Xc],Fa.needsUpdate&&(void 0===Fa.boundTo||"vertices"===Fa.boundTo)){Aa=0;Bc=Fa.value.length;if(1===Fa.size)for(gb=0;gb<Bc;gb++)Fa.array[gb]=Fa.value[gb];else if(2===Fa.size)for(gb=0;gb<Bc;gb++)rb=Fa.value[gb],Fa.array[Aa]=rb.x,Fa.array[Aa+1]=rb.y,Aa+=2;else if(3===Fa.size)if("c"===Fa.type)for(gb=0;gb<Bc;gb++)rb=Fa.value[gb],Fa.array[Aa]=rb.r,Fa.array[Aa+1]=rb.g,Fa.array[Aa+2]=rb.b,Aa+=3;else for(gb=
-0;gb<Bc;gb++)rb=Fa.value[gb],Fa.array[Aa]=rb.x,Fa.array[Aa+1]=rb.y,Fa.array[Aa+2]=rb.z,Aa+=3;else if(4===Fa.size)for(gb=0;gb<Bc;gb++)rb=Fa.value[gb],Fa.array[Aa]=rb.x,Fa.array[Aa+1]=rb.y,Fa.array[Aa+2]=rb.z,Fa.array[Aa+3]=rb.w,Aa+=4;j.bindBuffer(j.ARRAY_BUFFER,Fa.buffer);j.bufferData(j.ARRAY_BUFFER,Fa.array,Tc)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.normalsNeedUpdate=!1;ta.attributes&&x(ta)}else if(ia instanceof THREE.Line)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&
-i(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ta=e(ia,N);oa=ta.attributes&&t(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.lineDistancesNeedUpdate||oa){var Fb=N,ad=j.DYNAMIC_DRAW,Kc=void 0,Lc=void 0,Mc=void 0,bd=void 0,La=void 0,cd=void 0,Cd=Fb.vertices,Dd=Fb.colors,Ed=Fb.lineDistances,nd=Cd.length,Kd=Dd.length,Ld=Ed.length,dd=Fb.__vertexArray,ed=Fb.__colorArray,Fd=Fb.__lineDistanceArray,Md=Fb.colorsNeedUpdate,Nd=Fb.lineDistancesNeedUpdate,td=Fb.__webglCustomAttributesList,
-fd=void 0,Gd=void 0,hb=void 0,Cc=void 0,sb=void 0,Ga=void 0;if(Fb.verticesNeedUpdate){for(Kc=0;Kc<nd;Kc++)bd=Cd[Kc],La=3*Kc,dd[La]=bd.x,dd[La+1]=bd.y,dd[La+2]=bd.z;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,dd,ad)}if(Md){for(Lc=0;Lc<Kd;Lc++)cd=Dd[Lc],La=3*Lc,ed[La]=cd.r,ed[La+1]=cd.g,ed[La+2]=cd.b;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,ed,ad)}if(Nd){for(Mc=0;Mc<Ld;Mc++)Fd[Mc]=Ed[Mc];j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglLineDistanceBuffer);
-j.bufferData(j.ARRAY_BUFFER,Fd,ad)}if(td){fd=0;for(Gd=td.length;fd<Gd;fd++)if(Ga=td[fd],Ga.needsUpdate&&(void 0===Ga.boundTo||"vertices"===Ga.boundTo)){La=0;Cc=Ga.value.length;if(1===Ga.size)for(hb=0;hb<Cc;hb++)Ga.array[hb]=Ga.value[hb];else if(2===Ga.size)for(hb=0;hb<Cc;hb++)sb=Ga.value[hb],Ga.array[La]=sb.x,Ga.array[La+1]=sb.y,La+=2;else if(3===Ga.size)if("c"===Ga.type)for(hb=0;hb<Cc;hb++)sb=Ga.value[hb],Ga.array[La]=sb.r,Ga.array[La+1]=sb.g,Ga.array[La+2]=sb.b,La+=3;else for(hb=0;hb<Cc;hb++)sb=
-Ga.value[hb],Ga.array[La]=sb.x,Ga.array[La+1]=sb.y,Ga.array[La+2]=sb.z,La+=3;else if(4===Ga.size)for(hb=0;hb<Cc;hb++)sb=Ga.value[hb],Ga.array[La]=sb.x,Ga.array[La+1]=sb.y,Ga.array[La+2]=sb.z,Ga.array[La+3]=sb.w,La+=4;j.bindBuffer(j.ARRAY_BUFFER,Ga.buffer);j.bufferData(j.ARRAY_BUFFER,Ga.array,ad)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.lineDistancesNeedUpdate=!1;ta.attributes&&x(ta)}else if(ia instanceof THREE.ParticleSystem)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&
-i(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ta=e(ia,N);oa=ta.attributes&&t(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||ia.sortParticles||oa){var ac=N,ud=j.DYNAMIC_DRAW,Nc=ia,tb=void 0,bc=void 0,cc=void 0,ca=void 0,dc=void 0,rc=void 0,gd=ac.vertices,vd=gd.length,wd=ac.colors,Hd=wd.length,wc=ac.__vertexArray,xc=ac.__colorArray,kc=ac.__sortArray,Id=ac.verticesNeedUpdate,Jd=ac.colorsNeedUpdate,lc=ac.__webglCustomAttributesList,Jb=void 0,Dc=void 0,na=void 0,Kb=
-void 0,Ca=void 0,ba=void 0;if(Nc.sortParticles){ub.copy(fc);ub.multiply(Nc.matrixWorld);for(tb=0;tb<vd;tb++)cc=gd[tb],gc.copy(cc),gc.applyProjection(ub),kc[tb]=[gc.z,tb];kc.sort(m);for(tb=0;tb<vd;tb++)cc=gd[kc[tb][1]],ca=3*tb,wc[ca]=cc.x,wc[ca+1]=cc.y,wc[ca+2]=cc.z;for(bc=0;bc<Hd;bc++)ca=3*bc,rc=wd[kc[bc][1]],xc[ca]=rc.r,xc[ca+1]=rc.g,xc[ca+2]=rc.b;if(lc){Jb=0;for(Dc=lc.length;Jb<Dc;Jb++)if(ba=lc[Jb],void 0===ba.boundTo||"vertices"===ba.boundTo)if(ca=0,Kb=ba.value.length,1===ba.size)for(na=0;na<Kb;na++)dc=
-kc[na][1],ba.array[na]=ba.value[dc];else if(2===ba.size)for(na=0;na<Kb;na++)dc=kc[na][1],Ca=ba.value[dc],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(na=0;na<Kb;na++)dc=kc[na][1],Ca=ba.value[dc],ba.array[ca]=Ca.r,ba.array[ca+1]=Ca.g,ba.array[ca+2]=Ca.b,ca+=3;else for(na=0;na<Kb;na++)dc=kc[na][1],Ca=ba.value[dc],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ca+=3;else if(4===ba.size)for(na=0;na<Kb;na++)dc=kc[na][1],Ca=ba.value[dc],ba.array[ca]=Ca.x,
-ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ba.array[ca+3]=Ca.w,ca+=4}}else{if(Id)for(tb=0;tb<vd;tb++)cc=gd[tb],ca=3*tb,wc[ca]=cc.x,wc[ca+1]=cc.y,wc[ca+2]=cc.z;if(Jd)for(bc=0;bc<Hd;bc++)rc=wd[bc],ca=3*bc,xc[ca]=rc.r,xc[ca+1]=rc.g,xc[ca+2]=rc.b;if(lc){Jb=0;for(Dc=lc.length;Jb<Dc;Jb++)if(ba=lc[Jb],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo))if(Kb=ba.value.length,ca=0,1===ba.size)for(na=0;na<Kb;na++)ba.array[na]=ba.value[na];else if(2===ba.size)for(na=0;na<Kb;na++)Ca=ba.value[na],ba.array[ca]=
-Ca.x,ba.array[ca+1]=Ca.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(na=0;na<Kb;na++)Ca=ba.value[na],ba.array[ca]=Ca.r,ba.array[ca+1]=Ca.g,ba.array[ca+2]=Ca.b,ca+=3;else for(na=0;na<Kb;na++)Ca=ba.value[na],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ca+=3;else if(4===ba.size)for(na=0;na<Kb;na++)Ca=ba.value[na],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ba.array[ca+3]=Ca.w,ca+=4}}if(Id||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ac.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,
-wc,ud);if(Jd||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ac.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xc,ud);if(lc){Jb=0;for(Dc=lc.length;Jb<Dc;Jb++)if(ba=lc[Jb],ba.needsUpdate||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ba.buffer),j.bufferData(j.ARRAY_BUFFER,ba.array,ud)}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;ta.attributes&&x(ta)}}};this.initMaterial=function(a,b,c,d){var e,f,g,i;a.addEventListener("dispose",O);var h,k,m,n,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof
-THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.LineDashedMaterial?l="dashed":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var p=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,s,r;e=g=s=r=
-p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&s++,q instanceof THREE.SpotLight&&r++,q instanceof THREE.HemisphereLight&&p++);e=g;f=s;g=r;i=p;p=q=0;for(r=b.length;p<r;p++)s=b[p],s.castShadow&&(s instanceof THREE.SpotLight&&q++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&q++);n=q;tc&&d&&d.useVertexTexture?m=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&
-(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),m=b);a:{s=a.fragmentShader;r=a.vertexShader;p=a.uniforms;b=a.attributes;q=a.defines;var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,
-skinning:a.skinning,maxBones:m,useVertexTexture:tc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:i,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
-alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,w,d=[];l?d.push(l):(d.push(s),d.push(r));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);l=d.join();t=0;for(v=va.length;t<v;t++)if(d=va[t],d.code===l){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");
-v=[];for(w in q)d=q[w],!1!==d&&(d="#define "+w+" "+d,v.push(d));d=v.join("\n");w=j.createProgram();v=["precision "+W+" float;",d,sc?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,
+!1;ta.attributes&&t(ta)}else if(ia instanceof THREE.Ribbon){ta=e(ia,N);oa=ta.attributes&&x(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.normalsNeedUpdate||oa){var Fb=N,Tc=j.DYNAMIC_DRAW,Hc=void 0,Ic=void 0,Jc=void 0,Uc=void 0,Aa=void 0,Vc=void 0,Wc=void 0,Xc=void 0,yd=void 0,hb=void 0,Bc=void 0,Fa=void 0,sb=void 0,zd=Fb.vertices,Ad=Fb.colors,Bd=Fb.normals,id=zd.length,jd=Ad.length,kd=Bd.length,Yc=Fb.__vertexArray,Zc=Fb.__colorArray,$c=Fb.__normalArray,ld=Fb.colorsNeedUpdate,md=Fb.normalsNeedUpdate,
+sd=Fb.__webglCustomAttributesList;if(Fb.verticesNeedUpdate){for(Hc=0;Hc<id;Hc++)Uc=zd[Hc],Aa=3*Hc,Yc[Aa]=Uc.x,Yc[Aa+1]=Uc.y,Yc[Aa+2]=Uc.z;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Yc,Tc)}if(ld){for(Ic=0;Ic<jd;Ic++)Vc=Ad[Ic],Aa=3*Ic,Zc[Aa]=Vc.r,Zc[Aa+1]=Vc.g,Zc[Aa+2]=Vc.b;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Zc,Tc)}if(md){for(Jc=0;Jc<kd;Jc++)Wc=Bd[Jc],Aa=3*Jc,$c[Aa]=Wc.x,$c[Aa+1]=Wc.y,$c[Aa+2]=Wc.z;j.bindBuffer(j.ARRAY_BUFFER,
+Fb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,$c,Tc)}if(sd){Xc=0;for(yd=sd.length;Xc<yd;Xc++)if(Fa=sd[Xc],Fa.needsUpdate&&(void 0===Fa.boundTo||"vertices"===Fa.boundTo)){Aa=0;Bc=Fa.value.length;if(1===Fa.size)for(hb=0;hb<Bc;hb++)Fa.array[hb]=Fa.value[hb];else if(2===Fa.size)for(hb=0;hb<Bc;hb++)sb=Fa.value[hb],Fa.array[Aa]=sb.x,Fa.array[Aa+1]=sb.y,Aa+=2;else if(3===Fa.size)if("c"===Fa.type)for(hb=0;hb<Bc;hb++)sb=Fa.value[hb],Fa.array[Aa]=sb.r,Fa.array[Aa+1]=sb.g,Fa.array[Aa+2]=sb.b,Aa+=3;else for(hb=
+0;hb<Bc;hb++)sb=Fa.value[hb],Fa.array[Aa]=sb.x,Fa.array[Aa+1]=sb.y,Fa.array[Aa+2]=sb.z,Aa+=3;else if(4===Fa.size)for(hb=0;hb<Bc;hb++)sb=Fa.value[hb],Fa.array[Aa]=sb.x,Fa.array[Aa+1]=sb.y,Fa.array[Aa+2]=sb.z,Fa.array[Aa+3]=sb.w,Aa+=4;j.bindBuffer(j.ARRAY_BUFFER,Fa.buffer);j.bufferData(j.ARRAY_BUFFER,Fa.array,Tc)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.normalsNeedUpdate=!1;ta.attributes&&t(ta)}else if(ia instanceof THREE.Line)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&
+i(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ta=e(ia,N);oa=ta.attributes&&x(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.lineDistancesNeedUpdate||oa){var Gb=N,ad=j.DYNAMIC_DRAW,Kc=void 0,Lc=void 0,Mc=void 0,bd=void 0,La=void 0,cd=void 0,Cd=Gb.vertices,Dd=Gb.colors,Ed=Gb.lineDistances,nd=Cd.length,Kd=Dd.length,Ld=Ed.length,dd=Gb.__vertexArray,ed=Gb.__colorArray,Fd=Gb.__lineDistanceArray,Md=Gb.colorsNeedUpdate,Nd=Gb.lineDistancesNeedUpdate,td=Gb.__webglCustomAttributesList,
+fd=void 0,Gd=void 0,ib=void 0,Cc=void 0,tb=void 0,Ga=void 0;if(Gb.verticesNeedUpdate){for(Kc=0;Kc<nd;Kc++)bd=Cd[Kc],La=3*Kc,dd[La]=bd.x,dd[La+1]=bd.y,dd[La+2]=bd.z;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,dd,ad)}if(Md){for(Lc=0;Lc<Kd;Lc++)cd=Dd[Lc],La=3*Lc,ed[La]=cd.r,ed[La+1]=cd.g,ed[La+2]=cd.b;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,ed,ad)}if(Nd){for(Mc=0;Mc<Ld;Mc++)Fd[Mc]=Ed[Mc];j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglLineDistanceBuffer);
+j.bufferData(j.ARRAY_BUFFER,Fd,ad)}if(td){fd=0;for(Gd=td.length;fd<Gd;fd++)if(Ga=td[fd],Ga.needsUpdate&&(void 0===Ga.boundTo||"vertices"===Ga.boundTo)){La=0;Cc=Ga.value.length;if(1===Ga.size)for(ib=0;ib<Cc;ib++)Ga.array[ib]=Ga.value[ib];else if(2===Ga.size)for(ib=0;ib<Cc;ib++)tb=Ga.value[ib],Ga.array[La]=tb.x,Ga.array[La+1]=tb.y,La+=2;else if(3===Ga.size)if("c"===Ga.type)for(ib=0;ib<Cc;ib++)tb=Ga.value[ib],Ga.array[La]=tb.r,Ga.array[La+1]=tb.g,Ga.array[La+2]=tb.b,La+=3;else for(ib=0;ib<Cc;ib++)tb=
+Ga.value[ib],Ga.array[La]=tb.x,Ga.array[La+1]=tb.y,Ga.array[La+2]=tb.z,La+=3;else if(4===Ga.size)for(ib=0;ib<Cc;ib++)tb=Ga.value[ib],Ga.array[La]=tb.x,Ga.array[La+1]=tb.y,Ga.array[La+2]=tb.z,Ga.array[La+3]=tb.w,La+=4;j.bindBuffer(j.ARRAY_BUFFER,Ga.buffer);j.bufferData(j.ARRAY_BUFFER,Ga.array,ad)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.lineDistancesNeedUpdate=!1;ta.attributes&&t(ta)}else if(ia instanceof THREE.ParticleSystem)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&
+i(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ta=e(ia,N);oa=ta.attributes&&x(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||ia.sortParticles||oa){var bc=N,ud=j.DYNAMIC_DRAW,Nc=ia,ub=void 0,cc=void 0,dc=void 0,ca=void 0,ec=void 0,rc=void 0,gd=bc.vertices,vd=gd.length,wd=bc.colors,Hd=wd.length,wc=bc.__vertexArray,xc=bc.__colorArray,kc=bc.__sortArray,Id=bc.verticesNeedUpdate,Jd=bc.colorsNeedUpdate,lc=bc.__webglCustomAttributesList,Kb=void 0,Dc=void 0,na=void 0,Lb=
+void 0,Ca=void 0,ba=void 0;if(Nc.sortParticles){vb.copy(gc);vb.multiply(Nc.matrixWorld);for(ub=0;ub<vd;ub++)dc=gd[ub],Pa.copy(dc),Pa.applyProjection(vb),kc[ub]=[Pa.z,ub];kc.sort(m);for(ub=0;ub<vd;ub++)dc=gd[kc[ub][1]],ca=3*ub,wc[ca]=dc.x,wc[ca+1]=dc.y,wc[ca+2]=dc.z;for(cc=0;cc<Hd;cc++)ca=3*cc,rc=wd[kc[cc][1]],xc[ca]=rc.r,xc[ca+1]=rc.g,xc[ca+2]=rc.b;if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],void 0===ba.boundTo||"vertices"===ba.boundTo)if(ca=0,Lb=ba.value.length,1===ba.size)for(na=0;na<Lb;na++)ec=
+kc[na][1],ba.array[na]=ba.value[ec];else if(2===ba.size)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.r,ba.array[ca+1]=Ca.g,ba.array[ca+2]=Ca.b,ca+=3;else for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ca+=3;else if(4===ba.size)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,
+ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ba.array[ca+3]=Ca.w,ca+=4}}else{if(Id)for(ub=0;ub<vd;ub++)dc=gd[ub],ca=3*ub,wc[ca]=dc.x,wc[ca+1]=dc.y,wc[ca+2]=dc.z;if(Jd)for(cc=0;cc<Hd;cc++)rc=wd[cc],ca=3*cc,xc[ca]=rc.r,xc[ca+1]=rc.g,xc[ca+2]=rc.b;if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo))if(Lb=ba.value.length,ca=0,1===ba.size)for(na=0;na<Lb;na++)ba.array[na]=ba.value[na];else if(2===ba.size)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=
+Ca.x,ba.array[ca+1]=Ca.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.r,ba.array[ca+1]=Ca.g,ba.array[ca+2]=Ca.b,ca+=3;else for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ca+=3;else if(4===ba.size)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ba.array[ca+3]=Ca.w,ca+=4}}if(Id||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,
+wc,ud);if(Jd||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xc,ud);if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],ba.needsUpdate||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ba.buffer),j.bufferData(j.ARRAY_BUFFER,ba.array,ud)}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;ta.attributes&&t(ta)}}};this.initMaterial=function(a,b,c,d){var e,f,g,i;a.addEventListener("dispose",O);var h,k,m,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof
+THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,r,s;e=g=r=s=
+p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&p++);e=g;f=r;g=s;i=p;p=q=0;for(s=b.length;p<s;p++)r=b[p],r.castShadow&&(r instanceof THREE.SpotLight&&q++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&q++);l=q;tc&&d&&d.useVertexTexture?m=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&
+(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),m=b);a:{r=a.fragmentShader;s=a.vertexShader;p=a.uniforms;b=a.attributes;q=a.defines;var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,
+skinning:a.skinning,maxBones:m,useVertexTexture:tc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:i,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
+alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,x,d=[];n?d.push(n):(d.push(r),d.push(s));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(v=va.length;t<v;t++)if(d=va[t],d.code===n){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");
+v=[];for(x in q)d=q[x],!1!==d&&(d="#define "+x+" "+d,v.push(d));d=v.join("\n");x=j.createProgram();v=["precision "+W+" float;",d,sc?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,
 "#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):
 "",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 t=["precision "+W+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
 c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=V("fragment",t+s);v=V("vertex",v+r);j.attachShader(w,v);j.attachShader(w,t);j.linkProgram(w);j.getProgramParameter(w,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(w,j.VALIDATE_STATUS)+", gl error ["+
-j.getError()+"]");j.deleteShader(t);j.deleteShader(v);w.uniforms={};w.attributes={};var x;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(x in p)t.push(x);x=t;t=0;for(v=x.length;t<v;t++)p=x[t],w.uniforms[p]=j.getUniformLocation(w,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(x=0;x<c.maxMorphTargets;x++)t.push("morphTarget"+
-x);for(x=0;x<c.maxMorphNormals;x++)t.push("morphNormal"+x);for(k in b)t.push(k);k=t;x=0;for(b=k.length;x<b;x++)t=k[x],w.attributes[t]=j.getAttribLocation(w,t);w.id=Xa++;va.push({program:w,code:l,usedTimes:1});L.info.memory.programs=va.length;k=w}a.program=k;x=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)w=b+k,0<=x[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)w=
-b+k,0<=x[w]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;X!==
-b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),X=b);ha!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),ha=a)};this.setDepthTest=function(a){Za!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Za=a)};this.setDepthWrite=function(a){ia!==a&&(j.depthMask(a),ia=a)};this.setBlending=function(a,b,c,d){a!==ra&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),
-j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),ra=a);if(a===THREE.CustomBlending){if(b!==fa&&(j.blendEquation(G(b)),fa=b),c!==Da||d!==Ya)j.blendFunc(G(c),G(d)),Da=c,Ya=d}else Ya=
-Da=fa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Qc),a.__webglTexture=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=G(a.format),
-f=G(a.type);B(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var i=0,h=g.length;i<h;i++)c=g[i],j.texImage2D(j.TEXTURE_2D,i,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){i=0;for(h=g.length;i<h;i++)c=g[i],j.compressedTexImage2D(j.TEXTURE_2D,i,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){i=0;for(h=g.length;i<h;i++)c=g[i],j.texImage2D(j.TEXTURE_2D,
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=V("fragment",t+r);v=V("vertex",v+s);j.attachShader(x,v);j.attachShader(x,t);j.linkProgram(x);j.getProgramParameter(x,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(x,j.VALIDATE_STATUS)+", gl error ["+
+j.getError()+"]");j.deleteShader(t);j.deleteShader(v);x.uniforms={};x.attributes={};var w;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(w in p)t.push(w);w=t;t=0;for(v=w.length;t<v;t++)p=w[t],x.uniforms[p]=j.getUniformLocation(x,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)t.push("morphTarget"+
+w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],x.attributes[t]=j.getAttribLocation(x,t);x.id=Ya++;va.push({program:x,code:n,usedTimes:1});L.info.memory.programs=va.length;k=x}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)x=b+k,0<=w[x]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)x=
+b+k,0<=w[x]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;X!==
+b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),X=b);ha!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),ha=a)};this.setDepthTest=function(a){$a!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),$a=a)};this.setDepthWrite=function(a){ia!==a&&(j.depthMask(a),ia=a)};this.setBlending=function(a,b,c,d){a!==ra&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),
+j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),ra=a);if(a===THREE.CustomBlending){if(b!==fa&&(j.blendEquation(I(b)),fa=b),c!==Da||d!==Za)j.blendFunc(I(c),I(d)),Da=c,Za=d}else Za=
+Da=fa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Qc),a.__webglTexture=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=I(a.format),
+f=I(a.type);B(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var i=0,h=g.length;i<h;i++)c=g[i],j.texImage2D(j.TEXTURE_2D,i,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){i=0;for(h=g.length;i<h;i++)c=g[i],j.compressedTexImage2D(j.TEXTURE_2D,i,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){i=0;for(h=g.length;i<h;i++)c=g[i],j.texImage2D(j.TEXTURE_2D,
 i,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Rc);a.__webglTexture=
-j.createTexture();L.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=G(a.format),e=G(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);B(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,i=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
+j.createTexture();L.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=I(a.format),e=I(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);B(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,i=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
 a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,i,g.__webglTexture,0);T(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),B(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),
 j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):T(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,
-null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Ib,a=ec,d=ob,e=Hb);b!==Gb&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Gb=b);mc=c;pb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){THREE.EventDispatcher.call(this);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);
+null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Jb,a=fc,d=pb,e=Ib);b!==Hb&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Hb=b);mc=c;qb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){THREE.EventDispatcher.call(this);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};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a};
 THREE.WebGLRenderTarget.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
-this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;a.getHSV(e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,m=h.length;n<m;n++){var s=h[n].clone();c&&s.applyMatrix4(c);g.push(s)}n=0;for(m=k.length;n<m;n++){var s=k[n],q,r,p=s.vertexNormals,t=s.vertexColors;s instanceof THREE.Face3?
-q=new THREE.Face3(s.a+e,s.b+e,s.c+e):s instanceof THREE.Face4&&(q=new THREE.Face4(s.a+e,s.b+e,s.c+e,s.d+e));q.normal.copy(s.normal);d&&q.normal.applyMatrix3(d).normalize();g=0;for(h=p.length;g<h;g++)r=p[g].clone(),d&&r.applyMatrix3(d).normalize(),q.vertexNormals.push(r);q.color.copy(s.color);g=0;for(h=t.length;g<h;g++)r=t[g],q.vertexColors.push(r.clone());q.materialIndex=s.materialIndex;q.centroid.copy(s.centroid);c&&q.centroid.applyMatrix4(c);i.push(q)}n=0;for(m=f.length;n<m;n++){c=f[n];d=[];g=0;
+this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;a.getHSV(e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,m=h.length;n<m;n++){var s=h[n].clone();c&&s.applyMatrix4(c);g.push(s)}n=0;for(m=k.length;n<m;n++){var s=k[n],r,p,q=s.vertexNormals,x=s.vertexColors;s instanceof THREE.Face3?
+r=new THREE.Face3(s.a+e,s.b+e,s.c+e):s instanceof THREE.Face4&&(r=new THREE.Face4(s.a+e,s.b+e,s.c+e,s.d+e));r.normal.copy(s.normal);d&&r.normal.applyMatrix3(d).normalize();g=0;for(h=q.length;g<h;g++)p=q[g].clone(),d&&p.applyMatrix3(d).normalize(),r.vertexNormals.push(p);r.color.copy(s.color);g=0;for(h=x.length;g<h;g++)p=x[g],r.vertexColors.push(p.clone());r.materialIndex=s.materialIndex;r.centroid.copy(s.centroid);c&&r.centroid.applyMatrix4(c);i.push(r)}n=0;for(m=f.length;n<m;n++){c=f[n];d=[];g=0;
 for(h=c.length;g<h;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));l.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,g=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||g.push(f);a.faces=g},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.add(h);
 h.copy(c);h.multiplyScalar(f);g.add(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a],e=b.vertices[a.b],f=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,
 e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],l,n,m,s;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?(l=g[d.a],n=g[d.b],m=g[d.c],
@@ -512,14 +513,14 @@ e[g]=i;var k=new XMLHttpRequest;k.onload=b(k,i);k.onerror=d;i=a[g];k.open("GET",
 d,k.open("GET",a,!0),k.responseType="arraybuffer",k.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(542327876!==h[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!h[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
 d;var i=h[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.isCubemap=h[28]&512?!0:!1;d.width=h[4];d.height=h[3];for(var h=h[1]+4,f=d.width,g=d.height,i=d.isCubemap?
 6:1,k=0;k<i;k++){for(var l=0;l<d.mipmapCount;l++){var n=Math.max(4,f)/4*Math.max(4,g)/4*e,m={data:new Uint8Array(a,h,n),width:f,height:g};d.mipmaps.push(m);h+=n;f=Math.max(0.5*f,1);g=Math.max(0.5*g,1)}f=d.width;g=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,
-0,d,e).data,i=g.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var n=0;n<e;n++){var m=0>n-1?0:n-1,s=n+1>e-1?e-1:n+1,q=0>l-1?0:l-1,r=l+1>d-1?d-1:l+1,p=[],t=[0,0,h[4*(n*d+l)]/255*b];p.push([-1,0,h[4*(n*d+q)]/255*b]);p.push([-1,-1,h[4*(m*d+q)]/255*b]);p.push([0,-1,h[4*(m*d+l)]/255*b]);p.push([1,-1,h[4*(m*d+r)]/255*b]);p.push([1,0,h[4*(n*d+r)]/255*b]);p.push([1,1,h[4*(s*d+r)]/255*b]);p.push([0,1,h[4*(s*d+l)]/255*b]);p.push([-1,1,h[4*(s*d+q)]/255*b]);m=[];q=p.length;for(s=0;s<q;s++){var r=p[s],x=p[(s+1)%
-q],r=[r[0]-t[0],r[1]-t[1],r[2]-t[2]],x=[x[0]-t[0],x[1]-t[1],x[2]-t[2]];m.push(c([r[1]*x[2]-r[2]*x[1],r[2]*x[0]-r[0]*x[2],r[0]*x[1]-r[1]*x[0]]))}p=[0,0,0];for(s=0;s<m.length;s++)p[0]+=m[s][0],p[1]+=m[s][1],p[2]+=m[s][2];p[0]/=m.length;p[1]/=m.length;p[2]/=m.length;t=4*(n*d+l);k[t]=255*((p[0]+1)/2)|0;k[t+1]=255*((p[1]+1)/2)|0;k[t+2]=255*p[2]|0;k[t+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),
+0,d,e).data,i=g.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var n=0;n<e;n++){var m=0>n-1?0:n-1,s=n+1>e-1?e-1:n+1,r=0>l-1?0:l-1,p=l+1>d-1?d-1:l+1,q=[],x=[0,0,h[4*(n*d+l)]/255*b];q.push([-1,0,h[4*(n*d+r)]/255*b]);q.push([-1,-1,h[4*(m*d+r)]/255*b]);q.push([0,-1,h[4*(m*d+l)]/255*b]);q.push([1,-1,h[4*(m*d+p)]/255*b]);q.push([1,0,h[4*(n*d+p)]/255*b]);q.push([1,1,h[4*(s*d+p)]/255*b]);q.push([0,1,h[4*(s*d+l)]/255*b]);q.push([-1,1,h[4*(s*d+r)]/255*b]);m=[];r=q.length;for(s=0;s<r;s++){var p=q[s],t=q[(s+1)%
+r],p=[p[0]-x[0],p[1]-x[1],p[2]-x[2]],t=[t[0]-x[0],t[1]-x[1],t[2]-x[2]];m.push(c([p[1]*t[2]-p[2]*t[1],p[2]*t[0]-p[0]*t[2],p[0]*t[1]-p[1]*t[0]]))}q=[0,0,0];for(s=0;s<m.length;s++)q[0]+=m[s][0],q[1]+=m[s][1],q[2]+=m[s][2];q[0]/=m.length;q[1]/=m.length;q[2]/=m.length;x=4*(n*d+l);k[x]=255*((q[0]+1)/2)|0;k[x+1]=255*((q[1]+1)/2)|0;k[x+2]=255*q[2]|0;k[x+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),
 c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,l,n,m,s,q,r,p,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
-c+d;l=b[a++]*c;s=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(s,q,i,l);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var x=g/h;THREE.Shape.Utils.b2(x,n,s,i);THREE.Shape.Utils.b2(x,m,q,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,s=b[a++]*c+d,q=b[a++]*-c,r=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,l,s,q,r,p),g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++)x=g/h,THREE.Shape.Utils.b3(x,n,s,r,i),THREE.Shape.Utils.b3(x,m,q,p,l)}}}return{offset:t.ha*c,path:e}}}};
+0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,l,n,m,s,r,p,q,x=b.glyphs[a]||b.glyphs["?"];if(x){if(x.o){b=x._cachedOutline||(x._cachedOutline=x.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
+c+d;l=b[a++]*c;s=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(s,r,i,l);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h;THREE.Shape.Utils.b2(t,n,s,i);THREE.Shape.Utils.b2(t,m,r,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,s=b[a++]*c+d,r=b[a++]*-c,p=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,s,r,p,q),g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++)t=g/h,THREE.Shape.Utils.b3(t,n,s,p,i),THREE.Shape.Utils.b3(t,m,r,q,l)}}}return{offset:x.ha*c,path:e}}}};
 THREE.FontUtils.generateShapes=function(a,b){var b=b||{},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 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var n=2*e;for(k=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{var s=m=void 0,q=void 0,r=void 0,p=void 0,t=void 0,x=void 0,w=void 0,v=
-void 0,s=a[g[i]].x,q=a[g[i]].y,r=a[g[k]].x,p=a[g[k]].y,t=a[g[l]].x,x=a[g[l]].y;if(1E-10>(r-s)*(x-q)-(p-q)*(t-s))m=!1;else{var H=void 0,F=void 0,A=void 0,z=void 0,K=void 0,I=void 0,E=void 0,V=void 0,B=void 0,T=void 0,B=V=E=v=w=void 0,H=t-r,F=x-p,A=s-t,z=q-x,K=r-s,I=p-q;for(m=0;m<e;m++)if(!(m===i||m===k||m===l))if(w=a[g[m]].x,v=a[g[m]].y,E=w-s,V=v-q,B=w-r,T=v-p,w-=t,v-=x,B=H*T-F*B,E=K*V-I*E,V=A*v-z*w,0<=B&&0<=V&&0<=E){m=!1;break a}m=!0}}if(m){f.push([a[g[i]],a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);
+(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 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var n=2*e;for(k=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{var s=m=void 0,r=void 0,p=void 0,q=void 0,x=void 0,t=void 0,v=void 0,w=
+void 0,s=a[g[i]].x,r=a[g[i]].y,p=a[g[k]].x,q=a[g[k]].y,x=a[g[l]].x,t=a[g[l]].y;if(1E-10>(p-s)*(t-r)-(q-r)*(x-s))m=!1;else{var D=void 0,K=void 0,A=void 0,z=void 0,F=void 0,H=void 0,G=void 0,V=void 0,B=void 0,T=void 0,B=V=G=w=v=void 0,D=x-p,K=t-q,A=s-x,z=r-t,F=p-s,H=q-r;for(m=0;m<e;m++)if(!(m===i||m===k||m===l))if(v=a[g[m]].x,w=a[g[m]].y,G=v-s,V=w-r,B=v-p,T=w-q,v-=x,w-=t,B=D*T-K*B,G=F*V-H*G,V=A*w-z*v,0<=B&&0<=V&&0<=G){m=!1;break a}m=!0}}if(m){f.push([a[g[i]],a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);
 i=k;for(l=k+1;l<e;i++,l++)g[i]=g[l];e--;n=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.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
 THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
 THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
@@ -551,17 +552,17 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
 THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
 THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,h,i,k,l,n,m,s,q,r;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];m=f[1];0<c.length?(g=c[c.length-1],s=g.x,
-q=g.y):(g=this.actions[d-1].args,s=g[g.length-2],q=g[g.length-1]);for(f=1;f<=a;f++)r=f/a,g=THREE.Shape.Utils.b2(r,s,n,h),r=THREE.Shape.Utils.b2(r,q,m,i),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];m=f[1];k=f[2];l=f[3];0<c.length?(g=c[c.length-1],s=g.x,q=g.y):(g=this.actions[d-1].args,s=g[g.length-2],q=g[g.length-1]);for(f=1;f<=a;f++)r=f/a,g=THREE.Shape.Utils.b3(r,s,n,k,h),r=THREE.Shape.Utils.b3(r,q,m,l,i),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.CSPLINE_THRU:g=
-this.actions[d-1].args;r=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;r=r.concat(f[0]);r=new THREE.SplineCurve(r);for(f=1;f<=g;f++)c.push(r.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];k=f[3];g=f[4];n=!!f[5];s=g-k;q=2*a;for(f=1;f<=q;f++)r=f/q,n||(r=1-r),r=k+r*s,g=h+m*Math.cos(r),r=i+m*Math.sin(r),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];l=f[3];k=f[4];g=f[5];n=!!f[6];s=g-k;q=2*a;for(f=1;f<=q;f++)r=f/q,n||
-(r=1-r),r=k+r*s,g=h+m*Math.cos(r),r=i+l*Math.sin(r),c.push(new THREE.Vector2(g,r))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,h,i,k,l,n,m,s,r,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];m=f[1];0<c.length?(g=c[c.length-1],s=g.x,
+r=g.y):(g=this.actions[d-1].args,s=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b2(p,s,n,h),p=THREE.Shape.Utils.b2(p,r,m,i),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];m=f[1];k=f[2];l=f[3];0<c.length?(g=c[c.length-1],s=g.x,r=g.y):(g=this.actions[d-1].args,s=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b3(p,s,n,k,h),p=THREE.Shape.Utils.b3(p,r,m,l,i),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.CSPLINE_THRU:g=
+this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];k=f[3];g=f[4];n=!!f[5];s=g-k;r=2*a;for(f=1;f<=r;f++)p=f/r,n||(p=1-p),p=k+p*s,g=h+m*Math.cos(p),p=i+m*Math.sin(p),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];l=f[3];k=f[4];g=f[5];n=!!f[6];s=g-k;r=2*a;for(f=1;f<=r;f++)p=f/r,n||
+(p=1-p),p=k+p*s,g=h+m*Math.cos(p),p=i+l*Math.sin(p),c.push(new THREE.Vector2(g,p))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves,d.push(g),d;if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
 b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{a=0;for(b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
 THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,l,n,m,s,q=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];s=[];for(n=0;n<c.length;n++)l=c[n],l=m.distanceToSquared(l),s.push(l),l<f&&(f=l,g=e,h=n)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;var r=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(r);var p=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(p);s=h;l=g;h+=1;g+=-1;0>
-h&&(h+=c.length);h%=c.length;0>g&&(g+=k.length);g%=k.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;r=[k[g],c[h],c[e]];r=THREE.FontUtils.Triangulate.area(r);p=[k[g],k[f],c[h]];p=THREE.FontUtils.Triangulate.area(p);n+m>r+p&&(h=s,g=l,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=k.length),g%=k.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:k.length-1);n=c.slice(0,h);m=c.slice(h);s=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];q.push([k[g],c[h],c[e]]);q.push(f);c=n.concat(s).concat(l).concat(m)}return{shape:c,
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,k={};f=0;for(g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,l,n,m,s,r=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];s=[];for(n=0;n<c.length;n++)l=c[n],l=m.distanceToSquared(l),s.push(l),l<f&&(f=l,g=e,h=n)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;var p=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(p);var q=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);s=h;l=g;h+=1;g+=-1;0>
+h&&(h+=c.length);h%=c.length;0>g&&(g+=k.length);g%=k.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;p=[k[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(p);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);n+m>p+q&&(h=s,g=l,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=k.length),g%=k.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:k.length-1);n=c.slice(0,h);m=c.slice(h);s=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];r.push([k[g],c[h],c[e]]);r.push(f);c=n.concat(s).concat(l).concat(m)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,k={};f=0;for(g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
 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.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++)if(0>a.hierarchy[c].keys[d].time&&
 (a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=h;
@@ -595,20 +596,20 @@ THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*
 THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a,d=0.707*b,c=[[a,0,0],[b,0,0],[-a,0,0],[-b,0,0],[0,a,0],[0,b,0],[0,-a,0],[0,-b,0],[0,0,a],[0,0,b],[0,0,-a],[0,0,-b],[c,c,0],[d,d,0],[-c,-c,0],[-d,-d,0],[c,-c,0],[d,-d,0],[-c,c,0],[-d,d,0],[c,0,c],[d,0,d],[-c,0,-c],[-d,0,-d],[c,0,-c],[d,0,-d],[-c,0,c],[-d,0,d],[0,c,c],[0,d,d],[0,-c,-c],[0,-d,-d],[0,c,-c],[0,d,-d],[0,-c,c],[0,-d,d]],d=0,e=c.length;d<e;d++)this.vertices.push(new THREE.Vector3(c[d][0],c[d][1],c[d][2]))};
 THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),
-this.faceVertexUvs[0].push([f[e],f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,r){var p,t=h.widthSegments,x=h.heightSegments,w=e/2,v=f/2,H=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)p="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)p="y",x=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)p="x",t=h.depthSegments;var F=t+1,A=x+1,z=e/t,K=f/x,I=new THREE.Vector3;I[p]=0<g?1:-1;for(e=0;e<A;e++)for(f=0;f<F;f++){var E=new THREE.Vector3;E[a]=(f*z-w)*c;E[b]=(e*K-v)*d;E[p]=g;h.vertices.push(E)}for(e=
-0;e<x;e++)for(f=0;f<t;f++)a=new THREE.Face4(f+F*e+H,f+F*(e+1)+H,f+1+F*(e+1)+H,f+1+F*e+H),a.normal.copy(I),a.vertexNormals.push(I.clone(),I.clone(),I.clone(),I.clone()),a.materialIndex=r,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/t,1-e/x),new THREE.Vector2(f/t,1-(e+1)/x),new THREE.Vector2((f+1)/t,1-(e+1)/x),new THREE.Vector2((f+1)/t,1-e/x)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
-f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var n=[],m=[],s=i/e,q=s*(b-a)+a;for(h=0;h<=d;h++){var r=h/d,p=new THREE.Vector3;p.x=q*Math.sin(2*r*Math.PI);p.y=-s*c+g;p.z=q*Math.cos(2*r*Math.PI);this.vertices.push(p);n.push(this.vertices.length-1);m.push(new THREE.Vector2(r,1-s))}k.push(n);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(n=this.vertices[k[0][h]].clone(),
-m=this.vertices[k[0][h+1]].clone()):(n=this.vertices[k[1][h]].clone(),m=this.vertices[k[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],q=k[i+1][h],r=k[i+1][h+1],p=k[i][h+1],t=n.clone(),x=n.clone(),w=m.clone(),v=m.clone(),H=l[i][h].clone(),F=l[i+1][h].clone(),A=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(s,q,r,p,[t,x,w,v]));this.faceVertexUvs[0].push([H,F,A,z])}}if(!f&&0<
-a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],q=k[0][h+1],r=this.vertices.length-1,t=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),H=l[0][h].clone(),F=l[0][h+1].clone(),A=new THREE.Vector2(F.u,0),this.faces.push(new THREE.Face3(s,q,r,[t,x,w])),this.faceVertexUvs[0].push([H,F,A])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],q=k[i][h],r=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,
--1,0),w=new THREE.Vector3(0,-1,0),H=l[i][h+1].clone(),F=l[i][h].clone(),A=new THREE.Vector2(F.u,1),this.faces.push(new THREE.Face3(s,q,r,[t,x,w])),this.faceVertexUvs[0].push([H,F,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
+this.faceVertexUvs[0].push([f[e],f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var q,x=h.widthSegments,t=h.heightSegments,v=e/2,w=f/2,D=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",t=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",x=h.depthSegments;var K=x+1,A=t+1,z=e/x,F=f/t,H=new THREE.Vector3;H[q]=0<g?1:-1;for(e=0;e<A;e++)for(f=0;f<K;f++){var G=new THREE.Vector3;G[a]=(f*z-v)*c;G[b]=(e*F-w)*d;G[q]=g;h.vertices.push(G)}for(e=
+0;e<t;e++)for(f=0;f<x;f++)a=new THREE.Face4(f+K*e+D,f+K*(e+1)+D,f+1+K*(e+1)+D,f+1+K*e+D),a.normal.copy(H),a.vertexNormals.push(H.clone(),H.clone(),H.clone(),H.clone()),a.materialIndex=p,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/x,1-e/t),new THREE.Vector2(f/x,1-(e+1)/t),new THREE.Vector2((f+1)/x,1-(e+1)/t),new THREE.Vector2((f+1)/x,1-e/t)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
+f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var n=[],m=[],s=i/e,r=s*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,q=new THREE.Vector3;q.x=r*Math.sin(2*p*Math.PI);q.y=-s*c+g;q.z=r*Math.cos(2*p*Math.PI);this.vertices.push(q);n.push(this.vertices.length-1);m.push(new THREE.Vector2(p,1-s))}k.push(n);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(n=this.vertices[k[0][h]].clone(),
+m=this.vertices[k[0][h+1]].clone()):(n=this.vertices[k[1][h]].clone(),m=this.vertices[k[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],r=k[i+1][h],p=k[i+1][h+1],q=k[i][h+1],x=n.clone(),t=n.clone(),v=m.clone(),w=m.clone(),D=l[i][h].clone(),K=l[i+1][h].clone(),A=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(s,r,p,q,[x,t,v,w]));this.faceVertexUvs[0].push([D,K,A,z])}}if(!f&&0<
+a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],r=k[0][h+1],p=this.vertices.length-1,x=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),D=l[0][h].clone(),K=l[0][h+1].clone(),A=new THREE.Vector2(K.u,0),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([D,K,A])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],r=k[i][h],p=this.vertices.length-1,x=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,
+-1,0),v=new THREE.Vector3(0,-1,0),D=l[i][h+1].clone(),K=l[i][h].clone(),A=new THREE.Vector2(K.u,1),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([D,K,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,i=THREE.ExtrudeGeometry.__v5,h=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);i.copy(a).add(f);h.copy(a).add(g);if(i.equals(h))return g.clone();
 i.copy(b).add(f);h.copy(c).add(g);f=d.dot(g);g=h.sub(i).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(i).sub(a).clone()}function e(c,d){var e,f;for(J=c.length;0<=--J;){e=J;f=J-1;0>f&&(f=c.length-1);for(var g=0,i=s+2*l,
-g=0;g<i;g++){var h=ua*g,k=ua*(g+1),m=d+e+h,h=d+f+h,n=d+f+k,k=d+e+k,p=c,q=g,r=i,t=e,v=f,m=m+V,h=h+V,n=n+V,k=k+V;E.faces.push(new THREE.Face4(m,h,n,k,null,null,x));m=w.generateSideWallUV(E,a,p,b,m,h,n,k,q,r,t,v);E.faceVertexUvs[0].push(m)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=V;d+=V;e+=V;E.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?w.generateBottomUV(E,a,b,c,d,e):w.generateTopUV(E,a,b,c,d,e);E.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
-100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,q=b.extrudePath,r,p=!1,t=b.material,x=b.extrudeMaterial,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,H,F,A;q&&(r=q.getSpacedPoints(s),p=!0,n=!1,v=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(q,s,
-!1),H=new THREE.Vector3,F=new THREE.Vector3,A=new THREE.Vector3);n||(k=i=l=0);var z,K,I,E=this,V=this.vertices.length,m=a.extractPoints(m),B=m.shape,m=m.holes;if(q=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();K=0;for(I=m.length;K<I;K++)z=m[K],THREE.Shape.Utils.isClockWise(z)&&(m[K]=z.reverse());q=!1}var T=THREE.Shape.Utils.triangulateShape(B,m),q=B;K=0;for(I=m.length;K<I;K++)z=m[K],B=B.concat(z);var C,G,M,W,ua=B.length,Ha=T.length,oa=[],J=0,da=q.length;C=da-1;for(G=J+1;J<da;J++,C++,G++)C===da&&
-(C=0),G===da&&(G=0),oa[J]=d(q[J],q[C],q[G]);var ka=[],Y,L=oa.concat();K=0;for(I=m.length;K<I;K++){z=m[K];Y=[];J=0;da=z.length;C=da-1;for(G=J+1;J<da;J++,C++,G++)C===da&&(C=0),G===da&&(G=0),Y[J]=d(z[J],z[C],z[G]);ka.push(Y);L=L.concat(Y)}for(C=0;C<l;C++){z=C/l;M=i*(1-z);G=k*Math.sin(z*Math.PI/2);J=0;for(da=q.length;J<da;J++)W=c(q[J],oa[J],G),f(W.x,W.y,-M);K=0;for(I=m.length;K<I;K++){z=m[K];Y=ka[K];J=0;for(da=z.length;J<da;J++)W=c(z[J],Y[J],G),f(W.x,W.y,-M)}}G=k;for(J=0;J<ua;J++)W=n?c(B[J],L[J],G):B[J],
-p?(F.copy(v.normals[0]).multiplyScalar(W.x),H.copy(v.binormals[0]).multiplyScalar(W.y),A.copy(r[0]).add(F).add(H),f(A.x,A.y,A.z)):f(W.x,W.y,0);for(z=1;z<=s;z++)for(J=0;J<ua;J++)W=n?c(B[J],L[J],G):B[J],p?(F.copy(v.normals[z]).multiplyScalar(W.x),H.copy(v.binormals[z]).multiplyScalar(W.y),A.copy(r[z]).add(F).add(H),f(A.x,A.y,A.z)):f(W.x,W.y,h/s*z);for(C=l-1;0<=C;C--){z=C/l;M=i*(1-z);G=k*Math.sin(z*Math.PI/2);J=0;for(da=q.length;J<da;J++)W=c(q[J],oa[J],G),f(W.x,W.y,h+M);K=0;for(I=m.length;K<I;K++){z=
-m[K];Y=ka[K];J=0;for(da=z.length;J<da;J++)W=c(z[J],Y[J],G),p?f(W.x,W.y+r[s-1].y,r[s-1].x+M):f(W.x,W.y,h+M)}}if(n){i=0*ua;for(J=0;J<Ha;J++)h=T[J],g(h[2]+i,h[1]+i,h[0]+i,!0);i=ua*(s+2*l);for(J=0;J<Ha;J++)h=T[J],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(J=0;J<Ha;J++)h=T[J],g(h[2],h[1],h[0],!0);for(J=0;J<Ha;J++)h=T[J],g(h[0]+ua*s,h[1]+ua*s,h[2]+ua*s,!1)}h=0;e(q,h);h+=q.length;K=0;for(I=m.length;K<I;K++)z=m[K],e(z,h),h+=z.length};
+g=0;g<i;g++){var h=ua*g,k=ua*(g+1),m=d+e+h,h=d+f+h,n=d+f+k,k=d+e+k,p=c,q=g,r=i,x=e,w=f,m=m+V,h=h+V,n=n+V,k=k+V;G.faces.push(new THREE.Face4(m,h,n,k,null,null,t));m=v.generateSideWallUV(G,a,p,b,m,h,n,k,q,r,x,w);G.faceVertexUvs[0].push(m)}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=V;d+=V;e+=V;G.faces.push(new THREE.Face3(c,d,e,null,null,x));c=f?v.generateBottomUV(G,a,b,c,d,e):v.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
+100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,p,q=!1,x=b.material,t=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,D,K,A;r&&(p=r.getSpacedPoints(s),q=!0,n=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,
+!1),D=new THREE.Vector3,K=new THREE.Vector3,A=new THREE.Vector3);n||(k=i=l=0);var z,F,H,G=this,V=this.vertices.length,m=a.extractPoints(m),B=m.shape,m=m.holes;if(r=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();F=0;for(H=m.length;F<H;F++)z=m[F],THREE.Shape.Utils.isClockWise(z)&&(m[F]=z.reverse());r=!1}var T=THREE.Shape.Utils.triangulateShape(B,m),r=B;F=0;for(H=m.length;F<H;F++)z=m[F],B=B.concat(z);var C,I,M,W,ua=B.length,Ha=T.length,oa=[],J=0,da=r.length;C=da-1;for(I=J+1;J<da;J++,C++,I++)C===da&&
+(C=0),I===da&&(I=0),oa[J]=d(r[J],r[C],r[I]);var ka=[],Y,L=oa.concat();F=0;for(H=m.length;F<H;F++){z=m[F];Y=[];J=0;da=z.length;C=da-1;for(I=J+1;J<da;J++,C++,I++)C===da&&(C=0),I===da&&(I=0),Y[J]=d(z[J],z[C],z[I]);ka.push(Y);L=L.concat(Y)}for(C=0;C<l;C++){z=C/l;M=i*(1-z);I=k*Math.sin(z*Math.PI/2);J=0;for(da=r.length;J<da;J++)W=c(r[J],oa[J],I),f(W.x,W.y,-M);F=0;for(H=m.length;F<H;F++){z=m[F];Y=ka[F];J=0;for(da=z.length;J<da;J++)W=c(z[J],Y[J],I),f(W.x,W.y,-M)}}I=k;for(J=0;J<ua;J++)W=n?c(B[J],L[J],I):B[J],
+q?(K.copy(w.normals[0]).multiplyScalar(W.x),D.copy(w.binormals[0]).multiplyScalar(W.y),A.copy(p[0]).add(K).add(D),f(A.x,A.y,A.z)):f(W.x,W.y,0);for(z=1;z<=s;z++)for(J=0;J<ua;J++)W=n?c(B[J],L[J],I):B[J],q?(K.copy(w.normals[z]).multiplyScalar(W.x),D.copy(w.binormals[z]).multiplyScalar(W.y),A.copy(p[z]).add(K).add(D),f(A.x,A.y,A.z)):f(W.x,W.y,h/s*z);for(C=l-1;0<=C;C--){z=C/l;M=i*(1-z);I=k*Math.sin(z*Math.PI/2);J=0;for(da=r.length;J<da;J++)W=c(r[J],oa[J],I),f(W.x,W.y,h+M);F=0;for(H=m.length;F<H;F++){z=
+m[F];Y=ka[F];J=0;for(da=z.length;J<da;J++)W=c(z[J],Y[J],I),q?f(W.x,W.y+p[s-1].y,p[s-1].x+M):f(W.x,W.y,h+M)}}if(n){i=0*ua;for(J=0;J<Ha;J++)h=T[J],g(h[2]+i,h[1]+i,h[0]+i,!0);i=ua*(s+2*l);for(J=0;J<Ha;J++)h=T[J],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(J=0;J<Ha;J++)h=T[J],g(h[2],h[1],h[0],!0);for(J=0;J<Ha;J++)h=T[J],g(h[0]+ua*s,h[1]+ua*s,h[2]+ua*s,!1)}h=0;e(r,h);h+=r.length;F=0;for(H=m.length;F<H;F++)z=m[F],e(z,h),h+=z.length};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,
 l=a.vertices[g].y,g=a.vertices[g].z,n=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(m,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
@@ -616,8 +617,8 @@ THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.
 i=i.concat(g);k=i.length;f=l.length;for(e=0;e<k;e++)g=i[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)k=l[e],i=k[0]+h,g=k[1]+h,k=k[2]+h,this.faces.push(new THREE.Face3(i,g,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,g,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var i=c+g*f*d,k=Math.cos(i),l=Math.sin(i),i=0,n=a.length;i<n;i++){var m=a[i],s=new THREE.Vector3;s.x=k*m.x-l*m.y;s.y=l*m.x+k*m.y;s.z=m.z;this.vertices.push(s)}c=a.length;g=0;for(h=b;g<h;g++){i=0;for(n=a.length-1;i<n;i++)d=b=i+c*g,l=b+c,k=b+1+c,this.faces.push(new THREE.Face4(d,l,k,b+1)),k=g*f,b=i*e,d=k+f,l=b+e,this.faceVertexUvs[0].push([new THREE.Vector2(k,
 b),new THREE.Vector2(d,b),new THREE.Vector2(d,l),new THREE.Vector2(k,l)])}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var c=a/2,e=b/2,d=this.widthSegments,f=this.heightSegments,g=d+1,h=f+1,i=this.width/d,k=this.height/f,l=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-c,-(a*k-e),0));for(a=0;a<f;a++)for(b=0;b<d;b++)c=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),c.normal.copy(l),c.vertexNormals.push(l.clone(),l.clone(),
 l.clone(),l.clone()),this.faces.push(c),this.faceVertexUvs[0].push([new THREE.Vector2(b/d,1-a/f),new THREE.Vector2(b/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-a/f)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a||50;this.widthSegments=Math.max(3,Math.floor(b)||8);this.heightSegments=Math.max(2,Math.floor(c)||6);for(var d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,h=[],i=[],c=0;c<=this.heightSegments;c++){for(var k=[],l=[],b=0;b<=this.widthSegments;b++){var n=b/this.widthSegments,m=c/this.heightSegments,s=new THREE.Vector3;s.x=-this.radius*Math.cos(d+n*e)*Math.sin(f+m*g);s.y=this.radius*
-Math.cos(f+m*g);s.z=this.radius*Math.sin(d+n*e)*Math.sin(f+m*g);this.vertices.push(s);k.push(this.vertices.length-1);l.push(new THREE.Vector2(n,1-m))}h.push(k);i.push(l)}for(c=0;c<this.heightSegments;c++)for(b=0;b<this.widthSegments;b++){var d=h[c][b+1],e=h[c][b],f=h[c+1][b],g=h[c+1][b+1],k=this.vertices[d].clone().normalize(),l=this.vertices[e].clone().normalize(),n=this.vertices[f].clone().normalize(),m=this.vertices[g].clone().normalize(),s=i[c][b+1].clone(),q=i[c][b].clone(),r=i[c+1][b].clone(),
-p=i[c+1][b+1].clone();Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(d,f,g,[k,n,m])),this.faceVertexUvs[0].push([s,r,p])):Math.abs(this.vertices[f].y)===this.radius?(this.faces.push(new THREE.Face3(d,e,f,[k,l,n])),this.faceVertexUvs[0].push([s,q,r])):(this.faces.push(new THREE.Face4(d,e,f,g,[k,l,n,m])),this.faceVertexUvs[0].push([s,q,r,p]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};
+Math.cos(f+m*g);s.z=this.radius*Math.sin(d+n*e)*Math.sin(f+m*g);this.vertices.push(s);k.push(this.vertices.length-1);l.push(new THREE.Vector2(n,1-m))}h.push(k);i.push(l)}for(c=0;c<this.heightSegments;c++)for(b=0;b<this.widthSegments;b++){var d=h[c][b+1],e=h[c][b],f=h[c+1][b],g=h[c+1][b+1],k=this.vertices[d].clone().normalize(),l=this.vertices[e].clone().normalize(),n=this.vertices[f].clone().normalize(),m=this.vertices[g].clone().normalize(),s=i[c][b+1].clone(),r=i[c][b].clone(),p=i[c+1][b].clone(),
+q=i[c+1][b+1].clone();Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(d,f,g,[k,n,m])),this.faceVertexUvs[0].push([s,p,q])):Math.abs(this.vertices[f].y)===this.radius?(this.faces.push(new THREE.Face3(d,e,f,[k,l,n])),this.faceVertexUvs[0].push([s,r,p])):(this.faces.push(new THREE.Face4(d,e,f,g,[k,l,n,m])),this.faceVertexUvs[0].push([s,r,p,q]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};
 THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,g=2*c/this.radialSegments*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*
 Math.cos(g))*Math.sin(f);h.z=this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(h.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,h=(this.tubularSegments+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.add(b[e]);i.normal.add(b[f]);i.normal.add(b[g]);i.normal.add(b[h]);
 i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
@@ -630,8 +631,8 @@ this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Ge
 THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,k,l,n;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++)l=k/(b-1),e[k]=a.getTangentAt(l),e[k].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);n=Math.abs(e[0].z);k<=a&&(a=k,d.set(1,0,0));l<=a&&(a=l,d.set(0,1,0));n<=a&&d.set(0,0,1);h.crossVectors(e[0],
 d).normalize();f[0].crossVectors(e[0],h);g[0].crossVectors(e[0],f[0]);for(k=1;k<b;k++)f[k]=f[k-1].clone(),g[k]=g[k-1].clone(),h.crossVectors(e[k-1],e[k]),1E-4<h.length()&&(h.normalize(),d=Math.acos(e[k-1].dot(e[k])),f[k].applyMatrix4(i.makeRotationAxis(h,d))),g[k].crossVectors(e[k],f[k]);if(c){d=Math.acos(f[0].dot(f[b-1]));d/=b-1;0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d);for(k=1;k<b;k++)f[k].applyMatrix4(i.makeRotationAxis(e[k],d*k)),g[k].crossVectors(e[k],f[k])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]),d.centroid.add(a).add(b).add(c).divideScalar(3),d.normal=d.centroid.clone().normalize(),i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,
 a,d),h(b.uv,b,d),h(c.uv,c,d)])):(d-=1,f(a,g(a,b),g(a,c),d),f(g(a,b),b,g(b,c),d),f(g(a,c),g(b,c),c,d),f(g(a,b),g(b,c),g(a,c),d))}function g(a,b){n[a.index]||(n[a.index]=[]);n[b.index]||(n[b.index]=[]);var c=n[a.index][b.index];void 0===c&&(n[a.index][b.index]=n[b.index][a.index]=c=e((new THREE.Vector3).addVectors(a,b).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a}THREE.Geometry.call(this);
-for(var c=c||1,d=d||0,i=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var n=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=void 0===d?!1:d,h,i,k,l,n=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++)k=i/b,k=a(k,l),e.push(k)}var m,s,q,r;for(h=0;h<c;h++)for(i=0;i<b;i++)a=h*n+i,e=h*n+i+1,l=(h+1)*n+i,k=(h+1)*n+i+1,m=new THREE.Vector2(i/b,h/c),s=new THREE.Vector2((i+1)/b,h/c),q=new THREE.Vector2(i/b,(h+1)/c),r=new THREE.Vector2((i+1)/b,(h+1)/c),d?(f.push(new THREE.Face3(a,e,l)),f.push(new THREE.Face3(e,
-k,l)),g.push([m,s,q]),g.push([s,r,q])):(f.push(new THREE.Face4(a,e,k,l)),g.push([m,s,r,q]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),g=f.length();f.x+=g*2E-6*(Math.random()-0.5);f.y+=g*2E-6*(Math.random()-0.5);f.z+=g*2E-6*(Math.random()-0.5);for(var g=[],h=0;h<c.length;){var i=c[h],k=f,l=a[i[0]],n;n=l;var m=a[i[1]],s=a[i[2]],q=new THREE.Vector3,r=new THREE.Vector3;q.subVectors(s,m);r.subVectors(n,m);q.cross(r);q.normalize();n=q;l=n.dot(l);
+for(var c=c||1,d=d||0,i=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var n=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=void 0===d?!1:d,h,i,k,l,n=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++)k=i/b,k=a(k,l),e.push(k)}var m,s,r,p;for(h=0;h<c;h++)for(i=0;i<b;i++)a=h*n+i,e=h*n+i+1,l=(h+1)*n+i,k=(h+1)*n+i+1,m=new THREE.Vector2(i/b,h/c),s=new THREE.Vector2((i+1)/b,h/c),r=new THREE.Vector2(i/b,(h+1)/c),p=new THREE.Vector2((i+1)/b,(h+1)/c),d?(f.push(new THREE.Face3(a,e,l)),f.push(new THREE.Face3(e,
+k,l)),g.push([m,s,r]),g.push([s,p,r])):(f.push(new THREE.Face4(a,e,k,l)),g.push([m,s,p,r]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),g=f.length();f.x+=g*2E-6*(Math.random()-0.5);f.y+=g*2E-6*(Math.random()-0.5);f.z+=g*2E-6*(Math.random()-0.5);for(var g=[],h=0;h<c.length;){var i=c[h],k=f,l=a[i[0]],n;n=l;var m=a[i[1]],s=a[i[2]],r=new THREE.Vector3,p=new THREE.Vector3;r.subVectors(s,m);p.subVectors(n,m);r.cross(p);r.normalize();n=r;l=n.dot(l);
 if(n.dot(k)>=l){for(k=0;3>k;k++){l=[i[k],i[(k+1)%3]];n=!0;for(m=0;m<g.length;m++)if(g[m][0]===l[1]&&g[m][1]===l[0]){g[m]=g[g.length-1];g.pop();n=!1;break}n&&g.push(l)}c[h]=c[c.length-1];c.pop()}else h++}for(m=0;m<g.length;m++)c.push([g[m][0],g[m][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;3>h;h++)void 0===f[g[h]]&&(f[g[h]]=e++,this.vertices.push(a[g[h]])),g[h]=f[g[h]]}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=0;d<this.faces.length;d++)g=
 this.faces[d],this.faceVertexUvs[0].push([b(this.vertices[g.a]),b(this.vertices[g.b]),b(this.vertices[g.c])]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a||1,0,0),new THREE.Vector3,new THREE.Vector3(0,a||1,0),new THREE.Vector3,new THREE.Vector3(0,0,a||1));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
 THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===c&&(c=20);void 0===d&&(d=16776960);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);b instanceof THREE.Vector3&&(this.position=
@@ -663,38 +664,38 @@ THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=thi
 THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;
-f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,i,k,l,n,m,s;this.init=function(q){b=q.context;c=q;d=q.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);q=0;e[q++]=-1;e[q++]=-1;
-e[q++]=0;e[q++]=0;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;q=0;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
+f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,i,k,l,n,m,s;this.init=function(r){b=r.context;c=r;d=r.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);r=0;e[r++]=-1;e[r++]=-1;
+e[r++]=0;e[r++]=0;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
 0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
 b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,n=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));m={};s={};m.vertex=b.getAttribLocation(n,"position");m.uv=b.getAttribLocation(n,"uv");s.renderType=b.getUniformLocation(n,"renderType");s.map=b.getUniformLocation(n,"map");s.occlusionMap=b.getUniformLocation(n,"occlusionMap");s.opacity=
-b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scale=b.getUniformLocation(n,"scale");s.rotation=b.getUniformLocation(n,"rotation");s.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,x=a.length;if(x){var w=new THREE.Vector3,v=f/e,H=0.5*e,F=0.5*f,A=16/f,z=new THREE.Vector2(A*v,A),K=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),E=s,A=m;b.useProgram(n);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
-b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(A.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var V,B,T,C,G;for(V=0;V<x;V++)if(A=16/f,z.set(A*v,A),C=a[V],w.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),w.applyMatrix4(d.matrixWorldInverse),w.applyProjection(d.projectionMatrix),K.copy(w),I.x=K.x*H+H,
-I.y=K.y*F+F,l||0<I.x&&I.x<e&&0<I.y&&I.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,z.x,z.y);b.uniform3f(E.screenPosition,K.x,K.y,K.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);C.positionScreen.copy(K);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);B=0;for(T=C.lensFlares.length;B<T;B++)G=C.lensFlares[B],0.001<G.opacity&&0.001<G.scale&&(K.x=G.x,K.y=G.y,K.z=G.z,A=G.size*G.scale/f,z.x=A*v,z.y=A,b.uniform3f(E.screenPosition,K.x,K.y,K.z),b.uniform2f(E.scale,z.x,z.y),b.uniform1f(E.rotation,G.rotation),b.uniform1f(E.opacity,
-G.opacity),b.uniform3f(E.color,G.color.r,G.color.g,G.color.b),c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst),c.setTexture(G.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,i=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
-vertexShader:g.vertexShader,uniforms:i,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,n){var m,s,q,r,p,t,x,w,v,H=[];r=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);m=0;for(s=l.__lights.length;m<s;m++)if(q=l.__lights[m],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(p=0;p<q.shadowCascadeCount;p++){var F;if(q.shadowCascadeArray[p])F=q.shadowCascadeArray[p];else{v=q;x=p;F=new THREE.DirectionalLight;F.isVirtual=!0;F.onlyShadow=!0;F.castShadow=!0;F.shadowCameraNear=v.shadowCameraNear;F.shadowCameraFar=v.shadowCameraFar;F.shadowCameraLeft=v.shadowCameraLeft;F.shadowCameraRight=v.shadowCameraRight;
-F.shadowCameraBottom=v.shadowCameraBottom;F.shadowCameraTop=v.shadowCameraTop;F.shadowCameraVisible=v.shadowCameraVisible;F.shadowDarkness=v.shadowDarkness;F.shadowBias=v.shadowCascadeBias[x];F.shadowMapWidth=v.shadowCascadeWidth[x];F.shadowMapHeight=v.shadowCascadeHeight[x];F.pointsWorld=[];F.pointsFrustum=[];w=F.pointsWorld;t=F.pointsFrustum;for(var A=0;8>A;A++)w[A]=new THREE.Vector3,t[A]=new THREE.Vector3;w=v.shadowCascadeNearZ[x];v=v.shadowCascadeFarZ[x];t[0].set(-1,-1,w);t[1].set(1,-1,w);t[2].set(-1,
-1,w);t[3].set(1,1,w);t[4].set(-1,-1,v);t[5].set(1,-1,v);t[6].set(-1,1,v);t[7].set(1,1,v);F.originalCamera=n;t=new THREE.Gyroscope;t.position=q.shadowCascadeOffset;t.add(F);t.add(F.target);n.add(t);q.shadowCascadeArray[p]=F;console.log("Created virtualLight",F)}x=q;w=p;v=x.shadowCascadeArray[w];v.position.copy(x.position);v.target.position.copy(x.target.position);v.lookAt(v.target);v.shadowCameraVisible=x.shadowCameraVisible;v.shadowDarkness=x.shadowDarkness;v.shadowBias=x.shadowCascadeBias[w];t=x.shadowCascadeNearZ[w];
-x=x.shadowCascadeFarZ[w];v=v.pointsFrustum;v[0].z=t;v[1].z=t;v[2].z=t;v[3].z=t;v[4].z=x;v[5].z=x;v[6].z=x;v[7].z=x;H[r]=F;r++}else H[r]=q,r++;m=0;for(s=H.length;m<s;m++){q=H[m];q.shadowMap||(p=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(p=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:p,magFilter:p,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
-if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}l.add(q.shadowCamera);b.autoUpdateScene&&l.updateMatrixWorld()}q.shadowCameraVisible&&
-!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&F.originalCamera==n){p=n;r=q.shadowCamera;t=q.pointsFrustum;v=q.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)w=v[x],w.copy(t[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,p),w.applyMatrix4(r.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
-(k.z=w.z);r.left=i.x;r.right=k.x;r.top=k.y;r.bottom=i.y;r.updateProjectionMatrix()}r=q.shadowMap;t=q.shadowMatrix;p=q.shadowCamera;p.position.getPositionFromMatrix(q.matrixWorld);p.lookAt(q.target.matrixWorld.getPosition());p.updateMatrixWorld();p.matrixWorldInverse.getInverse(p.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiply(p.projectionMatrix);t.multiply(p.matrixWorldInverse);
-h.multiplyMatrices(p.projectionMatrix,p.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(r);b.clear();v=l.__webglObjects;q=0;for(r=v.length;q<r;q++)if(x=v[q],t=x.object,x.render=!1,t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||g.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(p.matrixWorldInverse,t.matrixWorld),x.render=!0;q=0;for(r=v.length;q<r;q++)x=v[q],x.render&&(t=x.object,x=x.buffer,A=t.material instanceof THREE.MeshFaceMaterial?
-t.material.materials[0]:t.material,w=0<t.geometry.morphTargets.length&&A.morphTargets,A=t instanceof THREE.SkinnedMesh&&A.skinning,w=t.customDepthMaterial?t.customDepthMaterial:A?w?f:e:w?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(p,l.__lights,null,w,x,t):b.renderBuffer(p,l.__lights,null,w,x,t));v=l.__webglObjectsImmediate;q=0;for(r=v.length;q<r;q++)x=v[q],t=x.object,t.visible&&t.castShadow&&(t._modelViewMatrix.multiplyMatrices(p.matrixWorldInverse,t.matrixWorld),b.renderImmediateObject(p,
-l.__lights,null,c,t))}m=b.getClearColor();s=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,s);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,k,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,
-e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER),r="precision "+d+" float;\n";b.shaderSource(s,r+a.fragmentShader);b.shaderSource(q,r+a.vertexShader);b.compileShader(s);b.compileShader(q);b.attachShader(m,s);b.attachShader(m,q);b.linkProgram(m);i=m;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
+b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scale=b.getUniformLocation(n,"scale");s.rotation=b.getUniformLocation(n,"rotation");s.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,t=a.length;if(t){var v=new THREE.Vector3,w=f/e,D=0.5*e,K=0.5*f,A=16/f,z=new THREE.Vector2(A*w,A),F=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),G=s,A=m;b.useProgram(n);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
+b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(A.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var V,B,T,C,I;for(V=0;V<t;V++)if(A=16/f,z.set(A*w,A),C=a[V],v.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),F.copy(v),H.x=F.x*D+D,
+H.y=F.y*K+K,l||0<H.x&&H.x<e&&0<H.y&&H.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,z.x,z.y);b.uniform3f(G.screenPosition,F.x,F.y,F.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(G.renderType,1);b.disable(b.DEPTH_TEST);
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);C.positionScreen.copy(F);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);B=0;for(T=C.lensFlares.length;B<T;B++)I=C.lensFlares[B],0.001<I.opacity&&0.001<I.scale&&(F.x=I.x,F.y=I.y,F.z=I.z,A=I.size*I.scale/f,z.x=A*w,z.y=A,b.uniform3f(G.screenPosition,F.x,F.y,F.z),b.uniform2f(G.scale,z.x,z.y),b.uniform1f(G.rotation,I.rotation),b.uniform1f(G.opacity,
+I.opacity),b.uniform3f(G.color,I.color.r,I.color.g,I.color.b),c.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst),c.setTexture(I.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,i=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
+vertexShader:g.vertexShader,uniforms:i,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,m){var s,r,p,q,x,t,v,w,D,K=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=n.__lights.length;s<r;s++)if(p=n.__lights[s],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(x=0;x<p.shadowCascadeCount;x++){var A;if(p.shadowCascadeArray[x])A=p.shadowCascadeArray[x];else{D=p;v=x;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=D.shadowCameraNear;A.shadowCameraFar=D.shadowCameraFar;A.shadowCameraLeft=D.shadowCameraLeft;A.shadowCameraRight=D.shadowCameraRight;
+A.shadowCameraBottom=D.shadowCameraBottom;A.shadowCameraTop=D.shadowCameraTop;A.shadowCameraVisible=D.shadowCameraVisible;A.shadowDarkness=D.shadowDarkness;A.shadowBias=D.shadowCascadeBias[v];A.shadowMapWidth=D.shadowCascadeWidth[v];A.shadowMapHeight=D.shadowCascadeHeight[v];A.pointsWorld=[];A.pointsFrustum=[];w=A.pointsWorld;t=A.pointsFrustum;for(var z=0;8>z;z++)w[z]=new THREE.Vector3,t[z]=new THREE.Vector3;w=D.shadowCascadeNearZ[v];D=D.shadowCascadeFarZ[v];t[0].set(-1,-1,w);t[1].set(1,-1,w);t[2].set(-1,
+1,w);t[3].set(1,1,w);t[4].set(-1,-1,D);t[5].set(1,-1,D);t[6].set(-1,1,D);t[7].set(1,1,D);A.originalCamera=m;t=new THREE.Gyroscope;t.position=p.shadowCascadeOffset;t.add(A);t.add(A.target);m.add(t);p.shadowCascadeArray[x]=A;console.log("Created virtualLight",A)}v=p;w=x;D=v.shadowCascadeArray[w];D.position.copy(v.position);D.target.position.copy(v.target.position);D.lookAt(D.target);D.shadowCameraVisible=v.shadowCameraVisible;D.shadowDarkness=v.shadowDarkness;D.shadowBias=v.shadowCascadeBias[w];t=v.shadowCascadeNearZ[w];
+v=v.shadowCascadeFarZ[w];D=D.pointsFrustum;D[0].z=t;D[1].z=t;D[2].z=t;D[3].z=t;D[4].z=v;D[5].z=v;D[6].z=v;D[7].z=v;K[q]=A;q++}else K[q]=p,q++;s=0;for(r=K.length;s<r;s++){p=K[s];p.shadowMap||(x=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(x=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:x,magFilter:x,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
+if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}n.add(p.shadowCamera);b.autoUpdateScene&&n.updateMatrixWorld()}p.shadowCameraVisible&&
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&A.originalCamera==m){x=m;q=p.shadowCamera;t=p.pointsFrustum;D=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)w=D[v],w.copy(t[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,x),w.applyMatrix4(q.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
+(k.z=w.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;t=p.shadowMatrix;x=p.shadowCamera;x.position.getPositionFromMatrix(p.matrixWorld);l.getPositionFromMatrix(p.target.matrixWorld);x.lookAt(l);x.updateMatrixWorld();x.matrixWorldInverse.getInverse(x.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiply(x.projectionMatrix);t.multiply(x.matrixWorldInverse);
+h.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();D=n.__webglObjects;p=0;for(q=D.length;p<q;p++)if(v=D[p],t=v.object,v.render=!1,t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||g.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,t.matrixWorld),v.render=!0;p=0;for(q=D.length;p<q;p++)v=D[p],v.render&&(t=v.object,v=v.buffer,z=t.material instanceof THREE.MeshFaceMaterial?
+t.material.materials[0]:t.material,w=0<t.geometry.morphTargets.length&&z.morphTargets,z=t instanceof THREE.SkinnedMesh&&z.skinning,w=t.customDepthMaterial?t.customDepthMaterial:z?w?f:e:w?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(x,n.__lights,null,w,v,t):b.renderBuffer(x,n.__lights,null,w,v,t));D=n.__webglObjectsImmediate;p=0;for(q=D.length;p<q;p++)v=D[p],t=v.object,t.visible&&t.castShadow&&(t._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,t.matrixWorld),b.renderImmediateObject(x,
+n.__lights,null,c,t))}s=b.getClearColor();r=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,k,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,
+e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(s,p+a.fragmentShader);b.shaderSource(r,p+a.vertexShader);b.compileShader(s);b.compileShader(r);b.attachShader(m,s);b.attachShader(m,r);b.linkProgram(m);i=m;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
 "uv");l.uvOffset=b.getUniformLocation(i,"uvOffset");l.uvScale=b.getUniformLocation(i,"uvScale");l.rotation=b.getUniformLocation(i,"rotation");l.scale=b.getUniformLocation(i,"scale");l.alignment=b.getUniformLocation(i,"alignment");l.color=b.getUniformLocation(i,"color");l.map=b.getUniformLocation(i,"map");l.opacity=b.getUniformLocation(i,"opacity");l.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");l.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");l.screenPosition=b.getUniformLocation(i,
-"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,q){var r=d.__webglSprites,p=r.length;if(p){var t=k,x=l,w=q/
-f,f=0.5*f,v=0.5*q;b.useProgram(i);b.enableVertexAttribArray(t.position);b.enableVertexAttribArray(t.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(t.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(x.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(x.map,0);var H=t=0,F=d.fog;F?(b.uniform3f(x.fogColor,F.color.r,F.color.g,F.color.b),
-F instanceof THREE.Fog?(b.uniform1f(x.fogNear,F.near),b.uniform1f(x.fogFar,F.far),b.uniform1i(x.fogType,1),H=t=1):F instanceof THREE.FogExp2&&(b.uniform1f(x.fogDensity,F.density),b.uniform1i(x.fogType,2),H=t=2)):(b.uniform1i(x.fogType,0),H=t=0);for(var A,z,K=[],F=0;F<p;F++)A=r[F],z=A.material,A.visible&&0!==z.opacity&&(z.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,A.matrixWorld),A.z=-A._modelViewMatrix.elements[14]));r.sort(a);for(F=0;F<p;F++)A=
-r[F],z=A.material,A.visible&&0!==z.opacity&&(z.map&&z.map.image&&z.map.image.width)&&(b.uniform1f(x.alphaTest,z.alphaTest),!0===z.useScreenCoordinates?(b.uniform1i(x.useScreenCoordinates,1),b.uniform3f(x.screenPosition,(A.position.x*c.devicePixelRatio-f)/f,(v-A.position.y*c.devicePixelRatio)/v,Math.max(0,Math.min(1,A.position.z))),K[0]=c.devicePixelRatio,K[1]=c.devicePixelRatio):(b.uniform1i(x.useScreenCoordinates,0),b.uniform1i(x.sizeAttenuation,z.sizeAttenuation?1:0),b.uniformMatrix4fv(x.modelViewMatrix,
-!1,A._modelViewMatrix.elements),K[0]=1,K[1]=1),e=d.fog&&z.fog?H:0,t!==e&&(b.uniform1i(x.fogType,e),t=e),e=1/(z.scaleByViewport?q:1),K[0]*=e*w*A.scale.x,K[1]*=e*A.scale.y,b.uniform2f(x.uvScale,z.uvScale.x,z.uvScale.y),b.uniform2f(x.uvOffset,z.uvOffset.x,z.uvOffset.y),b.uniform2f(x.alignment,z.alignment.x,z.alignment.y),b.uniform1f(x.opacity,z.opacity),b.uniform3f(x.color,z.color.r,z.color.g,z.color.b),b.uniform1f(x.rotation,A.rotation),b.uniform2fv(x.scale,K),c.setBlending(z.blending,z.blendEquation,
+"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,r){var p=d.__webglSprites,q=p.length;if(q){var x=k,t=l,v=r/
+f,f=0.5*f,w=0.5*r;b.useProgram(i);b.enableVertexAttribArray(x.position);b.enableVertexAttribArray(x.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(x.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(x.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(t.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(t.map,0);var D=x=0,K=d.fog;K?(b.uniform3f(t.fogColor,K.color.r,K.color.g,K.color.b),
+K instanceof THREE.Fog?(b.uniform1f(t.fogNear,K.near),b.uniform1f(t.fogFar,K.far),b.uniform1i(t.fogType,1),D=x=1):K instanceof THREE.FogExp2&&(b.uniform1f(t.fogDensity,K.density),b.uniform1i(t.fogType,2),D=x=2)):(b.uniform1i(t.fogType,0),D=x=0);for(var A,z,F=[],K=0;K<q;K++)A=p[K],z=A.material,A.visible&&0!==z.opacity&&(z.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,A.matrixWorld),A.z=-A._modelViewMatrix.elements[14]));p.sort(a);for(K=0;K<q;K++)A=
+p[K],z=A.material,A.visible&&0!==z.opacity&&(z.map&&z.map.image&&z.map.image.width)&&(b.uniform1f(t.alphaTest,z.alphaTest),!0===z.useScreenCoordinates?(b.uniform1i(t.useScreenCoordinates,1),b.uniform3f(t.screenPosition,(A.position.x*c.devicePixelRatio-f)/f,(w-A.position.y*c.devicePixelRatio)/w,Math.max(0,Math.min(1,A.position.z))),F[0]=c.devicePixelRatio,F[1]=c.devicePixelRatio):(b.uniform1i(t.useScreenCoordinates,0),b.uniform1i(t.sizeAttenuation,z.sizeAttenuation?1:0),b.uniformMatrix4fv(t.modelViewMatrix,
+!1,A._modelViewMatrix.elements),F[0]=1,F[1]=1),e=d.fog&&z.fog?D:0,x!==e&&(b.uniform1i(t.fogType,e),x=e),e=1/(z.scaleByViewport?r:1),F[0]*=e*v*A.scale.x,F[1]*=e*A.scale.y,b.uniform2f(t.uvScale,z.uvScale.x,z.uvScale.y),b.uniform2f(t.uvOffset,z.uvOffset.x,z.uvOffset.y),b.uniform2f(t.alignment,z.alignment.x,z.alignment.y),b.uniform1f(t.opacity,z.opacity),b.uniform3f(t.color,z.color.r,z.color.g,z.color.b),b.uniform1f(t.rotation,A.rotation),b.uniform2fv(t.scale,F),c.setBlending(z.blending,z.blendEquation,
 z.blendSrc,z.blendDst),c.setDepthTest(z.depthTest),c.setDepthWrite(z.depthWrite),c.setTexture(z.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var l,n,m,s,q,r;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);h.multiplyMatrices(k.projectionMatrix,
-k.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();r=i.__webglObjects;l=0;for(n=r.length;l<n;l++)if(m=r[l],q=m.object,m.render=!1,q.visible&&(!(q instanceof THREE.Mesh||q instanceof THREE.ParticleSystem)||!q.frustumCulled||g.intersectsObject(q)))q._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,q.matrixWorld),m.render=!0;var p;l=0;for(n=r.length;l<n;l++)if(m=r[l],m.render&&(q=m.object,m=m.buffer,!(q instanceof THREE.ParticleSystem)||q.customDepthMaterial))(p=
-q.material instanceof THREE.MeshFaceMaterial?q.material.materials[0]:q.material)&&b.setMaterialFaces(q.material),s=0<q.geometry.morphTargets.length&&p.morphTargets,p=q instanceof THREE.SkinnedMesh&&p.skinning,s=q.customDepthMaterial?q.customDepthMaterial:p?s?f:e:s?d:c,m instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,s,m,q):b.renderBuffer(k,i.__lights,null,s,m,q);r=i.__webglObjectsImmediate;l=0;for(n=r.length;l<n;l++)m=r[l],q=m.object,q.visible&&(q._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
-q.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,q));l=b.getClearColor();n=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,n);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{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 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var l,n,m,s,r,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);h.multiplyMatrices(k.projectionMatrix,
+k.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;l=0;for(n=p.length;l<n;l++)if(m=p[l],r=m.object,m.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||g.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),m.render=!0;var q;l=0;for(n=p.length;l<n;l++)if(m=p[l],m.render&&(r=m.object,m=m.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(q=
+r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material)&&b.setMaterialFaces(r.material),s=0<r.geometry.morphTargets.length&&q.morphTargets,q=r instanceof THREE.SkinnedMesh&&q.skinning,s=r.customDepthMaterial?r.customDepthMaterial:q?s?f:e:s?d:c,m instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,s,m,r):b.renderBuffer(k,i.__lights,null,s,m,r);p=i.__webglObjectsImmediate;l=0;for(n=p.length;l<n;l++)m=p[l],r=m.object,r.visible&&(r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
+r.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,r));l=b.getClearColor();n=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,n);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{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 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
 fragmentShader:"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}"},lensFlare:{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 +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
 fragmentShader:"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}"}};

+ 1 - 1
editor/index.html

@@ -309,7 +309,7 @@
 
 								worker.onmessage = function ( event ) {
 
-									event.data.metadata = { 'format': 2 };
+									event.data.metadata = { format: 2 };
 									handleJSON( event.data );
 
 								};