Quellcode durchsuchen

Updated builds.

Mr.doob vor 12 Jahren
Ursprung
Commit
b4d8734f4e
2 geänderte Dateien mit 351 neuen und 324 gelöschten Zeilen
  1. 58 30
      build/three.js
  2. 293 294
      build/three.min.js

+ 58 - 30
build/three.js

@@ -5938,7 +5938,7 @@ THREE.EventDispatcher.prototype = {
 		this.ray = new THREE.Ray( origin, direction );
 
 		// normalized ray.direction required for accurate distance calculations
-		if( this.ray.direction.lengthSq() > 0 ) {
+		if ( this.ray.direction.lengthSq() > 0 ) {
 
 			this.ray.direction.normalize();
 
@@ -5985,6 +5985,13 @@ THREE.EventDispatcher.prototype = {
 
 			} );
 
+		} else if ( object instanceof THREE.LOD ) {
+
+			matrixPosition.getPositionFromMatrix( object.matrixWorld );
+			var distance = raycaster.ray.origin.distanceTo( matrixPosition );
+
+			intersectObject( object.getObjectForDistance( distance ), raycaster, intersects );
+
 		} else if ( object instanceof THREE.Mesh ) {
 
 			// Checking boundingSphere distance to ray
@@ -6038,11 +6045,11 @@ THREE.EventDispatcher.prototype = {
 
 				// check if we hit the wrong side of a single sided face
 				side = material.side;
-				if( side !== THREE.DoubleSide ) {
+				if ( side !== THREE.DoubleSide ) {
 
 					var planeSign = localRay.direction.dot( facePlane.normal );
 
-					if( ! ( side === THREE.FrontSide ? planeSign < 0 : planeSign > 0 ) ) continue;
+					if ( ! ( side === THREE.FrontSide ? planeSign < 0 : planeSign > 0 ) ) continue;
 
 				}
 
@@ -6113,7 +6120,7 @@ THREE.EventDispatcher.prototype = {
 		this.ray.set( origin, direction );
 
 		// normalized ray.direction required for accurate distance calculations
-		if( this.ray.direction.length() > 0 ) {
+		if ( this.ray.direction.length() > 0 ) {
 
 			this.ray.direction.normalize();
 
@@ -12434,6 +12441,8 @@ THREE.ShaderMaterial = function ( parameters ) {
 
 	this.shading = THREE.SmoothShading;
 
+	this.linewidth = 1;
+
 	this.wireframe = false;
 	this.wireframeLinewidth = 1;
 
@@ -13455,26 +13464,39 @@ THREE.LOD = function () {
 
 	THREE.Object3D.call( this );
 
-	this.LODs = [];
+	this.objects = [];
 
 };
 
 
 THREE.LOD.prototype = Object.create( THREE.Object3D.prototype );
 
-THREE.LOD.prototype.addLevel = function ( object3D, visibleAtDistance ) {
+THREE.LOD.prototype.addLevel = function ( object, distance ) {
+
+	if ( distance === undefined ) distance = 0;
+
+	distance = Math.abs( distance );
 
-	if ( visibleAtDistance === undefined ) {
+	for ( var l = 0; l < this.objects.length; l ++ ) {
 
-		visibleAtDistance = 0;
+		if ( distance < this.objects[ l ].distance ) {
+
+			break;
+
+		}
 
 	}
 
-	visibleAtDistance = Math.abs( visibleAtDistance );
+	this.objects.splice( l, 0, { distance: distance, object: object } );
+	this.add( object );
 
-	for ( var l = 0; l < this.LODs.length; l ++ ) {
+};
+
+THREE.LOD.prototype.getObjectForDistance = function ( distance ) {
 
-		if ( visibleAtDistance < this.LODs[ l ].visibleAtDistance ) {
+	for ( var i = 1, l = this.objects.length; i < l; i ++ ) {
+
+		if ( distance < this.objects[ i ].distance ) {
 
 			break;
 
@@ -13482,46 +13504,52 @@ THREE.LOD.prototype.addLevel = function ( object3D, visibleAtDistance ) {
 
 	}
 
-	this.LODs.splice( l, 0, { visibleAtDistance: visibleAtDistance, object3D: object3D } );
-	this.add( object3D );
+	return this.objects[ i - 1 ].object;
 
 };
 
-THREE.LOD.prototype.update = function ( camera ) {
+THREE.LOD.prototype.update = function () {
+
+	var v1 = new THREE.Vector3();
+	var v2 = new THREE.Vector3();
 
-	if ( this.LODs.length > 1 ) {
+	return function ( camera ) {
 
-		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
+		if ( this.objects.length > 1 ) {
 
-		var inverse  = camera.matrixWorldInverse;
-		var distance = -( inverse.elements[2] * this.matrixWorld.elements[12] + inverse.elements[6] * this.matrixWorld.elements[13] + inverse.elements[10] * this.matrixWorld.elements[14] + inverse.elements[14] );
+			v1.getPositionFromMatrix( camera.matrixWorld );
+			v2.getPositionFromMatrix( this.matrixWorld );
 
-		this.LODs[ 0 ].object3D.visible = true;
+			var distance = v1.distanceTo( v2 );
 
-		for ( var l = 1; l < this.LODs.length; l ++ ) {
+			this.objects[ 0 ].object.visible = true;
 
-			if( distance >= this.LODs[ l ].visibleAtDistance ) {
+			for ( var i = 1, l = this.objects.length; i < l; i ++ ) {
 
-				this.LODs[ l - 1 ].object3D.visible = false;
-				this.LODs[ l     ].object3D.visible = true;
+				if ( distance >= this.objects[ i ].distance ) {
 
-			} else {
+					this.objects[ i - 1 ].object.visible = false;
+					this.objects[ i     ].object.visible = true;
 
-				break;
+				} else {
+
+					break;
+
+				}
 
 			}
 
-		}
+			for( ; i < l; i ++ ) {
 
-		for( ; l < this.LODs.length; l ++ ) {
+				this.objects[ i ].object.visible = false;
 
-			this.LODs[ l ].object3D.visible = false;
+			}
 
 		}
 
-	}
+	};
 
-};
+}();
 
 THREE.LOD.prototype.clone = function () {
 

+ 293 - 294
build/three.min.js

@@ -22,9 +22,9 @@ palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:1677
 tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"YXZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*
 h-f*g*e,this.w=c*d*e+f*g*h):"ZXY"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"ZYX"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e+f*g*h):"YZX"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e-f*g*h):"XZY"===b&&(this.x=f*d*e-c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e+f*g*h);return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);
-return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],k=c+f+b;0<k?(c=0.5/Math.sqrt(k+1),this.w=0.25/c,this.x=(i-g)*c,this.y=(d-h)*c,this.z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
+return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;0<j?(c=0.5/Math.sqrt(j+1),this.w=0.25/c,this.x=(i-g)*c,this.y=(d-h)*c,this.z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
 return this},conjugate:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=this.length();0===a?(this.z=this.y=this.x=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),
-this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,k=b.w;this.x=c*k+f*g+d*i-e*h;this.y=d*k+f*h+e*g-c*i;this.z=e*k+f*i+c*h-d*g;this.w=f*k-c*g-d*h-e*i;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this.x,d=this.y,e=this.z,
+this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,j=b.w;this.x=c*j+f*g+d*i-e*h;this.y=d*j+f*h+e*g-c*i;this.z=e*j+f*i+c*h-d*g;this.w=f*j-c*g-d*h-e*i;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this.x,d=this.y,e=this.z,
 f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;0>g?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,g=-g):this.copy(a);if(1<=g)return this.w=f,this.x=c,this.y=d,this.z=e,this;var h=Math.acos(g),i=Math.sqrt(1-g*g);if(0.001>Math.abs(i))return this.w=0.5*(f+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},equals:function(a){return a.x===this.x&&a.y===
 this.y&&a.z===this.z&&a.w===this.w},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,
@@ -36,13 +36,13 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
 this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*
 b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements,e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);
-this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,a=a.w,h=a*b+f*d-g*c,i=a*c+g*b-e*d,k=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+i*-g-k*-f;this.y=i*a+b*-f+k*-e-h*-g;this.z=k*a+b*-g+h*-f-i*-e;return this},transformDirection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*
+this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,a=a.w,h=a*b+f*d-g*c,i=a*c+g*b-e*d,j=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+i*-g-j*-f;this.y=i*a+b*-f+j*-e-h*-g;this.z=j*a+b*-g+h*-f-i*-e;return this},transformDirection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*
 b+a[6]*c+a[10]*d;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=
 a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=
 this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=
-a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],k=d[9],m=d[2],p=d[6],d=d[10];void 0===b||"XYZ"===
-b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-k,d),this.z=Math.atan2(-f,e)):(this.x=Math.atan2(p,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(k)),0.99999>Math.abs(k)?(this.y=Math.atan2(g,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-m,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(p)),0.99999>Math.abs(p)?(this.y=Math.atan2(-m,d),this.z=Math.atan2(-f,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(m)),0.99999>Math.abs(m)?(this.x=Math.atan2(p,d),this.z=Math.atan2(h,
-e)):(this.x=0,this.z=Math.atan2(-f,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-k,i),this.y=Math.atan2(-m,e)):(this.x=0,this.y=Math.atan2(g,d))):"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(p,i),this.y=Math.atan2(g,e)):(this.x=Math.atan2(-k,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*
+a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],m=d[2],l=d[6],d=d[10];void 0===b||"XYZ"===
+b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-f,e)):(this.x=Math.atan2(l,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?(this.y=Math.atan2(g,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-m,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(l)),0.99999>Math.abs(l)?(this.y=Math.atan2(-m,d),this.z=Math.atan2(-f,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(m)),0.99999>Math.abs(m)?(this.x=Math.atan2(l,d),this.z=Math.atan2(h,
+e)):(this.x=0,this.z=Math.atan2(-f,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-m,e)):(this.x=0,this.y=Math.atan2(g,d))):"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(l,i),this.y=Math.atan2(g,e)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*
 (a.x*a.w-a.y*a.z),g-d-e+f),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),this.y=Math.asin(c(2*(a.y*a.w-a.x*
 a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getScaleFromMatrix:function(a){var b=
 this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},getColumnFromMatrix:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2]},toArray:function(){return[this.x,this.y,
@@ -53,8 +53,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},
 addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},
 applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=
-a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var k=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+k-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;k=(k+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>k?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>k?0.01>h?(b=0.707106781,
-c=0,d=0.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):0.01>k?(c=b=0.707106781,d=0):(d=Math.sqrt(k),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+k-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&
+a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>j?0.01>h?(b=0.707106781,
+c=0,d=0.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&
 (this.z=a.z);this.w<a.w&&(this.w=a.w);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*
 this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&
 a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3]},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3};
@@ -73,29 +73,29 @@ this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max
 this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,
 this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,f,g,h,i){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,f||0,g||0,h||0,void 0!==i?i:1)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,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)},
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,i){var j=this.elements;j[0]=a;j[3]=b;j[6]=c;j[1]=d;j[4]=e;j[7]=f;j[2]=g;j[5]=h;j[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,m,p,l,r,s,n){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!==m?m:1;q[14]=p||0;q[3]=l||0;q[7]=r||0;q[11]=s||0;q[15]=void 0!==n?n:1};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,m,p,l,r,s,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=k;q[10]=m;q[14]=p;q[3]=l;q[7]=r;q[11]=s;q[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},copyPosition:function(a){var b=this.elements,
+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,j,m,l,p,r,s,n){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]=j||0;q[10]=void 0!==m?m:1;q[14]=l||0;q[3]=p||0;q[7]=r||0;q[11]=s||0;q[15]=void 0!==n?n:1};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,m,l,p,r,s,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=j;q[10]=m;q[14]=l;q[3]=p;q[7]=r;q[11]=s;q[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},copyPosition:function(a){var b=this.elements,
 a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},copyRotation: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}}(),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,m=g*f,p=d*i,l=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=m+p*e;c[5]=k-l*e;c[9]=-d*h;c[2]=l-k*e;c[6]=p+m*e;c[10]=g*h}else"YXZ"===b?(k=h*i,m=h*f,p=e*i,l=e*f,c[0]=k+l*d,c[4]=p*d-m,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=m*d-p,c[6]=l+k*d,c[10]=g*h):"ZXY"===b?(k=h*i,m=h*f,p=e*i,l=e*f,c[0]=k-l*d,c[4]=-g*f,c[8]=p+m*d,c[1]=m+p*d,c[5]=g*i,c[9]=l-k*d,c[2]=-g*e,c[6]=d,c[10]=g*h):"ZYX"===b?(k=g*i,m=g*f,p=d*i,l=d*f,c[0]=h*i,c[4]=p*e-m,c[8]=
-k*e+l,c[1]=h*f,c[5]=l*e+k,c[9]=m*e-p,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(k=g*h,m=g*e,p=d*h,l=d*e,c[0]=h*i,c[4]=l-k*f,c[8]=p*f+m,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=m*f+p,c[10]=k-l*f):"XZY"===b&&(k=g*h,m=g*e,p=d*h,l=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=k*f+l,c[5]=g*i,c[9]=m*f-p,c[2]=p*f-m,c[6]=d*i,c[10]=l*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,m=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(m+e);b[4]=
-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+m);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],m=c[5],p=c[9],l=c[13],r=c[2],s=c[6],n=c[10],q=c[14],y=c[3],u=c[7],x=c[11],c=c[15],t=d[0],D=d[4],J=d[8],F=d[12],z=d[1],H=d[5],L=d[9],I=d[13],N=d[2],A=d[6],U=d[10],G=d[14],K=d[3],M=d[7],T=d[11],d=d[15];e[0]=f*
-t+g*z+h*N+i*K;e[4]=f*D+g*H+h*A+i*M;e[8]=f*J+g*L+h*U+i*T;e[12]=f*F+g*I+h*G+i*d;e[1]=k*t+m*z+p*N+l*K;e[5]=k*D+m*H+p*A+l*M;e[9]=k*J+m*L+p*U+l*T;e[13]=k*F+m*I+p*G+l*d;e[2]=r*t+s*z+n*N+q*K;e[6]=r*D+s*H+n*A+q*M;e[10]=r*J+s*L+n*U+q*T;e[14]=r*F+s*I+n*G+q*d;e[3]=y*t+u*z+x*N+c*K;e[7]=y*D+u*H+x*A+c*M;e[11]=y*J+u*L+x*U+c*T;e[15]=y*F+u*I+x*G+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]=
+e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var j=g*i,m=g*f,l=d*i,p=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=m+l*e;c[5]=j-p*e;c[9]=-d*h;c[2]=p-j*e;c[6]=l+m*e;c[10]=g*h}else"YXZ"===b?(j=h*i,m=h*f,l=e*i,p=e*f,c[0]=j+p*d,c[4]=l*d-m,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=m*d-l,c[6]=p+j*d,c[10]=g*h):"ZXY"===b?(j=h*i,m=h*f,l=e*i,p=e*f,c[0]=j-p*d,c[4]=-g*f,c[8]=l+m*d,c[1]=m+l*d,c[5]=g*i,c[9]=p-j*d,c[2]=-g*e,c[6]=d,c[10]=g*h):"ZYX"===b?(j=g*i,m=g*f,l=d*i,p=d*f,c[0]=h*i,c[4]=l*e-m,c[8]=
+j*e+p,c[1]=h*f,c[5]=p*e+j,c[9]=m*e-l,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(j=g*h,m=g*e,l=d*h,p=d*e,c[0]=h*i,c[4]=p-j*f,c[8]=l*f+m,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=m*f+l,c[10]=j-p*f):"XZY"===b&&(j=g*h,m=g*e,l=d*h,p=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=j*f+p,c[5]=g*i,c[9]=m*f-l,c[2]=l*f-m,c[6]=d*i,c[10]=p*f+j);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,j=c*h,c=c*i,m=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(m+e);b[4]=
+j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+m);return this},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],j=c[1],m=c[5],l=c[9],p=c[13],r=c[2],s=c[6],n=c[10],q=c[14],y=c[3],u=c[7],x=c[11],c=c[15],t=d[0],D=d[4],J=d[8],F=d[12],z=d[1],H=d[5],L=d[9],I=d[13],N=d[2],A=d[6],U=d[10],G=d[14],K=d[3],M=d[7],T=d[11],d=d[15];e[0]=f*
+t+g*z+h*N+i*K;e[4]=f*D+g*H+h*A+i*M;e[8]=f*J+g*L+h*U+i*T;e[12]=f*F+g*I+h*G+i*d;e[1]=j*t+m*z+l*N+p*K;e[5]=j*D+m*H+l*A+p*M;e[9]=j*J+m*L+l*U+p*T;e[13]=j*F+m*I+l*G+p*d;e[2]=r*t+s*z+n*N+q*K;e[6]=r*D+s*H+n*A+q*M;e[10]=r*J+s*L+n*U+q*T;e[14]=r*F+s*I+n*G+q*d;e[3]=y*t+u*z+x*N+c*K;e[7]=y*D+u*H+x*A+c*M;e[11]=y*J+u*L+x*U+c*T;e[15]=y*F+u*I+x*G+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){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
-a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],m=a[6],p=a[10],l=a[14];return a[3]*(+e*h*m-d*i*m-e*g*p+c*i*p+d*g*l-c*h*l)+a[7]*(+b*h*l-b*i*p+e*f*p-d*f*l+d*i*k-e*h*k)+a[11]*(+b*i*m-b*g*l-e*f*m+c*f*l+e*g*k-c*i*k)+a[15]*(-d*g*k-b*h*m+b*g*p+d*f*m-c*f*
-p+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.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],m=a[6],l=a[10],p=a[14];return a[3]*(+e*h*m-d*i*m-e*g*l+c*i*l+d*g*p-c*h*p)+a[7]*(+b*h*p-b*i*l+e*f*l-d*f*p+d*i*j-e*h*j)+a[11]*(+b*i*m-b*g*p-e*f*m+c*f*p+e*g*j-c*i*j)+a[15]*(-d*g*j-b*h*m+b*g*l+d*f*m-c*f*
+l+c*h*j)},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(){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],m=d[9],p=d[13],l=d[2],r=d[6],s=d[10],n=d[14],q=d[3],y=d[7],u=d[11],x=d[15];c[0]=m*n*y-p*s*y+p*r*u-k*n*u-m*r*x+k*s*x;c[4]=h*s*y-g*n*y-h*r*u+f*n*u+g*r*x-f*s*x;c[8]=g*p*y-h*m*y+h*k*u-f*p*u-g*k*x+f*m*x;c[12]=h*m*r-g*p*r-h*k*s+f*p*s+g*k*n-f*m*n;c[1]=p*s*q-m*n*q-p*l*u+i*n*u+m*l*x-i*s*x;c[5]=g*n*q-h*s*q+h*l*u-e*n*u-g*l*x+e*s*x;c[9]=h*m*q-g*p*q-h*i*u+e*p*u+g*i*x-
-e*m*x;c[13]=g*p*l-h*m*l+h*i*s-e*p*s-g*i*n+e*m*n;c[2]=k*n*q-p*r*q+p*l*y-i*n*y-k*l*x+i*r*x;c[6]=h*r*q-f*n*q-h*l*y+e*n*y+f*l*x-e*r*x;c[10]=f*p*q-h*k*q+h*i*y-e*p*y-f*i*x+e*k*x;c[14]=h*k*l-f*p*l-h*i*r+e*p*r+f*i*n-e*k*n;c[3]=m*r*q-k*s*q-m*l*y+i*s*y+k*l*u-i*r*u;c[7]=f*s*q-g*r*q+g*l*y-e*s*y-f*l*u+e*r*u;c[11]=g*k*q-f*m*q-g*i*y+e*m*y+f*i*u-e*k*u;c[15]=f*m*l-g*k*l+g*i*r-e*m*r-f*i*s+e*k*s;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");
+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],j=d[5],m=d[9],l=d[13],p=d[2],r=d[6],s=d[10],n=d[14],q=d[3],y=d[7],u=d[11],x=d[15];c[0]=m*n*y-l*s*y+l*r*u-j*n*u-m*r*x+j*s*x;c[4]=h*s*y-g*n*y-h*r*u+f*n*u+g*r*x-f*s*x;c[8]=g*l*y-h*m*y+h*j*u-f*l*u-g*j*x+f*m*x;c[12]=h*m*r-g*l*r-h*j*s+f*l*s+g*j*n-f*m*n;c[1]=l*s*q-m*n*q-l*p*u+i*n*u+m*p*x-i*s*x;c[5]=g*n*q-h*s*q+h*p*u-e*n*u-g*p*x+e*s*x;c[9]=h*m*q-g*l*q-h*i*u+e*l*u+g*i*x-
+e*m*x;c[13]=g*l*p-h*m*p+h*i*s-e*l*s-g*i*n+e*m*n;c[2]=j*n*q-l*r*q+l*p*y-i*n*y-j*p*x+i*r*x;c[6]=h*r*q-f*n*q-h*p*y+e*n*y+f*p*x-e*r*x;c[10]=f*l*q-h*j*q+h*i*y-e*l*y-f*i*x+e*j*x;c[14]=h*j*p-f*l*p-h*i*r+e*l*r+f*i*n-e*j*n;c[3]=m*r*q-j*s*q-m*p*y+i*s*y+j*p*u-i*r*u;c[7]=f*s*q-g*r*q+g*p*y-e*s*y-f*p*u+e*r*u;c[11]=g*j*q-f*m*q-g*i*y+e*m*y+f*i*u-e*j*u;c[15]=f*m*p-g*j*p+g*i*r-e*m*r-f*i*s+e*j*s;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},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");return this.copyPosition(a)},extractRotation:function(a){console.warn("DEPRECATED: Matrix4's .extractRotation() has been renamed to .copyRotation().");return this.copyRotation(a)},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},
 rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},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,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+
+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=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,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=
 0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};
 THREE.extend(THREE.Matrix4.prototype,{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]}}()});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
@@ -105,19 +105,19 @@ a.normal.dot(this.direction);if(0==b){if(0==a.distanceToPoint(this.origin))retur
 THREE.Sphere.prototype={constructor:THREE.Sphere,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},applyMatrix4: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.Frustum.prototype={constructor:THREE.Frustum,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],m=c[8],p=c[9],l=c[10],r=c[11],s=c[12],n=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,k-g,r-m,c-s).normalize();b[1].setComponents(f+
-a,k+g,r+m,c+s).normalize();b[2].setComponents(f+d,k+h,r+p,c+n).normalize();b[3].setComponents(f-d,k-h,r-p,c-n).normalize();b[4].setComponents(f-e,k-i,r-l,c-q).normalize();b[5].setComponents(f+e,k+i,r+l,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=
+THREE.Frustum.prototype={constructor:THREE.Frustum,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],j=c[7],m=c[8],l=c[9],p=c[10],r=c[11],s=c[12],n=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,j-g,r-m,c-s).normalize();b[1].setComponents(f+
+a,j+g,r+m,c+s).normalize();b[2].setComponents(f+d,j+h,r+l,c+n).normalize();b[3].setComponents(f-d,j-h,r-l,c-n).normalize();b[4].setComponents(f-e,j-i,r-p,c-q).normalize();b[5].setComponents(f+e,j+i,r+p,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.Plane.prototype={constructor:THREE.Plane,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,
 b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start),a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectLine:function(){var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),f=this.normal.dot(e);if(0==f){if(0==this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)}}(),
 coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){var d=d||(new THREE.Matrix3).getInverse(c).transpose(),e=a.copy(this.normal).applyMatrix3(d),f=this.coplanarPoint(b);f.applyMatrix4(c);this.setFromNormalAndCoplanarPoint(e,f);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&
 a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}};THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,
-b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,m,p,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
-f+2;k=this.points[c[0]];m=this.points[c[1]];p=this.points[c[2]];l=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,m.x,p.x,l.x,g,h,i);d.y=b(k.y,m.y,p.y,l.y,g,h,i);d.z=b(k.z,m.z,p.z,l.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
-a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
+b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,m,l,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
+f+2;j=this.points[c[0]];m=this.points[c[1]];l=this.points[c[2]];p=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,m.x,l.x,p.x,g,h,i);d.y=b(j.y,m.y,l.y,p.y,g,h,i);d.z=b(j.z,m.z,l.z,p.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
+a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
 h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();
-THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,h){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),f=a.dot(c),i=b.dot(b),g=b.dot(c),k=d*i-e*e,h=h||new THREE.Vector3;if(0==k)return h.set(-2,-1,-1);k=1/k;i=(i*f-e*g)*k;d=(d*g-e*f)*k;return h.set(1-i-d,d,i)}}();
+THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,h){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),f=a.dot(c),i=b.dot(b),g=b.dot(c),j=d*i-e*e,h=h||new THREE.Vector3;if(0==j)return h.set(-2,-1,-1);j=1/j;i=(i*f-e*g)*j;d=(d*g-e*f)*j;return h.set(1-i-d,d,i)}}();
 THREE.Triangle.containsPoint=function(){var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}();
 THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return 0.5*a.cross(b).length()}}(),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)},
@@ -125,11 +125,11 @@ clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Vertex=function(a
 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(){};
 THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!==
-this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(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 r=h.geometry,s=r.vertices,n=h.material instanceof a.MeshFaceMaterial,q=!0===n?h.material.materials:null,y=h.material.side,u,x,t,D=i.precision;h.matrixRotationWorld.copyRotation(h.matrixWorld);g.getInverse(h.matrixWorld);c.copy(i.ray).applyMatrix4(g);for(var J=0,F=r.faces.length;J<F;J++){var z=r.faces[J],y=!0===n?q[z.materialIndex]:
-h.material;if(void 0!==y){d.setFromNormalAndCoplanarPoint(z.normal,s[z.a]);var H=c.distanceToPlane(d);if(!(Math.abs(H)<D)&&!(0>H)){y=y.side;if(y!==a.DoubleSide&&(u=c.direction.dot(d.normal),!(y===a.FrontSide?0>u:0<u)))continue;if(!(H<i.near||H>i.far)){e=c.at(H,e);if(z instanceof a.Face3){if(y=s[z.a],u=s[z.b],x=s[z.c],!a.Triangle.containsPoint(e,y,u,x))continue}else if(z instanceof a.Face4){if(y=s[z.a],u=s[z.b],x=s[z.c],t=s[z.d],!a.Triangle.containsPoint(e,y,u,t)&&!a.Triangle.containsPoint(e,u,x,t))continue}else throw Error("face type not supported");
-k.push({distance:H,point:i.ray.at(H),face:z,faceIndex:J,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.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=
+this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(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,j,p){if(h instanceof a.Particle){f.getPositionFromMatrix(h.matrixWorld);var r=j.ray.distanceToPoint(f);if(r>h.scale.x)return p;p.push({distance:r,point:h.position,face:null,object:h})}else if(h instanceof
+a.LOD)f.getPositionFromMatrix(h.matrixWorld),r=j.ray.origin.distanceTo(f),i(h.getObjectForDistance(r),j,p);else if(h instanceof a.Mesh){f.getPositionFromMatrix(h.matrixWorld);b.set(f,h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis());if(!j.ray.isIntersectionSphere(b))return p;var r=h.geometry,s=r.vertices,n=h.material instanceof a.MeshFaceMaterial,q=!0===n?h.material.materials:null,y=h.material.side,u,x,t,D=j.precision;h.matrixRotationWorld.copyRotation(h.matrixWorld);g.getInverse(h.matrixWorld);
+c.copy(j.ray).applyMatrix4(g);for(var J=0,F=r.faces.length;J<F;J++){var z=r.faces[J],y=!0===n?q[z.materialIndex]:h.material;if(void 0!==y){d.setFromNormalAndCoplanarPoint(z.normal,s[z.a]);var H=c.distanceToPlane(d);if(!(Math.abs(H)<D)&&!(0>H)){y=y.side;if(y!==a.DoubleSide&&(u=c.direction.dot(d.normal),!(y===a.FrontSide?0>u:0<u)))continue;if(!(H<j.near||H>j.far)){e=c.at(H,e);if(z instanceof a.Face3){if(y=s[z.a],u=s[z.b],x=s[z.c],!a.Triangle.containsPoint(e,y,u,x))continue}else if(z instanceof a.Face4){if(y=
+s[z.a],u=s[z.b],x=s[z.c],t=s[z.d],!a.Triangle.containsPoint(e,y,u,t)&&!a.Triangle.containsPoint(e,u,x,t))continue}else throw Error("face type not supported");p.push({distance:H,point:j.ray.at(H),face:z,faceIndex:J,object:h})}}}}}},j=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&&j(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&&j(a[d],this,c);c.sort(h);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=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.userData={}};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(){var a=new THREE.Matrix4;return function(b){this.matrix.multiplyMatrices(b,this.matrix);this.position.getPositionFromMatrix(this.matrix);this.scale.getScaleFromMatrix(this.matrix);a.copyRotation(this.matrix);!0===this.useQuaternion?this.quaternion.setFromRotationMatrix(a):this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder)}}(),rotateOnAxis:function(){var a=new THREE.Quaternion,b=new THREE.Quaternion;return function(c,
 d){a.setFromAxisAngle(c,d);!0===this.useQuaternion?this.quaternion.multiply(a):(b.setFromEuler(this.rotation,this.eulerOrder),b.multiply(a),this.rotation.setEulerFromQuaternion(b,this.eulerOrder));return this}}(),translateOnAxis:function(){var a=new THREE.Vector3;return function(b,c){a.copy(b);!0===this.useQuaternion?a.applyQuaternion(this.quaternion):a.applyEuler(this.rotation,this.eulerOrder);this.position.add(a.multiplyScalar(c));return this}}(),translate:function(a,b){console.warn("DEPRECATED: Object3D's .translate() has been removed. Use .translateOnAxis( axis, distance ) instead. Note args have been changed.");
@@ -140,19 +140,19 @@ getObjectByName:function(a,b){for(var c=0,d=this.children.length;c<d;c++){var e=
 updateMatrix:function(){this.matrix.setPosition(this.position);!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;a.userData=JSON.parse(JSON.stringify(this.userData));for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());
-return a}};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===p){var a=new THREE.RenderableVertex;m.push(a);p++;k++;return a}return m[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,m=[],p=0,l,r,s=[],n=0,q,y=[],u=0,x,t,D=[],J=0,F,z,H=[],L=0,I={objects:[],sprites:[],lights:[],elements:[]},N=new THREE.Vector3,A=new THREE.Vector4,U=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),G=new THREE.Box3,K=Array(3),M=Array(4),T=new THREE.Matrix4,$=new THREE.Matrix4,wa,fb=new THREE.Matrix4,B=new THREE.Matrix3,ca=new THREE.Matrix3,qa=new THREE.Vector3,ga=new THREE.Frustum,ja=new THREE.Vector4,E=new THREE.Vector4;
+return a}};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(j===l){var a=new THREE.RenderableVertex;m.push(a);l++;j++;return a}return m[j++]}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,j,m=[],l=0,p,r,s=[],n=0,q,y=[],u=0,x,t,D=[],J=0,F,z,H=[],L=0,I={objects:[],sprites:[],lights:[],elements:[]},N=new THREE.Vector3,A=new THREE.Vector4,U=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),G=new THREE.Box3,K=Array(3),M=Array(4),T=new THREE.Matrix4,$=new THREE.Matrix4,wa,fb=new THREE.Matrix4,B=new THREE.Matrix3,ca=new THREE.Matrix3,qa=new THREE.Vector3,ga=new THREE.Frustum,ja=new THREE.Vector4,E=new THREE.Vector4;
 this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);$.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection($)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);$.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection($)};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,p,Xa){var Ba=!1,ma,fa,X,V,Y,ia,ha,na,Ka,Ya,pa,Na,Qa;z=t=q=r=0;I.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();T.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));$.multiplyMatrices(h.projectionMatrix,T);ca.getInverse(T);ca.transpose();ga.setFromMatrix($);f=0;I.objects.length=0;I.sprites.length=0;I.lights.length=0;var Va=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
