Mr.doob 12 rokov pred
rodič
commit
b40681f26c
2 zmenil súbory, kde vykonal 62 pridanie a 59 odobranie
  1. 20 18
      build/three.js
  2. 42 41
      build/three.min.js

+ 20 - 18
build/three.js

@@ -4859,18 +4859,18 @@ THREE.Sphere.prototype = {
 		return this;
 	},
 
-	setFromCenterAndPoints: function ( center, points ) {
+	setFromPoints: function ( points ) {
 
-		var maxRadiusSq = 0;
+		var radiusSq, maxRadiusSq = 0;
 
 		for ( var i = 0, il = points.length; i < il; i ++ ) {
 
-			var radiusSq = center.distanceToSquared( points[ i ] );
+			radiusSq = points[ i ].lengthSq();
 			maxRadiusSq = Math.max( maxRadiusSq, radiusSq );
 
 		}
 
-		this.center = center;
+		this.center.set( 0, 0, 0 );
 		this.radius = Math.sqrt( maxRadiusSq );
 
 		return this;
@@ -7781,6 +7781,18 @@ THREE.Geometry.prototype = {
 
 		}
 
+		if ( this.boundingBox instanceof THREE.Box3 ) {
+
+			this.computeBoundingBox();
+
+		}
+
+		if ( this.boundingSphere instanceof THREE.Sphere ) {
+
+			this.computeBoundingSphere();
+
+		}
+
 	},
 
 	computeCentroids: function () {
@@ -8287,7 +8299,7 @@ THREE.Geometry.prototype = {
 
 		}
 
-		this.boundingSphere.setFromCenterAndPoints( this.boundingSphere.center, this.vertices );
+		this.boundingSphere.setFromPoints( this.vertices );
 
 	},
 
@@ -33228,7 +33240,7 @@ THREE.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype );
  * http://www.cs.indiana.edu/pub/techreports/TR425.pdf
  */
 
-THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed, debug ) {
+THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed ) {
 
 	THREE.Geometry.call( this );
 
@@ -33238,8 +33250,6 @@ THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed, d
 	this.radialSegments = radialSegments || 8;
 	this.closed = closed || false;
 
-	if ( debug ) this.debug = new THREE.Object3D();
-
 	this.grid = [];
 
 	var scope = this,
@@ -33292,14 +33302,6 @@ THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed, d
 		normal = normals[ i ];
 		binormal = binormals[ i ];
 
-		if ( this.debug ) {
-
-			this.debug.add( new THREE.ArrowHelper(tangent, pos, radius, 0x0000ff ) );
-			this.debug.add( new THREE.ArrowHelper(normal, pos, radius, 0xff0000 ) );
-			this.debug.add( new THREE.ArrowHelper(binormal, pos, radius, 0x00ff00 ) );
-
-		}
-
 		for ( j = 0; j < this.radialSegments; j++ ) {
 
 			v = j / this.radialSegments * 2 * Math.PI;
@@ -33461,7 +33463,7 @@ THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) {
 
 			vec.normalize();
 
-			theta = Math.acos( tangents[ i-1 ].dot( tangents[ i ] ) );
+			theta = Math.acos( THREE.Math.clamp( tangents[ i-1 ].dot( tangents[ i ] ), -1, 1 ) ); // clamp for floating pt errors
 
 			normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );
 
@@ -33476,7 +33478,7 @@ THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) {
 
 	if ( closed ) {
 
-		theta = Math.acos( normals[ 0 ].dot( normals[ numpoints-1 ] ) );
+		theta = Math.acos( THREE.Math.clamp( normals[ 0 ].dot( normals[ numpoints-1 ] ), -1, 1 ) );
 		theta /= ( numpoints - 1 );
 
 		if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints-1 ] ) ) > 0 ) {

+ 42 - 41
build/three.min.js

@@ -103,7 +103,7 @@ h.x;d.elements[1]/=h.x;d.elements[2]/=h.x;d.elements[4]/=h.y;d.elements[5]/=h.y;
 THREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);
 var d=c.dot(this.direction);return c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){return 0!=a.normal.dot(this.direction)||0==a.distanceToPoint(this.origin)?!0:!1},distanceToPlane:function(a){var b=
 a.normal.dot(this.direction);if(0==b){if(0==a.distanceToPoint(this.origin))return 0}else return-(this.origin.dot(a.normal)+a.constant)/b},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return void 0===c?void 0:this.at(c,b)},applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};
-THREE.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)-
+THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a){for(var b,c=0,d=0,e=a.length;d<e;d++)b=a[d].lengthSq(),c=Math.max(c,b);this.center.set(0,0,0);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 h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[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],h=c[4],g=c[5],i=c[6],j=c[7],l=c[8],p=c[9],m=c[10],q=c[11],t=c[12],n=c[13],r=c[14],c=c[15];b[0].setComponents(f-a,j-h,q-l,c-t).normalize();b[1].setComponents(f+
@@ -165,21 +165,22 @@ THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.
 return a}};THREE.Geometry=function(){this.id=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.normals=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
 this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),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,h=e.vertexNormals.length;f<h;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],h=this.vertices[e.b];a.subVectors(this.vertices[e.c],h);b.subVectors(f,h);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,h,g,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,