+c)};this.projectScene=function(g,h,l,Xa){var Ba=!1,ma,fa,X,V,Y,ia,ha,na,Ka,Ya,pa,Na,Qa;z=t=q=r=0;I.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();T.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));$.multiplyMatrices(h.projectionMatrix,T);ca.getInverse(T);ca.transpose();ga.setFromMatrix($);f=0;I.objects.length=0;I.sprites.length=0;I.lights.length=0;var Va=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)I.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===ga.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(N.getPositionFromMatrix(f.matrixWorld),N.applyProjection($),e.z=N.z),I.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(N.getPositionFromMatrix(f.matrixWorld),N.applyProjection($),e.z=N.z),I.sprites.push(e)):(e=a(),e.object=
-f,null!==f.renderDepth?e.z=f.renderDepth:(N.getPositionFromMatrix(f.matrixWorld),N.applyProjection($),e.z=N.z),I.objects.push(e));Va(f)}}};Va(g);!0===p&&I.objects.sort(c);g=0;for(p=I.objects.length;g<p;g++)if(na=I.objects[g].object,wa=na.matrixWorld,k=0,na instanceof THREE.Mesh){Ka=na.geometry;X=Ka.vertices;Ya=Ka.faces;Ka=Ka.faceVertexUvs;B.getInverse(wa);B.transpose();Na=na.material instanceof THREE.MeshFaceMaterial;Qa=!0===Na?na.material:null;ma=0;for(fa=X.length;ma<fa;ma++)i=b(),i.positionWorld.copy(X[ma]).applyMatrix4(wa),
+f,null!==f.renderDepth?e.z=f.renderDepth:(N.getPositionFromMatrix(f.matrixWorld),N.applyProjection($),e.z=N.z),I.objects.push(e));Va(f)}}};Va(g);!0===l&&I.objects.sort(c);g=0;for(l=I.objects.length;g<l;g++)if(na=I.objects[g].object,wa=na.matrixWorld,j=0,na instanceof THREE.Mesh){Ka=na.geometry;X=Ka.vertices;Ya=Ka.faces;Ka=Ka.faceVertexUvs;B.getInverse(wa);B.transpose();Na=na.material instanceof THREE.MeshFaceMaterial;Qa=!0===Na?na.material:null;ma=0;for(fa=X.length;ma<fa;ma++)i=b(),i.positionWorld.copy(X[ma]).applyMatrix4(wa),
 i.positionScreen.copy(i.positionWorld).applyMatrix4($),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);X=0;for(ma=Ya.length;X<ma;X++){fa=Ya[X];var Wa=!0===Na?Qa.materials[fa.materialIndex]:na.material;if(void 0!==Wa){ia=Wa.side;if(fa instanceof THREE.Face3)if(V=m[fa.a],Y=m[fa.b],ha=m[fa.c],
-K[0]=V.positionScreen,K[1]=Y.positionScreen,K[2]=ha.positionScreen,!0===V.visible||!0===Y.visible||!0===ha.visible||U.isIntersectionBox(G.setFromPoints(K)))if(Ba=0>(ha.positionScreen.x-V.positionScreen.x)*(Y.positionScreen.y-V.positionScreen.y)-(ha.positionScreen.y-V.positionScreen.y)*(Y.positionScreen.x-V.positionScreen.x),ia===THREE.DoubleSide||Ba===(ia===THREE.FrontSide))r===n?(pa=new THREE.RenderableFace3,s.push(pa),n++,r++,l=pa):l=s[r++],l.v1.copy(V),l.v2.copy(Y),l.v3.copy(ha);else continue;
+K[0]=V.positionScreen,K[1]=Y.positionScreen,K[2]=ha.positionScreen,!0===V.visible||!0===Y.visible||!0===ha.visible||U.isIntersectionBox(G.setFromPoints(K)))if(Ba=0>(ha.positionScreen.x-V.positionScreen.x)*(Y.positionScreen.y-V.positionScreen.y)-(ha.positionScreen.y-V.positionScreen.y)*(Y.positionScreen.x-V.positionScreen.x),ia===THREE.DoubleSide||Ba===(ia===THREE.FrontSide))r===n?(pa=new THREE.RenderableFace3,s.push(pa),n++,r++,p=pa):p=s[r++],p.v1.copy(V),p.v2.copy(Y),p.v3.copy(ha);else continue;
 else continue;else if(fa instanceof THREE.Face4)if(V=m[fa.a],Y=m[fa.b],ha=m[fa.c],pa=m[fa.d],M[0]=V.positionScreen,M[1]=Y.positionScreen,M[2]=ha.positionScreen,M[3]=pa.positionScreen,!0===V.visible||!0===Y.visible||!0===ha.visible||!0===pa.visible||U.isIntersectionBox(G.setFromPoints(M)))if(Ba=0>(pa.positionScreen.x-V.positionScreen.x)*(Y.positionScreen.y-V.positionScreen.y)-(pa.positionScreen.y-V.positionScreen.y)*(Y.positionScreen.x-V.positionScreen.x)||0>(Y.positionScreen.x-ha.positionScreen.x)*
-(pa.positionScreen.y-ha.positionScreen.y)-(Y.positionScreen.y-ha.positionScreen.y)*(pa.positionScreen.x-ha.positionScreen.x),ia===THREE.DoubleSide||Ba===(ia===THREE.FrontSide)){if(q===u){var Bb=new THREE.RenderableFace4;y.push(Bb);u++;q++;l=Bb}else l=y[q++];l.v1.copy(V);l.v2.copy(Y);l.v3.copy(ha);l.v4.copy(pa)}else continue;else continue;l.normalModel.copy(fa.normal);!1===Ba&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&l.normalModel.negate();l.normalModel.applyMatrix3(B).normalize();l.normalModelView.copy(l.normalModel).applyMatrix3(ca);
-l.centroidModel.copy(fa.centroid).applyMatrix4(wa);ha=fa.vertexNormals;V=0;for(Y=ha.length;V<Y;V++)pa=l.vertexNormalsModel[V],pa.copy(ha[V]),!1===Ba&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&pa.negate(),pa.applyMatrix3(B).normalize(),l.vertexNormalsModelView[V].copy(pa).applyMatrix3(ca);l.vertexNormalsLength=ha.length;V=0;for(Y=Ka.length;V<Y;V++)if(pa=Ka[V][X],void 0!==pa){ia=0;for(ha=pa.length;ia<ha;ia++)l.uvs[V][ia]=pa[ia]}l.color=fa.color;l.material=Wa;qa.copy(l.centroidModel).applyProjection($);
-l.z=qa.z;I.elements.push(l)}}}else if(na instanceof THREE.Line){fb.multiplyMatrices($,wa);X=na.geometry.vertices;V=b();V.positionScreen.copy(X[0]).applyMatrix4(fb);Ya=na.type===THREE.LinePieces?2:1;ma=1;for(fa=X.length;ma<fa;ma++)V=b(),V.positionScreen.copy(X[ma]).applyMatrix4(fb),0<(ma+1)%Ya||(Y=m[k-2],ja.copy(V.positionScreen),E.copy(Y.positionScreen),!0===d(ja,E)&&(ja.multiplyScalar(1/ja.w),E.multiplyScalar(1/E.w),t===J?(Ka=new THREE.RenderableLine,D.push(Ka),J++,t++,x=Ka):x=D[t++],x.v1.positionScreen.copy(ja),
-x.v2.positionScreen.copy(E),x.z=Math.max(ja.z,E.z),x.material=na.material,I.elements.push(x)))}g=0;for(p=I.sprites.length;g<p;g++)na=I.sprites[g].object,wa=na.matrixWorld,na instanceof THREE.Particle&&(A.set(wa.elements[12],wa.elements[13],wa.elements[14],1),A.applyMatrix4($),A.z/=A.w,0<A.z&&1>A.z&&(z===L?(Ba=new THREE.RenderableParticle,H.push(Ba),L++,z++,F=Ba):F=H[z++],F.object=na,F.x=A.x/A.w,F.y=A.y/A.w,F.z=A.z,F.rotation=na.rotation.z,F.scale.x=na.scale.x*Math.abs(F.x-(A.x+h.projectionMatrix.elements[0])/
+(pa.positionScreen.y-ha.positionScreen.y)-(Y.positionScreen.y-ha.positionScreen.y)*(pa.positionScreen.x-ha.positionScreen.x),ia===THREE.DoubleSide||Ba===(ia===THREE.FrontSide)){if(q===u){var Bb=new THREE.RenderableFace4;y.push(Bb);u++;q++;p=Bb}else p=y[q++];p.v1.copy(V);p.v2.copy(Y);p.v3.copy(ha);p.v4.copy(pa)}else continue;else continue;p.normalModel.copy(fa.normal);!1===Ba&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&p.normalModel.negate();p.normalModel.applyMatrix3(B).normalize();p.normalModelView.copy(p.normalModel).applyMatrix3(ca);
+p.centroidModel.copy(fa.centroid).applyMatrix4(wa);ha=fa.vertexNormals;V=0;for(Y=ha.length;V<Y;V++)pa=p.vertexNormalsModel[V],pa.copy(ha[V]),!1===Ba&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&pa.negate(),pa.applyMatrix3(B).normalize(),p.vertexNormalsModelView[V].copy(pa).applyMatrix3(ca);p.vertexNormalsLength=ha.length;V=0;for(Y=Ka.length;V<Y;V++)if(pa=Ka[V][X],void 0!==pa){ia=0;for(ha=pa.length;ia<ha;ia++)p.uvs[V][ia]=pa[ia]}p.color=fa.color;p.material=Wa;qa.copy(p.centroidModel).applyProjection($);
+p.z=qa.z;I.elements.push(p)}}}else if(na instanceof THREE.Line){fb.multiplyMatrices($,wa);X=na.geometry.vertices;V=b();V.positionScreen.copy(X[0]).applyMatrix4(fb);Ya=na.type===THREE.LinePieces?2:1;ma=1;for(fa=X.length;ma<fa;ma++)V=b(),V.positionScreen.copy(X[ma]).applyMatrix4(fb),0<(ma+1)%Ya||(Y=m[j-2],ja.copy(V.positionScreen),E.copy(Y.positionScreen),!0===d(ja,E)&&(ja.multiplyScalar(1/ja.w),E.multiplyScalar(1/E.w),t===J?(Ka=new THREE.RenderableLine,D.push(Ka),J++,t++,x=Ka):x=D[t++],x.v1.positionScreen.copy(ja),
+x.v2.positionScreen.copy(E),x.z=Math.max(ja.z,E.z),x.material=na.material,I.elements.push(x)))}g=0;for(l=I.sprites.length;g<l;g++)na=I.sprites[g].object,wa=na.matrixWorld,na instanceof THREE.Particle&&(A.set(wa.elements[12],wa.elements[13],wa.elements[14],1),A.applyMatrix4($),A.z/=A.w,0<A.z&&1>A.z&&(z===L?(Ba=new THREE.RenderableParticle,H.push(Ba),L++,z++,F=Ba):F=H[z++],F.object=na,F.x=A.x/A.w,F.y=A.y/A.w,F.z=A.z,F.rotation=na.rotation.z,F.scale.x=na.scale.x*Math.abs(F.x-(A.x+h.projectionMatrix.elements[0])/
 (A.w+h.projectionMatrix.elements[12])),F.scale.y=na.scale.y*Math.abs(F.y-(A.y+h.projectionMatrix.elements[5])/(A.w+h.projectionMatrix.elements[13])),F.material=na.material,I.elements.push(F)));!0===Xa&&I.elements.sort(c);return I}};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};
@@ -162,28 +162,28 @@ this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getInverse(a).transpose(),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];e.normal.applyMatrix3(b).normalize();for(var f=0,g=e.vertexNormals.length;f<g;f++)e.vertexNormals[f].applyMatrix3(b).normalize();e.centroid.applyMatrix4(a)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],
 c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.add(this.vertices[c.d]),c.centroid.divideScalar(4))},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],
 f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]:d instanceof THREE.Face4&&
-(d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,g,h,i=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3,l=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],i.subVectors(g,f),k.subVectors(a,f),i.cross(k),e[d.a].add(i),e[d.b].add(i),
-e[d.c].add(i)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h=this.vertices[d.d],m.subVectors(h,f),k.subVectors(a,f),m.cross(k),e[d.a].add(m),e[d.b].add(m),e[d.d].add(m),p.subVectors(h,g),l.subVectors(f,g),p.cross(l),e[d.b].add(p),e[d.c].add(p),e[d.d].add(p))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)):d instanceof THREE.Face4&&(e[d.a].add(d.normal),e[d.b].add(d.normal),
+(d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,g,h,i=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],i.subVectors(g,f),j.subVectors(a,f),i.cross(j),e[d.a].add(i),e[d.b].add(i),
+e[d.c].add(i)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h=this.vertices[d.d],m.subVectors(h,f),j.subVectors(a,f),m.cross(j),e[d.a].add(m),e[d.b].add(m),e[d.d].add(m),l.subVectors(h,g),p.subVectors(f,g),l.cross(p),e[d.b].add(l),e[d.c].add(l),e[d.d].add(l))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)):d instanceof THREE.Face4&&(e[d.a].add(d.normal),e[d.b].add(d.normal),
 e[d.c].add(d.normal),e[d.d].add(d.normal))}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeMorphNormals:function(){var a,b,c,d,e;c=0;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];m=g[e];p=g[f];l=g[z];r=i.x-h.x;s=k.x-h.x;n=i.y-h.y;q=k.y-h.y;y=i.z-h.z;u=k.z-h.z;x=p.x-m.x;t=l.x-m.x;D=p.y-m.y;J=l.y-m.y;F=1/(x*J-t*D);I.set((J*r-D*s)*F,(J*n-D*q)*F,(J*y-D*u)*F);N.set((x*s-t*r)*F,(x*q-t*n)*F,(x*u-t*y)*F);H[b].add(I);H[c].add(I);H[d].add(I);L[b].add(N);L[c].add(N);L[d].add(N)}var b,c,d,e,f,g,h,i,k,m,p,l,r,s,n,q,y,u,x,t,D,J,F,z,H=[],L=[],I=new THREE.Vector3,N=new THREE.Vector3,A=new THREE.Vector3,U=new THREE.Vector3,G=new THREE.Vector3;
+[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(j)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=
+this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],j=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,
+d,e,f,z){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];m=g[e];l=g[f];p=g[z];r=i.x-h.x;s=j.x-h.x;n=i.y-h.y;q=j.y-h.y;y=i.z-h.z;u=j.z-h.z;x=l.x-m.x;t=p.x-m.x;D=l.y-m.y;J=p.y-m.y;F=1/(x*J-t*D);I.set((J*r-D*s)*F,(J*n-D*q)*F,(J*y-D*u)*F);N.set((x*s-t*r)*F,(x*q-t*n)*F,(x*u-t*y)*F);H[b].add(I);H[c].add(I);H[d].add(I);L[b].add(N);L[c].add(N);L[d].add(N)}var b,c,d,e,f,g,h,i,j,m,l,p,r,s,n,q,y,u,x,t,D,J,F,z,H=[],L=[],I=new THREE.Vector3,N=new THREE.Vector3,A=new THREE.Vector3,U=new THREE.Vector3,G=new THREE.Vector3;
 b=0;for(c=this.vertices.length;b<c;b++)H[b]=new THREE.Vector3,L[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 K=["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++)G.copy(f.vertexNormals[d]),e=f[K[d]],z=H[e],A.copy(z),A.sub(G.multiplyScalar(G.dot(z))).normalize(),
 U.crossVectors(f.vertexNormals[d],z),e=U.dot(L[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(A.x,A.y,A.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 m=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&&(m.vertexNormals=a.vertexNormals,m.vertexNormals.splice(d,
+this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i,j;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 m=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++)(j=this.faceVertexUvs[h][f])&&j.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(m.vertexNormals=a.vertexNormals,m.vertexNormals.splice(d,
 1));a.vertexColors&&0<a.vertexColors.length&&(m.vertexColors=a.vertexColors,m.vertexColors.splice(d,1));this.faces[f]=m}}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];
 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(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.extend(THREE.Geometry.prototype,THREE.EventDispatcher.prototype);THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
 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,m,p,l=new THREE.Vector3,r=new THREE.Vector3,s=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var y=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;g=u[c].count;var x=u[c].index;a=b;for(b+=g;a<b;a+=3)g=x+y[a],h=x+y[a+1],i=x+y[a+2],k=e[3*g],m=e[3*g+1],p=e[3*g+2],l.set(k,m,p),k=e[3*h],m=e[3*h+1],p=e[3*h+2],r.set(k,m,p),k=e[3*i],m=e[3*i+1],p=e[3*i+2],s.set(k,
-m,p),n.subVectors(s,r),q.subVectors(l,r),n.cross(q),f[3*g]+=n.x,f[3*g+1]+=n.y,f[3*g+2]+=n.z,f[3*h]+=n.x,f[3*h+1]+=n.y,f[3*h+2]+=n.z,f[3*i]+=n.x,f[3*i+1]+=n.y,f[3*i+2]+=n.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],m=e[a+1],p=e[a+2],l.set(k,m,p),k=e[a+3],m=e[a+4],p=e[a+5],r.set(k,m,p),k=e[a+6],m=e[a+7],p=e[a+8],s.set(k,m,p),n.subVectors(s,r),q.subVectors(l,r),n.cross(q),f[a]=n.x,f[a+1]=n.y,f[a+2]=n.z,f[a+3]=n.x,f[a+4]=n.y,f[a+5]=n.z,f[a+6]=n.x,f[a+7]=n.y,f[a+8]=n.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){wa.x=d[3*a];wa.y=d[3*a+1];wa.z=d[3*a+2];fb.copy(wa);ca=i[a];T.copy(ca);T.sub(wa.multiplyScalar(wa.dot(ca))).normalize();$.crossVectors(fb,ca);qa=$.dot(k[a]);B=0>qa?-1:1;h[4*a]=T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=B}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 m,p,l,r,s,n,q,y,u,x,t,D,J,F,z,f=new THREE.Vector3,g=new THREE.Vector3,H,L,I,N,A,U,G,K=this.offsets;I=0;for(N=K.length;I<N;++I){L=K[I].start;A=K[I].count;var M=K[I].index;H=L;for(L+=A;H<L;H+=3)A=M+b[H],U=M+b[H+1],G=M+b[H+2],m=c[3*A],p=c[3*A+1],l=c[3*A+2],r=c[3*U],s=c[3*U+1],n=c[3*U+2],q=c[3*G],y=c[3*G+1],u=c[3*G+2],x=e[2*A],t=e[2*A+1],D=e[2*U],J=e[2*U+1],F=e[2*G],z=e[2*G+1],r-=m,m=q-m,s-=p,p=y-p,n-=l,l=u-l,D-=x,x=F-x,J-=t,t=z-t,z=1/(D*t-x*J),f.set((t*r-
-J*m)*z,(t*s-J*p)*z,(t*n-J*l)*z),g.set((D*m-x*r)*z,(D*p-x*s)*z,(D*l-x*n)*z),i[A].add(f),i[U].add(f),i[G].add(f),k[A].add(g),k[U].add(g),k[G].add(g)}var T=new THREE.Vector3,$=new THREE.Vector3,wa=new THREE.Vector3,fb=new THREE.Vector3,B,ca,qa;I=0;for(N=K.length;I<N;++I){L=K[I].start;A=K[I].count;M=K[I].index;H=L;for(L+=A;H<L;H+=3)A=M+b[H],U=M+b[H+1],G=M+b[H+2],a(A),a(U),a(G)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};
+0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,j,m,l,p=new THREE.Vector3,r=new THREE.Vector3,s=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var y=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;g=u[c].count;var x=u[c].index;a=b;for(b+=g;a<b;a+=3)g=x+y[a],h=x+y[a+1],i=x+y[a+2],j=e[3*g],m=e[3*g+1],l=e[3*g+2],p.set(j,m,l),j=e[3*h],m=e[3*h+1],l=e[3*h+2],r.set(j,m,l),j=e[3*i],m=e[3*i+1],l=e[3*i+2],s.set(j,
+m,l),n.subVectors(s,r),q.subVectors(p,r),n.cross(q),f[3*g]+=n.x,f[3*g+1]+=n.y,f[3*g+2]+=n.z,f[3*h]+=n.x,f[3*h+1]+=n.y,f[3*h+2]+=n.z,f[3*i]+=n.x,f[3*i+1]+=n.y,f[3*i+2]+=n.z}}else{a=0;for(b=e.length;a<b;a+=9)j=e[a],m=e[a+1],l=e[a+2],p.set(j,m,l),j=e[a+3],m=e[a+4],l=e[a+5],r.set(j,m,l),j=e[a+6],m=e[a+7],l=e[a+8],s.set(j,m,l),n.subVectors(s,r),q.subVectors(p,r),n.cross(q),f[a]=n.x,f[a+1]=n.y,f[a+2]=n.z,f[a+3]=n.x,f[a+4]=n.y,f[a+5]=n.z,f[a+6]=n.x,f[a+7]=n.y,f[a+8]=n.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){wa.x=d[3*a];wa.y=d[3*a+1];wa.z=d[3*a+2];fb.copy(wa);ca=i[a];T.copy(ca);T.sub(wa.multiplyScalar(wa.dot(ca))).normalize();$.crossVectors(fb,ca);qa=$.dot(j[a]);B=0>qa?-1:1;h[4*a]=T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=B}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=[],j=[],g=0;g<f;g++)i[g]=
+new THREE.Vector3,j[g]=new THREE.Vector3;var m,l,p,r,s,n,q,y,u,x,t,D,J,F,z,f=new THREE.Vector3,g=new THREE.Vector3,H,L,I,N,A,U,G,K=this.offsets;I=0;for(N=K.length;I<N;++I){L=K[I].start;A=K[I].count;var M=K[I].index;H=L;for(L+=A;H<L;H+=3)A=M+b[H],U=M+b[H+1],G=M+b[H+2],m=c[3*A],l=c[3*A+1],p=c[3*A+2],r=c[3*U],s=c[3*U+1],n=c[3*U+2],q=c[3*G],y=c[3*G+1],u=c[3*G+2],x=e[2*A],t=e[2*A+1],D=e[2*U],J=e[2*U+1],F=e[2*G],z=e[2*G+1],r-=m,m=q-m,s-=l,l=y-l,n-=p,p=u-p,D-=x,x=F-x,J-=t,t=z-t,z=1/(D*t-x*J),f.set((t*r-
+J*m)*z,(t*s-J*l)*z,(t*n-J*p)*z),g.set((D*m-x*r)*z,(D*l-x*s)*z,(D*p-x*n)*z),i[A].add(f),i[U].add(f),i[G].add(f),j[A].add(g),j[U].add(g),j[G].add(g)}var T=new THREE.Vector3,$=new THREE.Vector3,wa=new THREE.Vector3,fb=new THREE.Vector3,B,ca,qa;I=0;for(N=K.length;I<N;++I){L=K[I].start;A=K[I].count;M=K[I].index;H=L;for(L+=A;H<L;H+=3)A=M+b[H],U=M+b[H+1],G=M+b[H+2],a(A),a(U),a(G)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};
 THREE.extend(THREE.BufferGeometry.prototype,THREE.EventDispatcher.prototype);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(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);!0===this.useQuaternion?this.quaternion.setFromRotationMatrix(a):this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=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.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.clone=function(){var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a};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.set(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,
@@ -192,18 +192,18 @@ THREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLig
 this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};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,q){var y=/\.dds$/i.test(f),u=b+"/"+f;if(y){var x=THREE.ImageUtils.loadCompressedTexture(u);a[e]=x}else x=document.createElement("canvas"),a[e]=new THREE.Texture(x);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(!y){var t=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);t.image.width=a;t.image.height=b;t.image.getContext("2d").drawImage(this,0,0,a,b)}else t.image=this;t.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=u}}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);
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,j,q){var y=/\.dds$/i.test(f),u=b+"/"+f;if(y){var x=THREE.ImageUtils.loadCompressedTexture(u);a[e]=x}else x=document.createElement("canvas"),a[e]=new THREE.Texture(x);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]);j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
+f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]&&(a[e].wrapT=f[j[1]]));q&&(a[e].anisotropy=q);if(!y){var t=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);t.image.width=a;t.image.height=b;t.image.getContext("2d").drawImage(this,0,0,a,b)}else t.image=this;t.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=u}}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 j=a.shading.toLowerCase();"phong"===j?h="MeshPhongMaterial":"basic"===j&&(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,
-a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(h=THREE.ShaderLib.normalmap,k=THREE.UniformsUtils.clone(h.uniforms),k.tNormal.value=i.normalMap,a.mapNormalFactor&&k.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(k.tDiffuse.value=i.map,k.enableDiffuse.value=!0),i.specularMap&&(k.tSpecular.value=i.specularMap,k.enableSpecular.value=!0),i.lightMap&&(k.tAO.value=i.lightMap,k.enableAO.value=!0),k.uDiffuseColor.value.setHex(i.color),
-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(){this.crossOrigin=null};THREE.ImageLoader.prototype.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.extend(THREE.ImageLoader.prototype,THREE.EventDispatcher.prototype);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)};
+a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(h=THREE.ShaderLib.normalmap,j=THREE.UniformsUtils.clone(h.uniforms),j.tNormal.value=i.normalMap,a.mapNormalFactor&&j.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(j.tDiffuse.value=i.map,j.enableDiffuse.value=!0),i.specularMap&&(j.tSpecular.value=i.specularMap,j.enableSpecular.value=!0),i.lightMap&&(j.tAO.value=i.lightMap,j.enableAO.value=!0),j.uDiffuseColor.value.setHex(i.color),
+j.uSpecularColor.value.setHex(i.specular),j.uAmbientColor.value.setHex(i.ambient),j.uShininess.value=i.shininess,void 0!==i.opacity&&(j.uOpacity.value=i.opacity),h=new THREE.ShaderMaterial({fragmentShader:h.fragmentShader,vertexShader:h.vertexShader,uniforms:j,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(){this.crossOrigin=null};THREE.ImageLoader.prototype.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.extend(THREE.ImageLoader.prototype,THREE.EventDispatcher.prototype);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),h=a.parse(h,d);c(h.geometry,h.materials)}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.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,g,h,i,k,m,p,l,r,s,n,q,y,u,x=a.faces;r=a.vertices;var t=a.normals,D=a.colors,J=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&J++;for(e=0;e<J;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[];h=0;for(i=r.length;h<i;)k=new THREE.Vector3,k.x=r[h++]*d,k.y=r[h++]*d,k.z=r[h++]*d,c.vertices.push(k);h=0;for(i=x.length;h<i;){r=x[h++];k=r&1;g=r&2;e=r&4;f=r&8;p=r&16;m=r&32;s=r&64;r&=128;k?(n=new THREE.Face4,n.a=
-x[h++],n.b=x[h++],n.c=x[h++],n.d=x[h++],k=4):(n=new THREE.Face3,n.a=x[h++],n.b=x[h++],n.c=x[h++],k=3);g&&(g=x[h++],n.materialIndex=g);g=c.faces.length;if(e)for(e=0;e<J;e++)q=a.uvs[e],l=x[h++],u=q[2*l],l=q[2*l+1],c.faceUvs[e][g]=new THREE.Vector2(u,l);if(f)for(e=0;e<J;e++){q=a.uvs[e];y=[];for(f=0;f<k;f++)l=x[h++],u=q[2*l],l=q[2*l+1],y[f]=new THREE.Vector2(u,l);c.faceVertexUvs[e][g]=y}p&&(p=3*x[h++],f=new THREE.Vector3,f.x=t[p++],f.y=t[p++],f.z=t[p],n.normal=f);if(m)for(e=0;e<k;e++)p=3*x[h++],f=new THREE.Vector3,
-f.x=t[p++],f.y=t[p++],f.z=t[p],n.vertexNormals.push(f);s&&(m=x[h++],m=new THREE.Color(D[m]),n.color=m);if(r)for(e=0;e<k;e++)m=x[h++],m=new THREE.Color(D[m]),n.vertexColors.push(m);c.faces.push(n)}if(a.skinWeights){h=0;for(i=a.skinWeights.length;h<i;h+=2)x=a.skinWeights[h],t=a.skinWeights[h+1],c.skinWeights.push(new THREE.Vector4(x,t,0,0))}if(a.skinIndices){h=0;for(i=a.skinIndices.length;h<i;h+=2)x=a.skinIndices[h],t=a.skinIndices[h+1],c.skinIndices.push(new THREE.Vector4(x,t,0,0))}c.bones=a.bones;
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,g,h,i,j,m,l,p,r,s,n,q,y,u,x=a.faces;r=a.vertices;var t=a.normals,D=a.colors,J=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&J++;for(e=0;e<J;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[];h=0;for(i=r.length;h<i;)j=new THREE.Vector3,j.x=r[h++]*d,j.y=r[h++]*d,j.z=r[h++]*d,c.vertices.push(j);h=0;for(i=x.length;h<i;){r=x[h++];j=r&1;g=r&2;e=r&4;f=r&8;l=r&16;m=r&32;s=r&64;r&=128;j?(n=new THREE.Face4,n.a=
+x[h++],n.b=x[h++],n.c=x[h++],n.d=x[h++],j=4):(n=new THREE.Face3,n.a=x[h++],n.b=x[h++],n.c=x[h++],j=3);g&&(g=x[h++],n.materialIndex=g);g=c.faces.length;if(e)for(e=0;e<J;e++)q=a.uvs[e],p=x[h++],u=q[2*p],p=q[2*p+1],c.faceUvs[e][g]=new THREE.Vector2(u,p);if(f)for(e=0;e<J;e++){q=a.uvs[e];y=[];for(f=0;f<j;f++)p=x[h++],u=q[2*p],p=q[2*p+1],y[f]=new THREE.Vector2(u,p);c.faceVertexUvs[e][g]=y}l&&(l=3*x[h++],f=new THREE.Vector3,f.x=t[l++],f.y=t[l++],f.z=t[l],n.normal=f);if(m)for(e=0;e<j;e++)l=3*x[h++],f=new THREE.Vector3,
+f.x=t[l++],f.y=t[l++],f.z=t[l],n.vertexNormals.push(f);s&&(m=x[h++],m=new THREE.Color(D[m]),n.color=m);if(r)for(e=0;e<j;e++)m=x[h++],m=new THREE.Color(D[m]),n.vertexColors.push(m);c.faces.push(n)}if(a.skinWeights){h=0;for(i=a.skinWeights.length;h<i;h+=2)x=a.skinWeights[h],t=a.skinWeights[h+1],c.skinWeights.push(new THREE.Vector4(x,t,0,0))}if(a.skinIndices){h=0;for(i=a.skinIndices.length;h<i;h+=2)x=a.skinIndices[h],t=a.skinIndices[h+1],c.skinIndices.push(new THREE.Vector4(x,t,0,0))}c.bones=a.bones;
 c.animation=a.animation;if(void 0!==a.morphTargets){h=0;for(i=a.morphTargets.length;h<i;h++){c.morphTargets[h]={};c.morphTargets[h].name=a.morphTargets[h].name;c.morphTargets[h].vertices=[];D=c.morphTargets[h].vertices;J=a.morphTargets[h].vertices;x=0;for(t=J.length;x<t;x+=3)r=new THREE.Vector3,r.x=J[x]*d,r.y=J[x+1]*d,r.z=J[x+2]*d,D.push(r)}}if(void 0!==a.morphColors){h=0;for(i=a.morphColors.length;h<i;h++){c.morphColors[h]={};c.morphColors[h].name=a.morphColors[h].name;c.morphColors[h].colors=[];
 t=c.morphColors[h].colors;D=a.morphColors[h].colors;d=0;for(x=D.length;d<x;d+=3)J=new THREE.Color(16755200),J.setRGB(D[d],D[d+1],D[d+2]),t.push(J)}}c.computeCentroids();c.computeFaceNormals();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingMonitor=function(){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.extend(THREE.LoadingMonitor.prototype,THREE.EventDispatcher.prototype);THREE.GeometryLoader=function(){};THREE.extend(THREE.GeometryLoader.prototype,THREE.EventDispatcher.prototype);THREE.MaterialLoader=function(){};
 THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a){var b=this,c=new XMLHttpRequest;c.addEventListener("load",function(a){a=b.parse(JSON.parse(a.target.responseText));b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("progress",function(a){b.dispatchEvent({type:"progress",loaded:a.loaded,total:a.total})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.open("GET",a,!0);c.send(null)},parse:function(a){var b;
@@ -211,19 +211,19 @@ switch(a.type){case "MeshBasicMaterial":b=new THREE.MeshBasicMaterial({color:a.c
 transparent:a.transparent,wireframe:a.wireframe});break;case "MeshNormalMaterial":b=new THREE.MeshNormalMaterial({opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshDepthMaterial":b=new THREE.MeshDepthMaterial({opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe})}return b}};THREE.extend(THREE.MaterialLoader.prototype,THREE.EventDispatcher.prototype);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:p+"/"+a}function e(){f(z.scene,L.objects)}function f(a,b){var c,e,g,i,k,p,n;for(n in b)if(void 0===z.objects[n]){var q=b[n],t=null;if(q.type&&q.type in m.hierarchyHandlerMap){if(void 0===q.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var A in q)A in e||(g[A]=q[A]);r=z.materials[q.material];q.loading=!0;
-e=m.hierarchyHandlerMap[q.type].loaderObject;e.options?e.load(d(q.url,L.urlBaseType),h(n,a,r,q)):e.load(d(q.url,L.urlBaseType),h(n,a,r,q),g)}}else if(void 0!==q.geometry){if(l=z.geometries[q.geometry]){t=!1;r=z.materials[q.material];t=r instanceof THREE.ShaderMaterial;g=q.position;i=q.rotation;k=q.scale;c=q.matrix;p=q.quaternion;q.material||(r=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));
-if(r instanceof THREE.MeshFaceMaterial)for(e=0;e<r.materials.length;e++)t=t||r.materials[e]instanceof THREE.ShaderMaterial;t&&l.computeTangents();q.skin?t=new THREE.SkinnedMesh(l,r):q.morph?(t=new THREE.MorphAnimMesh(l,r),void 0!==q.duration&&(t.duration=q.duration),void 0!==q.time&&(t.time=q.time),void 0!==q.mirroredLoop&&(t.mirroredLoop=q.mirroredLoop),r.morphNormals&&l.computeMorphNormals()):t=new THREE.Mesh(l,r);t.name=n;c?(t.matrixAutoUpdate=!1,t.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])):(t.position.set(g[0],g[1],g[2]),p?(t.quaternion.set(p[0],p[1],p[2],p[3]),t.useQuaternion=!0):t.rotation.set(i[0],i[1],i[2]),t.scale.set(k[0],k[1],k[2]));t.visible=q.visible;t.castShadow=q.castShadow;t.receiveShadow=q.receiveShadow;a.add(t);z.objects[n]=t}}else"DirectionalLight"===q.type||"PointLight"===q.type||"AmbientLight"===q.type?(u=void 0!==q.color?q.color:16777215,x=void 0!==q.intensity?q.intensity:1,"DirectionalLight"===q.type?(g=q.direction,
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:l+"/"+a}function e(){f(z.scene,L.objects)}function f(a,b){var c,e,g,i,j,l,n;for(n in b)if(void 0===z.objects[n]){var q=b[n],t=null;if(q.type&&q.type in m.hierarchyHandlerMap){if(void 0===q.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var A in q)A in e||(g[A]=q[A]);r=z.materials[q.material];q.loading=!0;
+e=m.hierarchyHandlerMap[q.type].loaderObject;e.options?e.load(d(q.url,L.urlBaseType),h(n,a,r,q)):e.load(d(q.url,L.urlBaseType),h(n,a,r,q),g)}}else if(void 0!==q.geometry){if(p=z.geometries[q.geometry]){t=!1;r=z.materials[q.material];t=r instanceof THREE.ShaderMaterial;g=q.position;i=q.rotation;j=q.scale;c=q.matrix;l=q.quaternion;q.material||(r=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));
+if(r instanceof THREE.MeshFaceMaterial)for(e=0;e<r.materials.length;e++)t=t||r.materials[e]instanceof THREE.ShaderMaterial;t&&p.computeTangents();q.skin?t=new THREE.SkinnedMesh(p,r):q.morph?(t=new THREE.MorphAnimMesh(p,r),void 0!==q.duration&&(t.duration=q.duration),void 0!==q.time&&(t.time=q.time),void 0!==q.mirroredLoop&&(t.mirroredLoop=q.mirroredLoop),r.morphNormals&&p.computeMorphNormals()):t=new THREE.Mesh(p,r);t.name=n;c?(t.matrixAutoUpdate=!1,t.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])):(t.position.set(g[0],g[1],g[2]),l?(t.quaternion.set(l[0],l[1],l[2],l[3]),t.useQuaternion=!0):t.rotation.set(i[0],i[1],i[2]),t.scale.set(j[0],j[1],j[2]));t.visible=q.visible;t.castShadow=q.castShadow;t.receiveShadow=q.receiveShadow;a.add(t);z.objects[n]=t}}else"DirectionalLight"===q.type||"PointLight"===q.type||"AmbientLight"===q.type?(u=void 0!==q.color?q.color:16777215,x=void 0!==q.intensity?q.intensity:1,"DirectionalLight"===q.type?(g=q.direction,
 y=new THREE.DirectionalLight(u,x),y.position.set(g[0],g[1],g[2]),q.target&&(H.push({object:y,targetName:q.target}),y.target=null)):"PointLight"===q.type?(g=q.position,e=q.distance,y=new THREE.PointLight(u,x,e),y.position.set(g[0],g[1],g[2])):"AmbientLight"===q.type&&(y=new THREE.AmbientLight(u)),a.add(y),y.name=n,z.lights[n]=y,z.objects[n]=y):"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?("PerspectiveCamera"===q.type?s=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===
-q.type&&(s=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),g=q.position,s.position.set(g[0],g[1],g[2]),a.add(s),s.name=n,z.cameras[n]=s,z.objects[n]=s):(g=q.position,i=q.rotation,k=q.scale,p=q.quaternion,t=new THREE.Object3D,t.name=n,t.position.set(g[0],g[1],g[2]),p?(t.quaternion.set(p[0],p[1],p[2],p[3]),t.useQuaternion=!0):t.rotation.set(i[0],i[1],i[2]),t.scale.set(k[0],k[1],k[2]),t.visible=void 0!==q.visible?q.visible:!1,a.add(t),z.objects[n]=t,z.empties[n]=t);if(t){if(void 0!==
-q.userData)for(var D in q.userData)t.userData[D]=q.userData[D];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(n);void 0!==q.children&&f(t,q.children)}}}function g(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c;e();t-=1;m.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,l=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(l[0],l[1],l[2]);c&&f.traverse(function(a){a.material=c});var p=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=p});b.add(f);f.name=a;z.objects[a]=f;e();t-=1;m.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c}}function k(){m.callbackProgress({totalModels:J,totalTextures:F,loadedModels:J-t,loadedTextures:F-D},z);m.onLoadProgress();
-if(0===t&&0===D){for(var a=0;a<H.length;a++){var c=H[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.userData.targetInverse=c.object}b(z)}}var m=this,p=THREE.Loader.prototype.extractUrlBase(c),l,r,s,n,q,y,u,x,t,D,J,F,z,H=[],L=a,I;for(I in this.geometryHandlerMap)a=this.geometryHandlerMap[I].loaderClass,this.geometryHandlerMap[I].loaderObject=new a;for(I in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[I].loaderClass,
-this.hierarchyHandlerMap[I].loaderObject=new a;D=t=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(L.transform&&(I=L.transform.position,a=L.transform.rotation,c=L.transform.scale,I&&z.scene.position.set(I[0],I[1],I[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),I||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();I=function(a){return function(){D-=a;k();m.onLoadComplete()}};
-for(var N in L.fogs)a=L.fogs[N],"linear"===a.type?n=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(n=new THREE.FogExp2(0,a.density)),a=a.color,n.color.setRGB(a[0],a[1],a[2]),z.fogs[N]=n;for(var A in L.geometries)n=L.geometries[A],n.type in this.geometryHandlerMap&&(t+=1,m.onLoadStart());for(var U in L.objects)n=L.objects[U],n.type&&n.type in this.hierarchyHandlerMap&&(t+=1,m.onLoadStart());J=t;for(A in L.geometries)if(n=L.geometries[A],"cube"===n.type)l=new THREE.CubeGeometry(n.width,n.height,n.depth,
-n.widthSegments,n.heightSegments,n.depthSegments),l.name=A,z.geometries[A]=l;else if("plane"===n.type)l=new THREE.PlaneGeometry(n.width,n.height,n.widthSegments,n.heightSegments),l.name=A,z.geometries[A]=l;else if("sphere"===n.type)l=new THREE.SphereGeometry(n.radius,n.widthSegments,n.heightSegments),l.name=A,z.geometries[A]=l;else if("cylinder"===n.type)l=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),l.name=A,z.geometries[A]=l;else if("torus"===n.type)l=new THREE.TorusGeometry(n.radius,
-n.tube,n.segmentsR,n.segmentsT),l.name=A,z.geometries[A]=l;else if("icosahedron"===n.type)l=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),l.name=A,z.geometries[A]=l;else if(n.type in this.geometryHandlerMap){U={};for(q in n)"type"!==q&&"url"!==q&&(U[q]=n[q]);this.geometryHandlerMap[n.type].loaderObject.load(d(n.url,L.urlBaseType),g(A),U)}else"embedded"===n.type&&(U=L.embeds[n.id],U.metadata=L.metadata,U&&(U=this.geometryHandlerMap.ascii.loaderObject.parse(U,""),i(A)(U.geometry,U.materials)));
+q.type&&(s=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),g=q.position,s.position.set(g[0],g[1],g[2]),a.add(s),s.name=n,z.cameras[n]=s,z.objects[n]=s):(g=q.position,i=q.rotation,j=q.scale,l=q.quaternion,t=new THREE.Object3D,t.name=n,t.position.set(g[0],g[1],g[2]),l?(t.quaternion.set(l[0],l[1],l[2],l[3]),t.useQuaternion=!0):t.rotation.set(i[0],i[1],i[2]),t.scale.set(j[0],j[1],j[2]),t.visible=void 0!==q.visible?q.visible:!1,a.add(t),z.objects[n]=t,z.empties[n]=t);if(t){if(void 0!==
+q.userData)for(var D in q.userData)t.userData[D]=q.userData[D];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(n);void 0!==q.children&&f(t,q.children)}}}function g(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c;e();t-=1;m.onLoadComplete();j()}}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,p=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(p[0],p[1],p[2]);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;z.objects[a]=f;e();t-=1;m.onLoadComplete();j()}}function i(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c}}function j(){m.callbackProgress({totalModels:J,totalTextures:F,loadedModels:J-t,loadedTextures:F-D},z);m.onLoadProgress();
+if(0===t&&0===D){for(var a=0;a<H.length;a++){var c=H[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.userData.targetInverse=c.object}b(z)}}var m=this,l=THREE.Loader.prototype.extractUrlBase(c),p,r,s,n,q,y,u,x,t,D,J,F,z,H=[],L=a,I;for(I in this.geometryHandlerMap)a=this.geometryHandlerMap[I].loaderClass,this.geometryHandlerMap[I].loaderObject=new a;for(I in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[I].loaderClass,
+this.hierarchyHandlerMap[I].loaderObject=new a;D=t=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(L.transform&&(I=L.transform.position,a=L.transform.rotation,c=L.transform.scale,I&&z.scene.position.set(I[0],I[1],I[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),I||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();I=function(a){return function(){D-=a;j();m.onLoadComplete()}};
+for(var N in L.fogs)a=L.fogs[N],"linear"===a.type?n=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(n=new THREE.FogExp2(0,a.density)),a=a.color,n.color.setRGB(a[0],a[1],a[2]),z.fogs[N]=n;for(var A in L.geometries)n=L.geometries[A],n.type in this.geometryHandlerMap&&(t+=1,m.onLoadStart());for(var U in L.objects)n=L.objects[U],n.type&&n.type in this.hierarchyHandlerMap&&(t+=1,m.onLoadStart());J=t;for(A in L.geometries)if(n=L.geometries[A],"cube"===n.type)p=new THREE.CubeGeometry(n.width,n.height,n.depth,
+n.widthSegments,n.heightSegments,n.depthSegments),p.name=A,z.geometries[A]=p;else if("plane"===n.type)p=new THREE.PlaneGeometry(n.width,n.height,n.widthSegments,n.heightSegments),p.name=A,z.geometries[A]=p;else if("sphere"===n.type)p=new THREE.SphereGeometry(n.radius,n.widthSegments,n.heightSegments),p.name=A,z.geometries[A]=p;else if("cylinder"===n.type)p=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),p.name=A,z.geometries[A]=p;else if("torus"===n.type)p=new THREE.TorusGeometry(n.radius,
+n.tube,n.segmentsR,n.segmentsT),p.name=A,z.geometries[A]=p;else if("icosahedron"===n.type)p=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),p.name=A,z.geometries[A]=p;else if(n.type in this.geometryHandlerMap){U={};for(q in n)"type"!==q&&"url"!==q&&(U[q]=n[q]);this.geometryHandlerMap[n.type].loaderObject.load(d(n.url,L.urlBaseType),g(A),U)}else"embedded"===n.type&&(U=L.embeds[n.id],U.metadata=L.metadata,U&&(U=this.geometryHandlerMap.ascii.loaderObject.parse(U,""),i(A)(U.geometry,U.materials)));
 for(var G in L.textures)if(A=L.textures[G],A.url instanceof Array){D+=A.url.length;for(q=0;q<A.url.length;q++)m.onLoadStart()}else D+=1,m.onLoadStart();F=D;for(G in L.textures){A=L.textures[G];void 0!==A.mapping&&void 0!==THREE[A.mapping]&&(A.mapping=new THREE[A.mapping]);if(A.url instanceof Array){U=A.url.length;n=[];for(q=0;q<U;q++)n[q]=d(A.url[q],L.urlBaseType);q=(q=/\.dds$/i.test(n[0]))?THREE.ImageUtils.loadCompressedTextureCube(n,A.mapping,I(U)):THREE.ImageUtils.loadTextureCube(n,A.mapping,I(U))}else q=
 /\.dds$/i.test(A.url),U=d(A.url,L.urlBaseType),n=I(1),q=q?THREE.ImageUtils.loadCompressedTexture(U,A.mapping,n):THREE.ImageUtils.loadTexture(U,A.mapping,n),void 0!==THREE[A.minFilter]&&(q.minFilter=THREE[A.minFilter]),void 0!==THREE[A.magFilter]&&(q.magFilter=THREE[A.magFilter]),A.anisotropy&&(q.anisotropy=A.anisotropy),A.repeat&&(q.repeat.set(A.repeat[0],A.repeat[1]),1!==A.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==A.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),A.offset&&q.offset.set(A.offset[0],
 A.offset[1]),A.wrap&&(U={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==U[A.wrap[0]]&&(q.wrapS=U[A.wrap[0]]),void 0!==U[A.wrap[1]]&&(q.wrapT=U[A.wrap[1]]));z.textures[G]=q}var K,M;for(K in L.materials){G=L.materials[K];for(M in G.parameters)"envMap"===M||"map"===M||"lightMap"===M||"bumpMap"===M?G.parameters[M]=z.textures[G.parameters[M]]:"shading"===M?G.parameters[M]="flat"===G.parameters[M]?THREE.FlatShading:THREE.SmoothShading:"side"===M?G.parameters[M]="double"==G.parameters[M]?
@@ -231,7 +231,7 @@ THREE.DoubleSide:"back"==G.parameters[M]?THREE.BackSide:THREE.FrontSide:"blendin
 1>G.parameters.opacity&&(G.parameters.transparent=!0);G.parameters.normalMap?(I=THREE.ShaderLib.normalmap,A=THREE.UniformsUtils.clone(I.uniforms),q=G.parameters.color,U=G.parameters.specular,n=G.parameters.ambient,N=G.parameters.shininess,A.tNormal.value=z.textures[G.parameters.normalMap],G.parameters.normalScale&&A.uNormalScale.value.set(G.parameters.normalScale[0],G.parameters.normalScale[1]),G.parameters.map&&(A.tDiffuse.value=G.parameters.map,A.enableDiffuse.value=!0),G.parameters.envMap&&(A.tCube.value=
 G.parameters.envMap,A.enableReflection.value=!0,A.uReflectivity.value=G.parameters.reflectivity),G.parameters.lightMap&&(A.tAO.value=G.parameters.lightMap,A.enableAO.value=!0),G.parameters.specularMap&&(A.tSpecular.value=z.textures[G.parameters.specularMap],A.enableSpecular.value=!0),G.parameters.displacementMap&&(A.tDisplacement.value=z.textures[G.parameters.displacementMap],A.enableDisplacement.value=!0,A.uDisplacementBias.value=G.parameters.displacementBias,A.uDisplacementScale.value=G.parameters.displacementScale),
 A.uDiffuseColor.value.setHex(q),A.uSpecularColor.value.setHex(U),A.uAmbientColor.value.setHex(n),A.uShininess.value=N,G.parameters.opacity&&(A.uOpacity.value=G.parameters.opacity),r=new THREE.ShaderMaterial({fragmentShader:I.fragmentShader,vertexShader:I.vertexShader,uniforms:A,lights:!0,fog:!0})):r=new THREE[G.type](G.parameters);r.name=K;z.materials[K]=r}for(K in L.materials)if(G=L.materials[K],G.parameters.materials){M=[];for(q=0;q<G.parameters.materials.length;q++)M.push(z.materials[G.parameters.materials[q]]);
-z.materials[K].materials=M}e();z.cameras&&L.defaults.camera&&(z.currentCamera=z.cameras[L.defaults.camera]);z.fogs&&L.defaults.fog&&(z.scene.fog=z.fogs[L.defaults.fog]);m.callbackSync(z);k()};THREE.TextureLoader=function(){this.crossOrigin=null};THREE.TextureLoader.prototype.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.extend(THREE.TextureLoader.prototype,THREE.EventDispatcher.prototype);THREE.Material=function(){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};
+z.materials[K].materials=M}e();z.cameras&&L.defaults.camera&&(z.currentCamera=z.cameras[L.defaults.camera]);z.fogs&&L.defaults.fog&&(z.scene.fog=z.fogs[L.defaults.fog]);m.callbackSync(z);j()};THREE.TextureLoader=function(){this.crossOrigin=null};THREE.TextureLoader.prototype.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.extend(THREE.TextureLoader.prototype,THREE.EventDispatcher.prototype);THREE.Material=function(){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={constructor:THREE.Material,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}}},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},dispose:function(){this.dispatchEvent({type:"dispose"})}};
 THREE.extend(THREE.Material.prototype,THREE.EventDispatcher.prototype);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);
@@ -246,7 +246,7 @@ a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wirefr
 this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.MeshPhongMaterial.prototype.clone=function(){var a=new THREE.MeshPhongMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.specular.copy(this.specular);a.shininess=this.shininess;a.metal=this.metal;a.perPixel=this.perPixel;a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.bumpMap=this.bumpMap;a.bumpScale=this.bumpScale;a.normalMap=this.normalMap;a.normalScale.copy(this.normalScale);
 a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.MeshDepthMaterial=function(a){THREE.Material.call(this);this.wireframe=!1;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshDepthMaterial.prototype.clone=function(){var a=new THREE.MeshDepthMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);this.shading=THREE.FlatShading;this.wireframe=!1;this.wireframeLinewidth=1;this.morphTargets=!1;this.setValues(a)};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshNormalMaterial.prototype.clone=function(){var a=new THREE.MeshNormalMaterial;THREE.Material.prototype.clone.call(this,a);a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshFaceMaterial=function(a){this.materials=a instanceof Array?a:[]};THREE.MeshFaceMaterial.prototype.clone=function(){return new THREE.MeshFaceMaterial(this.materials.slice(0))};THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.ParticleBasicMaterial.prototype=Object.create(THREE.Material.prototype);
-THREE.ParticleBasicMaterial.prototype.clone=function(){var a=new THREE.ParticleBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.program=function(){};this.setValues(a)};THREE.ParticleCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ParticleCanvasMaterial.prototype.clone=function(){var a=new THREE.ParticleCanvasMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.program=this.program;return a};THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.defines={};this.attributes=null;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
+THREE.ParticleBasicMaterial.prototype.clone=function(){var a=new THREE.ParticleBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.program=function(){};this.setValues(a)};THREE.ParticleCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ParticleCanvasMaterial.prototype.clone=function(){var a=new THREE.ParticleCanvasMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.program=this.program;return a};THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.defines={};this.attributes=null;this.shading=THREE.SmoothShading;this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
 THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=
 this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=new THREE.Texture;this.useScreenCoordinates=!0;this.depthTest=!this.useScreenCoordinates;this.sizeAttenuation=!this.useScreenCoordinates;this.scaleByViewport=!this.sizeAttenuation;this.alignment=THREE.SpriteAlignment.center.clone();this.fog=!1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1);this.setValues(a);a=a||{};void 0===a.depthTest&&(this.depthTest=!this.useScreenCoordinates);
 void 0===a.sizeAttenuation&&(this.sizeAttenuation=!this.useScreenCoordinates);void 0===a.scaleByViewport&&(this.scaleByViewport=!this.sizeAttenuation)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);
@@ -254,7 +254,7 @@ THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;T
 THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Texture=function(a,b,c,d,e,f,g,h,i){this.id=THREE.TextureIdCount++;this.name="";this.image=a;this.mipmaps=[];this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==i?i:1;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,
 0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.needsUpdate=!1;this.onUpdate=null};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=
-this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.extend(THREE.Texture.prototype,THREE.EventDispatcher.prototype);THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,g,h,i,k,m){THREE.Texture.call(this,null,f,g,h,i,k,d,e,m);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,k,m){THREE.Texture.call(this,null,f,g,h,i,k,d,e,m);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.Particle.prototype.clone=function(a){void 0===a&&(a=new THREE.Particle(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;this.geometry&&null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere();this.frustumCulled=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
+this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.extend(THREE.Texture.prototype,THREE.EventDispatcher.prototype);THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,g,h,i,j,m){THREE.Texture.call(this,null,f,g,h,i,j,d,e,m);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,j,m){THREE.Texture.call(this,null,f,g,h,i,j,d,e,m);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.Particle.prototype.clone=function(a){void 0===a&&(a=new THREE.Particle(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;this.geometry&&null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere();this.frustumCulled=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
 THREE.ParticleSystem.prototype.clone=function(a){void 0===a&&(a=new THREE.ParticleSystem(this.geometry,this.material));a.sortParticles=this.sortParticles;THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.type));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.material=this.geometry=null;this.setGeometry(a);this.setMaterial(b)};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.setGeometry=function(a){void 0!==a&&(this.geometry=a,null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere(),this.updateMorphTargets())};THREE.Mesh.prototype.setMaterial=function(a){this.material=void 0!==a?a:new THREE.MeshBasicMaterial({color:16777215*Math.random(),wireframe:!0})};
 THREE.Mesh.prototype.updateMorphTargets=function(){if(0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
@@ -269,29 +269,28 @@ THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;a.a
 THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={});this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=1E3*((c.end-c.start)/b),this.time=0):console.warn("animation["+a+"] undefined")};
 THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||0>this.time)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)}else this.time%=this.duration,0>this.time&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);a!==this.currentKeyframe&&
 (this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};
-THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=Object.create(THREE.Object3D.prototype);THREE.Ribbon.prototype.clone=function(a){void 0===a&&(a=new THREE.Ribbon(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length&&!(b<this.LODs[c].visibleAtDistance);c++);this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
-THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.elements[2]*this.matrixWorld.elements[12]+a.elements[6]*this.matrixWorld.elements[13]+a.elements[10]*this.matrixWorld.elements[14]+a.elements[14]);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=
-!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.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=Object.create(THREE.Object3D.prototype);THREE.Ribbon.prototype.clone=function(a){void 0===a&&(a=new THREE.Ribbon(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.objects=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c<this.objects.length&&!(b<this.objects[c].distance);c++);this.objects.splice(c,0,{distance:b,object:a});this.add(a)};THREE.LOD.prototype.getObjectForDistance=function(a){for(var b=1,c=this.objects.length;b<c&&!(a<this.objects[b].distance);b++);return this.objects[b-1].object};
+THREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){if(1<this.objects.length){a.getPositionFromMatrix(c.matrixWorld);b.getPositionFromMatrix(this.matrixWorld);c=a.distanceTo(b);this.objects[0].object.visible=!0;for(var d=1,e=this.objects.length;d<e;d++)if(c>=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;d<e;d++)this.objects[d].object.visible=!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=t.globalAlpha=a)}function c(a){z!==a&&(a===THREE.NormalBlending?t.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?t.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(t.globalCompositeOperation="darker"),z=a)}function d(a){I!==a&&(I=t.lineWidth=a)}function e(a){N!==a&&(N=t.lineCap=a)}function f(a){A!==a&&(A=t.lineJoin=a)}function g(a){H!==a&&(H=t.strokeStyle=a)}function h(a){L!==a&&(L=t.fillStyle=a)}function i(a,
-b){if(U!==a||G!==b)t.setLineDash([a,b]),U=a,G=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var k=THREE.Math.smoothstep,a=a||{},m=this,p,l,r,s=new THREE.Projector,n=void 0!==a.canvas?a.canvas:document.createElement("canvas"),q,y,u,x,t=n.getContext("2d"),D=new THREE.Color(0),J=0,F=1,z=0,H=null,L=null,I=null,N=null,A=null,U=null,G=0,K,M,T,$,wa=new THREE.RenderableVertex,fb=new THREE.RenderableVertex,B,ca,qa,ga,ja,E,Ma,ib,Ua,Xa,Ba,ma,fa=new THREE.Color,X=new THREE.Color,V=new THREE.Color,Y=new THREE.Color,
-ia=new THREE.Color,ha=new THREE.Color,na=new THREE.Color,Ka=new THREE.Color,Ya={},pa={},Na,Qa,Va,Wa,Bb,Kb,Nb,Ob,Pb,Tb,tb=new THREE.Box2,ra=new THREE.Box2,Ia=new THREE.Box2,nb=new THREE.Color,$b=new THREE.Color,Oa=new THREE.Color,ka=new THREE.Vector3,jb,Eb,j,Ra,ub,lb,Sa=16;jb=document.createElement("canvas");jb.width=jb.height=2;Eb=jb.getContext("2d");Eb.fillStyle="rgba(0,0,0,1)";Eb.fillRect(0,0,2,2);j=Eb.getImageData(0,0,2,2);Ra=j.data;ub=document.createElement("canvas");ub.width=ub.height=Sa;lb=
+b){if(U!==a||G!==b)t.setLineDash([a,b]),U=a,G=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var j=THREE.Math.smoothstep,a=a||{},m=this,l,p,r,s=new THREE.Projector,n=void 0!==a.canvas?a.canvas:document.createElement("canvas"),q,y,u,x,t=n.getContext("2d"),D=new THREE.Color(0),J=0,F=1,z=0,H=null,L=null,I=null,N=null,A=null,U=null,G=0,K,M,T,$,wa=new THREE.RenderableVertex,fb=new THREE.RenderableVertex,B,ca,qa,ga,ja,E,Ma,ib,Ua,Xa,Ba,ma,fa=new THREE.Color,X=new THREE.Color,V=new THREE.Color,Y=new THREE.Color,
+ia=new THREE.Color,ha=new THREE.Color,na=new THREE.Color,Ka=new THREE.Color,Ya={},pa={},Na,Qa,Va,Wa,Bb,Kb,Nb,Ob,Pb,Tb,tb=new THREE.Box2,ra=new THREE.Box2,Ia=new THREE.Box2,nb=new THREE.Color,$b=new THREE.Color,Oa=new THREE.Color,ka=new THREE.Vector3,jb,Eb,k,Ra,ub,lb,Sa=16;jb=document.createElement("canvas");jb.width=jb.height=2;Eb=jb.getContext("2d");Eb.fillStyle="rgba(0,0,0,1)";Eb.fillRect(0,0,2,2);k=Eb.getImageData(0,0,2,2);Ra=k.data;ub=document.createElement("canvas");ub.width=ub.height=Sa;lb=
 ub.getContext("2d");lb.translate(-Sa/2,-Sa/2);lb.scale(Sa,Sa);Sa--;void 0===t.setLineDash&&(t.setLineDash=void 0!==t.mozDash?function(a){t.mozDash=null!==a[0]?a:null}:function(){});this.domElement=n;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){q=a*this.devicePixelRatio;y=b*this.devicePixelRatio;u=Math.floor(q/2);x=Math.floor(y/2);n.width=q;n.height=y;n.style.width=a+"px";n.style.height=b+"px";tb.set(new THREE.Vector2(-u,-x),new THREE.Vector2(u,x));ra.set(new THREE.Vector2(-u,-x),new THREE.Vector2(u,x));F=1;z=0;A=N=I=L=H=null};this.setClearColor=function(a,b){D.copy(a);J=void 0!==b?b:1;ra.set(new THREE.Vector2(-u,-x),new THREE.Vector2(u,x))};this.setClearColorHex=function(a,b){D.setHex(a);J=void 0!==b?b:1;ra.set(new THREE.Vector2(-u,
 -x),new THREE.Vector2(u,x))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){t.setTransform(1,0,0,-1,u,x);!1===ra.empty()&&(ra.intersect(tb),ra.expandByScalar(2),1>J&&t.clearRect(ra.min.x|0,ra.min.y|0,ra.max.x-ra.min.x|0,ra.max.y-ra.min.y|0),0<J&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*D.r)+","+Math.floor(255*D.g)+","+Math.floor(255*D.b)+","+J+")"),t.fillRect(ra.min.x|0,ra.min.y|0,ra.max.x-ra.min.x|0,ra.max.y-ra.min.y|0)),ra.makeEmpty())};this.render=function(a,n){function q(a,
-b,c){for(var d=0,e=r.length;d<e;d++){var f=r[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ka.getPositionFromMatrix(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(Ka.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=ka.getPositionFromMatrix(f.matrixWorld),h=b.dot(ka.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Ka.multiplyScalar(h)))))}}function z(a,d,e,f,g,h,j,i){m.info.render.vertices+=
-3;m.info.render.faces++;b(i.opacity);c(i.blending);B=a.positionScreen.x;ca=a.positionScreen.y;qa=d.positionScreen.x;ga=d.positionScreen.y;ja=e.positionScreen.x;E=e.positionScreen.y;y(B,ca,qa,ga,ja,E);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(ha.copy(i.color),na.copy(i.emissive),i.vertexColors===THREE.FaceColors&&ha.multiply(j.color),!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==j.vertexNormalsLength?(X.copy(nb),V.copy(nb),Y.copy(nb),q(j.v1.positionWorld,
-j.vertexNormalsModel[0],X),q(j.v2.positionWorld,j.vertexNormalsModel[1],V),q(j.v3.positionWorld,j.vertexNormalsModel[2],Y),X.multiply(ha).add(na),V.multiply(ha).add(na),Y.multiply(ha).add(na),ia.addColors(V,Y).multiplyScalar(0.5),Va=H(X,V,Y,ia),J(B,ca,qa,ga,ja,E,0,0,1,0,0,1,Va)):(fa.copy(nb),q(j.centroidModel,j.normalModel,fa),fa.multiply(ha).add(na),!0===i.wireframe?D(fa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(fa))):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||
-i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Wa=j.uvs[0],G(B,ca,qa,ga,ja,E,Wa[f].x,Wa[f].y,Wa[g].x,Wa[g].y,Wa[h].x,Wa[h].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ka.copy(j.vertexNormalsModelView[f]),Bb=0.5*ka.x+0.5,Kb=0.5*ka.y+0.5,ka.copy(j.vertexNormalsModelView[g]),Nb=0.5*ka.x+0.5,Ob=0.5*ka.y+0.5,ka.copy(j.vertexNormalsModelView[h]),Pb=0.5*ka.x+0.5,Tb=0.5*ka.y+0.5,G(B,ca,qa,ga,ja,E,Bb,Kb,Nb,Ob,Pb,Tb,
-i.envMap)):(fa.copy(i.color),i.vertexColors===THREE.FaceColors&&fa.multiply(j.color),!0===i.wireframe?D(fa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(fa)):i instanceof THREE.MeshDepthMaterial?(Na=n.near,Qa=n.far,X.r=X.g=X.b=1-k(a.positionScreen.z*a.positionScreen.w,Na,Qa),V.r=V.g=V.b=1-k(d.positionScreen.z*d.positionScreen.w,Na,Qa),Y.r=Y.g=Y.b=1-k(e.positionScreen.z*e.positionScreen.w,Na,Qa),ia.addColors(V,Y).multiplyScalar(0.5),Va=H(X,V,Y,ia),J(B,ca,qa,ga,ja,E,0,0,1,0,0,1,Va)):
-i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(a=j.normalModelView,fa.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?D(fa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(fa)):i.shading==THREE.SmoothShading&&(a=j.vertexNormalsModelView[f],X.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=j.vertexNormalsModelView[g],V.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=j.vertexNormalsModelView[h],Y.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),
-ia.addColors(V,Y).multiplyScalar(0.5),Va=H(X,V,Y,ia),J(B,ca,qa,ga,ja,E,0,0,1,0,0,1,Va)))}function y(a,b,c,d,e,f){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.closePath()}function A(a,b,c,d,e,f,g,h){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.lineTo(g,h);t.closePath()}function D(a,b,c,h){d(b);e(c);f(h);g(a.getStyle());t.stroke();Ia.expandByScalar(2*b)}function F(a){h(a.getStyle());t.fill()}function G(a,b,c,d,e,f,g,i,j,Ja,k,l,m){if(!(m instanceof THREE.DataTexture||void 0===
-m.image||0==m.image.width)){if(!0===m.needsUpdate){var p=m.wrapS==THREE.RepeatWrapping,n=m.wrapT==THREE.RepeatWrapping;Ya[m.id]=t.createPattern(m.image,!0===p&&!0===n?"repeat":!0===p&&!1===n?"repeat-x":!1===p&&!0===n?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===Ya[m.id]?h("rgba(0,0,0,1)"):h(Ya[m.id]);var p=m.offset.x/m.repeat.x,n=m.offset.y/m.repeat.y,mb=m.image.width*m.repeat.x,q=m.image.height*m.repeat.y,g=(g+p)*mb,i=(1-i+n)*q,c=c-a,d=d-b,e=e-a,f=f-b,j=(j+p)*mb-g,Ja=(1-Ja+n)*q-i,k=(k+p)*mb-
-g,l=(1-l+n)*q-i,p=j*l-k*Ja;0===p?(void 0===pa[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),pa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=pa[m.id],g=4*(Math.floor(g)+Math.floor(i)*m.image.width),fa.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),F(fa)):(p=1/p,m=(l*c-Ja*e)*p,Ja=(l*d-Ja*f)*p,c=(j*e-k*c)*p,d=(j*f-k*d)*p,a=a-m*g-c*i,g=b-Ja*g-d*i,t.save(),t.transform(m,Ja,c,d,a,g),t.fill(),t.restore())}}
-function J(a,b,c,d,e,f,g,h,i,j,Ja,k,m){var p,l;p=m.width-1;l=m.height-1;g*=p;h*=l;c-=a;d-=b;e-=a;f-=b;i=i*p-g;j=j*l-h;Ja=Ja*p-g;k=k*l-h;l=1/(i*k-Ja*j);p=(k*c-j*e)*l;j=(k*d-j*f)*l;c=(i*e-Ja*c)*l;d=(i*f-Ja*d)*l;a=a-p*g-c*h;b=b-j*g-d*h;t.save();t.transform(p,j,c,d,a,b);t.clip();t.drawImage(m,0,0);t.restore()}function H(a,b,c,d){Ra[0]=255*a.r|0;Ra[1]=255*a.g|0;Ra[2]=255*a.b|0;Ra[4]=255*b.r|0;Ra[5]=255*b.g|0;Ra[6]=255*b.b|0;Ra[8]=255*c.r|0;Ra[9]=255*c.g|0;Ra[10]=255*c.b|0;Ra[12]=255*d.r|0;Ra[13]=255*d.g|
-0;Ra[14]=255*d.b|0;Eb.putImageData(j,0,0);lb.drawImage(jb,0,0);return ub}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===n instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();t.setTransform(1,0,0,-1,u,x);m.info.render.vertices=0;m.info.render.faces=0;p=s.projectScene(a,n,this.sortObjects,this.sortElements);l=p.elements;r=p.lights;
-nb.setRGB(0,0,0);$b.setRGB(0,0,0);Oa.setRGB(0,0,0);for(var L=0,U=r.length;L<U;L++){var O=r[L],W=O.color;O instanceof THREE.AmbientLight?nb.add(W):O instanceof THREE.DirectionalLight?$b.add(W):O instanceof THREE.PointLight&&Oa.add(W)}L=0;for(U=l.length;L<U;L++){var N=l[L],O=N.material;if(!(void 0===O||!1===O.visible)){Ia.makeEmpty();if(N instanceof THREE.RenderableParticle){K=N;K.x*=u;K.y*=x;var W=K,ua=N;b(O.opacity);c(O.blending);var Ja=void 0,vb=void 0,mb=void 0,wb=void 0,Nc=N=void 0,Oc=void 0;O instanceof
+b,c){for(var d=0,e=r.length;d<e;d++){var f=r[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ka.getPositionFromMatrix(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(Ka.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=ka.getPositionFromMatrix(f.matrixWorld),h=b.dot(ka.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Ka.multiplyScalar(h)))))}}function z(a,d,e,f,g,h,k,i){m.info.render.vertices+=
+3;m.info.render.faces++;b(i.opacity);c(i.blending);B=a.positionScreen.x;ca=a.positionScreen.y;qa=d.positionScreen.x;ga=d.positionScreen.y;ja=e.positionScreen.x;E=e.positionScreen.y;y(B,ca,qa,ga,ja,E);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(ha.copy(i.color),na.copy(i.emissive),i.vertexColors===THREE.FaceColors&&ha.multiply(k.color),!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==k.vertexNormalsLength?(X.copy(nb),V.copy(nb),Y.copy(nb),q(k.v1.positionWorld,
+k.vertexNormalsModel[0],X),q(k.v2.positionWorld,k.vertexNormalsModel[1],V),q(k.v3.positionWorld,k.vertexNormalsModel[2],Y),X.multiply(ha).add(na),V.multiply(ha).add(na),Y.multiply(ha).add(na),ia.addColors(V,Y).multiplyScalar(0.5),Va=H(X,V,Y,ia),J(B,ca,qa,ga,ja,E,0,0,1,0,0,1,Va)):(fa.copy(nb),q(k.centroidModel,k.normalModel,fa),fa.multiply(ha).add(na),!0===i.wireframe?D(fa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(fa))):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||
+i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Wa=k.uvs[0],G(B,ca,qa,ga,ja,E,Wa[f].x,Wa[f].y,Wa[g].x,Wa[g].y,Wa[h].x,Wa[h].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ka.copy(k.vertexNormalsModelView[f]),Bb=0.5*ka.x+0.5,Kb=0.5*ka.y+0.5,ka.copy(k.vertexNormalsModelView[g]),Nb=0.5*ka.x+0.5,Ob=0.5*ka.y+0.5,ka.copy(k.vertexNormalsModelView[h]),Pb=0.5*ka.x+0.5,Tb=0.5*ka.y+0.5,G(B,ca,qa,ga,ja,E,Bb,Kb,Nb,Ob,Pb,Tb,
+i.envMap)):(fa.copy(i.color),i.vertexColors===THREE.FaceColors&&fa.multiply(k.color),!0===i.wireframe?D(fa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(fa)):i instanceof THREE.MeshDepthMaterial?(Na=n.near,Qa=n.far,X.r=X.g=X.b=1-j(a.positionScreen.z*a.positionScreen.w,Na,Qa),V.r=V.g=V.b=1-j(d.positionScreen.z*d.positionScreen.w,Na,Qa),Y.r=Y.g=Y.b=1-j(e.positionScreen.z*e.positionScreen.w,Na,Qa),ia.addColors(V,Y).multiplyScalar(0.5),Va=H(X,V,Y,ia),J(B,ca,qa,ga,ja,E,0,0,1,0,0,1,Va)):
+i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(a=k.normalModelView,fa.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?D(fa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(fa)):i.shading==THREE.SmoothShading&&(a=k.vertexNormalsModelView[f],X.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=k.vertexNormalsModelView[g],V.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=k.vertexNormalsModelView[h],Y.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),
+ia.addColors(V,Y).multiplyScalar(0.5),Va=H(X,V,Y,ia),J(B,ca,qa,ga,ja,E,0,0,1,0,0,1,Va)))}function y(a,b,c,d,e,f){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.closePath()}function A(a,b,c,d,e,f,g,h){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.lineTo(g,h);t.closePath()}function D(a,b,c,h){d(b);e(c);f(h);g(a.getStyle());t.stroke();Ia.expandByScalar(2*b)}function F(a){h(a.getStyle());t.fill()}function G(a,b,c,d,e,f,g,k,i,Ja,j,p,m){if(!(m instanceof THREE.DataTexture||void 0===
+m.image||0==m.image.width)){if(!0===m.needsUpdate){var l=m.wrapS==THREE.RepeatWrapping,n=m.wrapT==THREE.RepeatWrapping;Ya[m.id]=t.createPattern(m.image,!0===l&&!0===n?"repeat":!0===l&&!1===n?"repeat-x":!1===l&&!0===n?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===Ya[m.id]?h("rgba(0,0,0,1)"):h(Ya[m.id]);var l=m.offset.x/m.repeat.x,n=m.offset.y/m.repeat.y,mb=m.image.width*m.repeat.x,q=m.image.height*m.repeat.y,g=(g+l)*mb,k=(1-k+n)*q,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+l)*mb-g,Ja=(1-Ja+n)*q-k,j=(j+l)*mb-
+g,p=(1-p+n)*q-k,l=i*p-j*Ja;0===l?(void 0===pa[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),pa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=pa[m.id],g=4*(Math.floor(g)+Math.floor(k)*m.image.width),fa.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),F(fa)):(l=1/l,m=(p*c-Ja*e)*l,Ja=(p*d-Ja*f)*l,c=(i*e-j*c)*l,d=(i*f-j*d)*l,a=a-m*g-c*k,g=b-Ja*g-d*k,t.save(),t.transform(m,Ja,c,d,a,g),t.fill(),t.restore())}}
+function J(a,b,c,d,e,f,g,h,k,i,Ja,j,m){var p,l;p=m.width-1;l=m.height-1;g*=p;h*=l;c-=a;d-=b;e-=a;f-=b;k=k*p-g;i=i*l-h;Ja=Ja*p-g;j=j*l-h;l=1/(k*j-Ja*i);p=(j*c-i*e)*l;i=(j*d-i*f)*l;c=(k*e-Ja*c)*l;d=(k*f-Ja*d)*l;a=a-p*g-c*h;b=b-i*g-d*h;t.save();t.transform(p,i,c,d,a,b);t.clip();t.drawImage(m,0,0);t.restore()}function H(a,b,c,d){Ra[0]=255*a.r|0;Ra[1]=255*a.g|0;Ra[2]=255*a.b|0;Ra[4]=255*b.r|0;Ra[5]=255*b.g|0;Ra[6]=255*b.b|0;Ra[8]=255*c.r|0;Ra[9]=255*c.g|0;Ra[10]=255*c.b|0;Ra[12]=255*d.r|0;Ra[13]=255*d.g|
+0;Ra[14]=255*d.b|0;Eb.putImageData(k,0,0);lb.drawImage(jb,0,0);return ub}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===n instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();t.setTransform(1,0,0,-1,u,x);m.info.render.vertices=0;m.info.render.faces=0;l=s.projectScene(a,n,this.sortObjects,this.sortElements);p=l.elements;r=l.lights;
+nb.setRGB(0,0,0);$b.setRGB(0,0,0);Oa.setRGB(0,0,0);for(var L=0,U=r.length;L<U;L++){var O=r[L],W=O.color;O instanceof THREE.AmbientLight?nb.add(W):O instanceof THREE.DirectionalLight?$b.add(W):O instanceof THREE.PointLight&&Oa.add(W)}L=0;for(U=p.length;L<U;L++){var N=p[L],O=N.material;if(!(void 0===O||!1===O.visible)){Ia.makeEmpty();if(N instanceof THREE.RenderableParticle){K=N;K.x*=u;K.y*=x;var W=K,ua=N;b(O.opacity);c(O.blending);var Ja=void 0,vb=void 0,mb=void 0,wb=void 0,Nc=N=void 0,Oc=void 0;O instanceof
 THREE.ParticleBasicMaterial?null===O.map?(mb=ua.object.scale.x,wb=ua.object.scale.y,mb*=ua.scale.x*u,wb*=ua.scale.y*x,Ia.min.set(W.x-mb,W.y-wb),Ia.max.set(W.x+mb,W.y+wb),!1!==tb.isIntersectionBox(Ia)&&(h(O.color.getStyle()),t.save(),t.translate(W.x,W.y),t.rotate(-ua.rotation),t.scale(mb,wb),t.fillRect(-1,-1,2,2),t.restore())):(N=O.map.image,Nc=N.width>>1,Oc=N.height>>1,mb=ua.scale.x*u,wb=ua.scale.y*x,Ja=mb*Nc,vb=wb*Oc,Ia.min.set(W.x-Ja,W.y-vb),Ia.max.set(W.x+Ja,W.y+vb),!1!==tb.isIntersectionBox(Ia)&&
 (t.save(),t.translate(W.x,W.y),t.rotate(-ua.rotation),t.scale(mb,-wb),t.translate(-Nc,-Oc),t.drawImage(N,0,0),t.restore())):O instanceof THREE.ParticleCanvasMaterial&&(Ja=ua.scale.x*u,vb=ua.scale.y*x,Ia.min.set(W.x-Ja,W.y-vb),Ia.max.set(W.x+Ja,W.y+vb),!1!==tb.isIntersectionBox(Ia)&&(g(O.color.getStyle()),h(O.color.getStyle()),t.save(),t.translate(W.x,W.y),t.rotate(-ua.rotation),t.scale(Ja,vb),O.program(t),t.restore()))}else if(N instanceof THREE.RenderableLine)K=N.v1,M=N.v2,K.positionScreen.x*=u,
 K.positionScreen.y*=x,M.positionScreen.x*=u,M.positionScreen.y*=x,Ia.setFromPoints([K.positionScreen,M.positionScreen]),!0===tb.isIntersectionBox(Ia)&&(W=K,ua=M,b(O.opacity),c(O.blending),t.beginPath(),t.moveTo(W.positionScreen.x,W.positionScreen.y),t.lineTo(ua.positionScreen.x,ua.positionScreen.y),O instanceof THREE.LineBasicMaterial?(d(O.linewidth),e(O.linecap),f(O.linejoin),g(O.color.getStyle()),t.stroke(),Ia.expandByScalar(2*O.linewidth)):O instanceof THREE.LineDashedMaterial&&(d(O.linewidth),
@@ -302,8 +301,8 @@ T.positionScreen,$.positionScreen]);W=K;ua=M;Ja=T;vb=$;mb=wa;wb=fb;m.info.render
 ma=wb.positionScreen.y,O instanceof THREE.MeshLambertMaterial||O instanceof THREE.MeshPhongMaterial?(ha.copy(O.color),na.copy(O.emissive),O.vertexColors===THREE.FaceColors&&ha.multiply(N.color),!1===O.wireframe&&O.shading==THREE.SmoothShading&&4==N.vertexNormalsLength?(X.copy(nb),V.copy(nb),Y.copy(nb),ia.copy(nb),q(N.v1.positionWorld,N.vertexNormalsModel[0],X),q(N.v2.positionWorld,N.vertexNormalsModel[1],V),q(N.v4.positionWorld,N.vertexNormalsModel[3],Y),q(N.v3.positionWorld,N.vertexNormalsModel[2],
 ia),X.multiply(ha).add(na),V.multiply(ha).add(na),Y.multiply(ha).add(na),ia.multiply(ha).add(na),Va=H(X,V,Y,ia),y(B,ca,qa,ga,Ma,ib),J(B,ca,qa,ga,Ma,ib,0,0,1,0,0,1,Va),y(Ua,Xa,ja,E,Ba,ma),J(Ua,Xa,ja,E,Ba,ma,1,0,1,1,0,1,Va)):(fa.copy(nb),q(N.centroidModel,N.normalModel,fa),fa.multiply(ha).add(na),A(B,ca,qa,ga,ja,E,Ma,ib),!0===O.wireframe?D(fa,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):F(fa))):O instanceof THREE.MeshBasicMaterial?(fa.copy(O.color),O.vertexColors===THREE.FaceColors&&
 fa.multiply(N.color),A(B,ca,qa,ga,ja,E,Ma,ib),!0===O.wireframe?D(fa,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):F(fa)):O instanceof THREE.MeshNormalMaterial?(W=void 0,O.shading==THREE.FlatShading?(W=N.normalModelView,fa.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),A(B,ca,qa,ga,ja,E,Ma,ib),!0===O.wireframe?D(fa,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):F(fa)):O.shading==THREE.SmoothShading&&(W=N.vertexNormalsModelView[0],X.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),
-W=N.vertexNormalsModelView[1],V.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),W=N.vertexNormalsModelView[3],Y.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),W=N.vertexNormalsModelView[2],ia.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),Va=H(X,V,Y,ia),y(B,ca,qa,ga,Ma,ib),J(B,ca,qa,ga,Ma,ib,0,0,1,0,0,1,Va),y(Ua,Xa,ja,E,Ba,ma),J(Ua,Xa,ja,E,Ba,ma,1,0,1,1,0,1,Va))):O instanceof THREE.MeshDepthMaterial&&(Na=n.near,Qa=n.far,X.r=X.g=X.b=1-k(W.positionScreen.z*W.positionScreen.w,
-Na,Qa),V.r=V.g=V.b=1-k(ua.positionScreen.z*ua.positionScreen.w,Na,Qa),Y.r=Y.g=Y.b=1-k(vb.positionScreen.z*vb.positionScreen.w,Na,Qa),ia.r=ia.g=ia.b=1-k(Ja.positionScreen.z*Ja.positionScreen.w,Na,Qa),Va=H(X,V,Y,ia),y(B,ca,qa,ga,Ma,ib),J(B,ca,qa,ga,Ma,ib,0,0,1,0,0,1,Va),y(Ua,Xa,ja,E,Ba,ma),J(Ua,Xa,ja,E,Ba,ma,1,0,1,1,0,1,Va)))}ra.union(Ia)}}t.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",
+W=N.vertexNormalsModelView[1],V.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),W=N.vertexNormalsModelView[3],Y.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),W=N.vertexNormalsModelView[2],ia.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),Va=H(X,V,Y,ia),y(B,ca,qa,ga,Ma,ib),J(B,ca,qa,ga,Ma,ib,0,0,1,0,0,1,Va),y(Ua,Xa,ja,E,Ba,ma),J(Ua,Xa,ja,E,Ba,ma,1,0,1,1,0,1,Va))):O instanceof THREE.MeshDepthMaterial&&(Na=n.near,Qa=n.far,X.r=X.g=X.b=1-j(W.positionScreen.z*W.positionScreen.w,
+Na,Qa),V.r=V.g=V.b=1-j(ua.positionScreen.z*ua.positionScreen.w,Na,Qa),Y.r=Y.g=Y.b=1-j(vb.positionScreen.z*vb.positionScreen.w,Na,Qa),ia.r=ia.g=ia.b=1-j(Ja.positionScreen.z*Ja.positionScreen.w,Na,Qa),Va=H(X,V,Y,ia),y(B,ca,qa,ga,Ma,ib),J(B,ca,qa,ga,Ma,ib,0,0,1,0,0,1,Va),y(Ua,Xa,ja,E,Ba,ma),J(Ua,Xa,ja,E,Ba,ma,1,0,1,1,0,1,Va)))}ra.union(Ia)}}t.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",
@@ -353,106 +352,106 @@ THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"v
 THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
 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),p=f(d),l=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);p&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));l&&