-p=new THREE.Vector3,m=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],h=this.vertices[d.c],i.subVectors(h,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],h=this.vertices[d.c],g=this.vertices[d.d],l.subVectors(g,f),j.subVectors(a,f),l.cross(j),e[d.a].add(l),e[d.b].add(l),e[d.d].add(l),p.subVectors(g,h),m.subVectors(f,
-h),p.cross(m),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),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 h=this.morphNormals[a].faceNormals,g=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},h.push(i),g.push(j)}h=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=h.faceNormals[c],j=h.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,y){g=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=h[e];p=h[f];m=h[y];q=i.x-g.x;t=j.x-g.x;n=i.y-g.y;r=j.y-g.y;s=i.z-g.z;v=j.z-g.z;z=p.x-l.x;G=m.x-l.x;C=p.y-l.y;H=m.y-l.y;I=1/(z*H-G*C);B.set((H*q-C*t)*I,(H*n-C*r)*I,(H*s-C*v)*I);J.set((z*
-t-G*q)*I,(z*r-G*n)*I,(z*v-G*s)*I);A[b].add(B);A[c].add(B);A[d].add(B);K[b].add(J);K[c].add(J);K[d].add(J)}var b,c,d,e,f,h,g,i,j,l,p,m,q,t,n,r,s,v,z,G,C,H,I,F,A=[],K=[],B=new THREE.Vector3,J=new THREE.Vector3,N=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)A[b]=new THREE.Vector3,K[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],h=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 w=["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++)M.copy(f.vertexNormals[d]),e=f[w[d]],F=A[e],N.copy(F),N.sub(M.multiplyScalar(M.dot(F))).normalize(),y.crossVectors(f.vertexNormals[d],F),e=y.dot(K[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(N.x,N.y,N.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,h,g,i,j;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],
-d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(h=this.faces.length;f<h;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];g=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(g[i]==g[(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];g=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)g[i]==g[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=d){g.splice(d,
-1);var l=new THREE.Face3(g[0],g[1],g[2],a.normal,a.color,a.materialIndex);g=0;for(i=this.faceVertexUvs.length;g<i;g++)(j=this.faceVertexUvs[g][f])&&j.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(l.vertexNormals=a.vertexNormals,l.vertexNormals.splice(d,1));a.vertexColors&&0<a.vertexColors.length&&(l.vertexColors=a.vertexColors,l.vertexColors.splice(d,1));this.faces[f]=l}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);g=0;for(i=this.faceVertexUvs.length;g<i;g++)this.faceVertexUvs[g].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=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.BufferGeometry=function(){this.id=THREE.Math.generateUUID();this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
+this.faces[c];e.normal.applyMatrix3(b).normalize();for(var f=0,h=e.vertexNormals.length;f<h;f++)e.vertexNormals[f].applyMatrix3(b).normalize();e.centroid.applyMatrix4(a)}this.boundingBox instanceof THREE.Box3&&this.computeBoundingBox();this.boundingSphere instanceof THREE.Sphere&&this.computeBoundingSphere()},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],h=this.vertices[e.b];a.subVectors(this.vertices[e.c],h);b.subVectors(f,h);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,h,g,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,m=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],h=this.vertices[d.c],i.subVectors(h,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],h=this.vertices[d.c],g=this.vertices[d.d],
+l.subVectors(g,f),j.subVectors(a,f),l.cross(j),e[d.a].add(l),e[d.b].add(l),e[d.d].add(l),p.subVectors(g,h),m.subVectors(f,h),p.cross(m),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),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 h=this.morphNormals[a].faceNormals,
+g=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},h.push(i),g.push(j)}h=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=h.faceNormals[c],j=h.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,y){g=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=h[e];p=h[f];m=h[y];q=i.x-
+g.x;t=j.x-g.x;n=i.y-g.y;r=j.y-g.y;s=i.z-g.z;v=j.z-g.z;z=p.x-l.x;G=m.x-l.x;C=p.y-l.y;H=m.y-l.y;I=1/(z*H-G*C);B.set((H*q-C*t)*I,(H*n-C*r)*I,(H*s-C*v)*I);J.set((z*t-G*q)*I,(z*r-G*n)*I,(z*v-G*s)*I);A[b].add(B);A[c].add(B);A[d].add(B);K[b].add(J);K[c].add(J);K[d].add(J)}var b,c,d,e,f,h,g,i,j,l,p,m,q,t,n,r,s,v,z,G,C,H,I,F,A=[],K=[],B=new THREE.Vector3,J=new THREE.Vector3,N=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)A[b]=new THREE.Vector3,K[b]=new THREE.Vector3;
+b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],h=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 w=["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++)M.copy(f.vertexNormals[d]),e=f[w[d]],F=A[e],N.copy(F),N.sub(M.multiplyScalar(M.dot(F))).normalize(),y.crossVectors(f.vertexNormals[d],F),e=y.dot(K[e]),e=0>e?-1:1,f.vertexTangents[d]=
+new THREE.Vector4(N.x,N.y,N.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.setFromPoints(this.vertices)},mergeVertices:function(){var a=
+{},b=[],c=[],d,e=Math.pow(10,4),f,h,g,i,j;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(h=this.faces.length;f<h;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];g=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(g[i]==g[(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];g=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)g[i]==g[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=d){g.splice(d,1);var l=new THREE.Face3(g[0],g[1],g[2],a.normal,a.color,a.materialIndex);g=0;for(i=this.faceVertexUvs.length;g<i;g++)(j=this.faceVertexUvs[g][f])&&j.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(l.vertexNormals=a.vertexNormals,l.vertexNormals.splice(d,1));a.vertexColors&&0<a.vertexColors.length&&(l.vertexColors=a.vertexColors,l.vertexColors.splice(d,1));
+this.faces[f]=l}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);g=0;for(i=this.faceVertexUvs.length;g<i;g++)this.faceVertexUvs[g].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=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,
+e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.BufferGeometry=function(){this.id=THREE.Math.generateUUID();this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,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&&((new THREE.Matrix3).getNormalMatrix(a).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,h=a.length;f<h;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,h=a.length;f<h;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,
@@ -294,7 +295,7 @@ ua).multiplyScalar(0.5),lb=j(ra,ka,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):n
 a=U.vertexNormalsModelView[r],ua.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),Ra.addColors(ka,ua).multiplyScalar(0.5),lb=j(ra,ka,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)))}function d(a,b,c,d,e,f){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.closePath()}function e(a,b,c,d,e,f,h,g){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.lineTo(h,g);y.closePath()}function f(a,b,c,d){q(b);t(c);n(d);r(a.getStyle());y.stroke();va.expandByScalar(2*b)}function h(a){s(a.getStyle());
 y.fill()}function g(a,b,c,d,e,f,g,k,i,j,p,l,m){if(!(m instanceof THREE.DataTexture||void 0===m.image||0==m.image.width)){if(!0===m.needsUpdate){var n=m.wrapS==THREE.RepeatWrapping,q=m.wrapT==THREE.RepeatWrapping;Jb[m.id]=y.createPattern(m.image,!0===n&&!0===q?"repeat":!0===n&&!1===q?"repeat-x":!1===n&&!0===q?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===Jb[m.id]?s("rgba(0,0,0,1)"):s(Jb[m.id]);var n=m.offset.x/m.repeat.x,q=m.offset.y/m.repeat.y,r=m.image.width*m.repeat.x,t=m.image.height*m.repeat.y,
 g=(g+n)*r,k=(1-k+q)*t,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+n)*r-g,j=(1-j+q)*t-k,p=(p+n)*r-g,l=(1-l+q)*t-k,n=i*l-p*j;0===n?(void 0===Ab[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),Ab[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=Ab[m.id],g=4*(Math.floor(g)+Math.floor(k)*m.image.width),ha.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),h(ha)):(n=1/n,m=(l*c-j*e)*n,j=(l*d-j*f)*n,c=(i*e-p*c)*n,d=(i*f-p*d)*n,a=a-
-m*g-c*k,g=b-j*g-d*k,y.save(),y.transform(m,j,c,d,a,g),y.fill(),y.restore())}}function i(a,b,c,d,e,f,h,g,k,i,j,p,m){var l,n;l=m.width-1;n=m.height-1;h*=l;g*=n;c-=a;d-=b;e-=a;f-=b;k=k*l-h;i=i*n-g;j=j*l-h;p=p*n-g;n=1/(k*p-j*i);l=(p*c-i*e)*n;i=(p*d-i*f)*n;c=(k*e-j*c)*n;d=(k*f-j*d)*n;a=a-l*h-c*g;b=b-i*h-d*g;y.save();y.transform(l,i,c,d,a,b);y.clip();y.drawImage(m,0,0);y.restore()}function j(a,b,c,d){Ka[0]=255*a.r|0;Ka[1]=255*a.g|0;Ka[2]=255*a.b|0;Ka[4]=255*b.r|0;Ka[5]=255*b.g|0;Ka[6]=255*b.b|0;Ka[8]=255*
+m*g-c*k,g=b-j*g-d*k,y.save(),y.transform(m,j,c,d,a,g),y.fill(),y.restore())}}function i(a,b,c,d,e,f,h,g,k,i,j,p,l){var m,n;m=l.width-1;n=l.height-1;h*=m;g*=n;c-=a;d-=b;e-=a;f-=b;k=k*m-h;i=i*n-g;j=j*m-h;p=p*n-g;n=1/(k*p-j*i);m=(p*c-i*e)*n;i=(p*d-i*f)*n;c=(k*e-j*c)*n;d=(k*f-j*d)*n;a=a-m*h-c*g;b=b-i*h-d*g;y.save();y.transform(m,i,c,d,a,b);y.clip();y.drawImage(l,0,0);y.restore()}function j(a,b,c,d){Ka[0]=255*a.r|0;Ka[1]=255*a.g|0;Ka[2]=255*a.b|0;Ka[4]=255*b.r|0;Ka[5]=255*b.g|0;Ka[6]=255*b.b|0;Ka[8]=255*
 c.r|0;Ka[9]=255*c.g|0;Ka[10]=255*c.b|0;Ka[12]=255*d.r|0;Ka[13]=255*d.g|0;Ka[14]=255*d.b|0;Bb.putImageData(Kb,0,0);Lb.drawImage(Gb,0,0);return Sb}function l(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function p(a){Z!==a&&(Z=y.globalAlpha=a)}function m(a){L!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(y.globalCompositeOperation=
 "darker"),L=a)}function q(a){Va!==a&&(Va=y.lineWidth=a)}function t(a){O!==a&&(O=y.lineCap=a)}function n(a){qa!==a&&(qa=y.lineJoin=a)}function r(a){oa!==a&&(oa=y.strokeStyle=a)}function s(a){Pa!==a&&(Pa=y.fillStyle=a)}function v(a,b){if(Fa!==a||wa!==b)y.setLineDash([a,b]),Fa=a,wa=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var z=THREE.Math.smoothstep,a=a||{},G=this,C,H,I,F=new THREE.Projector,A=void 0!==a.canvas?a.canvas:document.createElement("canvas"),K,B,J,N,y=A.getContext("2d"),M=new THREE.Color(0),
 w=0,Z=1,L=0,oa=null,Pa=null,Va=null,O=null,qa=null,Fa=null,wa=0,D,V,ea,pa,Ua,pb=new THREE.RenderableVertex,ub=new THREE.RenderableVertex,ya,Ha,fa,da,T,aa,la,Y,ma,xa,bb,ia,ha=new THREE.Color,ra=new THREE.Color,ka=new THREE.Color,ua=new THREE.Color,Ra=new THREE.Color,Qa=new THREE.Color,Ya=new THREE.Color,Xb=new THREE.Color,Jb={},Ab={},Sa,xb,lb,Ga,Ca,yb,Ib,k,Rb,Yb,fb=new THREE.Box2,na=new THREE.Box2,va=new THREE.Box2,ib=new THREE.Color,Tb=new THREE.Color,Ub=new THREE.Color,Xa=new THREE.Vector3,Gb,Bb,
@@ -429,16 +430,16 @@ a.__webglUV2Buffer&&k.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinInd
 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);D.info.memory.geometries--},lc=function(a){a=a.target;a.removeEventListener("dispose",lc);a.image&&a.image.__webglTextureCube?k.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,k.deleteTexture(a.__webglTexture));D.info.memory.textures--},
 mc=function(a){a=a.target;a.removeEventListener("dispose",mc);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);D.info.memory.textures--},uc=function(a){a=a.target;a.removeEventListener("dispose",uc);vc(a)},vc=function(a){var b=a.program;if(void 0!==
 b){a.program=void 0;var c,d,e=!1,a=0;for(c=V.length;a<c;a++)if(d=V[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=V.length;a<c;a++)d=V[a],d.program!==b&&e.push(d);V=e;k.deleteProgram(b);D.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,h,g,i,j,l,p,m,n,q=3*a.count;for(n=0;n<q;n+=9)m=a.normalArray,
-d=m[n],e=m[n+1],f=m[n+2],h=m[n+3],i=m[n+4],l=m[n+5],g=m[n+6],j=m[n+7],p=m[n+8],d=(d+h+g)/3,e=(e+i+j)/3,f=(f+l+p)/3,m[n]=d,m[n+1]=e,m[n+2]=f,m[n+3]=d,m[n+4]=e,m[n+5]=f,m[n+6]=d,m[n+7]=e,m[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.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,p,m,n,q=3*a.count;for(n=0;n<q;n+=9)m=a.normalArray,
+d=m[n],e=m[n+1],f=m[n+2],g=m[n+3],i=m[n+4],l=m[n+5],h=m[n+6],j=m[n+7],p=m[n+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+l+p)/3,m[n]=d,m[n+1]=e,m[n+2]=f,m[n+3]=d,m[n+4]=e,m[n+5]=f,m[n+6]=d,m[n+7]=e,m[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 h,j,l;h=C(a,b,c,d,f);a=h.attributes;b=e.attributes;c=!1;h=16777215*e.id+
-2*h.id+(d.wireframe?1:0);h!==ub&&(ub=h,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&&(h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,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);D.info.render.calls++;D.info.render.vertices+=e[m].count;
-D.info.render.faces+=e[m].count/3}}else{if(c)for(j in b)"index"!==j&&(h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,l,k.FLOAT,!1,0,0)));j=e.attributes.position;k.drawArrays(k.TRIANGLES,0,j.numItems/3);D.info.render.calls++;D.info.render.vertices+=j.numItems/3;D.info.render.faces+=j.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(j in b)h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,
+2*h.id+(d.wireframe?1:0);h!==ub&&(ub=h,c=!0);c&&i();if(f instanceof THREE.Mesh)if(d=b.index){e=e.offsets;1<e.length&&(c=!0);for(var p=0,m=e.length;p<m;p++){var n=e[p].index;if(c){for(j in b)"index"!==j&&(h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,l,k.FLOAT,!1,0,4*n*l)));k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,d.buffer)}k.drawElements(k.TRIANGLES,e[p].count,k.UNSIGNED_SHORT,2*e[p].start);D.info.render.calls++;D.info.render.vertices+=e[p].count;
+D.info.render.faces+=e[p].count/3}}else{if(c)for(j in b)"index"!==j&&(h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,l,k.FLOAT,!1,0,0)));j=e.attributes.position;k.drawArrays(k.TRIANGLES,0,j.numItems/3);D.info.render.calls++;D.info.render.vertices+=j.numItems/3;D.info.render.faces+=j.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(j in b)h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,
 l,k.FLOAT,!1,0,0));j=b.position;k.drawArrays(k.POINTS,0,j.numItems/3);D.info.render.calls++;D.info.render.points+=j.numItems/3}}else if(f instanceof THREE.Line&&c){for(j in b)h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,l,k.FLOAT,!1,0,0));A(d.linewidth);j=b.position;k.drawArrays(k.LINE_STRIP,0,j.numItems/3);D.info.render.calls++;D.info.render.points+=j.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var h,j,c=C(a,b,c,d,
 f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ub&&(ub=c,b=!0);b&&i();if(!d.morphTargets&&0<=a.position)b&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),g(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]),g(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):0<=c.position&&(k.bindBuffer(k.ARRAY_BUFFER,
-e.__webglVertexBuffer),g(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<j.length;)0<=c["morphTarget"+m]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[m]]),g(c["morphTarget"+m]),k.vertexAttribPointer(c["morphTarget"+m],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[m]]),
-g(c["morphNormal"+m]),k.vertexAttribPointer(c["morphNormal"+m],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=h[j[m]],m++}else{j=[];h=f.morphTargetInfluences;var p,n=h.length;for(p=0;p<n;p++)m=h[p],0<m&&j.push([m,p]);j.length>d.numSupportedMorphTargets?(j.sort(l),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(l):0===j.length&&j.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)j[m]?(p=j[m][1],0<=c["morphTarget"+m]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[p]),
-g(c["morphTarget"+m]),k.vertexAttribPointer(c["morphTarget"+m],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[p]),g(c["morphNormal"+m]),k.vertexAttribPointer(c["morphNormal"+m],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=h[p]):f.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){h=
+e.__webglVertexBuffer),g(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var p=0;j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;p<d.numSupportedMorphTargets&&p<j.length;)0<=c["morphTarget"+p]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[p]]),g(c["morphTarget"+p]),k.vertexAttribPointer(c["morphTarget"+p],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[p]]),
+g(c["morphNormal"+p]),k.vertexAttribPointer(c["morphNormal"+p],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=h[j[p]],p++}else{j=[];h=f.morphTargetInfluences;var m,n=h.length;for(m=0;m<n;m++)p=h[m],0<p&&j.push([p,m]);j.length>d.numSupportedMorphTargets?(j.sort(l),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(l):0===j.length&&j.push([0,0]);for(p=0;p<d.numSupportedMorphTargets;)j[p]?(m=j[p][1],0<=c["morphTarget"+p]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m]),
+g(c["morphTarget"+p]),k.vertexAttribPointer(c["morphTarget"+p],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[m]),g(c["morphNormal"+p]),k.vertexAttribPointer(c["morphNormal"+p],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=h[m]):f.__webglMorphTargetInfluences[p]=0,p++}null!==d.program.uniforms.morphTargetInfluences&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){h=
 0;for(j=e.__webglCustomAttributesList.length;h<j;h++)c=e.__webglCustomAttributesList[h],0<=a[c.buffer.belongsToAttribute]&&(k.bindBuffer(k.ARRAY_BUFFER,c.buffer),g(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),g(a.color),k.vertexAttribPointer(a.color,3,k.FLOAT,!1,0,0));0<=a.normal&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer),g(a.normal),k.vertexAttribPointer(a.normal,
 3,k.FLOAT,!1,0,0));0<=a.tangent&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglTangentBuffer),g(a.tangent),k.vertexAttribPointer(a.tangent,4,k.FLOAT,!1,0,0));0<=a.uv&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer),g(a.uv),k.vertexAttribPointer(a.uv,2,k.FLOAT,!1,0,0));0<=a.uv2&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer),g(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),g(a.skinIndex),k.vertexAttribPointer(a.skinIndex,
 4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g(a.skinWeight),k.vertexAttribPointer(a.skinWeight,4,k.FLOAT,!1,0,0));0<=a.lineDistance&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglLineDistanceBuffer),g(a.lineDistance),k.vertexAttribPointer(a.lineDistance,1,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(A(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,
@@ -450,8 +451,8 @@ Ga.applyProjection(xb),f.z=Ga.z))}this.sortObjects&&g.sort(j);g=a.__webglObjects
 this.setDepthWrite(d.depthWrite),K(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,i,l,!0,d),q(a.__webglObjectsImmediate,"",b,i,l,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(a.__webglObjects,!0,"opaque",b,i,l,!1,d),q(a.__webglObjectsImmediate,"opaque",b,i,l,!1,d),m(a.__webglObjects,!1,"transparent",b,i,l,!0,d),q(a.__webglObjectsImmediate,"transparent",b,i,l,!0,d));p(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=C(a,b,c,d,e);ub=-1;D.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,
 k,Sa):e.render(function(a){D.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)t(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)v(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,c=a.__webglObjects.length;b<c;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&
-v(g,a),t(g,a));var i=g,j=i.geometry,m=void 0,p=void 0,n=void 0;if(j instanceof THREE.BufferGeometry){var q=k.DYNAMIC_DRAW,w=!j.dynamic,z=j.attributes,y=void 0,A=void 0;for(y in z)A=z[y],A.needsUpdate&&("index"===y?(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,A.buffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,A.array,q)):(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,q)),A.needsUpdate=!1),w&&!A.dynamic&&delete A.array}else if(i instanceof THREE.Mesh){for(var B=0,G=j.geometryGroupsList.length;B<
-G;B++)if(m=j.geometryGroupsList[B],n=e(i,m),j.buffersNeedUpdate&&d(m,i),p=n.attributes&&r(n),j.verticesNeedUpdate||j.morphTargetsNeedUpdate||j.elementsNeedUpdate||j.uvsNeedUpdate||j.normalsNeedUpdate||j.colorsNeedUpdate||j.tangentsNeedUpdate||p){var C=m,F=i,H=k.DYNAMIC_DRAW,I=!j.dynamic,J=n;if(C.__inittedArrays){var V=f(J),K=J.vertexColors?J.vertexColors:!1,L=h(J),M=V===THREE.SmoothShading,E=void 0,D=void 0,N=void 0,Q=void 0,O=void 0,ea=void 0,T=void 0,Y=void 0,pa=void 0,fa=void 0,aa=void 0,R=void 0,
+v(g,a),t(g,a));var i=g,j=i.geometry,p=void 0,m=void 0,n=void 0;if(j instanceof THREE.BufferGeometry){var q=k.DYNAMIC_DRAW,w=!j.dynamic,z=j.attributes,y=void 0,A=void 0;for(y in z)A=z[y],A.needsUpdate&&("index"===y?(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,A.buffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,A.array,q)):(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,q)),A.needsUpdate=!1),w&&!A.dynamic&&delete A.array}else if(i instanceof THREE.Mesh){for(var B=0,G=j.geometryGroupsList.length;B<
+G;B++)if(p=j.geometryGroupsList[B],n=e(i,p),j.buffersNeedUpdate&&d(p,i),m=n.attributes&&r(n),j.verticesNeedUpdate||j.morphTargetsNeedUpdate||j.elementsNeedUpdate||j.uvsNeedUpdate||j.normalsNeedUpdate||j.colorsNeedUpdate||j.tangentsNeedUpdate||m){var C=p,F=i,H=k.DYNAMIC_DRAW,I=!j.dynamic,J=n;if(C.__inittedArrays){var V=f(J),K=J.vertexColors?J.vertexColors:!1,L=h(J),M=V===THREE.SmoothShading,E=void 0,D=void 0,N=void 0,Q=void 0,O=void 0,ea=void 0,T=void 0,Y=void 0,pa=void 0,fa=void 0,aa=void 0,R=void 0,
 S=void 0,P=void 0,ba=void 0,Z=void 0,da=void 0,ya=void 0,ma=void 0,Ha=void 0,ha=void 0,Ua=void 0,qa=void 0,la=void 0,ia=void 0,ka=void 0,ua=void 0,na=void 0,oa=void 0,ra=void 0,Ca=void 0,va=void 0,wa=void 0,xa=void 0,pb=void 0,za=void 0,ub=void 0,Fa=void 0,Pa=void 0,Ra=void 0,cb=void 0,bb=void 0,$a=void 0,ab=void 0,Va=void 0,Qa=void 0,Ta=0,Za=0,Xa=0,Ya=0,Ka=0,jb=0,Da=0,ob=0,Wa=0,X=0,ga=0,x=0,Aa=void 0,db=C.__vertexArray,fb=C.__uvArray,ib=C.__uv2Array,Sa=C.__normalArray,La=C.__tangentArray,eb=C.__colorArray,
 Ma=C.__skinIndexArray,Na=C.__skinWeightArray,yb=C.__morphTargetsArrays,Ab=C.__morphNormalsArrays,Bb=C.__webglCustomAttributesList,u=void 0,Mb=C.__faceArray,wb=C.__lineArray,qb=F.geometry,Gb=qb.elementsNeedUpdate,Hb=qb.uvsNeedUpdate,Rb=qb.normalsNeedUpdate,Sb=qb.tangentsNeedUpdate,Xb=qb.colorsNeedUpdate,Yb=qb.morphTargetsNeedUpdate,cc=qb.vertices,sa=C.faces3,ta=C.faces4,kb=qb.faces,Jb=qb.faceVertexUvs[0],Lb=qb.faceVertexUvs[1],dc=qb.skinIndices,$b=qb.skinWeights,ac=qb.morphTargets,Ib=qb.morphNormals;
 if(qb.verticesNeedUpdate){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],R=cc[Q.a],S=cc[Q.b],P=cc[Q.c],db[Za]=R.x,db[Za+1]=R.y,db[Za+2]=R.z,db[Za+3]=S.x,db[Za+4]=S.y,db[Za+5]=S.z,db[Za+6]=P.x,db[Za+7]=P.y,db[Za+8]=P.z,Za+=9;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],R=cc[Q.a],S=cc[Q.b],P=cc[Q.c],ba=cc[Q.d],db[Za]=R.x,db[Za+1]=R.y,db[Za+2]=R.z,db[Za+3]=S.x,db[Za+4]=S.y,db[Za+5]=S.z,db[Za+6]=P.x,db[Za+7]=P.y,db[Za+8]=P.z,db[Za+9]=ba.x,db[Za+10]=ba.y,db[Za+11]=ba.z,Za+=12;k.bindBuffer(k.ARRAY_BUFFER,C.__webglVertexBuffer);
@@ -478,25 +479,25 @@ S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[
 15]=ba.w,x+=16}else if("faces"===u.boundTo){E=0;for(D=sa.length;E<D;E++)P=S=R=Aa=u.value[sa[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,x+=12;E=0;for(D=ta.length;E<D;E++)ba=P=S=R=Aa=u.value[ta[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+
 8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,u.array[x+12]=ba.x,u.array[x+13]=ba.y,u.array[x+14]=ba.z,u.array[x+15]=ba.w,x+=16}else if("faceVertices"===u.boundTo){E=0;for(D=sa.length;E<D;E++)Aa=u.value[sa[E]],R=Aa[0],S=Aa[1],P=Aa[2],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,x+=12;E=0;for(D=ta.length;E<D;E++)Aa=u.value[ta[E]],
 R=Aa[0],S=Aa[1],P=Aa[2],ba=Aa[3],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,u.array[x+12]=ba.x,u.array[x+13]=ba.y,u.array[x+14]=ba.z,u.array[x+15]=ba.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,u.buffer);k.bufferData(k.ARRAY_BUFFER,u.array,H)}}I&&(delete C.__inittedArrays,delete C.__colorArray,delete C.__normalArray,delete C.__tangentArray,delete C.__uvArray,
-delete C.__uv2Array,delete C.__faceArray,delete C.__vertexArray,delete C.__lineArray,delete C.__skinIndexArray,delete C.__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&&s(n)}else if(i instanceof THREE.Ribbon){n=e(i,j);p=n.attributes&&r(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.normalsNeedUpdate||p){var Cb=j,Kb=k.DYNAMIC_DRAW,
+delete C.__uv2Array,delete C.__faceArray,delete C.__vertexArray,delete C.__lineArray,delete C.__skinIndexArray,delete C.__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&&s(n)}else if(i instanceof THREE.Ribbon){n=e(i,j);m=n.attributes&&r(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.normalsNeedUpdate||m){var Cb=j,Kb=k.DYNAMIC_DRAW,
 nc=void 0,oc=void 0,pc=void 0,Tb=void 0,Ba=void 0,Ub=void 0,xc=void 0,yc=void 0,jc=void 0,gb=void 0,gc=void 0,Ia=void 0,rb=void 0,kc=Cb.vertices,lc=Cb.colors,mc=Cb.normals,uc=kc.length,vc=lc.length,Yc=mc.length,zc=Cb.__vertexArray,Ac=Cb.__colorArray,Bc=Cb.__normalArray,Zc=Cb.colorsNeedUpdate,$c=Cb.normalsNeedUpdate,Lc=Cb.__webglCustomAttributesList;if(Cb.verticesNeedUpdate){for(nc=0;nc<uc;nc++)Tb=kc[nc],Ba=3*nc,zc[Ba]=Tb.x,zc[Ba+1]=Tb.y,zc[Ba+2]=Tb.z;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglVertexBuffer);
 k.bufferData(k.ARRAY_BUFFER,zc,Kb)}if(Zc){for(oc=0;oc<vc;oc++)Ub=lc[oc],Ba=3*oc,Ac[Ba]=Ub.r,Ac[Ba+1]=Ub.g,Ac[Ba+2]=Ub.b;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Ac,Kb)}if($c){for(pc=0;pc<Yc;pc++)xc=mc[pc],Ba=3*pc,Bc[Ba]=xc.x,Bc[Ba+1]=xc.y,Bc[Ba+2]=xc.z;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,Bc,Kb)}if(Lc){yc=0;for(jc=Lc.length;yc<jc;yc++)if(Ia=Lc[yc],Ia.needsUpdate&&(void 0===Ia.boundTo||"vertices"===Ia.boundTo)){Ba=0;gc=
 Ia.value.length;if(1===Ia.size)for(gb=0;gb<gc;gb++)Ia.array[gb]=Ia.value[gb];else if(2===Ia.size)for(gb=0;gb<gc;gb++)rb=Ia.value[gb],Ia.array[Ba]=rb.x,Ia.array[Ba+1]=rb.y,Ba+=2;else if(3===Ia.size)if("c"===Ia.type)for(gb=0;gb<gc;gb++)rb=Ia.value[gb],Ia.array[Ba]=rb.r,Ia.array[Ba+1]=rb.g,Ia.array[Ba+2]=rb.b,Ba+=3;else for(gb=0;gb<gc;gb++)rb=Ia.value[gb],Ia.array[Ba]=rb.x,Ia.array[Ba+1]=rb.y,Ia.array[Ba+2]=rb.z,Ba+=3;else if(4===Ia.size)for(gb=0;gb<gc;gb++)rb=Ia.value[gb],Ia.array[Ba]=rb.x,Ia.array[Ba+
-1]=rb.y,Ia.array[Ba+2]=rb.z,Ia.array[Ba+3]=rb.w,Ba+=4;k.bindBuffer(k.ARRAY_BUFFER,Ia.buffer);k.bufferData(k.ARRAY_BUFFER,Ia.array,Kb)}}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;j.normalsNeedUpdate=!1;n.attributes&&s(n)}else if(i instanceof THREE.Line){n=e(i,j);p=n.attributes&&r(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.lineDistancesNeedUpdate||p){var Db=j,Cc=k.DYNAMIC_DRAW,qc=void 0,rc=void 0,sc=void 0,Dc=void 0,Oa=void 0,Ec=void 0,Qc=Db.vertices,Rc=Db.colors,Sc=Db.lineDistances,ad=Qc.length,
+1]=rb.y,Ia.array[Ba+2]=rb.z,Ia.array[Ba+3]=rb.w,Ba+=4;k.bindBuffer(k.ARRAY_BUFFER,Ia.buffer);k.bufferData(k.ARRAY_BUFFER,Ia.array,Kb)}}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;j.normalsNeedUpdate=!1;n.attributes&&s(n)}else if(i instanceof THREE.Line){n=e(i,j);m=n.attributes&&r(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.lineDistancesNeedUpdate||m){var Db=j,Cc=k.DYNAMIC_DRAW,qc=void 0,rc=void 0,sc=void 0,Dc=void 0,Oa=void 0,Ec=void 0,Qc=Db.vertices,Rc=Db.colors,Sc=Db.lineDistances,ad=Qc.length,
 bd=Rc.length,cd=Sc.length,Fc=Db.__vertexArray,Gc=Db.__colorArray,Tc=Db.__lineDistanceArray,dd=Db.colorsNeedUpdate,ed=Db.lineDistancesNeedUpdate,Mc=Db.__webglCustomAttributesList,Hc=void 0,Uc=void 0,hb=void 0,hc=void 0,sb=void 0,Ja=void 0;if(Db.verticesNeedUpdate){for(qc=0;qc<ad;qc++)Dc=Qc[qc],Oa=3*qc,Fc[Oa]=Dc.x,Fc[Oa+1]=Dc.y,Fc[Oa+2]=Dc.z;k.bindBuffer(k.ARRAY_BUFFER,Db.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Fc,Cc)}if(dd){for(rc=0;rc<bd;rc++)Ec=Rc[rc],Oa=3*rc,Gc[Oa]=Ec.r,Gc[Oa+1]=Ec.g,Gc[Oa+
 2]=Ec.b;k.bindBuffer(k.ARRAY_BUFFER,Db.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Gc,Cc)}if(ed){for(sc=0;sc<cd;sc++)Tc[sc]=Sc[sc];k.bindBuffer(k.ARRAY_BUFFER,Db.__webglLineDistanceBuffer);k.bufferData(k.ARRAY_BUFFER,Tc,Cc)}if(Mc){Hc=0;for(Uc=Mc.length;Hc<Uc;Hc++)if(Ja=Mc[Hc],Ja.needsUpdate&&(void 0===Ja.boundTo||"vertices"===Ja.boundTo)){Oa=0;hc=Ja.value.length;if(1===Ja.size)for(hb=0;hb<hc;hb++)Ja.array[hb]=Ja.value[hb];else if(2===Ja.size)for(hb=0;hb<hc;hb++)sb=Ja.value[hb],Ja.array[Oa]=sb.x,
 Ja.array[Oa+1]=sb.y,Oa+=2;else if(3===Ja.size)if("c"===Ja.type)for(hb=0;hb<hc;hb++)sb=Ja.value[hb],Ja.array[Oa]=sb.r,Ja.array[Oa+1]=sb.g,Ja.array[Oa+2]=sb.b,Oa+=3;else for(hb=0;hb<hc;hb++)sb=Ja.value[hb],Ja.array[Oa]=sb.x,Ja.array[Oa+1]=sb.y,Ja.array[Oa+2]=sb.z,Oa+=3;else if(4===Ja.size)for(hb=0;hb<hc;hb++)sb=Ja.value[hb],Ja.array[Oa]=sb.x,Ja.array[Oa+1]=sb.y,Ja.array[Oa+2]=sb.z,Ja.array[Oa+3]=sb.w,Oa+=4;k.bindBuffer(k.ARRAY_BUFFER,Ja.buffer);k.bufferData(k.ARRAY_BUFFER,Ja.array,Cc)}}}j.verticesNeedUpdate=
-!1;j.colorsNeedUpdate=!1;j.lineDistancesNeedUpdate=!1;n.attributes&&s(n)}else if(i instanceof THREE.ParticleSystem){n=e(i,j);p=n.attributes&&r(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||i.sortParticles||p){var Nb=j,Nc=k.DYNAMIC_DRAW,tc=i,tb=void 0,Ob=void 0,Pb=void 0,ca=void 0,Qb=void 0,bc=void 0,Ic=Nb.vertices,Oc=Ic.length,Pc=Nb.colors,Vc=Pc.length,ec=Nb.__vertexArray,fc=Nb.__colorArray,Vb=Nb.__sortArray,Wc=Nb.verticesNeedUpdate,Xc=Nb.colorsNeedUpdate,Wb=Nb.__webglCustomAttributesList,Eb=void 0,
+!1;j.colorsNeedUpdate=!1;j.lineDistancesNeedUpdate=!1;n.attributes&&s(n)}else if(i instanceof THREE.ParticleSystem){n=e(i,j);m=n.attributes&&r(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||i.sortParticles||m){var Nb=j,Nc=k.DYNAMIC_DRAW,tc=i,tb=void 0,Ob=void 0,Pb=void 0,ca=void 0,Qb=void 0,bc=void 0,Ic=Nb.vertices,Oc=Ic.length,Pc=Nb.colors,Vc=Pc.length,ec=Nb.__vertexArray,fc=Nb.__colorArray,Vb=Nb.__sortArray,Wc=Nb.verticesNeedUpdate,Xc=Nb.colorsNeedUpdate,Wb=Nb.__webglCustomAttributesList,Eb=void 0,
 ic=void 0,ja=void 0,Fb=void 0,Ea=void 0,$=void 0;if(tc.sortParticles){lb.copy(xb);lb.multiply(tc.matrixWorld);for(tb=0;tb<Oc;tb++)Pb=Ic[tb],Ga.copy(Pb),Ga.applyProjection(lb),Vb[tb]=[Ga.z,tb];Vb.sort(l);for(tb=0;tb<Oc;tb++)Pb=Ic[Vb[tb][1]],ca=3*tb,ec[ca]=Pb.x,ec[ca+1]=Pb.y,ec[ca+2]=Pb.z;for(Ob=0;Ob<Vc;Ob++)ca=3*Ob,bc=Pc[Vb[Ob][1]],fc[ca]=bc.r,fc[ca+1]=bc.g,fc[ca+2]=bc.b;if(Wb){Eb=0;for(ic=Wb.length;Eb<ic;Eb++)if($=Wb[Eb],void 0===$.boundTo||"vertices"===$.boundTo)if(ca=0,Fb=$.value.length,1===$.size)for(ja=
 0;ja<Fb;ja++)Qb=Vb[ja][1],$.array[ja]=$.value[Qb];else if(2===$.size)for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,ca+=2;else if(3===$.size)if("c"===$.type)for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.r,$.array[ca+1]=Ea.g,$.array[ca+2]=Ea.b,ca+=3;else for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,ca+=3;else if(4===$.size)for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.x,
 $.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,$.array[ca+3]=Ea.w,ca+=4}}else{if(Wc)for(tb=0;tb<Oc;tb++)Pb=Ic[tb],ca=3*tb,ec[ca]=Pb.x,ec[ca+1]=Pb.y,ec[ca+2]=Pb.z;if(Xc)for(Ob=0;Ob<Vc;Ob++)bc=Pc[Ob],ca=3*Ob,fc[ca]=bc.r,fc[ca+1]=bc.g,fc[ca+2]=bc.b;if(Wb){Eb=0;for(ic=Wb.length;Eb<ic;Eb++)if($=Wb[Eb],$.needsUpdate&&(void 0===$.boundTo||"vertices"===$.boundTo))if(Fb=$.value.length,ca=0,1===$.size)for(ja=0;ja<Fb;ja++)$.array[ja]=$.value[ja];else if(2===$.size)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,
 $.array[ca+1]=Ea.y,ca+=2;else if(3===$.size)if("c"===$.type)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.r,$.array[ca+1]=Ea.g,$.array[ca+2]=Ea.b,ca+=3;else for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,ca+=3;else if(4===$.size)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,$.array[ca+3]=Ea.w,ca+=4}}if(Wc||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,ec,Nc);
-if(Xc||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,fc,Nc);if(Wb){Eb=0;for(ic=Wb.length;Eb<ic;Eb++)if($=Wb[Eb],$.needsUpdate||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,$.buffer),k.bufferData(k.ARRAY_BUFFER,$.array,Nc)}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;n.attributes&&s(n)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",uc);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=h=r=s=n=0;for(f=b.length;e<f;e++)q=
-b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&h++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&n++);e=h;f=r;h=s;g=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;Bb&&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,
+if(Xc||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,fc,Nc);if(Wb){Eb=0;for(ic=Wb.length;Eb<ic;Eb++)if($=Wb[Eb],$.needsUpdate||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,$.buffer),k.bufferData(k.ARRAY_BUFFER,$.array,Nc)}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;n.attributes&&s(n)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",uc);var i,j,l,p,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?
+m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var q,r,s;e=h=r=s=n=0;for(f=b.length;e<f;e++)q=
+b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&h++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&n++);e=h;f=r;h=s;g=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++);p=q;Bb&&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:Bb&&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:h,maxHemiLights:g,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,v,w,d=[];p?d.push(p):(d.push(s),d.push(r));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);p=d.join();t=0;for(v=V.length;t<v;t++)if(d=V[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");v=[];for(w in q)d=
+useVertexTexture:Bb&&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:h,maxHemiLights:g,maxShadows:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,
+metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,w,d=[];m?d.push(m):(d.push(s),d.push(r));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);m=d.join();t=0;for(v=V.length;t<v;t++)if(d=V[t],d.code===m){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");v=[];for(w in q)d=
 q[w],!1!==d&&(d="#define "+w+" "+d,v.push(d));d=v.join("\n");w=k.createProgram();v=["precision "+L+" float;",d,Gb?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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");
@@ -504,7 +505,7 @@ t=["precision "+L+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_d
 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");v=J("vertex",v+r);t=J("fragment",t+s);k.attachShader(w,v);k.attachShader(w,t);k.linkProgram(w);k.getProgramParameter(w,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(w,k.VALIDATE_STATUS)+", gl error ["+
 k.getError()+"]");k.deleteShader(t);k.deleteShader(v);w.uniforms={};w.attributes={};var z;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(z in n)t.push(z);z=t;t=0;for(v=z.length;t<v;t++)n=z[t],w.uniforms[n]=k.getUniformLocation(w,n);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(z=0;z<c.maxMorphTargets;z++)t.push("morphTarget"+
-z);for(z=0;z<c.maxMorphNormals;z++)t.push("morphNormal"+z);for(j in b)t.push(j);j=t;z=0;for(b=j.length;z<b;z++)t=j[z],w.attributes[t]=k.getAttribLocation(w,t);w.id=ea++;V.push({program:w,code:p,usedTimes:1});D.info.memory.programs=V.length;j=w}a.program=j;z=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(j=0;j<this.maxMorphTargets;j++)w=b+j,0<=z[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(j=0;j<this.maxMorphNormals;j++)w=
+z);for(z=0;z<c.maxMorphNormals;z++)t.push("morphNormal"+z);for(j in b)t.push(j);j=t;z=0;for(b=j.length;z<b;z++)t=j[z],w.attributes[t]=k.getAttribLocation(w,t);w.id=ea++;V.push({program:w,code:m,usedTimes:1});D.info.memory.programs=V.length;j=w}a.program=j;z=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(j=0;j<this.maxMorphTargets;j++)w=b+j,0<=z[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(j=0;j<this.maxMorphNormals;j++)w=
 b+j,0<=z[w]&&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;da!==
 b&&(b?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),da=b);T!==a&&(a?k.frontFace(k.CW):k.frontFace(k.CCW),T=a)};this.setDepthTest=function(a){xa!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),xa=a)};this.setDepthWrite=function(a){bb!==a&&(k.depthMask(a),bb=a)};this.setBlending=function(a,b,c,d){a!==aa&&(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)),aa=a);if(a===THREE.CustomBlending){if(b!==la&&(k.blendEquation(w(b)),la=b),c!==Y||d!==ma)k.blendFunc(w(c),w(d)),Y=c,ma=d}else ma=Y=