-(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 n in d.attributes){var k=d.attributes[n],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=n,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){ra[a]||(j.enableVertexAttribArray(a),ra[a]=!0)}function i(){for(var a in ra)ra[a]&&(j.disableVertexAttribArray(a),ra[a]=!1)}function k(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b){return b[0]-a[0]}function p(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)fa=Ua=null,Ba=ma=ia=Y=Na=pa=ha=-1,jb=!0,a[d].render(b,
-c,Tb,tb),fa=Ua=null,Ba=ma=ia=Y=Na=pa=ha=-1,jb=!0}function l(a,b,c,d,e,f,g,h){var i,j,k,m;b?(j=a.length-1,m=b=-1):(j=0,b=a.length,m=1);for(var p=j;p!==b;p+=m)if(i=a[p],i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&E.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);I(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setMaterialFaces(i);k instanceof THREE.BufferGeometry?E.renderBufferDirect(d,
-e,f,i,k,j):E.renderBuffer(d,e,f,i,k,j)}}function r(a,b,c,d,e,f,g){for(var h,i,j=0,k=a.length;j<k;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);I(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}E.renderImmediateObject(c,d,e,h,i)}}function s(a,b){var e,f,g,h;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,
-a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",gc)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,h=f.attributes[i],h.buffer=j.createBuffer(),j.bindBuffer(k,h.buffer),j.bufferData(k,h.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){g=a.material;if(void 0===f.geometryGroups){i=f;var m,p,l,q,
-r;k={};var s=i.morphTargets.length,t=i.morphNormals.length,u=g instanceof THREE.MeshFaceMaterial;i.geometryGroups={};g=0;for(m=i.faces.length;g<m;g++)p=i.faces[g],l=u?p.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,counter:0}),r=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[r]&&(i.geometryGroups[r]={faces3:[],faces4:[],materialIndex:l,vertices:0,numMorphTargets:s,numMorphNormals:t}),q=p instanceof THREE.Face3?3:4,65535<i.geometryGroups[r].vertices+q&&(k[l].counter+=1,r=k[l].hash+"_"+k[l].counter,
-void 0===i.geometryGroups[r]&&(i.geometryGroups[r]={faces3:[],faces4:[],materialIndex:l,vertices:0,numMorphTargets:s,numMorphNormals:t})),p instanceof THREE.Face3?i.geometryGroups[r].faces3.push(g):i.geometryGroups[r].faces4.push(g),i.geometryGroups[r].vertices+=q;i.geometryGroupsList=[];for(h in i.geometryGroups)i.geometryGroups[h].id=X++,i.geometryGroupsList.push(i.geometryGroups[h])}for(e in f.geometryGroups)if(h=f.geometryGroups[e],!h.__webglVertexBuffer){i=h;i.__webglVertexBuffer=j.createBuffer();
-i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=j.createBuffer();s=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];k=0;for(s=i.numMorphTargets;k<s;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=
-[];k=0;for(s=i.numMorphNormals;k<s;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}E.info.memory.geometries++;d(h,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(h=f,h.__webglVertexBuffer=j.createBuffer(),h.__webglColorBuffer=j.createBuffer(),h.__webglNormalBuffer=j.createBuffer(),E.info.memory.geometries++,h=f,i=h.vertices.length,
-h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*i),h.__normalArray=new Float32Array(3*i),h.__webglVertexCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(h=f,h.__webglVertexBuffer=j.createBuffer(),h.__webglColorBuffer=j.createBuffer(),h.__webglLineDistanceBuffer=j.createBuffer(),E.info.memory.geometries++,h=f,i=h.vertices.length,h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*
-i),h.__lineDistanceArray=new Float32Array(1*i),h.__webglLineCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(h=f,h.__webglVertexBuffer=j.createBuffer(),h.__webglColorBuffer=j.createBuffer(),E.info.memory.geometries++,h=f,i=h.vertices.length,h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*i),h.__sortArray=[],h.__webglParticleCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=
+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)k.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=k.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,j=1*d.length+2*h.length,h=3*d.length+4*h.length,d=e(b,a),m=g(d),p=f(d),l=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);p&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));l&&
+(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*j);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*j;a.__webglLineCount=2*h;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var n in d.attributes){var j=d.attributes[n],c={},q;for(q in j)c[q]=j[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=k.createBuffer(),c.buffer.belongsToAttribute=n,j.needsUpdate=!0,c.__original=j;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){ra[a]||(k.enableVertexAttribArray(a),ra[a]=!0)}function i(){for(var a in ra)ra[a]&&(k.disableVertexAttribArray(a),ra[a]=!1)}function j(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b){return b[0]-a[0]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)fa=Ua=null,Ba=ma=ia=Y=Na=pa=ha=-1,jb=!0,a[d].render(b,
+c,Tb,tb),fa=Ua=null,Ba=ma=ia=Y=Na=pa=ha=-1,jb=!0}function p(a,b,c,d,e,f,g,h){var i,k,j,m;b?(k=a.length-1,m=b=-1):(k=0,b=a.length,m=1);for(var p=k;p!==b;p+=m)if(i=a[p],i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&E.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);I(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setMaterialFaces(i);j instanceof THREE.BufferGeometry?E.renderBufferDirect(d,
+e,f,i,j,k):E.renderBuffer(d,e,f,i,j,k)}}function r(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++)if(h=a[k],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);I(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}E.renderImmediateObject(c,d,e,h,i)}}function s(a,b){var e,f,g,h;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,
+a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",gc)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,j;for(i in f.attributes)j="index"===i?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER,h=f.attributes[i],h.buffer=k.createBuffer(),k.bindBuffer(j,h.buffer),k.bufferData(j,h.array,k.STATIC_DRAW)}else if(a instanceof THREE.Mesh){g=a.material;if(void 0===f.geometryGroups){i=f;var m,p,l,q,
+r;j={};var s=i.morphTargets.length,t=i.morphNormals.length,u=g instanceof THREE.MeshFaceMaterial;i.geometryGroups={};g=0;for(m=i.faces.length;g<m;g++)p=i.faces[g],l=u?p.materialIndex:0,void 0===j[l]&&(j[l]={hash:l,counter:0}),r=j[l].hash+"_"+j[l].counter,void 0===i.geometryGroups[r]&&(i.geometryGroups[r]={faces3:[],faces4:[],materialIndex:l,vertices:0,numMorphTargets:s,numMorphNormals:t}),q=p instanceof THREE.Face3?3:4,65535<i.geometryGroups[r].vertices+q&&(j[l].counter+=1,r=j[l].hash+"_"+j[l].counter,
+void 0===i.geometryGroups[r]&&(i.geometryGroups[r]={faces3:[],faces4:[],materialIndex:l,vertices:0,numMorphTargets:s,numMorphNormals:t})),p instanceof THREE.Face3?i.geometryGroups[r].faces3.push(g):i.geometryGroups[r].faces4.push(g),i.geometryGroups[r].vertices+=q;i.geometryGroupsList=[];for(h in i.geometryGroups)i.geometryGroups[h].id=X++,i.geometryGroupsList.push(i.geometryGroups[h])}for(e in f.geometryGroups)if(h=f.geometryGroups[e],!h.__webglVertexBuffer){i=h;i.__webglVertexBuffer=k.createBuffer();
+i.__webglNormalBuffer=k.createBuffer();i.__webglTangentBuffer=k.createBuffer();i.__webglColorBuffer=k.createBuffer();i.__webglUVBuffer=k.createBuffer();i.__webglUV2Buffer=k.createBuffer();i.__webglSkinIndicesBuffer=k.createBuffer();i.__webglSkinWeightsBuffer=k.createBuffer();i.__webglFaceBuffer=k.createBuffer();i.__webglLineBuffer=k.createBuffer();s=j=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];j=0;for(s=i.numMorphTargets;j<s;j++)i.__webglMorphTargetsBuffers.push(k.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=
+[];j=0;for(s=i.numMorphNormals;j<s;j++)i.__webglMorphNormalsBuffers.push(k.createBuffer())}E.info.memory.geometries++;d(h,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(h=f,h.__webglVertexBuffer=k.createBuffer(),h.__webglColorBuffer=k.createBuffer(),h.__webglNormalBuffer=k.createBuffer(),E.info.memory.geometries++,h=f,i=h.vertices.length,
+h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*i),h.__normalArray=new Float32Array(3*i),h.__webglVertexCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(h=f,h.__webglVertexBuffer=k.createBuffer(),h.__webglColorBuffer=k.createBuffer(),h.__webglLineDistanceBuffer=k.createBuffer(),E.info.memory.geometries++,h=f,i=h.vertices.length,h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*
+i),h.__lineDistanceArray=new Float32Array(1*i),h.__webglLineCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(h=f,h.__webglVertexBuffer=k.createBuffer(),h.__webglColorBuffer=k.createBuffer(),E.info.memory.geometries++,h=f,i=h.vertices.length,h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*i),h.__sortArray=[],h.__webglParticleCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=
 !0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)n(b.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)h=f.geometryGroups[e],n(b.__webglObjects,h,a)}else a instanceof THREE.Ribbon||a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,n(b.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?b.__webglObjectsImmediate.push({object:a,opaque:null,transparent:null}):
 a instanceof THREE.Sprite?b.__webglSprites.push(a):a instanceof THREE.LensFlare&&b.__webglFlares.push(a);a.__webglActive=!0}}function n(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function y(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Ribbon||a instanceof THREE.Line?x(b.__webglObjects,
 a):a instanceof THREE.Sprite?t(b.__webglSprites,a):a instanceof THREE.LensFlare?t(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&x(b.__webglObjectsImmediate,a);delete a.__webglActive}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function t(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){V=0;d.needsUpdate&&(d.program&&ua(d),E.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&
-(e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Ua&&(j.useProgram(g),Ua=g,f=!0);d.id!==Ba&&(Ba=d.id,f=!0);if(f||a!==fa)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==fa&&(fa=a);if(d.skinning)if(Ub&&e.useVertexTexture){if(null!==h.boneTexture){var k=J();j.uniform1i(h.boneTexture,k);E.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(jb){for(var m,l=k=0,p=0,n,q,r,s=Eb,t=s.directional.colors,u=s.directional.positions,x=s.point.colors,y=s.point.positions,A=s.point.distances,D=s.spot.colors,F=s.spot.positions,G=s.spot.distances,C=s.spot.directions,I=s.spot.anglesCos,L=
-s.spot.exponents,K=s.hemi.skyColors,N=s.hemi.groundColors,B=s.hemi.positions,O=0,W=0,Y=0,ma=0,$=0,R=0,S=0,P=0,da=m=0,c=r=da=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(n=m.color,q=m.intensity,r=m.distance,m instanceof THREE.AmbientLight?m.visible&&(E.gammaInput?(k+=n.r*n.r,l+=n.g*n.g,p+=n.b*n.b):(k+=n.r,l+=n.g,p+=n.b)):m instanceof THREE.DirectionalLight?($+=1,m.visible&&(ka.getPositionFromMatrix(m.matrixWorld),Oa.getPositionFromMatrix(m.target.matrixWorld),ka.sub(Oa),ka.normalize(),0===ka.x&&0===
+(e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Ua&&(k.useProgram(g),Ua=g,f=!0);d.id!==Ba&&(Ba=d.id,f=!0);if(f||a!==fa)k.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==fa&&(fa=a);if(d.skinning)if(Ub&&e.useVertexTexture){if(null!==h.boneTexture){var j=J();k.uniform1i(h.boneTexture,j);E.setTexture(e.boneTexture,j)}}else null!==h.boneGlobalMatrices&&k.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(jb){for(var m,l=j=0,p=0,n,q,r,s=Eb,t=s.directional.colors,u=s.directional.positions,x=s.point.colors,y=s.point.positions,A=s.point.distances,D=s.spot.colors,F=s.spot.positions,G=s.spot.distances,C=s.spot.directions,I=s.spot.anglesCos,L=
+s.spot.exponents,K=s.hemi.skyColors,N=s.hemi.groundColors,B=s.hemi.positions,O=0,W=0,Y=0,ma=0,$=0,R=0,S=0,P=0,da=m=0,c=r=da=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(n=m.color,q=m.intensity,r=m.distance,m instanceof THREE.AmbientLight?m.visible&&(E.gammaInput?(j+=n.r*n.r,l+=n.g*n.g,p+=n.b*n.b):(j+=n.r,l+=n.g,p+=n.b)):m instanceof THREE.DirectionalLight?($+=1,m.visible&&(ka.getPositionFromMatrix(m.matrixWorld),Oa.getPositionFromMatrix(m.target.matrixWorld),ka.sub(Oa),ka.normalize(),0===ka.x&&0===
 ka.y&&0===ka.z||(m=3*O,u[m]=ka.x,u[m+1]=ka.y,u[m+2]=ka.z,E.gammaInput?z(t,m,n,q*q):H(t,m,n,q),O+=1))):m instanceof THREE.PointLight?(R+=1,m.visible&&(da=3*W,E.gammaInput?z(x,da,n,q*q):H(x,da,n,q),Oa.getPositionFromMatrix(m.matrixWorld),y[da]=Oa.x,y[da+1]=Oa.y,y[da+2]=Oa.z,A[W]=r,W+=1)):m instanceof THREE.SpotLight?(S+=1,m.visible&&(da=3*Y,E.gammaInput?z(D,da,n,q*q):H(D,da,n,q),Oa.getPositionFromMatrix(m.matrixWorld),F[da]=Oa.x,F[da+1]=Oa.y,F[da+2]=Oa.z,G[Y]=r,ka.copy(Oa),Oa.getPositionFromMatrix(m.target.matrixWorld),
 ka.sub(Oa),ka.normalize(),C[da]=ka.x,C[da+1]=ka.y,C[da+2]=ka.z,I[Y]=Math.cos(m.angle),L[Y]=m.exponent,Y+=1)):m instanceof THREE.HemisphereLight&&(P+=1,m.visible&&(ka.getPositionFromMatrix(m.matrixWorld),ka.normalize(),0===ka.x&&0===ka.y&&0===ka.z||(r=3*ma,B[r]=ka.x,B[r+1]=ka.y,B[r+2]=ka.z,n=m.color,m=m.groundColor,E.gammaInput?(q*=q,z(K,r,n,q),z(N,r,m,q)):(H(K,r,n,q),H(N,r,m,q)),ma+=1))));c=3*O;for(f=Math.max(t.length,3*$);c<f;c++)t[c]=0;c=3*W;for(f=Math.max(x.length,3*R);c<f;c++)x[c]=0;c=3*Y;for(f=
-Math.max(D.length,3*S);c<f;c++)D[c]=0;c=3*ma;for(f=Math.max(K.length,3*P);c<f;c++)K[c]=0;c=3*ma;for(f=Math.max(N.length,3*P);c<f;c++)N[c]=0;s.directional.length=O;s.point.length=W;s.spot.length=Y;s.hemi.length=ma;s.ambient[0]=k;s.ambient[1]=l;s.ambient[2]=p;jb=!1}c=Eb;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=
+Math.max(D.length,3*S);c<f;c++)D[c]=0;c=3*ma;for(f=Math.max(K.length,3*P);c<f;c++)K[c]=0;c=3*ma;for(f=Math.max(N.length,3*P);c<f;c++)N[c]=0;s.directional.length=O;s.point.length=W;s.spot.length=Y;s.hemi.length=ma;s.ambient[0]=j;s.ambient[1]=l;s.ambient[2]=p;jb=!1}c=Eb;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;E.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 X;d.map?X=d.map:d.specularMap?X=d.specularMap:d.normalMap?X=d.normalMap:d.bumpMap&&(X=d.bumpMap);void 0!==X&&(c=X.offset,
 X=X.repeat,i.offsetRepeat.value.set(c.x,c.y,X.x,X.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=T.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,E.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?(E.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=X=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[X]=k.shadowMap,i.shadowMapSize.value[X]=k.shadowMapSize,i.shadowMatrix.value[X]=k.shadowMatrix,i.shadowDarkness.value[X]=k.shadowDarkness,i.shadowBias.value[X]=k.shadowBias,X++}b=d.uniformsList;i=0;for(X=b.length;i<X;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(p=k.length;l<p;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(p=k.length;l<p;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(p=k.length;l<p;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(p=k.length;l<p;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(s=k,k=J(),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(),E.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++)E.autoScaleCubemaps&&!f?(p=k,s=l,t=c.image[l],x=Hc,t.width<=x&&t.height<=x||(y=Math.max(t.width,t.height),u=Math.floor(t.width*x/y),x=Math.floor(t.height*x/y),y=document.createElement("canvas"),y.width=u,y.height=x,y.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,x),t=y),p[s]=t):k[l]=c.image[l];l=k[0];p=0===(l.width&l.width-
-1)&&0===(l.height&l.height-1);s=M(c.format);t=M(c.type);U(j.TEXTURE_CUBE_MAP,c,p);for(l=0;6>l;l++)if(f){x=k[l].mipmaps;y=0;for(A=x.length;y<A;y++)u=x[y],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,y,s,u.width,u.height,0,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,s,s,t,k[l]);c.generateMipmaps&&p&&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)):E.setTexture(s,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(p=c.value.length;l<p;l++)c._array[l]=J();j.uniform1iv(f,c._array);l=0;for(p=c.value.length;l<p;l++)s=c.value[l],k=c._array[l],s&&E.setTexture(s,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)Oa.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,
-Oa.x,Oa.y,Oa.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 J(){var a=V;a>=dc&&console.warn("WebGLRenderer: trying to use "+
-a+" texture units while this GPU supports only "+dc);V+=1;return a}function F(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 H(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function L(a){a!==Bb&&(j.lineWidth(a),Bb=a)}function I(a,b,c){Qa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Qa=a);if(a&&
-(Va!==b||Wa!==c))j.polygonOffset(b,c),Va=b,Wa=c}function N(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 A(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(N(b)),null):c}function U(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,M(b.wrapS)),j.texParameteri(a,
-j.TEXTURE_WRAP_T,M(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,M(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,M(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,K(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(b.minFilter)));if(lb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,lb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,ec)),b.__oldAnisotropy=
-b.anisotropy}function G(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 K(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function M(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!==Sa){if(a===THREE.RGB_S3TC_DXT1_Format)return Sa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},T=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
+d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=X=0;for(f=b.length;c<f;c++)if(j=b[c],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.value[X]=j.shadowMap,i.shadowMapSize.value[X]=j.shadowMapSize,i.shadowMatrix.value[X]=j.shadowMatrix,i.shadowDarkness.value[X]=j.shadowDarkness,i.shadowBias.value[X]=j.shadowBias,X++}b=d.uniformsList;i=0;for(X=b.length;i<X;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,j=c.value,"i"===
+l)k.uniform1i(f,j);else if("f"===l)k.uniform1f(f,j);else if("v2"===l)k.uniform2f(f,j.x,j.y);else if("v3"===l)k.uniform3f(f,j.x,j.y,j.z);else if("v4"===l)k.uniform4f(f,j.x,j.y,j.z,j.w);else if("c"===l)k.uniform3f(f,j.r,j.g,j.b);else if("iv1"===l)k.uniform1iv(f,j);else if("iv"===l)k.uniform3iv(f,j);else if("fv1"===l)k.uniform1fv(f,j);else if("fv"===l)k.uniform3fv(f,j);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*j.length));l=0;for(p=j.length;l<p;l++)s=2*l,c._array[s]=j[l].x,c._array[s+
+1]=j[l].y;k.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*j.length));l=0;for(p=j.length;l<p;l++)s=3*l,c._array[s]=j[l].x,c._array[s+1]=j[l].y,c._array[s+2]=j[l].z;k.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*j.length));l=0;for(p=j.length;l<p;l++)s=4*l,c._array[s]=j[l].x,c._array[s+1]=j[l].y,c._array[s+2]=j[l].z,c._array[s+3]=j[l].w;k.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),
+j.flattenToArray(c._array),k.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(p=j.length;l<p;l++)j[l].flattenToArrayOffset(c._array,16*l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(s=j,j=J(),k.uniform1i(f,j),s)if(s.image instanceof Array&&6===s.image.length){if(c=s,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=k.createTexture(),E.info.memory.textures++);k.activeTexture(k.TEXTURE0+
+f);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;j=[];for(l=0;6>l;l++)E.autoScaleCubemaps&&!f?(p=j,s=l,t=c.image[l],x=Hc,t.width<=x&&t.height<=x||(y=Math.max(t.width,t.height),u=Math.floor(t.width*x/y),x=Math.floor(t.height*x/y),y=document.createElement("canvas"),y.width=u,y.height=x,y.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,x),t=y),p[s]=t):j[l]=c.image[l];l=j[0];p=0===(l.width&l.width-
+1)&&0===(l.height&l.height-1);s=M(c.format);t=M(c.type);U(k.TEXTURE_CUBE_MAP,c,p);for(l=0;6>l;l++)if(f){x=j[l].mipmaps;y=0;for(A=x.length;y<A;y++)u=x[y],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,y,s,u.width,u.height,0,u.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,s,s,t,j[l]);c.generateMipmaps&&p&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else s instanceof
+THREE.WebGLRenderTargetCube?(c=s,k.activeTexture(k.TEXTURE0+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):E.setTexture(s,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(p=c.value.length;l<p;l++)c._array[l]=J();k.uniform1iv(f,c._array);l=0;for(p=c.value.length;l<p;l++)s=c.value[l],j=c._array[l],s&&E.setTexture(s,j)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)Oa.getPositionFromMatrix(a.matrixWorld),k.uniform3f(h.cameraPosition,
+Oa.x,Oa.y,Oa.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&k.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}k.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function J(){var a=V;a>=dc&&console.warn("WebGLRenderer: trying to use "+
+a+" texture units while this GPU supports only "+dc);V+=1;return a}function F(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 H(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function L(a){a!==Bb&&(k.lineWidth(a),Bb=a)}function I(a,b,c){Qa!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),Qa=a);if(a&&
+(Va!==b||Wa!==c))k.polygonOffset(b,c),Va=b,Wa=c}function N(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 A(a,b){var c;"fragment"===a?c=k.createShader(k.FRAGMENT_SHADER):"vertex"===a&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);return!k.getShaderParameter(c,k.COMPILE_STATUS)?(console.error(k.getShaderInfoLog(c)),console.error(N(b)),null):c}function U(a,b,c){c?(k.texParameteri(a,k.TEXTURE_WRAP_S,M(b.wrapS)),k.texParameteri(a,
+k.TEXTURE_WRAP_T,M(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,M(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,M(b.minFilter))):(k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,K(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,K(b.minFilter)));if(lb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))k.texParameterf(a,lb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,ec)),b.__oldAnisotropy=
+b.anisotropy}function G(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}
+function K(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function M(a){if(a===THREE.RepeatWrapping)return k.REPEAT;if(a===THREE.ClampToEdgeWrapping)return k.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return k.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return k.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return k.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return k.NEAREST_MIPMAP_LINEAR;if(a===
+THREE.LinearFilter)return k.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return k.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return k.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return k.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return k.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return k.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return k.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return k.BYTE;if(a===THREE.ShortType)return k.SHORT;if(a===
+THREE.UnsignedShortType)return k.UNSIGNED_SHORT;if(a===THREE.IntType)return k.INT;if(a===THREE.UnsignedIntType)return k.UNSIGNED_INT;if(a===THREE.FloatType)return k.FLOAT;if(a===THREE.AlphaFormat)return k.ALPHA;if(a===THREE.RGBFormat)return k.RGB;if(a===THREE.RGBAFormat)return k.RGBA;if(a===THREE.LuminanceFormat)return k.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return k.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return k.FUNC_ADD;if(a===THREE.SubtractEquation)return k.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return k.FUNC_REVERSE_SUBTRACT;
+if(a===THREE.ZeroFactor)return k.ZERO;if(a===THREE.OneFactor)return k.ONE;if(a===THREE.SrcColorFactor)return k.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return k.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return k.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return k.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return k.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return k.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return k.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return k.ONE_MINUS_DST_COLOR;
+if(a===THREE.SrcAlphaSaturateFactor)return k.SRC_ALPHA_SATURATE;if(void 0!==Sa){if(a===THREE.RGB_S3TC_DXT1_Format)return Sa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},T=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
 $=void 0!==a.precision?a.precision:"highp",wa=void 0!==a.alpha?a.alpha:!0,fb=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,B=void 0!==a.antialias?a.antialias:!1,ca=void 0!==a.stencil?a.stencil:!0,qa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ga=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),ja=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=T;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 E=this,Ma=[],ib=0,Ua=null,Xa=null,Ba=-1,ma=null,fa=null,X=0,V=0,Y=-1,ia=-1,ha=-1,na=-1,Ka=-1,Ya=-1,pa=-1,Na=-1,Qa=null,Va=null,Wa=null,Bb=null,Kb=0,Nb=0,Ob=0,Pb=0,Tb=0,tb=0,ra={},Ia=new THREE.Frustum,nb=new THREE.Matrix4,$b=new THREE.Matrix4,Oa=new THREE.Vector3,ka=new THREE.Vector3,jb=!0,Eb={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,Ra,ub,lb,Sa;try{if(!(j=T.getContext("experimental-webgl",{alpha:wa,premultipliedAlpha:fb,antialias:B,stencil:ca,preserveDrawingBuffer:qa})))throw"Error creating WebGL context.";}catch(Fc){console.error(Fc)}Ra=j.getExtension("OES_texture_float");ub=j.getExtension("OES_standard_derivatives");lb=j.getExtension("EXT_texture_filter_anisotropic")||
-j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Sa=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Ra||console.log("THREE.WebGLRenderer: Float textures not supported.");ub||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");lb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
-Sa||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(ga.r,ga.g,ga.b,ja);this.context=j;
-var dc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),Gc=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var Hc=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),ec=lb?j.getParameter(lb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Vb=0<Gc,Ub=Vb&&Ra;Sa&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var Kc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),Lc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var Jc=
-j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),Ic=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 Mc=0<Kc.precision&&0<Jc.precision,fc=0<Lc.precision&&0<Ic.precision;"highp"===$&&!Mc&&(fc?($="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):($="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===$&&!fc&&($="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return Vb};this.supportsFloatTextures=function(){return Ra};
-this.supportsStandardDerivatives=function(){return ub};this.supportsCompressedTextureS3TC=function(){return Sa};this.getMaxAnisotropy=function(){return ec};this.getPrecision=function(){return $};this.setSize=function(a,b){T.width=a*this.devicePixelRatio;T.height=b*this.devicePixelRatio;T.style.width=a+"px";T.style.height=b+"px";this.setViewport(0,0,T.width,T.height)};this.setViewport=function(a,b,c,d){Kb=void 0!==a?a:0;Nb=void 0!==b?b:0;Ob=void 0!==c?c:T.width;Pb=void 0!==d?d:T.height;j.viewport(Kb,
-Nb,Ob,Pb)};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){ga.setHex(a);ja=b;j.clearColor(ga.r,ga.g,ga.b,ja)};this.setClearColor=function(a,b){ga.copy(a);ja=b;j.clearColor(ga.r,ga.g,ga.b,ja)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return ja};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){Ua=null;Ba=ma=Na=pa=ha=-1;jb=!0;ia=Y=-1;this.shadowMapPlugin.update(a,b)};var gc=function(a){a=a.target;a.removeEventListener("dispose",gc);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);
-E.info.memory.geometries--},O=function(a){a=a.target;a.removeEventListener("dispose",O);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));E.info.memory.textures--},W=function(a){a=a.target;a.removeEventListener("dispose",W);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);E.info.memory.textures--},oc=function(a){a=a.target;a.removeEventListener("dispose",oc);ua(a)},ua=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=Ma.length;a<c;a++)if(d=Ma[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Ma.length;a<c;a++)d=Ma[a],d.program!==b&&e.push(d);Ma=e;j.deleteProgram(b);E.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,h,i,k,l,m,p,n,q=3*a.count;for(n=0;n<q;n+=9)p=a.normalArray,d=p[n],e=p[n+1],f=p[n+2],g=p[n+3],i=p[n+4],l=p[n+5],h=p[n+6],k=p[n+7],m=p[n+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+m)/3,p[n]=d,p[n+1]=e,p[n+2]=f,p[n+3]=d,p[n+4]=e,p[n+5]=f,p[n+6]=d,p[n+7]=e,p[n+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){var g,k,l;g=D(a,b,c,d,f);a=g.attributes;b=e.attributes;c=!1;g=16777215*e.id+2*g.id+(d.wireframe?1:0);g!==ma&&(ma=g,c=!0);c&&i();if(f instanceof THREE.Mesh)if(d=b.index){e=e.offsets;1<e.length&&(c=!0);for(var m=0,p=e.length;m<p;m++){var n=e[m].index;if(c){for(k in b)"index"!==k&&(g=a[k],f=b[k],l=f.itemSize,0<=g&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),h(g),j.vertexAttribPointer(g,l,j.FLOAT,!1,0,4*n*l)));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
-d.buffer)}j.drawElements(j.TRIANGLES,e[m].count,j.UNSIGNED_SHORT,2*e[m].start);E.info.render.calls++;E.info.render.vertices+=e[m].count;E.info.render.faces+=e[m].count/3}}else{if(c)for(k in b)"index"!==k&&(g=a[k],f=b[k],l=f.itemSize,0<=g&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),h(g),j.vertexAttribPointer(g,l,j.FLOAT,!1,0,0)));k=e.attributes.position;j.drawArrays(j.TRIANGLES,0,k.numItems/3);E.info.render.calls++;E.info.render.vertices+=k.numItems/3;E.info.render.faces+=k.numItems/3/3}else if(f instanceof
-THREE.ParticleSystem){if(c){for(k in b)g=a[k],f=b[k],l=f.itemSize,0<=g&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),h(g),j.vertexAttribPointer(g,l,j.FLOAT,!1,0,0));k=b.position;j.drawArrays(j.POINTS,0,k.numItems/3);E.info.render.calls++;E.info.render.points+=k.numItems/3}}else if(f instanceof THREE.Line&&c){for(k in b)g=a[k],f=b[k],l=f.itemSize,0<=g&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),h(g),j.vertexAttribPointer(g,l,j.FLOAT,!1,0,0));L(d.linewidth);k=b.position;j.drawArrays(j.LINE_STRIP,0,k.numItems/
-3);E.info.render.calls++;E.info.render.points+=k.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,k,c=D(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ma&&(ma=c,b=!0);b&&i();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.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]),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var l=0;k=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;l<d.numSupportedMorphTargets&&l<k.length;)0<=c["morphTarget"+l]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[l]]),h(c["morphTarget"+l]),
-j.vertexAttribPointer(c["morphTarget"+l],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[l]]),h(c["morphNormal"+l]),j.vertexAttribPointer(c["morphNormal"+l],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=g[k[l]],l++}else{k=[];g=f.morphTargetInfluences;var p,n=g.length;for(p=0;p<n;p++)l=g[p],0<l&&k.push([l,p]);k.length>d.numSupportedMorphTargets?(k.sort(m),k.length=d.numSupportedMorphTargets):k.length>d.numSupportedMorphNormals?
-k.sort(m):0===k.length&&k.push([0,0]);for(l=0;l<d.numSupportedMorphTargets;)k[l]?(p=k[l][1],0<=c["morphTarget"+l]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[p]),h(c["morphTarget"+l]),j.vertexAttribPointer(c["morphTarget"+l],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[p]),h(c["morphNormal"+l]),j.vertexAttribPointer(c["morphNormal"+l],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=g[p]):f.__webglMorphTargetInfluences[l]=
-0,l++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){g=0;for(k=e.__webglCustomAttributesList.length;g<k;g++)c=e.__webglCustomAttributesList[g],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),
-h(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0));0<=a.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),j.vertexAttribPointer(a.uv2,
-2,j.FLOAT,!1,0,0));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
-(L(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=e.__webglFaceCount,E.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,L(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),
-E.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),E.info.render.calls++,E.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),E.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,h,i=a.__lights,m=a.fog;Ba=-1;jb=!0;this.autoUpdateScene&&
-a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);nb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ia.setFromMatrix(nb);this.autoUpdateObjects&&this.initWebGLObjects(a);p(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=
+colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,Ra,ub,lb,Sa;try{if(!(k=T.getContext("experimental-webgl",{alpha:wa,premultipliedAlpha:fb,antialias:B,stencil:ca,preserveDrawingBuffer:qa})))throw"Error creating WebGL context.";}catch(Fc){console.error(Fc)}Ra=k.getExtension("OES_texture_float");ub=k.getExtension("OES_standard_derivatives");lb=k.getExtension("EXT_texture_filter_anisotropic")||
+k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Sa=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Ra||console.log("THREE.WebGLRenderer: Float textures not supported.");ub||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");lb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
+Sa||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===k.getShaderPrecisionFormat&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(ga.r,ga.g,ga.b,ja);this.context=k;
+var dc=k.getParameter(k.MAX_TEXTURE_IMAGE_UNITS),Gc=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Hc=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),ec=lb?k.getParameter(lb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Vb=0<Gc,Ub=Vb&&Ra;Sa&&k.getParameter(k.COMPRESSED_TEXTURE_FORMATS);var Kc=k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.HIGH_FLOAT),Lc=k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.MEDIUM_FLOAT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.LOW_FLOAT);var Jc=
+k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.HIGH_FLOAT),Ic=k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.MEDIUM_FLOAT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.LOW_FLOAT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.HIGH_INT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.MEDIUM_INT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.LOW_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.HIGH_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.MEDIUM_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,
+k.LOW_INT);var Mc=0<Kc.precision&&0<Jc.precision,fc=0<Lc.precision&&0<Ic.precision;"highp"===$&&!Mc&&(fc?($="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):($="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===$&&!fc&&($="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return k};this.supportsVertexTextures=function(){return Vb};this.supportsFloatTextures=function(){return Ra};
+this.supportsStandardDerivatives=function(){return ub};this.supportsCompressedTextureS3TC=function(){return Sa};this.getMaxAnisotropy=function(){return ec};this.getPrecision=function(){return $};this.setSize=function(a,b){T.width=a*this.devicePixelRatio;T.height=b*this.devicePixelRatio;T.style.width=a+"px";T.style.height=b+"px";this.setViewport(0,0,T.width,T.height)};this.setViewport=function(a,b,c,d){Kb=void 0!==a?a:0;Nb=void 0!==b?b:0;Ob=void 0!==c?c:T.width;Pb=void 0!==d?d:T.height;k.viewport(Kb,
+Nb,Ob,Pb)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ga.setHex(a);ja=b;k.clearColor(ga.r,ga.g,ga.b,ja)};this.setClearColor=function(a,b){ga.copy(a);ja=b;k.clearColor(ga.r,ga.g,ga.b,ja)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return ja};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=k.COLOR_BUFFER_BIT;if(void 0===b||b)d|=k.DEPTH_BUFFER_BIT;
+if(void 0===c||c)d|=k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Ua=null;Ba=ma=Na=pa=ha=-1;jb=!0;ia=Y=-1;this.shadowMapPlugin.update(a,b)};var gc=function(a){a=a.target;a.removeEventListener("dispose",gc);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&
+k.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&k.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&k.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&k.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&k.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&k.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&k.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&k.deleteBuffer(a.__webglSkinWeightsBuffer);
+void 0!==a.__webglFaceBuffer&&k.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&k.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&k.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++)k.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)k.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);
+E.info.memory.geometries--},O=function(a){a=a.target;a.removeEventListener("dispose",O);a.image&&a.image.__webglTextureCube?k.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,k.deleteTexture(a.__webglTexture));E.info.memory.textures--},W=function(a){a=a.target;a.removeEventListener("dispose",W);if(a&&a.__webglTexture)if(k.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)k.deleteFramebuffer(a.__webglFramebuffer[b]),k.deleteRenderbuffer(a.__webglRenderbuffer[b]);
+else k.deleteFramebuffer(a.__webglFramebuffer),k.deleteRenderbuffer(a.__webglRenderbuffer);E.info.memory.textures--},oc=function(a){a=a.target;a.removeEventListener("dispose",oc);ua(a)},ua=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=Ma.length;a<c;a++)if(d=Ma[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Ma.length;a<c;a++)d=Ma[a],d.program!==b&&e.push(d);Ma=e;k.deleteProgram(b);E.info.memory.programs--}}};this.renderBufferImmediate=
+function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=k.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=k.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=k.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=k.createBuffer());a.hasPositions&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,
+3,k.FLOAT,!1,0,0));if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,j,l,m,p,n,q=3*a.count;for(n=0;n<q;n+=9)p=a.normalArray,d=p[n],e=p[n+1],f=p[n+2],g=p[n+3],i=p[n+4],l=p[n+5],h=p[n+6],j=p[n+7],m=p[n+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+l+m)/3,p[n]=d,p[n+1]=e,p[n+2]=f,p[n+3]=d,p[n+4]=e,p[n+5]=f,p[n+6]=d,p[n+7]=e,p[n+8]=f}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,
+3,k.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer),k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.uv),k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.color),k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,!1,0,0));k.drawArrays(k.TRIANGLES,
+0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var g,j,l;g=D(a,b,c,d,f);a=g.attributes;b=e.attributes;c=!1;g=16777215*e.id+2*g.id+(d.wireframe?1:0);g!==ma&&(ma=g,c=!0);c&&i();if(f instanceof THREE.Mesh)if(d=b.index){e=e.offsets;1<e.length&&(c=!0);for(var m=0,p=e.length;m<p;m++){var n=e[m].index;if(c){for(j in b)"index"!==j&&(g=a[j],f=b[j],l=f.itemSize,0<=g&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),h(g),k.vertexAttribPointer(g,l,k.FLOAT,!1,0,4*n*l)));k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
+d.buffer)}k.drawElements(k.TRIANGLES,e[m].count,k.UNSIGNED_SHORT,2*e[m].start);E.info.render.calls++;E.info.render.vertices+=e[m].count;E.info.render.faces+=e[m].count/3}}else{if(c)for(j in b)"index"!==j&&(g=a[j],f=b[j],l=f.itemSize,0<=g&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),h(g),k.vertexAttribPointer(g,l,k.FLOAT,!1,0,0)));j=e.attributes.position;k.drawArrays(k.TRIANGLES,0,j.numItems/3);E.info.render.calls++;E.info.render.vertices+=j.numItems/3;E.info.render.faces+=j.numItems/3/3}else if(f instanceof
+THREE.ParticleSystem){if(c){for(j in b)g=a[j],f=b[j],l=f.itemSize,0<=g&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),h(g),k.vertexAttribPointer(g,l,k.FLOAT,!1,0,0));j=b.position;k.drawArrays(k.POINTS,0,j.numItems/3);E.info.render.calls++;E.info.render.points+=j.numItems/3}}else if(f instanceof THREE.Line&&c){for(j in b)g=a[j],f=b[j],l=f.itemSize,0<=g&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),h(g),k.vertexAttribPointer(g,l,k.FLOAT,!1,0,0));L(d.linewidth);j=b.position;k.drawArrays(k.LINE_STRIP,0,j.numItems/
+3);E.info.render.calls++;E.info.render.points+=j.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,j,c=D(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ma&&(ma=c,b=!0);b&&i();if(!d.morphTargets&&0<=a.position)b&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),k.vertexAttribPointer(a.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(k.bindBuffer(k.ARRAY_BUFFER,
+e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):0<=c.position&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var l=0;j=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;l<d.numSupportedMorphTargets&&l<j.length;)0<=c["morphTarget"+l]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[l]]),h(c["morphTarget"+l]),
+k.vertexAttribPointer(c["morphTarget"+l],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[l]]),h(c["morphNormal"+l]),k.vertexAttribPointer(c["morphNormal"+l],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=g[j[l]],l++}else{j=[];g=f.morphTargetInfluences;var p,n=g.length;for(p=0;p<n;p++)l=g[p],0<l&&j.push([l,p]);j.length>d.numSupportedMorphTargets?(j.sort(m),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?
+j.sort(m):0===j.length&&j.push([0,0]);for(l=0;l<d.numSupportedMorphTargets;)j[l]?(p=j[l][1],0<=c["morphTarget"+l]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[p]),h(c["morphTarget"+l]),k.vertexAttribPointer(c["morphTarget"+l],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[p]),h(c["morphNormal"+l]),k.vertexAttribPointer(c["morphNormal"+l],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=g[p]):f.__webglMorphTargetInfluences[l]=
+0,l++}null!==d.program.uniforms.morphTargetInfluences&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){g=0;for(j=e.__webglCustomAttributesList.length;g<j;g++)c=e.__webglCustomAttributesList[g],0<=a[c.buffer.belongsToAttribute]&&(k.bindBuffer(k.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),k.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,k.FLOAT,!1,0,0))}0<=a.color&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer),
+h(a.color),k.vertexAttribPointer(a.color,3,k.FLOAT,!1,0,0));0<=a.normal&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),k.vertexAttribPointer(a.normal,3,k.FLOAT,!1,0,0));0<=a.tangent&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),k.vertexAttribPointer(a.tangent,4,k.FLOAT,!1,0,0));0<=a.uv&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),k.vertexAttribPointer(a.uv,2,k.FLOAT,!1,0,0));0<=a.uv2&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),k.vertexAttribPointer(a.uv2,
+2,k.FLOAT,!1,0,0));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),k.vertexAttribPointer(a.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),k.vertexAttribPointer(a.skinWeight,4,k.FLOAT,!1,0,0));0<=a.lineDistance&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),k.vertexAttribPointer(a.lineDistance,1,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
+(L(d.wireframeLinewidth),b&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)):(b&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=e.__webglFaceCount,E.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,L(d.linewidth),k.drawArrays(f,0,e.__webglLineCount),
+E.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),E.info.render.calls++,E.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),E.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,h,i=a.__lights,m=a.fog;Ba=-1;jb=!0;this.autoUpdateScene&&
+a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);nb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ia.setFromMatrix(nb);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=
 0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||Ia.intersectsObject(g))){F(g,b);var n=f,q=n.buffer,s=void 0,t=s=void 0,t=n.object.material;if(t instanceof THREE.MeshFaceMaterial)s=q.materialIndex,s=t.materials[s],s.transparent?(n.transparent=s,n.opaque=null):(n.opaque=s,n.transparent=null);else if(s=t)s.transparent?(n.transparent=s,n.opaque=null):(n.opaque=s,n.transparent=null);f.render=!0;
-!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(Oa.getPositionFromMatrix(g.matrixWorld),Oa.applyProjection(nb),f.z=Oa.z))}this.sortObjects&&h.sort(k);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(F(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),l(a.__webglObjects,!1,"",b,i,m,!0,d),r(a.__webglObjectsImmediate,"",b,i,m,!1,d)):(d=null,this.setBlending(THREE.NoBlending),l(a.__webglObjects,!0,"opaque",b,i,m,!1,d),r(a.__webglObjectsImmediate,"opaque",b,i,m,!1,d),l(a.__webglObjects,!1,"transparent",b,i,m,!0,d),r(a.__webglObjectsImmediate,"transparent",b,i,m,!0,d));p(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;E.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ia):e.render(function(a){E.renderBufferImmediate(a,
-f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)s(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)u(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,c=a.__webglObjects.length;b<c;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&u(h,a),s(h,a));var i=h,k=i.geometry,l=void 0,p=
-void 0,n=void 0;if(k instanceof THREE.BufferGeometry){var r=j.DYNAMIC_DRAW,t=!k.dynamic,x=k.attributes,z=void 0,A=void 0;for(z in x)A=x[z],A.needsUpdate&&("index"===z?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,A.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,A.array,r)):(j.bindBuffer(j.ARRAY_BUFFER,A.buffer),j.bufferData(j.ARRAY_BUFFER,A.array,r)),A.needsUpdate=!1),t&&!A.dynamic&&delete A.array}else if(i instanceof THREE.Mesh){for(var D=0,F=k.geometryGroupsList.length;D<F;D++)if(l=k.geometryGroupsList[D],
-n=e(i,l),k.buffersNeedUpdate&&d(l,i),p=n.attributes&&q(n),k.verticesNeedUpdate||k.morphTargetsNeedUpdate||k.elementsNeedUpdate||k.uvsNeedUpdate||k.normalsNeedUpdate||k.colorsNeedUpdate||k.tangentsNeedUpdate||p){var E=l,J=i,G=j.DYNAMIC_DRAW,I=!k.dynamic,H=n;if(E.__inittedArrays){var K=f(H),L=H.vertexColors?H.vertexColors:!1,M=g(H),N=K===THREE.SmoothShading,C=void 0,B=void 0,O=void 0,Q=void 0,T=void 0,U=void 0,X=void 0,fa=void 0,V=void 0,W=void 0,Y=void 0,R=void 0,S=void 0,P=void 0,da=void 0,ma=void 0,
+!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(Oa.getPositionFromMatrix(g.matrixWorld),Oa.applyProjection(nb),f.z=Oa.z))}this.sortObjects&&h.sort(j);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(F(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),p(a.__webglObjects,!1,"",b,i,m,!0,d),r(a.__webglObjectsImmediate,"",b,i,m,!1,d)):(d=null,this.setBlending(THREE.NoBlending),p(a.__webglObjects,!0,"opaque",b,i,m,!1,d),r(a.__webglObjectsImmediate,"opaque",b,i,m,!1,d),p(a.__webglObjects,!1,"transparent",b,i,m,!0,d),r(a.__webglObjectsImmediate,"transparent",b,i,m,!0,d));l(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&
+(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.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;E.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,Ia):e.render(function(a){E.renderBufferImmediate(a,
+f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)s(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)u(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,c=a.__webglObjects.length;b<c;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&u(h,a),s(h,a));var i=h,j=i.geometry,l=void 0,p=
+void 0,n=void 0;if(j instanceof THREE.BufferGeometry){var r=k.DYNAMIC_DRAW,t=!j.dynamic,x=j.attributes,z=void 0,A=void 0;for(z in x)A=x[z],A.needsUpdate&&("index"===z?(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,A.buffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,A.array,r)):(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,r)),A.needsUpdate=!1),t&&!A.dynamic&&delete A.array}else if(i instanceof THREE.Mesh){for(var D=0,F=j.geometryGroupsList.length;D<F;D++)if(l=j.geometryGroupsList[D],
+n=e(i,l),j.buffersNeedUpdate&&d(l,i),p=n.attributes&&q(n),j.verticesNeedUpdate||j.morphTargetsNeedUpdate||j.elementsNeedUpdate||j.uvsNeedUpdate||j.normalsNeedUpdate||j.colorsNeedUpdate||j.tangentsNeedUpdate||p){var E=l,J=i,G=k.DYNAMIC_DRAW,I=!j.dynamic,H=n;if(E.__inittedArrays){var K=f(H),L=H.vertexColors?H.vertexColors:!1,M=g(H),N=K===THREE.SmoothShading,C=void 0,B=void 0,O=void 0,Q=void 0,T=void 0,U=void 0,X=void 0,fa=void 0,V=void 0,W=void 0,Y=void 0,R=void 0,S=void 0,P=void 0,da=void 0,ma=void 0,
 $=void 0,ca=void 0,Ma=void 0,ga=void 0,ha=void 0,ia=void 0,ib=void 0,na=void 0,ja=void 0,ka=void 0,Ba=void 0,Ua=void 0,pa=void 0,qa=void 0,wa=void 0,ra=void 0,Xa=void 0,ua=void 0,Ia=void 0,va=void 0,Va=void 0,Ka=void 0,Na=void 0,Ra=void 0,ab=void 0,fb=void 0,Za=void 0,$a=void 0,Sa=void 0,Qa=void 0,La=0,Ta=0,Wa=0,Ya=0,xb=0,gb=0,za=0,kb=0,Pa=0,aa=0,la=0,w=0,xa=void 0,bb=E.__vertexArray,jb=E.__uvArray,lb=E.__uv2Array,yb=E.__normalArray,Ea=E.__tangentArray,cb=E.__colorArray,Fa=E.__skinIndexArray,Ga=E.__skinWeightArray,
 tb=E.__morphTargetsArrays,ub=E.__morphNormalsArrays,Bb=E.__webglCustomAttributesList,v=void 0,Fb=E.__faceArray,sb=E.__lineArray,ob=J.geometry,Eb=ob.elementsNeedUpdate,Kb=ob.uvsNeedUpdate,Nb=ob.normalsNeedUpdate,Ob=ob.tangentsNeedUpdate,Pb=ob.colorsNeedUpdate,Tb=ob.morphTargetsNeedUpdate,Wb=ob.vertices,sa=E.faces3,ta=E.faces4,hb=ob.faces,Ub=ob.faceVertexUvs[0],Vb=ob.faceVertexUvs[1],Xb=ob.skinIndices,Qb=ob.skinWeights,Rb=ob.morphTargets,pc=ob.morphNormals;if(ob.verticesNeedUpdate){C=0;for(B=sa.length;C<
-B;C++)Q=hb[sa[C]],R=Wb[Q.a],S=Wb[Q.b],P=Wb[Q.c],bb[Ta]=R.x,bb[Ta+1]=R.y,bb[Ta+2]=R.z,bb[Ta+3]=S.x,bb[Ta+4]=S.y,bb[Ta+5]=S.z,bb[Ta+6]=P.x,bb[Ta+7]=P.y,bb[Ta+8]=P.z,Ta+=9;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],R=Wb[Q.a],S=Wb[Q.b],P=Wb[Q.c],da=Wb[Q.d],bb[Ta]=R.x,bb[Ta+1]=R.y,bb[Ta+2]=R.z,bb[Ta+3]=S.x,bb[Ta+4]=S.y,bb[Ta+5]=S.z,bb[Ta+6]=P.x,bb[Ta+7]=P.y,bb[Ta+8]=P.z,bb[Ta+9]=da.x,bb[Ta+10]=da.y,bb[Ta+11]=da.z,Ta+=12;j.bindBuffer(j.ARRAY_BUFFER,E.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,bb,G)}if(Tb){ab=
+B;C++)Q=hb[sa[C]],R=Wb[Q.a],S=Wb[Q.b],P=Wb[Q.c],bb[Ta]=R.x,bb[Ta+1]=R.y,bb[Ta+2]=R.z,bb[Ta+3]=S.x,bb[Ta+4]=S.y,bb[Ta+5]=S.z,bb[Ta+6]=P.x,bb[Ta+7]=P.y,bb[Ta+8]=P.z,Ta+=9;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],R=Wb[Q.a],S=Wb[Q.b],P=Wb[Q.c],da=Wb[Q.d],bb[Ta]=R.x,bb[Ta+1]=R.y,bb[Ta+2]=R.z,bb[Ta+3]=S.x,bb[Ta+4]=S.y,bb[Ta+5]=S.z,bb[Ta+6]=P.x,bb[Ta+7]=P.y,bb[Ta+8]=P.z,bb[Ta+9]=da.x,bb[Ta+10]=da.y,bb[Ta+11]=da.z,Ta+=12;k.bindBuffer(k.ARRAY_BUFFER,E.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,bb,G)}if(Tb){ab=
 0;for(fb=Rb.length;ab<fb;ab++){C=la=0;for(B=sa.length;C<B;C++)Sa=sa[C],Q=hb[Sa],R=Rb[ab].vertices[Q.a],S=Rb[ab].vertices[Q.b],P=Rb[ab].vertices[Q.c],Za=tb[ab],Za[la]=R.x,Za[la+1]=R.y,Za[la+2]=R.z,Za[la+3]=S.x,Za[la+4]=S.y,Za[la+5]=S.z,Za[la+6]=P.x,Za[la+7]=P.y,Za[la+8]=P.z,H.morphNormals&&(N?(Qa=pc[ab].vertexNormals[Sa],ga=Qa.a,ha=Qa.b,ia=Qa.c):ia=ha=ga=pc[ab].faceNormals[Sa],$a=ub[ab],$a[la]=ga.x,$a[la+1]=ga.y,$a[la+2]=ga.z,$a[la+3]=ha.x,$a[la+4]=ha.y,$a[la+5]=ha.z,$a[la+6]=ia.x,$a[la+7]=ia.y,$a[la+
 8]=ia.z),la+=9;C=0;for(B=ta.length;C<B;C++)Sa=ta[C],Q=hb[Sa],R=Rb[ab].vertices[Q.a],S=Rb[ab].vertices[Q.b],P=Rb[ab].vertices[Q.c],da=Rb[ab].vertices[Q.d],Za=tb[ab],Za[la]=R.x,Za[la+1]=R.y,Za[la+2]=R.z,Za[la+3]=S.x,Za[la+4]=S.y,Za[la+5]=S.z,Za[la+6]=P.x,Za[la+7]=P.y,Za[la+8]=P.z,Za[la+9]=da.x,Za[la+10]=da.y,Za[la+11]=da.z,H.morphNormals&&(N?(Qa=pc[ab].vertexNormals[Sa],ga=Qa.a,ha=Qa.b,ia=Qa.c,ib=Qa.d):ib=ia=ha=ga=pc[ab].faceNormals[Sa],$a=ub[ab],$a[la]=ga.x,$a[la+1]=ga.y,$a[la+2]=ga.z,$a[la+3]=ha.x,
-$a[la+4]=ha.y,$a[la+5]=ha.z,$a[la+6]=ia.x,$a[la+7]=ia.y,$a[la+8]=ia.z,$a[la+9]=ib.x,$a[la+10]=ib.y,$a[la+11]=ib.z),la+=12;j.bindBuffer(j.ARRAY_BUFFER,E.__webglMorphTargetsBuffers[ab]);j.bufferData(j.ARRAY_BUFFER,tb[ab],G);H.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,E.__webglMorphNormalsBuffers[ab]),j.bufferData(j.ARRAY_BUFFER,ub[ab],G))}}if(Qb.length){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],Ua=Qb[Q.a],pa=Qb[Q.b],qa=Qb[Q.c],Ga[aa]=Ua.x,Ga[aa+1]=Ua.y,Ga[aa+2]=Ua.z,Ga[aa+3]=Ua.w,Ga[aa+4]=pa.x,Ga[aa+
+$a[la+4]=ha.y,$a[la+5]=ha.z,$a[la+6]=ia.x,$a[la+7]=ia.y,$a[la+8]=ia.z,$a[la+9]=ib.x,$a[la+10]=ib.y,$a[la+11]=ib.z),la+=12;k.bindBuffer(k.ARRAY_BUFFER,E.__webglMorphTargetsBuffers[ab]);k.bufferData(k.ARRAY_BUFFER,tb[ab],G);H.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,E.__webglMorphNormalsBuffers[ab]),k.bufferData(k.ARRAY_BUFFER,ub[ab],G))}}if(Qb.length){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],Ua=Qb[Q.a],pa=Qb[Q.b],qa=Qb[Q.c],Ga[aa]=Ua.x,Ga[aa+1]=Ua.y,Ga[aa+2]=Ua.z,Ga[aa+3]=Ua.w,Ga[aa+4]=pa.x,Ga[aa+
 5]=pa.y,Ga[aa+6]=pa.z,Ga[aa+7]=pa.w,Ga[aa+8]=qa.x,Ga[aa+9]=qa.y,Ga[aa+10]=qa.z,Ga[aa+11]=qa.w,ra=Xb[Q.a],Xa=Xb[Q.b],ua=Xb[Q.c],Fa[aa]=ra.x,Fa[aa+1]=ra.y,Fa[aa+2]=ra.z,Fa[aa+3]=ra.w,Fa[aa+4]=Xa.x,Fa[aa+5]=Xa.y,Fa[aa+6]=Xa.z,Fa[aa+7]=Xa.w,Fa[aa+8]=ua.x,Fa[aa+9]=ua.y,Fa[aa+10]=ua.z,Fa[aa+11]=ua.w,aa+=12;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],Ua=Qb[Q.a],pa=Qb[Q.b],qa=Qb[Q.c],wa=Qb[Q.d],Ga[aa]=Ua.x,Ga[aa+1]=Ua.y,Ga[aa+2]=Ua.z,Ga[aa+3]=Ua.w,Ga[aa+4]=pa.x,Ga[aa+5]=pa.y,Ga[aa+6]=pa.z,Ga[aa+7]=pa.w,Ga[aa+
-8]=qa.x,Ga[aa+9]=qa.y,Ga[aa+10]=qa.z,Ga[aa+11]=qa.w,Ga[aa+12]=wa.x,Ga[aa+13]=wa.y,Ga[aa+14]=wa.z,Ga[aa+15]=wa.w,ra=Xb[Q.a],Xa=Xb[Q.b],ua=Xb[Q.c],Ia=Xb[Q.d],Fa[aa]=ra.x,Fa[aa+1]=ra.y,Fa[aa+2]=ra.z,Fa[aa+3]=ra.w,Fa[aa+4]=Xa.x,Fa[aa+5]=Xa.y,Fa[aa+6]=Xa.z,Fa[aa+7]=Xa.w,Fa[aa+8]=ua.x,Fa[aa+9]=ua.y,Fa[aa+10]=ua.z,Fa[aa+11]=ua.w,Fa[aa+12]=Ia.x,Fa[aa+13]=Ia.y,Fa[aa+14]=Ia.z,Fa[aa+15]=Ia.w,aa+=16;0<aa&&(j.bindBuffer(j.ARRAY_BUFFER,E.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Fa,G),j.bindBuffer(j.ARRAY_BUFFER,
-E.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Ga,G))}if(Pb&&L){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],X=Q.vertexColors,fa=Q.color,3===X.length&&L===THREE.VertexColors?(na=X[0],ja=X[1],ka=X[2]):ka=ja=na=fa,cb[Pa]=na.r,cb[Pa+1]=na.g,cb[Pa+2]=na.b,cb[Pa+3]=ja.r,cb[Pa+4]=ja.g,cb[Pa+5]=ja.b,cb[Pa+6]=ka.r,cb[Pa+7]=ka.g,cb[Pa+8]=ka.b,Pa+=9;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],X=Q.vertexColors,fa=Q.color,4===X.length&&L===THREE.VertexColors?(na=X[0],ja=X[1],ka=X[2],Ba=X[3]):Ba=ka=ja=na=fa,cb[Pa]=
-na.r,cb[Pa+1]=na.g,cb[Pa+2]=na.b,cb[Pa+3]=ja.r,cb[Pa+4]=ja.g,cb[Pa+5]=ja.b,cb[Pa+6]=ka.r,cb[Pa+7]=ka.g,cb[Pa+8]=ka.b,cb[Pa+9]=Ba.r,cb[Pa+10]=Ba.g,cb[Pa+11]=Ba.b,Pa+=12;0<Pa&&(j.bindBuffer(j.ARRAY_BUFFER,E.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,cb,G))}if(Ob&&ob.hasTangents){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],V=Q.vertexTangents,ma=V[0],$=V[1],ca=V[2],Ea[za]=ma.x,Ea[za+1]=ma.y,Ea[za+2]=ma.z,Ea[za+3]=ma.w,Ea[za+4]=$.x,Ea[za+5]=$.y,Ea[za+6]=$.z,Ea[za+7]=$.w,Ea[za+8]=ca.x,Ea[za+9]=ca.y,Ea[za+
-10]=ca.z,Ea[za+11]=ca.w,za+=12;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],V=Q.vertexTangents,ma=V[0],$=V[1],ca=V[2],Ma=V[3],Ea[za]=ma.x,Ea[za+1]=ma.y,Ea[za+2]=ma.z,Ea[za+3]=ma.w,Ea[za+4]=$.x,Ea[za+5]=$.y,Ea[za+6]=$.z,Ea[za+7]=$.w,Ea[za+8]=ca.x,Ea[za+9]=ca.y,Ea[za+10]=ca.z,Ea[za+11]=ca.w,Ea[za+12]=Ma.x,Ea[za+13]=Ma.y,Ea[za+14]=Ma.z,Ea[za+15]=Ma.w,za+=16;j.bindBuffer(j.ARRAY_BUFFER,E.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ea,G)}if(Nb&&K){C=0;for(B=sa.length;C<B;C++)if(Q=hb[sa[C]],T=Q.vertexNormals,
-U=Q.normal,3===T.length&&N)for(va=0;3>va;va++)Ka=T[va],yb[gb]=Ka.x,yb[gb+1]=Ka.y,yb[gb+2]=Ka.z,gb+=3;else for(va=0;3>va;va++)yb[gb]=U.x,yb[gb+1]=U.y,yb[gb+2]=U.z,gb+=3;C=0;for(B=ta.length;C<B;C++)if(Q=hb[ta[C]],T=Q.vertexNormals,U=Q.normal,4===T.length&&N)for(va=0;4>va;va++)Ka=T[va],yb[gb]=Ka.x,yb[gb+1]=Ka.y,yb[gb+2]=Ka.z,gb+=3;else for(va=0;4>va;va++)yb[gb]=U.x,yb[gb+1]=U.y,yb[gb+2]=U.z,gb+=3;j.bindBuffer(j.ARRAY_BUFFER,E.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,yb,G)}if(Kb&&Ub&&M){C=0;for(B=
-sa.length;C<B;C++)if(O=sa[C],W=Ub[O],void 0!==W)for(va=0;3>va;va++)Na=W[va],jb[Wa]=Na.x,jb[Wa+1]=Na.y,Wa+=2;C=0;for(B=ta.length;C<B;C++)if(O=ta[C],W=Ub[O],void 0!==W)for(va=0;4>va;va++)Na=W[va],jb[Wa]=Na.x,jb[Wa+1]=Na.y,Wa+=2;0<Wa&&(j.bindBuffer(j.ARRAY_BUFFER,E.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,jb,G))}if(Kb&&Vb&&M){C=0;for(B=sa.length;C<B;C++)if(O=sa[C],Y=Vb[O],void 0!==Y)for(va=0;3>va;va++)Ra=Y[va],lb[Ya]=Ra.x,lb[Ya+1]=Ra.y,Ya+=2;C=0;for(B=ta.length;C<B;C++)if(O=ta[C],Y=Vb[O],void 0!==
-Y)for(va=0;4>va;va++)Ra=Y[va],lb[Ya]=Ra.x,lb[Ya+1]=Ra.y,Ya+=2;0<Ya&&(j.bindBuffer(j.ARRAY_BUFFER,E.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,lb,G))}if(Eb){C=0;for(B=sa.length;C<B;C++)Fb[xb]=La,Fb[xb+1]=La+1,Fb[xb+2]=La+2,xb+=3,sb[kb]=La,sb[kb+1]=La+1,sb[kb+2]=La,sb[kb+3]=La+2,sb[kb+4]=La+1,sb[kb+5]=La+2,kb+=6,La+=3;C=0;for(B=ta.length;C<B;C++)Fb[xb]=La,Fb[xb+1]=La+1,Fb[xb+2]=La+3,Fb[xb+3]=La+1,Fb[xb+4]=La+2,Fb[xb+5]=La+3,xb+=6,sb[kb]=La,sb[kb+1]=La+1,sb[kb+2]=La,sb[kb+3]=La+3,sb[kb+4]=La+1,sb[kb+
-5]=La+2,sb[kb+6]=La+2,sb[kb+7]=La+3,kb+=8,La+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,E.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Fb,G);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,E.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,sb,G)}if(Bb){va=0;for(Va=Bb.length;va<Va;va++)if(v=Bb[va],v.__original.needsUpdate){w=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],v.array[w]=v.value[Q.a],v.array[w+1]=v.value[Q.b],v.array[w+2]=v.value[Q.c],
+8]=qa.x,Ga[aa+9]=qa.y,Ga[aa+10]=qa.z,Ga[aa+11]=qa.w,Ga[aa+12]=wa.x,Ga[aa+13]=wa.y,Ga[aa+14]=wa.z,Ga[aa+15]=wa.w,ra=Xb[Q.a],Xa=Xb[Q.b],ua=Xb[Q.c],Ia=Xb[Q.d],Fa[aa]=ra.x,Fa[aa+1]=ra.y,Fa[aa+2]=ra.z,Fa[aa+3]=ra.w,Fa[aa+4]=Xa.x,Fa[aa+5]=Xa.y,Fa[aa+6]=Xa.z,Fa[aa+7]=Xa.w,Fa[aa+8]=ua.x,Fa[aa+9]=ua.y,Fa[aa+10]=ua.z,Fa[aa+11]=ua.w,Fa[aa+12]=Ia.x,Fa[aa+13]=Ia.y,Fa[aa+14]=Ia.z,Fa[aa+15]=Ia.w,aa+=16;0<aa&&(k.bindBuffer(k.ARRAY_BUFFER,E.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,Fa,G),k.bindBuffer(k.ARRAY_BUFFER,
+E.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Ga,G))}if(Pb&&L){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],X=Q.vertexColors,fa=Q.color,3===X.length&&L===THREE.VertexColors?(na=X[0],ja=X[1],ka=X[2]):ka=ja=na=fa,cb[Pa]=na.r,cb[Pa+1]=na.g,cb[Pa+2]=na.b,cb[Pa+3]=ja.r,cb[Pa+4]=ja.g,cb[Pa+5]=ja.b,cb[Pa+6]=ka.r,cb[Pa+7]=ka.g,cb[Pa+8]=ka.b,Pa+=9;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],X=Q.vertexColors,fa=Q.color,4===X.length&&L===THREE.VertexColors?(na=X[0],ja=X[1],ka=X[2],Ba=X[3]):Ba=ka=ja=na=fa,cb[Pa]=
+na.r,cb[Pa+1]=na.g,cb[Pa+2]=na.b,cb[Pa+3]=ja.r,cb[Pa+4]=ja.g,cb[Pa+5]=ja.b,cb[Pa+6]=ka.r,cb[Pa+7]=ka.g,cb[Pa+8]=ka.b,cb[Pa+9]=Ba.r,cb[Pa+10]=Ba.g,cb[Pa+11]=Ba.b,Pa+=12;0<Pa&&(k.bindBuffer(k.ARRAY_BUFFER,E.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,cb,G))}if(Ob&&ob.hasTangents){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],V=Q.vertexTangents,ma=V[0],$=V[1],ca=V[2],Ea[za]=ma.x,Ea[za+1]=ma.y,Ea[za+2]=ma.z,Ea[za+3]=ma.w,Ea[za+4]=$.x,Ea[za+5]=$.y,Ea[za+6]=$.z,Ea[za+7]=$.w,Ea[za+8]=ca.x,Ea[za+9]=ca.y,Ea[za+
+10]=ca.z,Ea[za+11]=ca.w,za+=12;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],V=Q.vertexTangents,ma=V[0],$=V[1],ca=V[2],Ma=V[3],Ea[za]=ma.x,Ea[za+1]=ma.y,Ea[za+2]=ma.z,Ea[za+3]=ma.w,Ea[za+4]=$.x,Ea[za+5]=$.y,Ea[za+6]=$.z,Ea[za+7]=$.w,Ea[za+8]=ca.x,Ea[za+9]=ca.y,Ea[za+10]=ca.z,Ea[za+11]=ca.w,Ea[za+12]=Ma.x,Ea[za+13]=Ma.y,Ea[za+14]=Ma.z,Ea[za+15]=Ma.w,za+=16;k.bindBuffer(k.ARRAY_BUFFER,E.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,Ea,G)}if(Nb&&K){C=0;for(B=sa.length;C<B;C++)if(Q=hb[sa[C]],T=Q.vertexNormals,
+U=Q.normal,3===T.length&&N)for(va=0;3>va;va++)Ka=T[va],yb[gb]=Ka.x,yb[gb+1]=Ka.y,yb[gb+2]=Ka.z,gb+=3;else for(va=0;3>va;va++)yb[gb]=U.x,yb[gb+1]=U.y,yb[gb+2]=U.z,gb+=3;C=0;for(B=ta.length;C<B;C++)if(Q=hb[ta[C]],T=Q.vertexNormals,U=Q.normal,4===T.length&&N)for(va=0;4>va;va++)Ka=T[va],yb[gb]=Ka.x,yb[gb+1]=Ka.y,yb[gb+2]=Ka.z,gb+=3;else for(va=0;4>va;va++)yb[gb]=U.x,yb[gb+1]=U.y,yb[gb+2]=U.z,gb+=3;k.bindBuffer(k.ARRAY_BUFFER,E.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,yb,G)}if(Kb&&Ub&&M){C=0;for(B=
+sa.length;C<B;C++)if(O=sa[C],W=Ub[O],void 0!==W)for(va=0;3>va;va++)Na=W[va],jb[Wa]=Na.x,jb[Wa+1]=Na.y,Wa+=2;C=0;for(B=ta.length;C<B;C++)if(O=ta[C],W=Ub[O],void 0!==W)for(va=0;4>va;va++)Na=W[va],jb[Wa]=Na.x,jb[Wa+1]=Na.y,Wa+=2;0<Wa&&(k.bindBuffer(k.ARRAY_BUFFER,E.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,jb,G))}if(Kb&&Vb&&M){C=0;for(B=sa.length;C<B;C++)if(O=sa[C],Y=Vb[O],void 0!==Y)for(va=0;3>va;va++)Ra=Y[va],lb[Ya]=Ra.x,lb[Ya+1]=Ra.y,Ya+=2;C=0;for(B=ta.length;C<B;C++)if(O=ta[C],Y=Vb[O],void 0!==
+Y)for(va=0;4>va;va++)Ra=Y[va],lb[Ya]=Ra.x,lb[Ya+1]=Ra.y,Ya+=2;0<Ya&&(k.bindBuffer(k.ARRAY_BUFFER,E.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,lb,G))}if(Eb){C=0;for(B=sa.length;C<B;C++)Fb[xb]=La,Fb[xb+1]=La+1,Fb[xb+2]=La+2,xb+=3,sb[kb]=La,sb[kb+1]=La+1,sb[kb+2]=La,sb[kb+3]=La+2,sb[kb+4]=La+1,sb[kb+5]=La+2,kb+=6,La+=3;C=0;for(B=ta.length;C<B;C++)Fb[xb]=La,Fb[xb+1]=La+1,Fb[xb+2]=La+3,Fb[xb+3]=La+1,Fb[xb+4]=La+2,Fb[xb+5]=La+3,xb+=6,sb[kb]=La,sb[kb+1]=La+1,sb[kb+2]=La,sb[kb+3]=La+3,sb[kb+4]=La+1,sb[kb+
+5]=La+2,sb[kb+6]=La+2,sb[kb+7]=La+3,kb+=8,La+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,E.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Fb,G);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,E.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,sb,G)}if(Bb){va=0;for(Va=Bb.length;va<Va;va++)if(v=Bb[va],v.__original.needsUpdate){w=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],v.array[w]=v.value[Q.a],v.array[w+1]=v.value[Q.b],v.array[w+2]=v.value[Q.c],
 w+=3;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],v.array[w]=v.value[Q.a],v.array[w+1]=v.value[Q.b],v.array[w+2]=v.value[Q.c],v.array[w+3]=v.value[Q.d],w+=4}else{if("faces"===v.boundTo){C=0;for(B=sa.length;C<B;C++)xa=v.value[sa[C]],v.array[w]=xa,v.array[w+1]=xa,v.array[w+2]=xa,w+=3;C=0;for(B=ta.length;C<B;C++)xa=v.value[ta[C]],v.array[w]=xa,v.array[w+1]=xa,v.array[w+2]=xa,v.array[w+3]=xa,w+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],R=v.value[Q.a],
 S=v.value[Q.b],P=v.value[Q.c],v.array[w]=R.x,v.array[w+1]=R.y,v.array[w+2]=S.x,v.array[w+3]=S.y,v.array[w+4]=P.x,v.array[w+5]=P.y,w+=6;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],R=v.value[Q.a],S=v.value[Q.b],P=v.value[Q.c],da=v.value[Q.d],v.array[w]=R.x,v.array[w+1]=R.y,v.array[w+2]=S.x,v.array[w+3]=S.y,v.array[w+4]=P.x,v.array[w+5]=P.y,v.array[w+6]=da.x,v.array[w+7]=da.y,w+=8}else{if("faces"===v.boundTo){C=0;for(B=sa.length;C<B;C++)P=S=R=xa=v.value[sa[C]],v.array[w]=R.x,v.array[w+1]=R.y,v.array[w+2]=
 S.x,v.array[w+3]=S.y,v.array[w+4]=P.x,v.array[w+5]=P.y,w+=6;C=0;for(B=ta.length;C<B;C++)da=P=S=R=xa=v.value[ta[C]],v.array[w]=R.x,v.array[w+1]=R.y,v.array[w+2]=S.x,v.array[w+3]=S.y,v.array[w+4]=P.x,v.array[w+5]=P.y,v.array[w+6]=da.x,v.array[w+7]=da.y,w+=8}}else if(3===v.size){var Z;Z="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||"vertices"===v.boundTo){C=0;for(B=sa.length;C<B;C++)Q=hb[sa[C]],R=v.value[Q.a],S=v.value[Q.b],P=v.value[Q.c],v.array[w]=R[Z[0]],v.array[w+1]=R[Z[1]],v.array[w+
@@ -463,72 +462,72 @@ v.array[w+2]=R[Z[2]],v.array[w+3]=S[Z[0]],v.array[w+4]=S[Z[1]],v.array[w+5]=S[Z[
 S.w,v.array[w+8]=P.x,v.array[w+9]=P.y,v.array[w+10]=P.z,v.array[w+11]=P.w,w+=12;C=0;for(B=ta.length;C<B;C++)Q=hb[ta[C]],R=v.value[Q.a],S=v.value[Q.b],P=v.value[Q.c],da=v.value[Q.d],v.array[w]=R.x,v.array[w+1]=R.y,v.array[w+2]=R.z,v.array[w+3]=R.w,v.array[w+4]=S.x,v.array[w+5]=S.y,v.array[w+6]=S.z,v.array[w+7]=S.w,v.array[w+8]=P.x,v.array[w+9]=P.y,v.array[w+10]=P.z,v.array[w+11]=P.w,v.array[w+12]=da.x,v.array[w+13]=da.y,v.array[w+14]=da.z,v.array[w+15]=da.w,w+=16}else if("faces"===v.boundTo){C=0;for(B=
 sa.length;C<B;C++)P=S=R=xa=v.value[sa[C]],v.array[w]=R.x,v.array[w+1]=R.y,v.array[w+2]=R.z,v.array[w+3]=R.w,v.array[w+4]=S.x,v.array[w+5]=S.y,v.array[w+6]=S.z,v.array[w+7]=S.w,v.array[w+8]=P.x,v.array[w+9]=P.y,v.array[w+10]=P.z,v.array[w+11]=P.w,w+=12;C=0;for(B=ta.length;C<B;C++)da=P=S=R=xa=v.value[ta[C]],v.array[w]=R.x,v.array[w+1]=R.y,v.array[w+2]=R.z,v.array[w+3]=R.w,v.array[w+4]=S.x,v.array[w+5]=S.y,v.array[w+6]=S.z,v.array[w+7]=S.w,v.array[w+8]=P.x,v.array[w+9]=P.y,v.array[w+10]=P.z,v.array[w+
 11]=P.w,v.array[w+12]=da.x,v.array[w+13]=da.y,v.array[w+14]=da.z,v.array[w+15]=da.w,w+=16}else if("faceVertices"===v.boundTo){C=0;for(B=sa.length;C<B;C++)xa=v.value[sa[C]],R=xa[0],S=xa[1],P=xa[2],v.array[w]=R.x,v.array[w+1]=R.y,v.array[w+2]=R.z,v.array[w+3]=R.w,v.array[w+4]=S.x,v.array[w+5]=S.y,v.array[w+6]=S.z,v.array[w+7]=S.w,v.array[w+8]=P.x,v.array[w+9]=P.y,v.array[w+10]=P.z,v.array[w+11]=P.w,w+=12;C=0;for(B=ta.length;C<B;C++)xa=v.value[ta[C]],R=xa[0],S=xa[1],P=xa[2],da=xa[3],v.array[w]=R.x,v.array[w+
-1]=R.y,v.array[w+2]=R.z,v.array[w+3]=R.w,v.array[w+4]=S.x,v.array[w+5]=S.y,v.array[w+6]=S.z,v.array[w+7]=S.w,v.array[w+8]=P.x,v.array[w+9]=P.y,v.array[w+10]=P.z,v.array[w+11]=P.w,v.array[w+12]=da.x,v.array[w+13]=da.y,v.array[w+14]=da.z,v.array[w+15]=da.w,w+=16}j.bindBuffer(j.ARRAY_BUFFER,v.buffer);j.bufferData(j.ARRAY_BUFFER,v.array,G)}}I&&(delete E.__inittedArrays,delete E.__colorArray,delete E.__normalArray,delete E.__tangentArray,delete E.__uvArray,delete E.__uv2Array,delete E.__faceArray,delete E.__vertexArray,
-delete E.__lineArray,delete E.__skinIndexArray,delete E.__skinWeightArray)}}k.verticesNeedUpdate=!1;k.morphTargetsNeedUpdate=!1;k.elementsNeedUpdate=!1;k.uvsNeedUpdate=!1;k.normalsNeedUpdate=!1;k.colorsNeedUpdate=!1;k.tangentsNeedUpdate=!1;k.buffersNeedUpdate=!1;n.attributes&&y(n)}else if(i instanceof THREE.Ribbon){n=e(i,k);p=n.attributes&&q(n);if(k.verticesNeedUpdate||k.colorsNeedUpdate||k.normalsNeedUpdate||p){var zb=k,qc=j.DYNAMIC_DRAW,hc=void 0,ic=void 0,jc=void 0,rc=void 0,ya=void 0,sc=void 0,
-tc=void 0,uc=void 0,dc=void 0,db=void 0,ac=void 0,Ca=void 0,pb=void 0,ec=zb.vertices,fc=zb.colors,gc=zb.normals,oc=ec.length,Fc=fc.length,Gc=gc.length,vc=zb.__vertexArray,wc=zb.__colorArray,xc=zb.__normalArray,Hc=zb.colorsNeedUpdate,Ic=zb.normalsNeedUpdate,Pc=zb.__webglCustomAttributesList;if(zb.verticesNeedUpdate){for(hc=0;hc<oc;hc++)rc=ec[hc],ya=3*hc,vc[ya]=rc.x,vc[ya+1]=rc.y,vc[ya+2]=rc.z;j.bindBuffer(j.ARRAY_BUFFER,zb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,vc,qc)}if(Hc){for(ic=0;ic<
-Fc;ic++)sc=fc[ic],ya=3*ic,wc[ya]=sc.r,wc[ya+1]=sc.g,wc[ya+2]=sc.b;j.bindBuffer(j.ARRAY_BUFFER,zb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,wc,qc)}if(Ic){for(jc=0;jc<Gc;jc++)tc=gc[jc],ya=3*jc,xc[ya]=tc.x,xc[ya+1]=tc.y,xc[ya+2]=tc.z;j.bindBuffer(j.ARRAY_BUFFER,zb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,xc,qc)}if(Pc){uc=0;for(dc=Pc.length;uc<dc;uc++)if(Ca=Pc[uc],Ca.needsUpdate&&(void 0===Ca.boundTo||"vertices"===Ca.boundTo)){ya=0;ac=Ca.value.length;if(1===Ca.size)for(db=0;db<ac;db++)Ca.array[db]=
-Ca.value[db];else if(2===Ca.size)for(db=0;db<ac;db++)pb=Ca.value[db],Ca.array[ya]=pb.x,Ca.array[ya+1]=pb.y,ya+=2;else if(3===Ca.size)if("c"===Ca.type)for(db=0;db<ac;db++)pb=Ca.value[db],Ca.array[ya]=pb.r,Ca.array[ya+1]=pb.g,Ca.array[ya+2]=pb.b,ya+=3;else for(db=0;db<ac;db++)pb=Ca.value[db],Ca.array[ya]=pb.x,Ca.array[ya+1]=pb.y,Ca.array[ya+2]=pb.z,ya+=3;else if(4===Ca.size)for(db=0;db<ac;db++)pb=Ca.value[db],Ca.array[ya]=pb.x,Ca.array[ya+1]=pb.y,Ca.array[ya+2]=pb.z,Ca.array[ya+3]=pb.w,ya+=4;j.bindBuffer(j.ARRAY_BUFFER,
-Ca.buffer);j.bufferData(j.ARRAY_BUFFER,Ca.array,qc)}}}k.verticesNeedUpdate=!1;k.colorsNeedUpdate=!1;k.normalsNeedUpdate=!1;n.attributes&&y(n)}else if(i instanceof THREE.Line){n=e(i,k);p=n.attributes&&q(n);if(k.verticesNeedUpdate||k.colorsNeedUpdate||k.lineDistancesNeedUpdate||p){var Ab=k,yc=j.DYNAMIC_DRAW,kc=void 0,lc=void 0,mc=void 0,zc=void 0,Ha=void 0,Ac=void 0,Uc=Ab.vertices,Vc=Ab.colors,Wc=Ab.lineDistances,Jc=Uc.length,Kc=Vc.length,Lc=Wc.length,Bc=Ab.__vertexArray,Cc=Ab.__colorArray,Xc=Ab.__lineDistanceArray,
-Mc=Ab.colorsNeedUpdate,bd=Ab.lineDistancesNeedUpdate,Qc=Ab.__webglCustomAttributesList,Dc=void 0,Yc=void 0,eb=void 0,bc=void 0,qb=void 0,Da=void 0;if(Ab.verticesNeedUpdate){for(kc=0;kc<Jc;kc++)zc=Uc[kc],Ha=3*kc,Bc[Ha]=zc.x,Bc[Ha+1]=zc.y,Bc[Ha+2]=zc.z;j.bindBuffer(j.ARRAY_BUFFER,Ab.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Bc,yc)}if(Mc){for(lc=0;lc<Kc;lc++)Ac=Vc[lc],Ha=3*lc,Cc[Ha]=Ac.r,Cc[Ha+1]=Ac.g,Cc[Ha+2]=Ac.b;j.bindBuffer(j.ARRAY_BUFFER,Ab.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
-Cc,yc)}if(bd){for(mc=0;mc<Lc;mc++)Xc[mc]=Wc[mc];j.bindBuffer(j.ARRAY_BUFFER,Ab.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Xc,yc)}if(Qc){Dc=0;for(Yc=Qc.length;Dc<Yc;Dc++)if(Da=Qc[Dc],Da.needsUpdate&&(void 0===Da.boundTo||"vertices"===Da.boundTo)){Ha=0;bc=Da.value.length;if(1===Da.size)for(eb=0;eb<bc;eb++)Da.array[eb]=Da.value[eb];else if(2===Da.size)for(eb=0;eb<bc;eb++)qb=Da.value[eb],Da.array[Ha]=qb.x,Da.array[Ha+1]=qb.y,Ha+=2;else if(3===Da.size)if("c"===Da.type)for(eb=0;eb<bc;eb++)qb=
-Da.value[eb],Da.array[Ha]=qb.r,Da.array[Ha+1]=qb.g,Da.array[Ha+2]=qb.b,Ha+=3;else for(eb=0;eb<bc;eb++)qb=Da.value[eb],Da.array[Ha]=qb.x,Da.array[Ha+1]=qb.y,Da.array[Ha+2]=qb.z,Ha+=3;else if(4===Da.size)for(eb=0;eb<bc;eb++)qb=Da.value[eb],Da.array[Ha]=qb.x,Da.array[Ha+1]=qb.y,Da.array[Ha+2]=qb.z,Da.array[Ha+3]=qb.w,Ha+=4;j.bindBuffer(j.ARRAY_BUFFER,Da.buffer);j.bufferData(j.ARRAY_BUFFER,Da.array,yc)}}}k.verticesNeedUpdate=!1;k.colorsNeedUpdate=!1;k.lineDistancesNeedUpdate=!1;n.attributes&&y(n)}else if(i instanceof
-THREE.ParticleSystem){n=e(i,k);p=n.attributes&&q(n);if(k.verticesNeedUpdate||k.colorsNeedUpdate||i.sortParticles||p){var Gb=k,Rc=j.DYNAMIC_DRAW,nc=i,rb=void 0,Hb=void 0,Ib=void 0,ea=void 0,Jb=void 0,Sb=void 0,Ec=Gb.vertices,Sc=Ec.length,Tc=Gb.colors,Zc=Tc.length,Yb=Gb.__vertexArray,Zb=Gb.__colorArray,Lb=Gb.__sortArray,$c=Gb.verticesNeedUpdate,ad=Gb.colorsNeedUpdate,Mb=Gb.__webglCustomAttributesList,Cb=void 0,cc=void 0,oa=void 0,Db=void 0,Aa=void 0,ba=void 0;if(nc.sortParticles){$b.copy(nb);$b.multiply(nc.matrixWorld);
+1]=R.y,v.array[w+2]=R.z,v.array[w+3]=R.w,v.array[w+4]=S.x,v.array[w+5]=S.y,v.array[w+6]=S.z,v.array[w+7]=S.w,v.array[w+8]=P.x,v.array[w+9]=P.y,v.array[w+10]=P.z,v.array[w+11]=P.w,v.array[w+12]=da.x,v.array[w+13]=da.y,v.array[w+14]=da.z,v.array[w+15]=da.w,w+=16}k.bindBuffer(k.ARRAY_BUFFER,v.buffer);k.bufferData(k.ARRAY_BUFFER,v.array,G)}}I&&(delete E.__inittedArrays,delete E.__colorArray,delete E.__normalArray,delete E.__tangentArray,delete E.__uvArray,delete E.__uv2Array,delete E.__faceArray,delete E.__vertexArray,
+delete E.__lineArray,delete E.__skinIndexArray,delete E.__skinWeightArray)}}j.verticesNeedUpdate=!1;j.morphTargetsNeedUpdate=!1;j.elementsNeedUpdate=!1;j.uvsNeedUpdate=!1;j.normalsNeedUpdate=!1;j.colorsNeedUpdate=!1;j.tangentsNeedUpdate=!1;j.buffersNeedUpdate=!1;n.attributes&&y(n)}else if(i instanceof THREE.Ribbon){n=e(i,j);p=n.attributes&&q(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.normalsNeedUpdate||p){var zb=j,qc=k.DYNAMIC_DRAW,hc=void 0,ic=void 0,jc=void 0,rc=void 0,ya=void 0,sc=void 0,
+tc=void 0,uc=void 0,dc=void 0,db=void 0,ac=void 0,Ca=void 0,pb=void 0,ec=zb.vertices,fc=zb.colors,gc=zb.normals,oc=ec.length,Fc=fc.length,Gc=gc.length,vc=zb.__vertexArray,wc=zb.__colorArray,xc=zb.__normalArray,Hc=zb.colorsNeedUpdate,Ic=zb.normalsNeedUpdate,Pc=zb.__webglCustomAttributesList;if(zb.verticesNeedUpdate){for(hc=0;hc<oc;hc++)rc=ec[hc],ya=3*hc,vc[ya]=rc.x,vc[ya+1]=rc.y,vc[ya+2]=rc.z;k.bindBuffer(k.ARRAY_BUFFER,zb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,vc,qc)}if(Hc){for(ic=0;ic<
+Fc;ic++)sc=fc[ic],ya=3*ic,wc[ya]=sc.r,wc[ya+1]=sc.g,wc[ya+2]=sc.b;k.bindBuffer(k.ARRAY_BUFFER,zb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,wc,qc)}if(Ic){for(jc=0;jc<Gc;jc++)tc=gc[jc],ya=3*jc,xc[ya]=tc.x,xc[ya+1]=tc.y,xc[ya+2]=tc.z;k.bindBuffer(k.ARRAY_BUFFER,zb.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,xc,qc)}if(Pc){uc=0;for(dc=Pc.length;uc<dc;uc++)if(Ca=Pc[uc],Ca.needsUpdate&&(void 0===Ca.boundTo||"vertices"===Ca.boundTo)){ya=0;ac=Ca.value.length;if(1===Ca.size)for(db=0;db<ac;db++)Ca.array[db]=
+Ca.value[db];else if(2===Ca.size)for(db=0;db<ac;db++)pb=Ca.value[db],Ca.array[ya]=pb.x,Ca.array[ya+1]=pb.y,ya+=2;else if(3===Ca.size)if("c"===Ca.type)for(db=0;db<ac;db++)pb=Ca.value[db],Ca.array[ya]=pb.r,Ca.array[ya+1]=pb.g,Ca.array[ya+2]=pb.b,ya+=3;else for(db=0;db<ac;db++)pb=Ca.value[db],Ca.array[ya]=pb.x,Ca.array[ya+1]=pb.y,Ca.array[ya+2]=pb.z,ya+=3;else if(4===Ca.size)for(db=0;db<ac;db++)pb=Ca.value[db],Ca.array[ya]=pb.x,Ca.array[ya+1]=pb.y,Ca.array[ya+2]=pb.z,Ca.array[ya+3]=pb.w,ya+=4;k.bindBuffer(k.ARRAY_BUFFER,
+Ca.buffer);k.bufferData(k.ARRAY_BUFFER,Ca.array,qc)}}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;j.normalsNeedUpdate=!1;n.attributes&&y(n)}else if(i instanceof THREE.Line){n=e(i,j);p=n.attributes&&q(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.lineDistancesNeedUpdate||p){var Ab=j,yc=k.DYNAMIC_DRAW,kc=void 0,lc=void 0,mc=void 0,zc=void 0,Ha=void 0,Ac=void 0,Uc=Ab.vertices,Vc=Ab.colors,Wc=Ab.lineDistances,Jc=Uc.length,Kc=Vc.length,Lc=Wc.length,Bc=Ab.__vertexArray,Cc=Ab.__colorArray,Xc=Ab.__lineDistanceArray,
+Mc=Ab.colorsNeedUpdate,bd=Ab.lineDistancesNeedUpdate,Qc=Ab.__webglCustomAttributesList,Dc=void 0,Yc=void 0,eb=void 0,bc=void 0,qb=void 0,Da=void 0;if(Ab.verticesNeedUpdate){for(kc=0;kc<Jc;kc++)zc=Uc[kc],Ha=3*kc,Bc[Ha]=zc.x,Bc[Ha+1]=zc.y,Bc[Ha+2]=zc.z;k.bindBuffer(k.ARRAY_BUFFER,Ab.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Bc,yc)}if(Mc){for(lc=0;lc<Kc;lc++)Ac=Vc[lc],Ha=3*lc,Cc[Ha]=Ac.r,Cc[Ha+1]=Ac.g,Cc[Ha+2]=Ac.b;k.bindBuffer(k.ARRAY_BUFFER,Ab.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
+Cc,yc)}if(bd){for(mc=0;mc<Lc;mc++)Xc[mc]=Wc[mc];k.bindBuffer(k.ARRAY_BUFFER,Ab.__webglLineDistanceBuffer);k.bufferData(k.ARRAY_BUFFER,Xc,yc)}if(Qc){Dc=0;for(Yc=Qc.length;Dc<Yc;Dc++)if(Da=Qc[Dc],Da.needsUpdate&&(void 0===Da.boundTo||"vertices"===Da.boundTo)){Ha=0;bc=Da.value.length;if(1===Da.size)for(eb=0;eb<bc;eb++)Da.array[eb]=Da.value[eb];else if(2===Da.size)for(eb=0;eb<bc;eb++)qb=Da.value[eb],Da.array[Ha]=qb.x,Da.array[Ha+1]=qb.y,Ha+=2;else if(3===Da.size)if("c"===Da.type)for(eb=0;eb<bc;eb++)qb=
+Da.value[eb],Da.array[Ha]=qb.r,Da.array[Ha+1]=qb.g,Da.array[Ha+2]=qb.b,Ha+=3;else for(eb=0;eb<bc;eb++)qb=Da.value[eb],Da.array[Ha]=qb.x,Da.array[Ha+1]=qb.y,Da.array[Ha+2]=qb.z,Ha+=3;else if(4===Da.size)for(eb=0;eb<bc;eb++)qb=Da.value[eb],Da.array[Ha]=qb.x,Da.array[Ha+1]=qb.y,Da.array[Ha+2]=qb.z,Da.array[Ha+3]=qb.w,Ha+=4;k.bindBuffer(k.ARRAY_BUFFER,Da.buffer);k.bufferData(k.ARRAY_BUFFER,Da.array,yc)}}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;j.lineDistancesNeedUpdate=!1;n.attributes&&y(n)}else if(i instanceof
+THREE.ParticleSystem){n=e(i,j);p=n.attributes&&q(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||i.sortParticles||p){var Gb=j,Rc=k.DYNAMIC_DRAW,nc=i,rb=void 0,Hb=void 0,Ib=void 0,ea=void 0,Jb=void 0,Sb=void 0,Ec=Gb.vertices,Sc=Ec.length,Tc=Gb.colors,Zc=Tc.length,Yb=Gb.__vertexArray,Zb=Gb.__colorArray,Lb=Gb.__sortArray,$c=Gb.verticesNeedUpdate,ad=Gb.colorsNeedUpdate,Mb=Gb.__webglCustomAttributesList,Cb=void 0,cc=void 0,oa=void 0,Db=void 0,Aa=void 0,ba=void 0;if(nc.sortParticles){$b.copy(nb);$b.multiply(nc.matrixWorld);
 for(rb=0;rb<Sc;rb++)Ib=Ec[rb],Oa.copy(Ib),Oa.applyProjection($b),Lb[rb]=[Oa.z,rb];Lb.sort(m);for(rb=0;rb<Sc;rb++)Ib=Ec[Lb[rb][1]],ea=3*rb,Yb[ea]=Ib.x,Yb[ea+1]=Ib.y,Yb[ea+2]=Ib.z;for(Hb=0;Hb<Zc;Hb++)ea=3*Hb,Sb=Tc[Lb[Hb][1]],Zb[ea]=Sb.r,Zb[ea+1]=Sb.g,Zb[ea+2]=Sb.b;if(Mb){Cb=0;for(cc=Mb.length;Cb<cc;Cb++)if(ba=Mb[Cb],void 0===ba.boundTo||"vertices"===ba.boundTo)if(ea=0,Db=ba.value.length,1===ba.size)for(oa=0;oa<Db;oa++)Jb=Lb[oa][1],ba.array[oa]=ba.value[Jb];else if(2===ba.size)for(oa=0;oa<Db;oa++)Jb=
 Lb[oa][1],Aa=ba.value[Jb],ba.array[ea]=Aa.x,ba.array[ea+1]=Aa.y,ea+=2;else if(3===ba.size)if("c"===ba.type)for(oa=0;oa<Db;oa++)Jb=Lb[oa][1],Aa=ba.value[Jb],ba.array[ea]=Aa.r,ba.array[ea+1]=Aa.g,ba.array[ea+2]=Aa.b,ea+=3;else for(oa=0;oa<Db;oa++)Jb=Lb[oa][1],Aa=ba.value[Jb],ba.array[ea]=Aa.x,ba.array[ea+1]=Aa.y,ba.array[ea+2]=Aa.z,ea+=3;else if(4===ba.size)for(oa=0;oa<Db;oa++)Jb=Lb[oa][1],Aa=ba.value[Jb],ba.array[ea]=Aa.x,ba.array[ea+1]=Aa.y,ba.array[ea+2]=Aa.z,ba.array[ea+3]=Aa.w,ea+=4}}else{if($c)for(rb=
 0;rb<Sc;rb++)Ib=Ec[rb],ea=3*rb,Yb[ea]=Ib.x,Yb[ea+1]=Ib.y,Yb[ea+2]=Ib.z;if(ad)for(Hb=0;Hb<Zc;Hb++)Sb=Tc[Hb],ea=3*Hb,Zb[ea]=Sb.r,Zb[ea+1]=Sb.g,Zb[ea+2]=Sb.b;if(Mb){Cb=0;for(cc=Mb.length;Cb<cc;Cb++)if(ba=Mb[Cb],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo))if(Db=ba.value.length,ea=0,1===ba.size)for(oa=0;oa<Db;oa++)ba.array[oa]=ba.value[oa];else if(2===ba.size)for(oa=0;oa<Db;oa++)Aa=ba.value[oa],ba.array[ea]=Aa.x,ba.array[ea+1]=Aa.y,ea+=2;else if(3===ba.size)if("c"===ba.type)for(oa=0;oa<
-Db;oa++)Aa=ba.value[oa],ba.array[ea]=Aa.r,ba.array[ea+1]=Aa.g,ba.array[ea+2]=Aa.b,ea+=3;else for(oa=0;oa<Db;oa++)Aa=ba.value[oa],ba.array[ea]=Aa.x,ba.array[ea+1]=Aa.y,ba.array[ea+2]=Aa.z,ea+=3;else if(4===ba.size)for(oa=0;oa<Db;oa++)Aa=ba.value[oa],ba.array[ea]=Aa.x,ba.array[ea+1]=Aa.y,ba.array[ea+2]=Aa.z,ba.array[ea+3]=Aa.w,ea+=4}}if($c||nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,Yb,Rc);if(ad||nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglColorBuffer),
-j.bufferData(j.ARRAY_BUFFER,Zb,Rc);if(Mb){Cb=0;for(cc=Mb.length;Cb<cc;Cb++)if(ba=Mb[Cb],ba.needsUpdate||nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ba.buffer),j.bufferData(j.ARRAY_BUFFER,ba.array,Rc)}}k.verticesNeedUpdate=!1;k.colorsNeedUpdate=!1;n.attributes&&y(n)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",oc);var i,k,l,m,p;a instanceof THREE.MeshDepthMaterial?p="depth":a instanceof THREE.MeshNormalMaterial?p="normal":a instanceof THREE.MeshBasicMaterial?p="basic":
+Db;oa++)Aa=ba.value[oa],ba.array[ea]=Aa.r,ba.array[ea+1]=Aa.g,ba.array[ea+2]=Aa.b,ea+=3;else for(oa=0;oa<Db;oa++)Aa=ba.value[oa],ba.array[ea]=Aa.x,ba.array[ea+1]=Aa.y,ba.array[ea+2]=Aa.z,ea+=3;else if(4===ba.size)for(oa=0;oa<Db;oa++)Aa=ba.value[oa],ba.array[ea]=Aa.x,ba.array[ea+1]=Aa.y,ba.array[ea+2]=Aa.z,ba.array[ea+3]=Aa.w,ea+=4}}if($c||nc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Gb.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,Yb,Rc);if(ad||nc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Gb.__webglColorBuffer),
+k.bufferData(k.ARRAY_BUFFER,Zb,Rc);if(Mb){Cb=0;for(cc=Mb.length;Cb<cc;Cb++)if(ba=Mb[Cb],ba.needsUpdate||nc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,ba.buffer),k.bufferData(k.ARRAY_BUFFER,ba.array,Rc)}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;n.attributes&&y(n)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",oc);var i,j,l,m,p;a instanceof THREE.MeshDepthMaterial?p="depth":a instanceof THREE.MeshNormalMaterial?p="normal":a instanceof THREE.MeshBasicMaterial?p="basic":
 a instanceof THREE.MeshLambertMaterial?p="lambert":a instanceof THREE.MeshPhongMaterial?p="phong":a instanceof THREE.LineBasicMaterial?p="basic":a instanceof THREE.LineDashedMaterial?p="dashed":a instanceof THREE.ParticleBasicMaterial&&(p="particle_basic");if(p){var n=THREE.ShaderLib[p];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var q,r,s;e=g=r=s=n=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&&n++);e=g;f=r;g=s;h=n;n=q=0;for(s=b.length;n<s;n++)r=b[n],r.castShadow&&(r instanceof THREE.SpotLight&&q++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&q++);m=q;Ub&&d&&d.useVertexTexture?l=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 - "+
+g++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&n++);e=g;f=r;g=s;h=n;n=q=0;for(s=b.length;n<s;n++)r=b[n],r.castShadow&&(r instanceof THREE.SpotLight&&q++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&q++);m=q;Ub&&d&&d.useVertexTexture?l=1024:(b=k.getParameter(k.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)")),l=b);a:{s=a.fragmentShader;r=a.vertexShader;n=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:l,useVertexTexture:Ub&&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:h,maxShadows:m,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,x,u,d=[];p?d.push(p):(d.push(s),d.push(r));for(x in q)d.push(x),d.push(q[x]);for(t in c)d.push(t),d.push(c[t]);p=d.join();t=0;for(x=Ma.length;t<x;t++)if(d=Ma[t],d.code===p){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");x=[];for(u in q)d=q[u],!1!==d&&(d="#define "+u+" "+d,x.push(d));
-d=x.join("\n");u=j.createProgram();x=["precision "+$+" float;",d,Vb?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
+doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,x,u,d=[];p?d.push(p):(d.push(s),d.push(r));for(x in q)d.push(x),d.push(q[x]);for(t in c)d.push(t),d.push(c[t]);p=d.join();t=0;for(x=Ma.length;t<x;t++)if(d=Ma[t],d.code===p){d.usedTimes++;j=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");x=[];for(u in q)d=q[u],!1!==d&&(d="#define "+u+" "+d,x.push(d));
+d=x.join("\n");u=k.createProgram();x=["precision "+$+" float;",d,Vb?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_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 "+$+" 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:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
 c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.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");x=A("vertex",x+r);t=A("fragment",t+s);j.attachShader(u,x);j.attachShader(u,t);j.linkProgram(u);j.getProgramParameter(u,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(u,j.VALIDATE_STATUS)+", gl error ["+
-j.getError()+"]");j.deleteShader(t);j.deleteShader(x);u.uniforms={};u.attributes={};var y;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(y in n)t.push(y);y=t;t=0;for(x=y.length;t<x;t++)n=y[t],u.uniforms[n]=j.getUniformLocation(u,n);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(y=0;y<c.maxMorphTargets;y++)t.push("morphTarget"+
-y);for(y=0;y<c.maxMorphNormals;y++)t.push("morphNormal"+y);for(k in b)t.push(k);k=t;y=0;for(b=k.length;y<b;y++)t=k[y],u.attributes[t]=j.getAttribLocation(u,t);u.id=ib++;Ma.push({program:u,code:p,usedTimes:1});E.info.memory.programs=Ma.length;k=u}a.program=k;y=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)u=b+k,0<=y[u]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)u=
-b+k,0<=y[u]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};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;Y!==
-b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Y=b);ia!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),ia=a)};this.setDepthTest=function(a){pa!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),pa=a)};this.setDepthWrite=function(a){Na!==a&&(j.depthMask(a),Na=a)};this.setBlending=function(a,b,c,d){a!==ha&&(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)),ha=a);if(a===THREE.CustomBlending){if(b!==na&&(j.blendEquation(M(b)),na=b),c!==Ka||d!==Ya)j.blendFunc(M(c),M(d)),Ka=c,Ya=d}else Ya=
-Ka=na=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",O),a.__webglTexture=j.createTexture(),E.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=M(a.format),
-f=M(a.type);U(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,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){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,
-h,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",W);a.__webglTexture=
-j.createTexture();E.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=M(a.format),e=M(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);U(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,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
-a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);G(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),U(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):G(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=Ob,a=Pb,d=Kb,e=Nb);b!==Xa&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Xa=b);Tb=c;tb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=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:
+"",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");x=A("vertex",x+r);t=A("fragment",t+s);k.attachShader(u,x);k.attachShader(u,t);k.linkProgram(u);k.getProgramParameter(u,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(u,k.VALIDATE_STATUS)+", gl error ["+
+k.getError()+"]");k.deleteShader(t);k.deleteShader(x);u.uniforms={};u.attributes={};var y;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(y in n)t.push(y);y=t;t=0;for(x=y.length;t<x;t++)n=y[t],u.uniforms[n]=k.getUniformLocation(u,n);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(y=0;y<c.maxMorphTargets;y++)t.push("morphTarget"+
+y);for(y=0;y<c.maxMorphNormals;y++)t.push("morphNormal"+y);for(j in b)t.push(j);j=t;y=0;for(b=j.length;y<b;y++)t=j[y],u.attributes[t]=k.getAttribLocation(u,t);u.id=ib++;Ma.push({program:u,code:p,usedTimes:1});E.info.memory.programs=Ma.length;j=u}a.program=j;y=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(j=0;j<this.maxMorphTargets;j++)u=b+j,0<=y[u]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(j=0;j<this.maxMorphNormals;j++)u=
+b+j,0<=y[u]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?k.disable(k.CULL_FACE):(b===THREE.FrontFaceDirectionCW?k.frontFace(k.CW):k.frontFace(k.CCW),a===THREE.CullFaceBack?k.cullFace(k.BACK):a===THREE.CullFaceFront?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;Y!==
+b&&(b?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),Y=b);ia!==a&&(a?k.frontFace(k.CW):k.frontFace(k.CCW),ia=a)};this.setDepthTest=function(a){pa!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),pa=a)};this.setDepthWrite=function(a){Na!==a&&(k.depthMask(a),Na=a)};this.setBlending=function(a,b,c,d){a!==ha&&(a===THREE.NoBlending?k.disable(k.BLEND):a===THREE.AdditiveBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.SRC_ALPHA,k.ONE)):a===THREE.SubtractiveBlending?(k.enable(k.BLEND),
+k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.SRC_COLOR)):a===THREE.CustomBlending?k.enable(k.BLEND):(k.enable(k.BLEND),k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)),ha=a);if(a===THREE.CustomBlending){if(b!==na&&(k.blendEquation(M(b)),na=b),c!==Ka||d!==Ya)k.blendFunc(M(c),M(d)),Ka=c,Ya=d}else Ya=
+Ka=na=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",O),a.__webglTexture=k.createTexture(),E.info.memory.textures++);k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);k.pixelStorei(k.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=M(a.format),
+f=M(a.type);U(k.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],k.texImage2D(k.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],k.compressedTexImage2D(k.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],k.texImage2D(k.TEXTURE_2D,
+h,e,e,f,c);a.generateMipmaps=!1}else k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",W);a.__webglTexture=
+k.createTexture();E.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=M(a.format),e=M(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);U(k.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,
+a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);G(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=k.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),U(k.TEXTURE_2D,a,c),k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),
+k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):G(a.__webglRenderbuffer,a),c&&k.generateMipmap(k.TEXTURE_2D);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,
+null);k.bindFramebuffer(k.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Ob,a=Pb,d=Kb,e=Nb);b!==Xa&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),Xa=b);Tb=c;tb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=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={constructor:THREE.WebGLRenderTarget,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},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.extend(THREE.WebGLRenderTarget.prototype,THREE.EventDispatcher.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.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.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,i=g.vertices,k=a.faces,m=g.faces,a=a.faceVertexUvs[0],g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=new THREE.Matrix3,e.getInverse(d),e.transpose());for(var b=0,p=i.length;b<p;b++){var l=i[b].clone();d&&l.applyMatrix4(d);h.push(l)}b=0;for(p=m.length;b<p;b++){var l=m[b],r,s,n=l.vertexNormals,q=l.vertexColors;
-l instanceof THREE.Face3?r=new THREE.Face3(l.a+f,l.b+f,l.c+f):l instanceof THREE.Face4&&(r=new THREE.Face4(l.a+f,l.b+f,l.c+f,l.d+f));r.normal.copy(l.normal);e&&r.normal.applyMatrix3(e).normalize();h=0;for(i=n.length;h<i;h++)s=n[h].clone(),e&&s.applyMatrix3(e).normalize(),r.vertexNormals.push(s);r.color.copy(l.color);h=0;for(i=q.length;h<i;h++)s=q[h],r.vertexColors.push(s.clone());r.materialIndex=l.materialIndex+c;r.centroid.copy(l.centroid);d&&r.centroid.applyMatrix4(d);k.push(r)}b=0;for(p=g.length;b<
-p;b++){c=g[b];d=[];h=0;for(i=c.length;h<i;h++)d.push(new THREE.Vector2(c[h].x,c[h].y));a.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);
+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.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,i=g.vertices,j=a.faces,m=g.faces,a=a.faceVertexUvs[0],g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=new THREE.Matrix3,e.getInverse(d),e.transpose());for(var b=0,l=i.length;b<l;b++){var p=i[b].clone();d&&p.applyMatrix4(d);h.push(p)}b=0;for(l=m.length;b<l;b++){var p=m[b],r,s,n=p.vertexNormals,q=p.vertexColors;
+p instanceof THREE.Face3?r=new THREE.Face3(p.a+f,p.b+f,p.c+f):p instanceof THREE.Face4&&(r=new THREE.Face4(p.a+f,p.b+f,p.c+f,p.d+f));r.normal.copy(p.normal);e&&r.normal.applyMatrix3(e).normalize();h=0;for(i=n.length;h<i;h++)s=n[h].clone(),e&&s.applyMatrix3(e).normalize(),r.vertexNormals.push(s);r.color.copy(p.color);h=0;for(i=q.length;h<i;h++)s=q[h],r.vertexColors.push(s.clone());r.materialIndex=p.materialIndex+c;r.centroid.copy(p.centroid);d&&r.centroid.applyMatrix4(d);j.push(r)}b=0;for(l=g.length;b<
+l;b++){c=g[b];d=[];h=0;for(i=c.length;h<i;h++)d.push(new THREE.Vector2(c[h].x,c[h].y));a.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=[],m,p,l,r;for(e=0;e<h;e++)d=f[e],
-d instanceof THREE.Face3?(m=g[d.a],p=g[d.b],l=g[d.c],d._area=THREE.GeometryUtils.triangleArea(m,p,l)):d instanceof THREE.Face4&&(m=g[d.a],p=g[d.b],l=g[d.c],r=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(m,p,r),d._area2=THREE.GeometryUtils.triangleArea(p,l,r),d._area=d._area1+d._area2),i+=d._area,k[e]=i;d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d=THREE.GeometryUtils.__v1,e=THREE.GeometryUtils.__v2;
+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 j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],m,l,p,r;for(e=0;e<h;e++)d=f[e],
+d instanceof THREE.Face3?(m=g[d.a],l=g[d.b],p=g[d.c],d._area=THREE.GeometryUtils.triangleArea(m,l,p)):d instanceof THREE.Face4&&(m=g[d.a],l=g[d.b],p=g[d.c],r=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(m,l,r),d._area2=THREE.GeometryUtils.triangleArea(l,p,r),d._area=d._area1+d._area2),i+=d._area,j[e]=i;d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d=THREE.GeometryUtils.__v1,e=THREE.GeometryUtils.__v2;
 d.subVectors(b,a);e.subVectors(c,a);d.cross(e);return 0.5*d.length()},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].x&&(d[e].x-=Math.floor(d[e].x)),1!==d[e].y&&(d[e].y-=Math.floor(d[e].y))},triangulateQuads:function(a){var b,
-c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,k=d.c,m=d.d,p=new THREE.Face3,l=new THREE.Face3;p.color.copy(d.color);l.color.copy(d.color);p.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;p.a=e;p.b=i;p.c=m;l.a=i;l.b=k;l.c=m;4===d.vertexColors.length&&(p.vertexColors[0]=d.vertexColors[0].clone(),p.vertexColors[1]=d.vertexColors[1].clone(),
-p.vertexColors[2]=d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());f.push(p,l);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(p=a.faceVertexUvs[d][b],i=p[1],k=p[2],m=p[3],p=[p[0].clone(),i.clone(),m.clone()],i=[i.clone(),k.clone(),m.clone()],h[d].push(p,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=
+c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,m=d.d,l=new THREE.Face3,p=new THREE.Face3;l.color.copy(d.color);p.color.copy(d.color);l.materialIndex=d.materialIndex;p.materialIndex=d.materialIndex;l.a=e;l.b=i;l.c=m;p.a=i;p.b=j;p.c=m;4===d.vertexColors.length&&(l.vertexColors[0]=d.vertexColors[0].clone(),l.vertexColors[1]=d.vertexColors[1].clone(),
+l.vertexColors[2]=d.vertexColors[3].clone(),p.vertexColors[0]=d.vertexColors[1].clone(),p.vertexColors[1]=d.vertexColors[2].clone(),p.vertexColors[2]=d.vertexColors[3].clone());f.push(l,p);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(l=a.faceVertexUvs[d][b],i=l[1],j=l[2],m=l[3],l=[l[0].clone(),i.clone(),m.clone()],i=[i.clone(),j.clone(),m.clone()],h[d].push(l,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=
 a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;THREE.GeometryUtils.__v2=new THREE.Vector3;THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
 !0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=!0,c&&c(f))};h.onerror=d;h.crossOrigin=
 this.crossOrigin;h.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var g=0,h=a.length;g<h;++g){var i={};
-e[g]=i;var k=new XMLHttpRequest;k.onload=b(k,i);k.onerror=d;i=a[g];k.open("GET",i,!0);k.responseType="arraybuffer";k.send(null)}else k=new XMLHttpRequest,k.onload=function(){var a=THREE.ImageUtils.parseDDS(k.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},k.onerror=
-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"),
+e[g]=i;var j=new XMLHttpRequest;j.onload=b(j,i);j.onerror=d;i=a[g];j.open("GET",i,!0);j.responseType="arraybuffer";j.send(null)}else j=new XMLHttpRequest,j.onload=function(){var a=THREE.ImageUtils.parseDDS(j.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},j.onerror=
+d,j.open("GET",a,!0),j.responseType="arraybuffer",j.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 m=0;m<d.mipmapCount;m++){var p=Math.max(4,f)/4*Math.max(4,g)/4*e,l={data:new Uint8Array(a,h,p),width:f,height:g};d.mipmaps.push(l);h+=p;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,m=0;m<d;m++)for(var p=0;p<e;p++){var l=0>p-1?0:p-1,r=p+1>e-1?e-1:p+1,s=0>m-1?0:m-1,n=m+1>d-1?d-1:m+1,q=[],y=[0,0,h[4*(p*d+m)]/255*b];q.push([-1,0,h[4*(p*d+s)]/255*b]);q.push([-1,-1,h[4*(l*d+s)]/255*b]);q.push([0,-1,h[4*(l*d+m)]/255*b]);q.push([1,-1,h[4*(l*d+n)]/255*b]);q.push([1,0,h[4*(p*d+n)]/255*b]);q.push([1,1,h[4*(r*d+n)]/255*b]);q.push([0,1,h[4*(r*d+m)]/255*b]);q.push([-1,1,h[4*(r*d+s)]/255*b]);l=[];s=q.length;for(r=0;r<s;r++){var n=q[r],u=q[(r+1)%
-s],n=[n[0]-y[0],n[1]-y[1],n[2]-y[2]],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]];l.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}q=[0,0,0];for(r=0;r<l.length;r++)q[0]+=l[r][0],q[1]+=l[r][1],q[2]+=l[r][2];q[0]/=l.length;q[1]/=l.length;q[2]/=l.length;y=4*(p*d+m);k[y]=255*((q[0]+1)/2)|0;k[y+1]=255*((q[1]+1)/2)|0;k[y+2]=255*q[2]|0;k[y+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),
+6:1,j=0;j<i;j++){for(var m=0;m<d.mipmapCount;m++){var l=Math.max(4,f)/4*Math.max(4,g)/4*e,p={data:new Uint8Array(a,h,l),width:f,height:g};d.mipmaps.push(p);h+=l;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),j=i.data,m=0;m<d;m++)for(var l=0;l<e;l++){var p=0>l-1?0:l-1,r=l+1>e-1?e-1:l+1,s=0>m-1?0:m-1,n=m+1>d-1?d-1:m+1,q=[],y=[0,0,h[4*(l*d+m)]/255*b];q.push([-1,0,h[4*(l*d+s)]/255*b]);q.push([-1,-1,h[4*(p*d+s)]/255*b]);q.push([0,-1,h[4*(p*d+m)]/255*b]);q.push([1,-1,h[4*(p*d+n)]/255*b]);q.push([1,0,h[4*(l*d+n)]/255*b]);q.push([1,1,h[4*(r*d+n)]/255*b]);q.push([0,1,h[4*(r*d+m)]/255*b]);q.push([-1,1,h[4*(r*d+s)]/255*b]);p=[];s=q.length;for(r=0;r<s;r++){var n=q[r],u=q[(r+1)%
+s],n=[n[0]-y[0],n[1]-y[1],n[2]-y[2]],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]];p.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}q=[0,0,0];for(r=0;r<p.length;r++)q[0]+=p[r][0],q[1]+=p[r][1],q[2]+=p[r][2];q[0]/=p.length;q[1]/=p.length;q[2]/=p.length;y=4*(l*d+m);j[y]=255*((q[0]+1)/2)|0;j[y+1]=255*((q[1]+1)/2)|0;j[y+2]=255*q[2]|0;j[y+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,m,p,l,r,s,n,q,y=b.glyphs[a]||b.glyphs["?"];if(y){if(y.o){b=y._cachedOutline||(y._cachedOutline=y.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
-c+d;m=b[a++]*c;r=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(r,s,i,m);if(g=f[f.length-1]){p=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,p,r,i);THREE.Shape.Utils.b2(u,l,s,m)}}break;case "b":if(i=b[a++]*c+d,m=b[a++]*c,r=b[a++]*c+d,s=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,m,r,s,n,q),g=f[f.length-1]){p=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++)u=g/h,THREE.Shape.Utils.b3(u,p,r,n,i),THREE.Shape.Utils.b3(u,l,s,q,m)}}}return{offset:y.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,j,m,l,p,r,s,n,q,y=b.glyphs[a]||b.glyphs["?"];if(y){if(y.o){b=y._cachedOutline||(y._cachedOutline=y.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
+c+d;m=b[a++]*c;r=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(r,s,i,m);if(g=f[f.length-1]){l=g.x;p=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,l,r,i);THREE.Shape.Utils.b2(u,p,s,m)}}break;case "b":if(i=b[a++]*c+d,m=b[a++]*c,r=b[a++]*c+d,s=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,m,r,s,n,q),g=f[f.length-1]){l=g.x;p=g.y;g=1;for(h=this.divisions;g<=h;g++)u=g/h,THREE.Shape.Utils.b3(u,l,r,n,i),THREE.Shape.Utils.b3(u,p,s,q,m)}}}return{offset:y.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,m;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 p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);m=k+1;e<=m&&(m=0);var l;a:{var r=l=void 0,s=void 0,n=void 0,q=void 0,y=void 0,u=void 0,x=void 0,t=
-void 0,r=a[g[i]].x,s=a[g[i]].y,n=a[g[k]].x,q=a[g[k]].y,y=a[g[m]].x,u=a[g[m]].y;if(1E-10>(n-r)*(u-s)-(q-s)*(y-r))l=!1;else{var D=void 0,J=void 0,F=void 0,z=void 0,H=void 0,L=void 0,I=void 0,N=void 0,A=void 0,U=void 0,A=N=I=t=x=void 0,D=y-n,J=u-q,F=r-y,z=s-u,H=n-r,L=q-s;for(l=0;l<e;l++)if(!(l===i||l===k||l===m))if(x=a[g[l]].x,t=a[g[l]].y,I=x-r,N=t-s,A=x-n,U=t-q,x-=y,t-=u,A=D*U-J*A,I=H*N-L*I,N=F*t-z*x,0<=A&&0<=N&&0<=I){l=!1;break a}l=!0}}if(l){f.push([a[g[i]],a[g[k]],a[g[m]]]);h.push([g[i],g[k],g[m]]);
-i=k;for(m=k+1;m<e;i++,m++)g[i]=g[m];e--;p=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};
+(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,j,m;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var l=2*e;for(j=e-1;2<e;){if(0>=l--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);m=j+1;e<=m&&(m=0);var p;a:{var r=p=void 0,s=void 0,n=void 0,q=void 0,y=void 0,u=void 0,x=void 0,t=
+void 0,r=a[g[i]].x,s=a[g[i]].y,n=a[g[j]].x,q=a[g[j]].y,y=a[g[m]].x,u=a[g[m]].y;if(1E-10>(n-r)*(u-s)-(q-s)*(y-r))p=!1;else{var D=void 0,J=void 0,F=void 0,z=void 0,H=void 0,L=void 0,I=void 0,N=void 0,A=void 0,U=void 0,A=N=I=t=x=void 0,D=y-n,J=u-q,F=r-y,z=s-u,H=n-r,L=q-s;for(p=0;p<e;p++)if(!(p===i||p===j||p===m))if(x=a[g[p]].x,t=a[g[p]].y,I=x-r,N=t-s,A=x-n,U=t-q,x-=y,t-=u,A=D*U-J*A,I=H*N-L*I,N=F*t-z*x,0<=A&&0<=N&&0<=I){p=!1;break a}p=!0}}if(p){f.push([a[g[i]],a[g[j]],a[g[m]]]);h.push([g[i],g[j],g[m]]);
+i=j;for(m=j+1;m<e;i++,m++)g[i]=g[m];e--;l=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()};
 THREE.Curve.prototype.getTangentAt=function(a){a=this.getUtoTmapping(a);return this.getTangent(a)};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};
@@ -547,7 +546,7 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
 THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,k,m,p=a[0]instanceof THREE.Vector3;m=p?new THREE.Vector3:new THREE.Vector2;i=0;for(k=a.length;i<k;i++)h=a[i],h.x>b?b=h.x:h.x<e&&(e=h.x),h.y>c?c=h.y:h.y<f&&(f=h.y),p&&(h.z>d?d=h.z:h.z<g&&(g=h.z)),m.add(h);a={minX:e,minY:f,maxX:b,maxY:c,centroid:m.divideScalar(k)};p&&(a.maxZ=d,a.minZ=g);return a};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,j,m,l=a[0]instanceof THREE.Vector3;m=l?new THREE.Vector3:new THREE.Vector2;i=0;for(j=a.length;i<j;i++)h=a[i],h.x>b?b=h.x:h.x<e&&(e=h.x),h.y>c?c=h.y:h.y<f&&(f=h.y),l&&(h.z>d?d=h.z:h.z<g&&(g=h.z)),m.add(h);a={minX:e,minY:f,maxX:b,maxY:c,centroid:m.divideScalar(j)};l&&(a.maxZ=d,a.minZ=g);return a};
 THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
 THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
 THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