@@ -616,7 +617,7 @@ t,n,r,[s,v,z,G]));this.faceVertexUvs[0].push([C,H,I,F])}}if(!1===f&&0<a){this.ve
 t=j[i][g],n=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),C=l[i][g+1].clone(),H=l[i][g].clone(),I=new THREE.Vector2(H.u,1),this.faces.push(new THREE.Face3(q,t,n,[s,v,z])),this.faceVertexUvs[0].push([C,H,I])}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(O=c.length;0<=--O;){e=O;f=O-1;0>f&&(f=c.length-1);for(var g=0,h=q+2*l,
-g=0;g<h;g++){var i=oa*g,j=oa*(g+1),m=d+e+i,i=d+f+i,p=d+f+j,j=d+e+j,n=c,r=g,s=h,t=e,w=f,m=m+J,i=i+J,p=p+J,j=j+J;B.faces.push(new THREE.Face4(m,i,p,j,null,null,v));m=z.generateSideWallUV(B,a,n,b,m,i,p,j,r,s,t,w);B.faceVertexUvs[0].push(m)}}}function f(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=J;d+=J;e+=J;B.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?z.generateBottomUV(B,a,b,c,d,e):z.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
+g=0;g<h;g++){var i=oa*g,j=oa*(g+1),p=d+e+i,i=d+f+i,m=d+f+j,j=d+e+j,n=c,r=g,s=h,t=e,w=f,p=p+J,i=i+J,m=m+J,j=j+J;B.faces.push(new THREE.Face4(p,i,m,j,null,null,v));p=z.generateSideWallUV(B,a,n,b,p,i,m,j,r,s,t,w);B.faceVertexUvs[0].push(p)}}}function f(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=J;d+=J;e+=J;B.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?z.generateBottomUV(B,a,b,c,d,e):z.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
 100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,t=b.extrudePath,n,r=!1,s=b.material,v=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,G,C,H,I;t&&(n=t.getSpacedPoints(q),r=!0,p=!1,G=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,q,
 !1),C=new THREE.Vector3,H=new THREE.Vector3,I=new THREE.Vector3);p||(j=i=l=0);var F,A,K,B=this,J=this.vertices.length,m=a.extractPoints(m),N=m.shape,m=m.holes;if(t=!THREE.Shape.Utils.isClockWise(N)){N=N.reverse();A=0;for(K=m.length;A<K;A++)F=m[A],THREE.Shape.Utils.isClockWise(F)&&(m[A]=F.reverse());t=!1}var y=THREE.Shape.Utils.triangulateShape(N,m),t=N;A=0;for(K=m.length;A<K;A++)F=m[A],N=N.concat(F);var M,w,Z,L,oa=N.length,Pa=y.length,Va=[],O=0,qa=t.length;M=qa-1;for(w=O+1;O<qa;O++,M++,w++)M===qa&&
 (M=0),w===qa&&(w=0),Va[O]=d(t[O],t[M],t[w]);var Fa=[],wa,D=Va.concat();A=0;for(K=m.length;A<K;A++){F=m[A];wa=[];O=0;qa=F.length;M=qa-1;for(w=O+1;O<qa;O++,M++,w++)M===qa&&(M=0),w===qa&&(w=0),wa[O]=d(F[O],F[M],F[w]);Fa.push(wa);D=D.concat(wa)}for(M=0;M<l;M++){F=M/l;Z=i*(1-F);w=j*Math.sin(F*Math.PI/2);O=0;for(qa=t.length;O<qa;O++)L=c(t[O],Va[O],w),f(L.x,L.y,-Z);A=0;for(K=m.length;A<K;A++){F=m[A];wa=Fa[A];O=0;for(qa=F.length;O<qa;O++)L=c(F[O],wa[O],w),f(L.x,L.y,-Z)}}w=j;for(O=0;O<oa;O++)L=p?c(N[O],D[O],
@@ -636,12 +637,12 @@ Math.cos(h))*Math.sin(f);g.z=this.tube*Math.sin(h);this.vertices.push(g);a.push(
 i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[h].clone(),a[g].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,h){function g(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=h||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,h=2*(b/this.tubularSegments)*Math.PI,f=g(i,h,this.q,this.p,this.radius,this.heightScale),i=g(i+0.01,h,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(h);h=this.tube*Math.sin(h);f.x+=i*d.x+h*e.x;f.y+=i*d.y+h*e.y;f.z+=i*d.z+h*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],h=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),l=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
-d,e,f));this.faceVertexUvs[0].push([h,i,j,l])}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.radialSegments=d||8;this.closed=e||!1;f&&(this.debug=new THREE.Object3D);this.grid=[];var h,g,e=this.segments+1,i,j,l,f=new THREE.Vector3,p,m,q,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);p=b.tangents;m=b.normals;q=b.binormals;this.tangents=p;this.normals=m;this.binormals=q;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);l=a.getPointAt(d);d=p[b];h=m[b];
-g=q[b];this.debug&&(this.debug.add(new THREE.ArrowHelper(d,l,c,255)),this.debug.add(new THREE.ArrowHelper(h,l,c,16711680)),this.debug.add(new THREE.ArrowHelper(g,l,c,65280)));for(d=0;d<this.radialSegments;d++)i=2*(d/this.radialSegments)*Math.PI,j=-this.radius*Math.cos(i),i=this.radius*Math.sin(i),f.copy(l),f.x+=j*h.x+i*g.x,f.y+=j*h.y+i*g.y,f.z+=j*h.z+i*g.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.radialSegments;d++)e=this.closed?
-(b+1)%this.segments:b+1,f=(d+1)%this.radialSegments,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.radialSegments),m=new THREE.Vector2((b+1)/this.segments,d/this.radialSegments),q=new THREE.Vector2((b+1)/this.segments,(d+1)/this.radialSegments),h=new THREE.Vector2(b/this.segments,(d+1)/this.radialSegments),this.faces.push(new THREE.Face4(a,c,e,f)),this.faceVertexUvs[0].push([p,m,q,h]);this.computeCentroids();this.computeFaceNormals();
-this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
+d,e,f));this.faceVertexUvs[0].push([h,i,j,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radialSegments=d||8;this.closed=e||!1;this.grid=[];var f,h,d=this.segments+1,g,i,j,e=new THREE.Vector3,l,p,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);l=b.normals;p=b.binormals;this.tangents=b.tangents;this.normals=l;this.binormals=p;for(b=0;b<d;b++){this.grid[b]=[];c=b/(d-1);j=a.getPointAt(c);f=l[b];h=p[b];for(c=0;c<this.radialSegments;c++)g=2*(c/this.radialSegments)*
+Math.PI,i=-this.radius*Math.cos(g),g=this.radius*Math.sin(g),e.copy(j),e.x+=i*f.x+g*h.x,e.y+=i*f.y+g*h.y,e.z+=i*f.z+g*h.z,this.grid[b][c]=this.vertices.push(new THREE.Vector3(e.x,e.y,e.z))-1}for(b=0;b<this.segments;b++)for(c=0;c<this.radialSegments;c++)e=this.closed?(b+1)%this.segments:b+1,l=(c+1)%this.radialSegments,a=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][l],l=this.grid[b][l],p=new THREE.Vector2(b/this.segments,c/this.radialSegments),f=new THREE.Vector2((b+1)/this.segments,c/this.radialSegments),
+h=new THREE.Vector2((b+1)/this.segments,(c+1)/this.radialSegments),i=new THREE.Vector2(b/this.segments,(c+1)/this.radialSegments),this.faces.push(new THREE.Face4(a,d,e,l)),this.faceVertexUvs[0].push([p,f,h,i]);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=[],h=[],g=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,l,p;this.tangents=e;this.normals=f;this.binormals=h;for(j=0;j<b;j++)l=j/(b-1),e[j]=a.getTangentAt(l),e[j].normalize();f[0]=new THREE.Vector3;h[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);p=Math.abs(e[0].z);j<=a&&(a=j,d.set(1,0,0));l<=a&&(a=l,d.set(0,1,0));p<=a&&d.set(0,0,1);g.crossVectors(e[0],
-d).normalize();f[0].crossVectors(e[0],g);h[0].crossVectors(e[0],f[0]);for(j=1;j<b;j++)f[j]=f[j-1].clone(),h[j]=h[j-1].clone(),g.crossVectors(e[j-1],e[j]),1E-4<g.length()&&(g.normalize(),d=Math.acos(e[j-1].dot(e[j])),f[j].applyMatrix4(i.makeRotationAxis(g,d))),h[j].crossVectors(e[j],f[j]);if(c){d=Math.acos(f[0].dot(f[b-1]));d/=b-1;0<e[0].dot(g.crossVectors(f[0],f[b-1]))&&(d=-d);for(j=1;j<b;j++)f[j].applyMatrix4(i.makeRotationAxis(e[j],d*j)),h[j].crossVectors(e[j],f[j])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=g.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);g.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);g.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),
+d).normalize();f[0].crossVectors(e[0],g);h[0].crossVectors(e[0],f[0]);for(j=1;j<b;j++)f[j]=f[j-1].clone(),h[j]=h[j-1].clone(),g.crossVectors(e[j-1],e[j]),1E-4<g.length()&&(g.normalize(),d=Math.acos(THREE.Math.clamp(e[j-1].dot(e[j]),-1,1)),f[j].applyMatrix4(i.makeRotationAxis(g,d))),h[j].crossVectors(e[j],f[j]);if(c){d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1));d/=b-1;0<e[0].dot(g.crossVectors(f[0],f[b-1]))&&(d=-d);for(j=1;j<b;j++)f[j].applyMatrix4(i.makeRotationAxis(e[j],d*j)),h[j].crossVectors(e[j],
+f[j])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=g.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);g.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);g.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),
 h(c.uv,c,d)])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,j=a.length;i<j;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var l=this.vertices,a=[],i=0,j=b.length;i<j;i++){var p=l[b[i][0]],m=l[b[i][1]],q=l[b[i][2]];a[i]=new THREE.Face3(p.index,m.index,q.index,[p.clone(),m.clone(),q.clone()])}i=0;for(j=a.length;i<j;i++){m=a[i];l=d;b=Math.pow(2,
 l);Math.pow(4,l);for(var l=e(g.vertices[m.a]),p=e(g.vertices[m.b]),t=e(g.vertices[m.c]),m=[],q=0;q<=b;q++){m[q]=[];for(var n=e(l.clone().lerp(t,q/b)),r=e(p.clone().lerp(t,q/b)),s=b-q,v=0;v<=s;v++)m[q][v]=0==v&&q==b?n:e(n.clone().lerp(r,v/s))}for(q=0;q<b;q++)for(v=0;v<2*(b-q)-1;v++)l=Math.floor(v/2),0==v%2?f(m[q][l+1],m[q+1][l],m[q][l]):f(m[q][l+1],m[q+1][l+1],m[q+1][l])}i=0;for(j=this.faceVertexUvs[0].length;i<j;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,p=Math.max(a,Math.max(b,l)),
 m=Math.min(a,Math.min(b,l)),0.9<p&&0.1>m&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(d[2].x+=1));i=0;for(j=this.vertices.length;i<j;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();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,h=this.faceVertexUvs[0],d=void 0===d?!1:d,g,i,j,l,p=b+1;for(g=0;g<=c;g++){l=g/c;for(i=0;i<=b;i++)j=i/b,j=a(j,l),e.push(j)}var m,q,t,n;for(g=0;g<c;g++)for(i=0;i<b;i++)a=g*p+i,e=g*p+i+1,l=(g+1)*p+i,j=(g+1)*p+i+1,m=new THREE.Vector2(i/b,g/c),q=new THREE.Vector2((i+1)/b,g/c),t=new THREE.Vector2(i/b,(g+1)/c),n=new THREE.Vector2((i+1)/b,(g+1)/c),d?(f.push(new THREE.Face3(a,e,l)),f.push(new THREE.Face3(e,