@@ -559,43 +558,43 @@ 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,m,p,l,r,s,n;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];p=f[0];l=f[1];0<c.length?(g=c[c.length-1],r=g.x,
-s=g.y):(g=this.actions[d-1].args,r=g[g.length-2],s=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,r,p,h),n=THREE.Shape.Utils.b2(n,s,l,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];l=f[1];k=f[2];m=f[3];0<c.length?(g=c[c.length-1],r=g.x,s=g.y):(g=this.actions[d-1].args,r=g[g.length-2],s=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,r,p,k,h),n=THREE.Shape.Utils.b3(n,s,l,m,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:g=
-this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];l=f[2];k=f[3];g=f[4];p=!!f[5];r=g-k;s=2*a;for(f=1;f<=s;f++)n=f/s,p||(n=1-n),n=k+n*r,g=h+l*Math.cos(n),n=i+l*Math.sin(n),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];l=f[2];m=f[3];k=f[4];g=f[5];p=!!f[6];r=g-k;s=2*a;for(f=1;f<=s;f++)n=f/s,p||
-(n=1-n),n=k+n*r,g=h+l*Math.cos(n),n=i+m*Math.sin(n),c.push(new THREE.Vector2(g,n))}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,j,m,l,p,r,s,n;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];l=f[0];p=f[1];0<c.length?(g=c[c.length-1],r=g.x,
+s=g.y):(g=this.actions[d-1].args,r=g[g.length-2],s=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,r,l,h),n=THREE.Shape.Utils.b2(n,s,p,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];l=f[0];p=f[1];j=f[2];m=f[3];0<c.length?(g=c[c.length-1],r=g.x,s=g.y):(g=this.actions[d-1].args,r=g[g.length-2],s=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,r,l,j,h),n=THREE.Shape.Utils.b3(n,s,p,m,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:g=
+this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];p=f[2];j=f[3];g=f[4];l=!!f[5];r=g-j;s=2*a;for(f=1;f<=s;f++)n=f/s,l||(n=1-n),n=j+n*r,g=h+p*Math.cos(n),n=i+p*Math.sin(n),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];p=f[2];m=f[3];j=f[4];g=f[5];l=!!f[6];r=g-j;s=2*a;for(f=1;f<=s;f++)n=f/s,l||
+(n=1-n),n=j+n*r,g=h+p*Math.cos(n),n=i+m*Math.sin(n),c.push(new THREE.Vector2(g,n))}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,m,p,l,r,s=[];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++){l=k[e];r=[];for(p=0;p<c.length;p++)m=c[p],m=l.distanceToSquared(m),r.push(m),m<f&&(f=m,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;var n=[k[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(n);var q=[k[g],k[f],c[h]];l=THREE.FontUtils.Triangulate.area(q);r=h;m=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;n=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);p+l>n+q&&(h=r,g=m,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=c.slice(0,h);l=c.slice(h);r=k.slice(g);m=k.slice(0,g);f=[k[g],k[f],c[h]];s.push([k[g],c[h],c[e]]);s.push(f);c=p.concat(r).concat(m).concat(l)}return{shape:c,
-isolatedPts:s,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,j,m,l,p,r,s=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){p=j[e];r=[];for(l=0;l<c.length;l++)m=c[l],m=p.distanceToSquared(m),r.push(m),m<f&&(f=m,g=e,h=l)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;var n=[j[g],c[h],c[e]];l=THREE.FontUtils.Triangulate.area(n);var q=[j[g],j[f],c[h]];p=THREE.FontUtils.Triangulate.area(q);r=h;m=g;h+=1;g+=-1;0>
+h&&(h+=c.length);h%=c.length;0>g&&(g+=j.length);g%=j.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;n=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);l+p>n+q&&(h=r,g=m,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=j.length),g%=j.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:j.length-1);l=c.slice(0,h);p=c.slice(h);r=j.slice(g);m=j.slice(0,g);f=[j[g],j[f],c[h]];s.push([j[g],c[h],c[e]]);s.push(f);c=l.concat(r).concat(m).concat(p)}return{shape:c,
+isolatedPts:s,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,j={};f=0;for(g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==j[i]&&console.log("Duplicate point",i),j[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=j[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=j[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;
-for(d=0;d<a.hierarchy[c].keys.length;d++){var m={};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){m[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(m[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=m}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
+(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 j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;
+for(d=0;d<a.hierarchy[c].keys.length;d++){var m={};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){m[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(m[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=m}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
 d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],
 b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!1===this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD&&(e.useQuaternion=!0);e.matrixAutoUpdate=!0;void 0===e.animationCache&&(e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Bone?e.skinMatrix:e.matrix);var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){!0===this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this)};
-THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,k,m;m=this.currentTime+=a*this.timeScale;k=this.currentTime%=this.data.length;parseInt(Math.min(k*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,l=this.hierarchy.length;p<l;p++){a=this.hierarchy[p];i=a.animationCache;for(var r=0;3>r;r++){c=b[r];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(k<m)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<
-k;)g=h,h=this.getNextKeyWith(c,p,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,p,h.index+1);while(h.time<k)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(k-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+
-(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",p,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d),
+THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,m;m=this.currentTime+=a*this.timeScale;j=this.currentTime%=this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,p=this.hierarchy.length;l<p;l++){a=this.hierarchy[l];i=a.animationCache;for(var r=0;3>r;r++){c=b[r];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(j<m)if(this.loop){g=this.data.hierarchy[l].keys[0];for(h=this.getNextKeyWith(c,l,1);h.time<
+j;)g=h,h=this.getNextKeyWith(c,l,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,l,h.index+1);while(h.time<j)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(j-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+
+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",l,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",l,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d),
 this.target.set(d[0],d[1],d[2]),this.target.sub(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0))}else"rot"===c?THREE.Quaternion.slerp(e,f,a.quaternion,d):"scl"===c&&(c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d)}}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,k;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],k[2],e,c,g);return d};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
 d.matrixWorldNeedsUpdate=!0}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++)e=this.hierarchy[c],f=this.data.hierarchy[c],e.useQuaternion=!0,void 0===f.animationCache&&(f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
 e.matrix),e=this.data.hierarchy[c].keys,e.length&&(f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;g<this.startTimeMs&&(g=this.currentTime=this.startTimeMs+g);e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var m=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=m.length-1;e=this.hierarchy[a];if(m.length){for(m=
-0;m<f.length;m++)g=f[m],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var m=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(m.length){this.JITCompile&&p&&(d instanceof
-THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix);b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=m[0];for(c=m[1];c.time<g;)b=c,c=m[b.index+1]}else if(!i)for(var l=m.length-1;c.time<g&&c.index!==l;)b=c,c=m[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;g<this.startTimeMs&&(g=this.currentTime=this.startTimeMs+g);e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var m=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=m.length-1;e=this.hierarchy[a];if(m.length){for(m=
+0;m<f.length;m++)g=f[m],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var m=b.keys,l=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(m.length){this.JITCompile&&l&&(d instanceof
+THREE.Bone?d.skinMatrix=l.originalMatrix:d.matrix=l.originalMatrix);b=l.prevKey;c=l.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=m[0];for(c=m[1];c.time<g;)b=c,c=m[b.index+1]}else if(!i)for(var p=m.length-1;c.time<g&&c.index!==p;)b=c,c=m[b.index+1];l.prevKey=b;l.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
 this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
-1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,l=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
-2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=l;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);
+1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,p=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
+2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=p;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPerspectiveMode=!0;this.inOrthographicMode=!1};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPerspectiveMode=!1;this.inOrthographicMode=!0};
 THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){this.inPerspectiveMode?this.toPerspective():(this.toPerspective(),this.toOrthographic())};
@@ -604,43 +603,43 @@ THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rota
 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.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,i=c+e/b*d;h.x=a*Math.cos(i);h.y=a*Math.sin(i);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,n){var q,y=h.widthSegments,u=h.heightSegments,x=e/2,t=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",u=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",y=h.depthSegments;var J=y+1,F=u+1,z=e/y,H=f/u,L=new THREE.Vector3;L[q]=0<g?1:-1;for(e=0;e<F;e++)for(f=0;f<J;f++){var I=new THREE.Vector3;I[a]=(f*z-x)*c;I[b]=(e*H-t)*d;I[q]=g;h.vertices.push(I)}for(e=
 0;e<u;e++)for(f=0;f<y;f++)a=new THREE.Face4(f+J*e+D,f+J*(e+1)+D,f+1+J*(e+1)+D,f+1+J*e+D),a.normal.copy(L),a.vertexNormals.push(L.clone(),L.clone(),L.clone(),L.clone()),a.materialIndex=n,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/y,1-e/u),new THREE.Vector2(f/y,1-(e+1)/u),new THREE.Vector2((f+1)/y,1-(e+1)/u),new THREE.Vector2((f+1)/y,1-e/u)])}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);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radiusSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var g=c/2,h,i,k=[],m=[];for(i=0;i<=e;i++){var p=[],l=[],r=i/e,s=r*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=s*Math.sin(2*n*Math.PI);q.y=-r*c+g;q.z=s*Math.cos(2*n*Math.PI);this.vertices.push(q);p.push(this.vertices.length-1);l.push(new THREE.Vector2(n,
-1-r))}k.push(p);m.push(l)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(p=this.vertices[k[0][h]].clone(),l=this.vertices[k[0][h+1]].clone()):(p=this.vertices[k[1][h]].clone(),l=this.vertices[k[1][h+1]].clone());p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();for(i=0;i<e;i++){var r=k[i][h],s=k[i+1][h],n=k[i+1][h+1],q=k[i][h+1],y=p.clone(),u=p.clone(),x=l.clone(),t=l.clone(),D=m[i][h].clone(),J=m[i+1][h].clone(),F=m[i+1][h+1].clone(),z=m[i][h+1].clone();this.faces.push(new THREE.Face4(r,
-s,n,q,[y,u,x,t]));this.faceVertexUvs[0].push([D,J,F,z])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)r=k[0][h],s=k[0][h+1],n=this.vertices.length-1,y=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),D=m[0][h].clone(),J=m[0][h+1].clone(),F=new THREE.Vector2(J.u,0),this.faces.push(new THREE.Face3(r,s,n,[y,u,x])),this.faceVertexUvs[0].push([D,J,F])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)r=k[i][h+1],
-s=k[i][h],n=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),D=m[i][h+1].clone(),J=m[i][h].clone(),F=new THREE.Vector2(J.u,1),this.faces.push(new THREE.Face3(r,s,n,[y,u,x])),this.faceVertexUvs[0].push([D,J,F])}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)};
+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);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radiusSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var g=c/2,h,i,j=[],m=[];for(i=0;i<=e;i++){var l=[],p=[],r=i/e,s=r*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=s*Math.sin(2*n*Math.PI);q.y=-r*c+g;q.z=s*Math.cos(2*n*Math.PI);this.vertices.push(q);l.push(this.vertices.length-1);p.push(new THREE.Vector2(n,
+1-r))}j.push(l);m.push(p)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(l=this.vertices[j[0][h]].clone(),p=this.vertices[j[0][h+1]].clone()):(l=this.vertices[j[1][h]].clone(),p=this.vertices[j[1][h+1]].clone());l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();for(i=0;i<e;i++){var r=j[i][h],s=j[i+1][h],n=j[i+1][h+1],q=j[i][h+1],y=l.clone(),u=l.clone(),x=p.clone(),t=p.clone(),D=m[i][h].clone(),J=m[i+1][h].clone(),F=m[i+1][h+1].clone(),z=m[i][h+1].clone();this.faces.push(new THREE.Face4(r,
+s,n,q,[y,u,x,t]));this.faceVertexUvs[0].push([D,J,F,z])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)r=j[0][h],s=j[0][h+1],n=this.vertices.length-1,y=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),D=m[0][h].clone(),J=m[0][h+1].clone(),F=new THREE.Vector2(J.u,0),this.faces.push(new THREE.Face3(r,s,n,[y,u,x])),this.faceVertexUvs[0].push([D,J,F])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)r=j[i][h+1],
+s=j[i][h],n=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),D=m[i][h+1].clone(),J=m[i][h].clone(),F=new THREE.Vector2(J.u,1),this.faces.push(new THREE.Face3(r,s,n,[y,u,x])),this.faceVertexUvs[0].push([D,J,F])}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,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
 h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).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(h).sub(a).clone()}function e(c,d){var e,f;for(B=c.length;0<=--B;){e=B;f=B-1;0>f&&(f=c.length-1);for(var g=0,h=r+2*m,
-g=0;g<h;g++){var i=$*g,k=$*(g+1),l=d+e+i,i=d+f+i,p=d+f+k,k=d+e+k,n=c,q=g,s=h,t=e,y=f,l=l+N,i=i+N,p=p+N,k=k+N;I.faces.push(new THREE.Face4(l,i,p,k,null,null,u));l=x.generateSideWallUV(I,a,n,b,l,i,p,k,q,s,t,y);I.faceVertexUvs[0].push(l)}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=N;d+=N;e+=N;I.faces.push(new THREE.Face3(c,d,e,null,null,y));c=f?x.generateBottomUV(I,a,b,c,d,e):x.generateTopUV(I,a,b,c,d,e);I.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,m=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,r=void 0!==b.steps?b.steps:1,s=b.extrudePath,n,q=!1,y=b.material,u=b.extrudeMaterial,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,D,J,F;s&&(n=s.getSpacedPoints(r),q=!0,p=!1,t=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,r,
-!1),D=new THREE.Vector3,J=new THREE.Vector3,F=new THREE.Vector3);p||(k=i=m=0);var z,H,L,I=this,N=this.vertices.length,l=a.extractPoints(l),A=l.shape,l=l.holes;if(s=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();H=0;for(L=l.length;H<L;H++)z=l[H],THREE.Shape.Utils.isClockWise(z)&&(l[H]=z.reverse());s=!1}var U=THREE.Shape.Utils.triangulateShape(A,l),s=A;H=0;for(L=l.length;H<L;H++)z=l[H],A=A.concat(z);var G,K,M,T,$=A.length,wa=U.length,fb=[],B=0,ca=s.length;G=ca-1;for(K=B+1;B<ca;B++,G++,K++)G===ca&&
-(G=0),K===ca&&(K=0),fb[B]=d(s[B],s[G],s[K]);var qa=[],ga,ja=fb.concat();H=0;for(L=l.length;H<L;H++){z=l[H];ga=[];B=0;ca=z.length;G=ca-1;for(K=B+1;B<ca;B++,G++,K++)G===ca&&(G=0),K===ca&&(K=0),ga[B]=d(z[B],z[G],z[K]);qa.push(ga);ja=ja.concat(ga)}for(G=0;G<m;G++){z=G/m;M=i*(1-z);K=k*Math.sin(z*Math.PI/2);B=0;for(ca=s.length;B<ca;B++)T=c(s[B],fb[B],K),f(T.x,T.y,-M);H=0;for(L=l.length;H<L;H++){z=l[H];ga=qa[H];B=0;for(ca=z.length;B<ca;B++)T=c(z[B],ga[B],K),f(T.x,T.y,-M)}}K=k;for(B=0;B<$;B++)T=p?c(A[B],
-ja[B],K):A[B],q?(J.copy(t.normals[0]).multiplyScalar(T.x),D.copy(t.binormals[0]).multiplyScalar(T.y),F.copy(n[0]).add(J).add(D),f(F.x,F.y,F.z)):f(T.x,T.y,0);for(z=1;z<=r;z++)for(B=0;B<$;B++)T=p?c(A[B],ja[B],K):A[B],q?(J.copy(t.normals[z]).multiplyScalar(T.x),D.copy(t.binormals[z]).multiplyScalar(T.y),F.copy(n[z]).add(J).add(D),f(F.x,F.y,F.z)):f(T.x,T.y,h/r*z);for(G=m-1;0<=G;G--){z=G/m;M=i*(1-z);K=k*Math.sin(z*Math.PI/2);B=0;for(ca=s.length;B<ca;B++)T=c(s[B],fb[B],K),f(T.x,T.y,h+M);H=0;for(L=l.length;H<
-L;H++){z=l[H];ga=qa[H];B=0;for(ca=z.length;B<ca;B++)T=c(z[B],ga[B],K),q?f(T.x,T.y+n[r-1].y,n[r-1].x+M):f(T.x,T.y,h+M)}}if(p){i=0*$;for(B=0;B<wa;B++)h=U[B],g(h[2]+i,h[1]+i,h[0]+i,!0);i=$*(r+2*m);for(B=0;B<wa;B++)h=U[B],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(B=0;B<wa;B++)h=U[B],g(h[2],h[1],h[0],!0);for(B=0;B<wa;B++)h=U[B],g(h[0]+$*r,h[1]+$*r,h[2]+$*r,!1)}h=0;e(s,h);h+=s.length;H=0;for(L=l.length;H<L;H++)z=l[H],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,
-m=a.vertices[g].y,g=a.vertices[g].z,p=a.vertices[h].x,l=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(p,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-g),new THREE.Vector2(l,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;
+g=0;g<h;g++){var i=$*g,j=$*(g+1),l=d+e+i,i=d+f+i,p=d+f+j,j=d+e+j,n=c,q=g,s=h,t=e,y=f,l=l+N,i=i+N,p=p+N,j=j+N;I.faces.push(new THREE.Face4(l,i,p,j,null,null,u));l=x.generateSideWallUV(I,a,n,b,l,i,p,j,q,s,t,y);I.faceVertexUvs[0].push(l)}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=N;d+=N;e+=N;I.faces.push(new THREE.Face3(c,d,e,null,null,y));c=f?x.generateBottomUV(I,a,b,c,d,e):x.generateTopUV(I,a,b,c,d,e);I.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
+100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,l=void 0!==b.bevelEnabled?b.bevelEnabled:!0,p=void 0!==b.curveSegments?b.curveSegments:12,r=void 0!==b.steps?b.steps:1,s=b.extrudePath,n,q=!1,y=b.material,u=b.extrudeMaterial,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,D,J,F;s&&(n=s.getSpacedPoints(r),q=!0,l=!1,t=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,r,
+!1),D=new THREE.Vector3,J=new THREE.Vector3,F=new THREE.Vector3);l||(j=i=m=0);var z,H,L,I=this,N=this.vertices.length,p=a.extractPoints(p),A=p.shape,p=p.holes;if(s=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();H=0;for(L=p.length;H<L;H++)z=p[H],THREE.Shape.Utils.isClockWise(z)&&(p[H]=z.reverse());s=!1}var U=THREE.Shape.Utils.triangulateShape(A,p),s=A;H=0;for(L=p.length;H<L;H++)z=p[H],A=A.concat(z);var G,K,M,T,$=A.length,wa=U.length,fb=[],B=0,ca=s.length;G=ca-1;for(K=B+1;B<ca;B++,G++,K++)G===ca&&
+(G=0),K===ca&&(K=0),fb[B]=d(s[B],s[G],s[K]);var qa=[],ga,ja=fb.concat();H=0;for(L=p.length;H<L;H++){z=p[H];ga=[];B=0;ca=z.length;G=ca-1;for(K=B+1;B<ca;B++,G++,K++)G===ca&&(G=0),K===ca&&(K=0),ga[B]=d(z[B],z[G],z[K]);qa.push(ga);ja=ja.concat(ga)}for(G=0;G<m;G++){z=G/m;M=i*(1-z);K=j*Math.sin(z*Math.PI/2);B=0;for(ca=s.length;B<ca;B++)T=c(s[B],fb[B],K),f(T.x,T.y,-M);H=0;for(L=p.length;H<L;H++){z=p[H];ga=qa[H];B=0;for(ca=z.length;B<ca;B++)T=c(z[B],ga[B],K),f(T.x,T.y,-M)}}K=j;for(B=0;B<$;B++)T=l?c(A[B],
+ja[B],K):A[B],q?(J.copy(t.normals[0]).multiplyScalar(T.x),D.copy(t.binormals[0]).multiplyScalar(T.y),F.copy(n[0]).add(J).add(D),f(F.x,F.y,F.z)):f(T.x,T.y,0);for(z=1;z<=r;z++)for(B=0;B<$;B++)T=l?c(A[B],ja[B],K):A[B],q?(J.copy(t.normals[z]).multiplyScalar(T.x),D.copy(t.binormals[z]).multiplyScalar(T.y),F.copy(n[z]).add(J).add(D),f(F.x,F.y,F.z)):f(T.x,T.y,h/r*z);for(G=m-1;0<=G;G--){z=G/m;M=i*(1-z);K=j*Math.sin(z*Math.PI/2);B=0;for(ca=s.length;B<ca;B++)T=c(s[B],fb[B],K),f(T.x,T.y,h+M);H=0;for(L=p.length;H<
+L;H++){z=p[H];ga=qa[H];B=0;for(ca=z.length;B<ca;B++)T=c(z[B],ga[B],K),q?f(T.x,T.y+n[r-1].y,n[r-1].x+M):f(T.x,T.y,h+M)}}if(l){i=0*$;for(B=0;B<wa;B++)h=U[B],g(h[2]+i,h[1]+i,h[0]+i,!0);i=$*(r+2*m);for(B=0;B<wa;B++)h=U[B],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(B=0;B<wa;B++)h=U[B],g(h[2],h[1],h[0],!0);for(B=0;B<wa;B++)h=U[B],g(h[0]+$*r,h[1]+$*r,h[2]+$*r,!1)}h=0;e(s,h);h+=s.length;H=0;for(L=p.length;H<L;H++)z=p[H],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,j=a.vertices[g].x,
+m=a.vertices[g].y,g=a.vertices[g].z,l=a.vertices[h].x,p=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(j,1-g),new THREE.Vector2(l,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-g),new THREE.Vector2(p,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};
-THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,k=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=k.length;e<f;e++)g=k[e],THREE.Shape.Utils.isClockWise(g)&&(k[e]=g.reverse())}var m=THREE.Shape.Utils.triangulateShape(i,k);e=0;for(f=k.length;e<f;e++)g=k[e],
-i=i.concat(g);k=i.length;f=m.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=m[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),m=Math.sin(i),i=0,p=a.length;i<p;i++){var l=a[i],r=new THREE.Vector3;r.x=k*l.x-m*l.y;r.y=m*l.x+k*l.y;r.z=l.z;this.vertices.push(r)}c=a.length;g=0;for(h=b;g<h;g++){i=0;for(p=a.length-1;i<p;i++)d=b=i+c*g,m=b+c,k=b+1+c,this.faces.push(new THREE.Face4(d,m,k,b+1)),k=g*f,b=i*e,d=k+f,m=b+e,this.faceVertexUvs[0].push([new THREE.Vector2(k,
-b),new THREE.Vector2(d,b),new THREE.Vector2(d,m),new THREE.Vector2(k,m)])}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,m=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(m),c.vertexNormals.push(m.clone(),m.clone(),
-m.clone(),m.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.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,g=[],h=a,i=(b-a)/d,a=0;a<=d;a++){for(b=0;b<=c;b++){var k=new THREE.Vector3,m=e+b/c*f;k.x=h*Math.cos(m);k.y=h*Math.sin(m);this.vertices.push(k);g.push(new THREE.Vector2((k.x/h+1)/2,-(k.y/h+1)/2+1))}h+=i}e=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){f=a*c;for(b=0;b<=c;b++){var m=b+f,i=m+a,k=m+c+a,p=m+c+1+a;this.faces.push(new THREE.Face3(i,
-k,p,[e,e,e]));this.faceVertexUvs[0].push([g[i],g[k],g[p]]);i=m+a;k=m+c+1+a;p=m+1+a;this.faces.push(new THREE.Face3(i,k,p,[e,e,e]));this.faceVertexUvs[0].push([g[i],g[k],g[p]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,h)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=g=void 0!==g?g:Math.PI;var h,i,k=[],m=[];for(i=0;i<=c;i++){var p=[],l=[];for(h=0;h<=b;h++){var r=h/b,s=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+r*e)*Math.sin(f+s*g);n.y=a*Math.cos(f+s*g);
-n.z=a*Math.sin(d+r*e)*Math.sin(f+s*g);this.vertices.push(n);p.push(this.vertices.length-1);l.push(new THREE.Vector2(r,1-s))}k.push(p);m.push(l)}for(i=0;i<this.heightSegments;i++)for(h=0;h<this.widthSegments;h++){var b=k[i][h+1],c=k[i][h],d=k[i+1][h],e=k[i+1][h+1],f=this.vertices[b].clone().normalize(),g=this.vertices[c].clone().normalize(),p=this.vertices[d].clone().normalize(),l=this.vertices[e].clone().normalize(),r=m[i][h+1].clone(),s=m[i][h].clone(),n=m[i+1][h].clone(),q=m[i+1][h+1].clone();Math.abs(this.vertices[b].y)===
-this.radius?(this.faces.push(new THREE.Face3(b,d,e,[f,p,l])),this.faceVertexUvs[0].push([r,n,q])):Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(b,c,d,[f,g,p])),this.faceVertexUvs[0].push([r,s,n])):(this.faces.push(new THREE.Face4(b,c,d,e,[f,g,p,l])),this.faceVertexUvs[0].push([r,s,n,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 b=b||{},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*
+THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,j=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=j.length;e<f;e++)g=j[e],THREE.Shape.Utils.isClockWise(g)&&(j[e]=g.reverse())}var m=THREE.Shape.Utils.triangulateShape(i,j);e=0;for(f=j.length;e<f;e++)g=j[e],
+i=i.concat(g);j=i.length;f=m.length;for(e=0;e<j;e++)g=i[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)j=m[e],i=j[0]+h,g=j[1]+h,j=j[2]+h,this.faces.push(new THREE.Face3(i,g,j,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,g,j))};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,j=Math.cos(i),m=Math.sin(i),i=0,l=a.length;i<l;i++){var p=a[i],r=new THREE.Vector3;r.x=j*p.x-m*p.y;r.y=m*p.x+j*p.y;r.z=p.z;this.vertices.push(r)}c=a.length;g=0;for(h=b;g<h;g++){i=0;for(l=a.length-1;i<l;i++)d=b=i+c*g,m=b+c,j=b+1+c,this.faces.push(new THREE.Face4(d,m,j,b+1)),j=g*f,b=i*e,d=j+f,m=b+e,this.faceVertexUvs[0].push([new THREE.Vector2(j,
+b),new THREE.Vector2(d,b),new THREE.Vector2(d,m),new THREE.Vector2(j,m)])}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,j=this.height/f,m=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*j-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(m),c.vertexNormals.push(m.clone(),m.clone(),
+m.clone(),m.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.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,g=[],h=a,i=(b-a)/d,a=0;a<=d;a++){for(b=0;b<=c;b++){var j=new THREE.Vector3,m=e+b/c*f;j.x=h*Math.cos(m);j.y=h*Math.sin(m);this.vertices.push(j);g.push(new THREE.Vector2((j.x/h+1)/2,-(j.y/h+1)/2+1))}h+=i}e=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){f=a*c;for(b=0;b<=c;b++){var m=b+f,i=m+a,j=m+c+a,l=m+c+1+a;this.faces.push(new THREE.Face3(i,
+j,l,[e,e,e]));this.faceVertexUvs[0].push([g[i],g[j],g[l]]);i=m+a;j=m+c+1+a;l=m+1+a;this.faces.push(new THREE.Face3(i,j,l,[e,e,e]));this.faceVertexUvs[0].push([g[i],g[j],g[l]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,h)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=g=void 0!==g?g:Math.PI;var h,i,j=[],m=[];for(i=0;i<=c;i++){var l=[],p=[];for(h=0;h<=b;h++){var r=h/b,s=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+r*e)*Math.sin(f+s*g);n.y=a*Math.cos(f+s*g);
+n.z=a*Math.sin(d+r*e)*Math.sin(f+s*g);this.vertices.push(n);l.push(this.vertices.length-1);p.push(new THREE.Vector2(r,1-s))}j.push(l);m.push(p)}for(i=0;i<this.heightSegments;i++)for(h=0;h<this.widthSegments;h++){var b=j[i][h+1],c=j[i][h],d=j[i+1][h],e=j[i+1][h+1],f=this.vertices[b].clone().normalize(),g=this.vertices[c].clone().normalize(),l=this.vertices[d].clone().normalize(),p=this.vertices[e].clone().normalize(),r=m[i][h+1].clone(),s=m[i][h].clone(),n=m[i+1][h].clone(),q=m[i+1][h+1].clone();Math.abs(this.vertices[b].y)===
+this.radius?(this.faces.push(new THREE.Face3(b,d,e,[f,l,p])),this.faceVertexUvs[0].push([r,n,q])):Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(b,c,d,[f,g,l])),this.faceVertexUvs[0].push([r,s,n])):(this.faces.push(new THREE.Face4(b,c,d,e,[f,g,l,p])),this.faceVertexUvs[0].push([r,s,n,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 b=b||{},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]=
 Array(this.tubularSegments);for(b=0;b<this.tubularSegments;++b){var i=2*(a/this.radialSegments)*this.p*Math.PI,g=2*(b/this.tubularSegments)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.subVectors(i,f);d.addVectors(i,f);e.crossVectors(c,d);d.crossVectors(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,
-f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),i=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),k=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),m=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
-d,e,f));this.faceVertexUvs[0].push([g,i,k,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||!1;f&&(this.debug=new THREE.Object3D);this.grid=[];var g,h,e=this.segments+1,i,k,m,f=new THREE.Vector3,p,l,r,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);p=b.tangents;l=b.normals;r=b.binormals;this.tangents=p;this.normals=l;this.binormals=r;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);m=a.getPointAt(d);d=p[b];g=l[b];
-h=r[b];this.debug&&(this.debug.add(new THREE.ArrowHelper(d,m,c,255)),this.debug.add(new THREE.ArrowHelper(g,m,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,m,c,65280)));for(d=0;d<this.radiusSegments;d++)i=2*(d/this.radiusSegments)*Math.PI,k=-this.radius*Math.cos(i),i=this.radius*Math.sin(i),f.copy(m),f.x+=k*g.x+i*h.x,f.y+=k*g.y+i*h.y,f.z+=k*g.z+i*h.z,this.grid[b][d]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++)e=this.closed?
-(b+1)%this.segments:b+1,f=(d+1)%this.radiusSegments,a=this.grid[b][d],c=this.grid[e][d],e=this.grid[e][f],f=this.grid[b][f],p=new THREE.Vector2(b/this.segments,d/this.radiusSegments),l=new THREE.Vector2((b+1)/this.segments,d/this.radiusSegments),r=new THREE.Vector2((b+1)/this.segments,(d+1)/this.radiusSegments),g=new THREE.Vector2(b/this.segments,(d+1)/this.radiusSegments),this.faces.push(new THREE.Face4(a,c,e,f)),this.faceVertexUvs[0].push([p,l,r,g]);this.computeCentroids();this.computeFaceNormals();
+f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),i=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),j=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),m=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
+d,e,f));this.faceVertexUvs[0].push([g,i,j,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||!1;f&&(this.debug=new THREE.Object3D);this.grid=[];var g,h,e=this.segments+1,i,j,m,f=new THREE.Vector3,l,p,r,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);l=b.tangents;p=b.normals;r=b.binormals;this.tangents=l;this.normals=p;this.binormals=r;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);m=a.getPointAt(d);d=l[b];g=p[b];
+h=r[b];this.debug&&(this.debug.add(new THREE.ArrowHelper(d,m,c,255)),this.debug.add(new THREE.ArrowHelper(g,m,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,m,c,65280)));for(d=0;d<this.radiusSegments;d++)i=2*(d/this.radiusSegments)*Math.PI,j=-this.radius*Math.cos(i),i=this.radius*Math.sin(i),f.copy(m),f.x+=j*g.x+i*h.x,f.y+=j*g.y+i*h.y,f.z+=j*g.z+i*h.z,this.grid[b][d]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++)e=this.closed?
+(b+1)%this.segments:b+1,f=(d+1)%this.radiusSegments,a=this.grid[b][d],c=this.grid[e][d],e=this.grid[e][f],f=this.grid[b][f],l=new THREE.Vector2(b/this.segments,d/this.radiusSegments),p=new THREE.Vector2((b+1)/this.segments,d/this.radiusSegments),r=new THREE.Vector2((b+1)/this.segments,(d+1)/this.radiusSegments),g=new THREE.Vector2(b/this.segments,(d+1)/this.radiusSegments),this.faces.push(new THREE.Face4(a,c,e,f)),this.faceVertexUvs[0].push([l,p,r,g]);this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,k,m,p;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++)m=k/(b-1),e[k]=a.getTangentAt(m),e[k].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);m=Math.abs(e[0].y);p=Math.abs(e[0].z);k<=a&&(a=k,d.set(1,0,0));m<=a&&(a=m,d.set(0,1,0));p<=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=h.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){var 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.copy(d.centroid).normalize();h.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);h.faceVertexUvs[0].push([g(a.uv,
-a,d),g(b.uv,b,d),g(c.uv,c,d)])}function g(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,h=this,i=0,k=a.length;i<k;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var m=this.vertices,a=[],i=0,k=b.length;i<k;i++){var p=m[b[i][0]],l=m[b[i][1]],r=m[b[i][2]];a[i]=new THREE.Face3(p.index,l.index,r.index,[p.clone(),l.clone(),r.clone()])}i=0;for(k=a.length;i<k;i++){l=a[i];m=
-d;b=Math.pow(2,m);Math.pow(4,m);for(var m=e(h.vertices[l.a]),p=e(h.vertices[l.b]),s=e(h.vertices[l.c]),l=[],r=0;r<=b;r++){l[r]=[];for(var n=e(m.clone().lerp(s,r/b)),q=e(p.clone().lerp(s,r/b)),y=b-r,u=0;u<=y;u++)l[r][u]=0==u&&r==b?n:e(n.clone().lerp(q,u/y))}for(r=0;r<b;r++)for(u=0;u<2*(b-r)-1;u++)m=Math.floor(u/2),0==u%2?f(l[r][m+1],l[r+1][m],l[r][m]):f(l[r][m+1],l[r+1][m+1],l[r+1][m])}this.mergeVertices();i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].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){this.radius=a;this.detail=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,m,p=b+1;for(h=0;h<=c;h++){m=h/c;for(i=0;i<=b;i++)k=i/b,k=a(k,m),e.push(k)}var l,r,s,n;for(h=0;h<c;h++)for(i=0;i<b;i++)a=h*p+i,e=h*p+i+1,m=(h+1)*p+i,k=(h+1)*p+i+1,l=new THREE.Vector2(i/b,h/c),r=new THREE.Vector2((i+1)/b,h/c),s=new THREE.Vector2(i/b,(h+1)/c),n=new THREE.Vector2((i+1)/b,(h+1)/c),d?(f.push(new THREE.Face3(a,e,m)),f.push(new THREE.Face3(e,
-k,m)),g.push([l,r,s]),g.push([r,n,s])):(f.push(new THREE.Face4(a,e,k,m)),g.push([l,r,n,s]));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,m=a[i[0]],p;p=m;var l=a[i[1]],r=a[i[2]],s=new THREE.Vector3,n=new THREE.Vector3;s.subVectors(r,l);n.subVectors(p,l);s.cross(n);s.normalize();p=s;m=p.dot(m);
-if(p.dot(k)>=m){for(k=0;3>k;k++){m=[i[k],i[(k+1)%3]];p=!0;for(l=0;l<g.length;l++)if(g[l][0]===m[1]&&g[l][1]===m[0]){g[l]=g[g.length-1];g.pop();p=!1;break}p&&g.push(m)}c[h]=c[c.length-1];c.pop()}else h++}for(l=0;l<g.length;l++)c.push([g[l][0],g[l][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=
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,m,l;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++)m=j/(b-1),e[j]=a.getTangentAt(m),e[j].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);m=Math.abs(e[0].y);l=Math.abs(e[0].z);j<=a&&(a=j,d.set(1,0,0));m<=a&&(a=m,d.set(0,1,0));l<=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(j=1;j<b;j++)f[j]=f[j-1].clone(),g[j]=g[j-1].clone(),h.crossVectors(e[j-1],e[j]),1E-4<h.length()&&(h.normalize(),d=Math.acos(e[j-1].dot(e[j])),f[j].applyMatrix4(i.makeRotationAxis(h,d))),g[j].crossVectors(e[j],f[j]);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(j=1;j<b;j++)f[j].applyMatrix4(i.makeRotationAxis(e[j],d*j)),g[j].crossVectors(e[j],f[j])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=h.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){var 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.copy(d.centroid).normalize();h.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);h.faceVertexUvs[0].push([g(a.uv,
+a,d),g(b.uv,b,d),g(c.uv,c,d)])}function g(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,h=this,i=0,j=a.length;i<j;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var m=this.vertices,a=[],i=0,j=b.length;i<j;i++){var l=m[b[i][0]],p=m[b[i][1]],r=m[b[i][2]];a[i]=new THREE.Face3(l.index,p.index,r.index,[l.clone(),p.clone(),r.clone()])}i=0;for(j=a.length;i<j;i++){p=a[i];m=
+d;b=Math.pow(2,m);Math.pow(4,m);for(var m=e(h.vertices[p.a]),l=e(h.vertices[p.b]),s=e(h.vertices[p.c]),p=[],r=0;r<=b;r++){p[r]=[];for(var n=e(m.clone().lerp(s,r/b)),q=e(l.clone().lerp(s,r/b)),y=b-r,u=0;u<=y;u++)p[r][u]=0==u&&r==b?n:e(n.clone().lerp(q,u/y))}for(r=0;r<b;r++)for(u=0;u<2*(b-r)-1;u++)m=Math.floor(u/2),0==u%2?f(p[r][m+1],p[r+1][m],p[r][m]):f(p[r][m+1],p[r+1][m+1],p[r+1][m])}this.mergeVertices();i=0;for(j=this.vertices.length;i<j;i++)this.vertices[i].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){this.radius=a;this.detail=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,j,m,l=b+1;for(h=0;h<=c;h++){m=h/c;for(i=0;i<=b;i++)j=i/b,j=a(j,m),e.push(j)}var p,r,s,n;for(h=0;h<c;h++)for(i=0;i<b;i++)a=h*l+i,e=h*l+i+1,m=(h+1)*l+i,j=(h+1)*l+i+1,p=new THREE.Vector2(i/b,h/c),r=new THREE.Vector2((i+1)/b,h/c),s=new THREE.Vector2(i/b,(h+1)/c),n=new THREE.Vector2((i+1)/b,(h+1)/c),d?(f.push(new THREE.Face3(a,e,m)),f.push(new THREE.Face3(e,
+j,m)),g.push([p,r,s]),g.push([r,n,s])):(f.push(new THREE.Face4(a,e,j,m)),g.push([p,r,n,s]));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],j=f,m=a[i[0]],l;l=m;var p=a[i[1]],r=a[i[2]],s=new THREE.Vector3,n=new THREE.Vector3;s.subVectors(r,p);n.subVectors(l,p);s.cross(n);s.normalize();l=s;m=l.dot(m);
+if(l.dot(j)>=m){for(j=0;3>j;j++){m=[i[j],i[(j+1)%3]];l=!0;for(p=0;p<g.length;p++)if(g[p][0]===m[1]&&g[p][1]===m[0]){g[p]=g[g.length-1];g.pop();l=!1;break}l&&g.push(m)}c[h]=c[c.length-1];c.pop()}else h++}for(p=0;p<g.length;p++)c.push([g[p][0],g[p][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=
 b);this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(a){var b=THREE.ArrowHelper.__v1.copy(a).normalize();0.999<b.y?this.rotation.set(0,0,0):-0.999>b.y?this.rotation.set(Math.PI,0,0):(a=THREE.ArrowHelper.__v2.set(b.z,0,-b.x).normalize(),b=Math.acos(b.y),a=THREE.ArrowHelper.__q1.setFromAxisAngle(a,b),this.rotation.setEulerFromQuaternion(a,this.eulerOrder))};
@@ -662,38 +661,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,m,p,l,r;this.init=function(s){b=s.context;c=s;d=s.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);s=0;e[s++]=-1;e[s++]=-1;
-e[s++]=0;e[s++]=0;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;s=0;f[s++]=0;f[s++]=1;f[s++]=2;f[s++]=0;f[s++]=2;f[s++]=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)?(m=!1,p=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,p=a(THREE.ShaderFlares.lensFlareVertexTexture,d));l={};r={};l.vertex=b.getAttribLocation(p,"position");l.uv=b.getAttribLocation(p,"uv");r.renderType=b.getUniformLocation(p,"renderType");r.map=b.getUniformLocation(p,"map");r.occlusionMap=b.getUniformLocation(p,"occlusionMap");r.opacity=
-b.getUniformLocation(p,"opacity");r.color=b.getUniformLocation(p,"color");r.scale=b.getUniformLocation(p,"scale");r.rotation=b.getUniformLocation(p,"rotation");r.screenPosition=b.getUniformLocation(p,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var x=new THREE.Vector3,t=f/e,D=0.5*e,J=0.5*f,F=16/f,z=new THREE.Vector2(F*t,F),H=new THREE.Vector3(1,1,0),L=new THREE.Vector2(1,1),I=r,F=l;b.useProgram(p);b.enableVertexAttribArray(l.vertex);b.enableVertexAttribArray(l.uv);
+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,j,m,l,p,r;this.init=function(s){b=s.context;c=s;d=s.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);s=0;e[s++]=-1;e[s++]=-1;
+e[s++]=0;e[s++]=0;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;s=0;f[s++]=0;f[s++]=1;f[s++]=2;f[s++]=0;f[s++]=2;f[s++]=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();j=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,j);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)?(m=!1,l=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture,d));p={};r={};p.vertex=b.getAttribLocation(l,"position");p.uv=b.getAttribLocation(l,"uv");r.renderType=b.getUniformLocation(l,"renderType");r.map=b.getUniformLocation(l,"map");r.occlusionMap=b.getUniformLocation(l,"occlusionMap");r.opacity=
+b.getUniformLocation(l,"opacity");r.color=b.getUniformLocation(l,"color");r.scale=b.getUniformLocation(l,"scale");r.rotation=b.getUniformLocation(l,"rotation");r.screenPosition=b.getUniformLocation(l,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var x=new THREE.Vector3,t=f/e,D=0.5*e,J=0.5*f,F=16/f,z=new THREE.Vector2(F*t,F),H=new THREE.Vector3(1,1,0),L=new THREE.Vector2(1,1),I=r,F=p;b.useProgram(l);b.enableVertexAttribArray(p.vertex);b.enableVertexAttribArray(p.uv);
 b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(F.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(F.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var N,A,U,G,K;for(N=0;N<u;N++)if(F=16/f,z.set(F*t,F),G=a[N],x.set(G.matrixWorld.elements[12],G.matrixWorld.elements[13],G.matrixWorld.elements[14]),x.applyMatrix4(d.matrixWorldInverse),x.applyProjection(d.projectionMatrix),H.copy(x),L.x=H.x*D+D,
-L.y=H.y*J+J,m||0<L.x&&L.x<e&&0<L.y&&L.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,L.x-8,L.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,z.x,z.y);b.uniform3f(I.screenPosition,H.x,H.y,H.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,L.x-8,L.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);
+L.y=H.y*J+J,m||0<L.x&&L.x<e&&0<L.y&&L.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,L.x-8,L.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,z.x,z.y);b.uniform3f(I.screenPosition,H.x,H.y,H.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,L.x-8,L.y-8,16,16,0);b.uniform1i(I.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);G.positionScreen.copy(H);G.customUpdateCallback?G.customUpdateCallback(G):G.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);A=0;for(U=G.lensFlares.length;A<U;A++)K=G.lensFlares[A],0.001<K.opacity&&0.001<K.scale&&(H.x=K.x,H.y=K.y,H.z=K.z,F=K.size*K.scale/f,z.x=F*t,z.y=F,b.uniform3f(I.screenPosition,H.x,H.y,H.z),b.uniform2f(I.scale,z.x,z.y),b.uniform1f(I.rotation,K.rotation),b.uniform1f(I.opacity,
-K.opacity),b.uniform3f(I.color,K.color.r,K.color.g,K.color.b),c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst),c.setTexture(K.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!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,m=new THREE.Vector3;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,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(p,l){var r,s,n,q,y,u,x,t,D,J=[];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);r=0;for(s=p.__lights.length;r<s;r++)if(n=p.__lights[r],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(y=0;y<n.shadowCascadeCount;y++){var F;if(n.shadowCascadeArray[y])F=n.shadowCascadeArray[y];else{D=n;x=y;F=new THREE.DirectionalLight;F.isVirtual=!0;F.onlyShadow=!0;F.castShadow=!0;F.shadowCameraNear=D.shadowCameraNear;F.shadowCameraFar=D.shadowCameraFar;F.shadowCameraLeft=D.shadowCameraLeft;F.shadowCameraRight=D.shadowCameraRight;
+K.opacity),b.uniform3f(I.color,K.color.r,K.color.g,K.color.b),c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst),c.setTexture(K.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3;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,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,p){var r,s,n,q,y,u,x,t,D,J=[];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);r=0;for(s=l.__lights.length;r<s;r++)if(n=l.__lights[r],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(y=0;y<n.shadowCascadeCount;y++){var F;if(n.shadowCascadeArray[y])F=n.shadowCascadeArray[y];else{D=n;x=y;F=new THREE.DirectionalLight;F.isVirtual=!0;F.onlyShadow=!0;F.castShadow=!0;F.shadowCameraNear=D.shadowCameraNear;F.shadowCameraFar=D.shadowCameraFar;F.shadowCameraLeft=D.shadowCameraLeft;F.shadowCameraRight=D.shadowCameraRight;
 F.shadowCameraBottom=D.shadowCameraBottom;F.shadowCameraTop=D.shadowCameraTop;F.shadowCameraVisible=D.shadowCameraVisible;F.shadowDarkness=D.shadowDarkness;F.shadowBias=D.shadowCascadeBias[x];F.shadowMapWidth=D.shadowCascadeWidth[x];F.shadowMapHeight=D.shadowCascadeHeight[x];F.pointsWorld=[];F.pointsFrustum=[];t=F.pointsWorld;u=F.pointsFrustum;for(var z=0;8>z;z++)t[z]=new THREE.Vector3,u[z]=new THREE.Vector3;t=D.shadowCascadeNearZ[x];D=D.shadowCascadeFarZ[x];u[0].set(-1,-1,t);u[1].set(1,-1,t);u[2].set(-1,
-1,t);u[3].set(1,1,t);u[4].set(-1,-1,D);u[5].set(1,-1,D);u[6].set(-1,1,D);u[7].set(1,1,D);F.originalCamera=l;u=new THREE.Gyroscope;u.position=n.shadowCascadeOffset;u.add(F);u.add(F.target);l.add(u);n.shadowCascadeArray[y]=F;console.log("Created virtualLight",F)}x=n;t=y;D=x.shadowCascadeArray[t];D.position.copy(x.position);D.target.position.copy(x.target.position);D.lookAt(D.target);D.shadowCameraVisible=x.shadowCameraVisible;D.shadowDarkness=x.shadowDarkness;D.shadowBias=x.shadowCascadeBias[t];u=x.shadowCascadeNearZ[t];
+1,t);u[3].set(1,1,t);u[4].set(-1,-1,D);u[5].set(1,-1,D);u[6].set(-1,1,D);u[7].set(1,1,D);F.originalCamera=p;u=new THREE.Gyroscope;u.position=n.shadowCascadeOffset;u.add(F);u.add(F.target);p.add(u);n.shadowCascadeArray[y]=F;console.log("Created virtualLight",F)}x=n;t=y;D=x.shadowCascadeArray[t];D.position.copy(x.position);D.target.position.copy(x.target.position);D.lookAt(D.target);D.shadowCameraVisible=x.shadowCameraVisible;D.shadowDarkness=x.shadowDarkness;D.shadowBias=x.shadowCascadeBias[t];u=x.shadowCascadeNearZ[t];
 x=x.shadowCascadeFarZ[t];D=D.pointsFrustum;D[0].z=u;D[1].z=u;D[2].z=u;D[3].z=u;D[4].z=x;D[5].z=x;D[6].z=x;D[7].z=x;J[q]=F;q++}else J[q]=n,q++;r=0;for(s=J.length;r<s;r++){n=J[r];n.shadowMap||(y=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(y=THREE.NearestFilter),n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:y,magFilter:y,format:THREE.RGBAFormat}),n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight),n.shadowMatrix=new THREE.Matrix4);
-if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}p.add(n.shadowCamera);b.autoUpdateScene&&p.updateMatrixWorld()}n.shadowCameraVisible&&
-!n.cameraHelper&&(n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),n.shadowCamera.add(n.cameraHelper));if(n.isVirtual&&F.originalCamera==l){y=l;q=n.shadowCamera;u=n.pointsFrustum;D=n.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)t=D[x],t.copy(u[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(t,y),t.applyMatrix4(q.matrixWorldInverse),t.x<i.x&&(i.x=t.x),t.x>k.x&&(k.x=t.x),t.y<i.y&&(i.y=t.y),t.y>k.y&&(k.y=t.y),t.z<i.z&&(i.z=t.z),t.z>k.z&&
-(k.z=t.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=n.shadowMap;u=n.shadowMatrix;y=n.shadowCamera;y.position.getPositionFromMatrix(n.matrixWorld);m.getPositionFromMatrix(n.target.matrixWorld);y.lookAt(m);y.updateMatrixWorld();y.matrixWorldInverse.getInverse(y.matrixWorld);n.cameraHelper&&(n.cameraHelper.visible=n.shadowCameraVisible);n.shadowCameraVisible&&n.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(y.projectionMatrix);u.multiply(y.matrixWorldInverse);
-h.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();D=p.__webglObjects;n=0;for(q=D.length;n<q;n++)if(x=D[n],u=x.object,x.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||g.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,u.matrixWorld),x.render=!0;n=0;for(q=D.length;n<q;n++)x=D[n],x.render&&(u=x.object,x=x.buffer,z=u.material instanceof THREE.MeshFaceMaterial?
-u.material.materials[0]:u.material,t=0<u.geometry.morphTargets.length&&z.morphTargets,z=u instanceof THREE.SkinnedMesh&&z.skinning,t=u.customDepthMaterial?u.customDepthMaterial:z?t?f:e:t?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(y,p.__lights,null,t,x,u):b.renderBuffer(y,p.__lights,null,t,x,u));D=p.__webglObjectsImmediate;n=0;for(q=D.length;n<q;n++)x=D[n],u=x.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(y,
-p.__lights,null,c,u))}r=b.getClearColor();s=b.getClearAlpha();a.clearColor(r.r,r.g,r.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,m;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,l=b.createProgram(),r=b.createShader(b.FRAGMENT_SHADER),s=b.createShader(b.VERTEX_SHADER),n="precision "+d+" float;\n";b.shaderSource(r,n+a.fragmentShader);b.shaderSource(s,n+a.vertexShader);b.compileShader(r);b.compileShader(s);b.attachShader(l,r);b.attachShader(l,s);b.linkProgram(l);i=l;k={};m={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
+if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}l.add(n.shadowCamera);b.autoUpdateScene&&l.updateMatrixWorld()}n.shadowCameraVisible&&
+!n.cameraHelper&&(n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),n.shadowCamera.add(n.cameraHelper));if(n.isVirtual&&F.originalCamera==p){y=p;q=n.shadowCamera;u=n.pointsFrustum;D=n.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)t=D[x],t.copy(u[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(t,y),t.applyMatrix4(q.matrixWorldInverse),t.x<i.x&&(i.x=t.x),t.x>j.x&&(j.x=t.x),t.y<i.y&&(i.y=t.y),t.y>j.y&&(j.y=t.y),t.z<i.z&&(i.z=t.z),t.z>j.z&&
+(j.z=t.z);q.left=i.x;q.right=j.x;q.top=j.y;q.bottom=i.y;q.updateProjectionMatrix()}q=n.shadowMap;u=n.shadowMatrix;y=n.shadowCamera;y.position.getPositionFromMatrix(n.matrixWorld);m.getPositionFromMatrix(n.target.matrixWorld);y.lookAt(m);y.updateMatrixWorld();y.matrixWorldInverse.getInverse(y.matrixWorld);n.cameraHelper&&(n.cameraHelper.visible=n.shadowCameraVisible);n.shadowCameraVisible&&n.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(y.projectionMatrix);u.multiply(y.matrixWorldInverse);
+h.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();D=l.__webglObjects;n=0;for(q=D.length;n<q;n++)if(x=D[n],u=x.object,x.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||g.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,u.matrixWorld),x.render=!0;n=0;for(q=D.length;n<q;n++)x=D[n],x.render&&(u=x.object,x=x.buffer,z=u.material instanceof THREE.MeshFaceMaterial?
+u.material.materials[0]:u.material,t=0<u.geometry.morphTargets.length&&z.morphTargets,z=u instanceof THREE.SkinnedMesh&&z.skinning,t=u.customDepthMaterial?u.customDepthMaterial:z?t?f:e:t?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(y,l.__lights,null,t,x,u):b.renderBuffer(y,l.__lights,null,t,x,u));D=l.__webglObjectsImmediate;n=0;for(q=D.length;n<q;n++)x=D[n],u=x.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(y,
+l.__lights,null,c,u))}r=b.getClearColor();s=b.getClearAlpha();a.clearColor(r.r,r.g,r.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,j,m;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,p=b.createProgram(),r=b.createShader(b.FRAGMENT_SHADER),s=b.createShader(b.VERTEX_SHADER),n="precision "+d+" float;\n";b.shaderSource(r,n+a.fragmentShader);b.shaderSource(s,n+a.vertexShader);b.compileShader(r);b.compileShader(s);b.attachShader(p,r);b.attachShader(p,s);b.linkProgram(p);i=p;j={};m={};j.position=b.getAttribLocation(i,"position");j.uv=b.getAttribLocation(i,
 "uv");m.uvOffset=b.getUniformLocation(i,"uvOffset");m.uvScale=b.getUniformLocation(i,"uvScale");m.rotation=b.getUniformLocation(i,"rotation");m.scale=b.getUniformLocation(i,"scale");m.alignment=b.getUniformLocation(i,"alignment");m.color=b.getUniformLocation(i,"color");m.map=b.getUniformLocation(i,"map");m.opacity=b.getUniformLocation(i,"opacity");m.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");m.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");m.screenPosition=b.getUniformLocation(i,
-"screenPosition");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");m.fogType=b.getUniformLocation(i,"fogType");m.fogDensity=b.getUniformLocation(i,"fogDensity");m.fogNear=b.getUniformLocation(i,"fogNear");m.fogFar=b.getUniformLocation(i,"fogFar");m.fogColor=b.getUniformLocation(i,"fogColor");m.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,s){var n=d.__webglSprites,q=n.length;if(q){var y=k,u=m,x=s/
+"screenPosition");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");m.fogType=b.getUniformLocation(i,"fogType");m.fogDensity=b.getUniformLocation(i,"fogDensity");m.fogNear=b.getUniformLocation(i,"fogNear");m.fogFar=b.getUniformLocation(i,"fogFar");m.fogColor=b.getUniformLocation(i,"fogColor");m.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,s){var n=d.__webglSprites,q=n.length;if(q){var y=j,u=m,x=s/
 f,f=0.5*f,t=0.5*s;b.useProgram(i);b.enableVertexAttribArray(y.position);b.enableVertexAttribArray(y.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(y.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(y.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);var D=y=0,J=d.fog;J?(b.uniform3f(u.fogColor,J.color.r,J.color.g,J.color.b),
 J instanceof THREE.Fog?(b.uniform1f(u.fogNear,J.near),b.uniform1f(u.fogFar,J.far),b.uniform1i(u.fogType,1),D=y=1):J instanceof THREE.FogExp2&&(b.uniform1f(u.fogDensity,J.density),b.uniform1i(u.fogType,2),D=y=2)):(b.uniform1i(u.fogType,0),D=y=0);for(var F,z,H=[],J=0;J<q;J++)F=n[J],z=F.material,F.visible&&0!==z.opacity&&(z.useScreenCoordinates?F.z=-F.position.z:(F._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,F.matrixWorld),F.z=-F._modelViewMatrix.elements[14]));n.sort(a);for(J=0;J<q;J++)F=
 n[J],z=F.material,F.visible&&0!==z.opacity&&(z.map&&z.map.image&&z.map.image.width)&&(b.uniform1f(u.alphaTest,z.alphaTest),!0===z.useScreenCoordinates?(b.uniform1i(u.useScreenCoordinates,1),b.uniform3f(u.screenPosition,(F.position.x*c.devicePixelRatio-f)/f,(t-F.position.y*c.devicePixelRatio)/t,Math.max(0,Math.min(1,F.position.z))),H[0]=c.devicePixelRatio,H[1]=c.devicePixelRatio):(b.uniform1i(u.useScreenCoordinates,0),b.uniform1i(u.sizeAttenuation,z.sizeAttenuation?1:0),b.uniformMatrix4fv(u.modelViewMatrix,
 !1,F._modelViewMatrix.elements),H[0]=1,H[1]=1),e=d.fog&&z.fog?D:0,y!==e&&(b.uniform1i(u.fogType,e),y=e),e=1/(z.scaleByViewport?s:1),H[0]*=e*x*F.scale.x,H[1]*=e*F.scale.y,b.uniform2f(u.uvScale,z.uvScale.x,z.uvScale.y),b.uniform2f(u.uvOffset,z.uvOffset.x,z.uvOffset.y),b.uniform2f(u.alignment,z.alignment.x,z.alignment.y),b.uniform1f(u.opacity,z.opacity),b.uniform3f(u.color,z.color.r,z.color.g,z.color.b),b.uniform1f(u.rotation,F.rotation),b.uniform2fv(u.scale,H),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 m,p,l,r,s,n;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();n=i.__webglObjects;m=0;for(p=n.length;m<p;m++)if(l=n[m],s=l.object,l.render=!1,s.visible&&(!(s instanceof THREE.Mesh||s instanceof THREE.ParticleSystem)||!s.frustumCulled||g.intersectsObject(s)))s._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,s.matrixWorld),l.render=!0;var q;m=0;for(p=n.length;m<p;m++)if(l=n[m],l.render&&(s=l.object,l=l.buffer,!(s instanceof THREE.ParticleSystem)||s.customDepthMaterial))(q=
-s.material instanceof THREE.MeshFaceMaterial?s.material.materials[0]:s.material)&&b.setMaterialFaces(s.material),r=0<s.geometry.morphTargets.length&&q.morphTargets,q=s instanceof THREE.SkinnedMesh&&q.skinning,r=s.customDepthMaterial?s.customDepthMaterial:q?r?f:e:r?d:c,l instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,r,l,s):b.renderBuffer(k,i.__lights,null,r,l,s);n=i.__webglObjectsImmediate;m=0;for(p=n.length;m<p;m++)l=n[m],s=l.object,s.visible&&(s._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
-s.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,s));m=b.getClearColor();p=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,p);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,j){var m,l,p,r,s,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();j.matrixWorldInverse.getInverse(j.matrixWorld);h.multiplyMatrices(j.projectionMatrix,
+j.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();n=i.__webglObjects;m=0;for(l=n.length;m<l;m++)if(p=n[m],s=p.object,p.render=!1,s.visible&&(!(s instanceof THREE.Mesh||s instanceof THREE.ParticleSystem)||!s.frustumCulled||g.intersectsObject(s)))s._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,s.matrixWorld),p.render=!0;var q;m=0;for(l=n.length;m<l;m++)if(p=n[m],p.render&&(s=p.object,p=p.buffer,!(s instanceof THREE.ParticleSystem)||s.customDepthMaterial))(q=
+s.material instanceof THREE.MeshFaceMaterial?s.material.materials[0]:s.material)&&b.setMaterialFaces(s.material),r=0<s.geometry.morphTargets.length&&q.morphTargets,q=s instanceof THREE.SkinnedMesh&&q.skinning,r=s.customDepthMaterial?s.customDepthMaterial:q?r?f:e:r?d:c,p instanceof THREE.BufferGeometry?b.renderBufferDirect(j,i.__lights,null,r,p,s):b.renderBuffer(j,i.__lights,null,r,p,s);n=i.__webglObjectsImmediate;m=0;for(l=n.length;m<l;m++)p=n[m],s=p.object,s.visible&&(s._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,
+s.matrixWorld),b.renderImmediateObject(j,i.__lights,null,c,s));m=b.getClearColor();l=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,l);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}"}};