Browse Source

Updated builds.

Mr.doob 11 years ago
parent
commit
e47616cf02
2 changed files with 61 additions and 75 deletions
  1. 49 63
      build/three.js
  2. 12 12
      build/three.min.js

+ 49 - 63
build/three.js

@@ -8035,7 +8035,7 @@ THREE.Projector = function () {
 
 		};
 
-		var handleVertex = function ( x, y, z ) {
+		var pushVertex = function ( x, y, z ) {
 
 			_vertex = getNextVertexInPool();
 			_vertex.position.set( x, y, z );
@@ -8064,7 +8064,7 @@ THREE.Projector = function () {
 
 		};
 
-		var handleLine = function ( a, b ) {
+		var pushLine = function ( a, b ) {
 
 			var v1 = _vertexPool[ a ];
 			var v2 = _vertexPool[ b ];
@@ -8082,7 +8082,7 @@ THREE.Projector = function () {
 
 		};
 
-		var handleTriangle = function ( a, b, c ) {
+		var pushTriangle = function ( a, b, c ) {
 
 			var v1 = _vertexPool[ a ];
 			var v2 = _vertexPool[ b ];
@@ -8110,9 +8110,9 @@ THREE.Projector = function () {
 			setObject: setObject,
 			projectVertex: projectVertex,
 			checkTriangleVisibility: checkTriangleVisibility,
-			handleVertex: handleVertex,
-			handleLine: handleLine,
-			handleTriangle: handleTriangle
+			pushVertex: pushVertex,
+			pushLine: pushLine,
+			pushTriangle: pushTriangle
 		}
 
 	};
@@ -8165,7 +8165,7 @@ THREE.Projector = function () {
 
 						for ( var i = 0, l = positions.length; i < l; i += 3 ) {
 
-							renderList.handleVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
+							renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
 
 						}
 
@@ -8175,7 +8175,7 @@ THREE.Projector = function () {
 
 							for ( var i = 0, l = indices.length; i < l; i += 3 ) {
 
-								renderList.handleTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
+								renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
 
 							}
 
@@ -8183,7 +8183,7 @@ THREE.Projector = function () {
 
 							for ( var i = 0, l = positions.length / 3; i < l; i += 3 ) {
 
-								renderList.handleTriangle( i, i + 1, i + 2 );
+								renderList.pushTriangle( i, i + 1, i + 2 );
 
 							}
 
@@ -8193,17 +8193,17 @@ THREE.Projector = function () {
 
 				} else if ( geometry instanceof THREE.Geometry2 ) {
 
-					var positions = geometry.positions;
+					vertices = geometry.vertices;
 
-					for ( var i = 0, l = positions.length; i < l; i += 3 ) {
+					for ( var i = 0, l = vertices.length; i < l; i += 3 ) {
 
-						renderList.handleVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
+						renderList.pushVertex( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] );
 
 					}
 
-					for ( var i = 0, l = positions.length / 3; i < l; i += 3 ) {
+					for ( var i = 0, l = vertices.length / 3; i < l; i += 3 ) {
 
-						renderList.handleTriangle( i, i + 1, i + 2 );
+						renderList.pushTriangle( i, i + 1, i + 2 );
 
 					}
 
@@ -8221,7 +8221,7 @@ THREE.Projector = function () {
 					for ( var v = 0, vl = vertices.length; v < vl; v ++ ) {
 
 						var vertex = vertices[ v ];
-						renderList.handleVertex( vertex.x, vertex.y, vertex.z );
+						renderList.pushVertex( vertex.x, vertex.y, vertex.z );
 
 					}
 
@@ -8372,7 +8372,7 @@ THREE.Projector = function () {
 
 						for ( var i = 0, l = positions.length; i < l; i += 3 ) {
 
-							renderList.handleVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
+							renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
 
 						}
 
@@ -8382,7 +8382,7 @@ THREE.Projector = function () {
 
 							for ( var i = 0, l = indices.length; i < l; i += 2 ) {
 
-								renderList.handleLine( indices[ i ], indices[ i + 1 ] );
+								renderList.pushLine( indices[ i ], indices[ i + 1 ] );
 
 							}
 
@@ -8390,7 +8390,7 @@ THREE.Projector = function () {
 
 							for ( var i = 0, l = ( positions.length / 3 ) - 1; i < l; i ++ ) {
 
-								renderList.handleLine( i, i + 1 );
+								renderList.pushLine( i, i + 1 );
 
 							}
 
@@ -9364,7 +9364,7 @@ THREE.Geometry2 = function ( size ) {
 
 	this.name = '';
 
-	this.positions = size !== undefined ? new Float32Array( size * 3 ) : [];
+	this.vertices = size !== undefined ? new Float32Array( size * 3 ) : [];
 	this.normals = size !== undefined ? new Float32Array( size * 3 ) : [];
 	this.uvs = size !== undefined ? new Float32Array( size * 2 ) : [];
 
@@ -9379,7 +9379,7 @@ THREE.Geometry2.prototype = {
 
 	applyMatrix: function ( matrix ) {
 
-		matrix.multiplyVector3Array( this.positions );
+		matrix.multiplyVector3Array( this.vertices );
 
 	},
 
@@ -9398,12 +9398,12 @@ THREE.Geometry2.prototype = {
 
 			box.makeEmpty();
 
-			var positions = this.positions;
+			var vertices = this.vertices;
 			var center = this.boundingSphere.center;
 
-			for ( var i = 0, il = positions.length; i < il; i += 3 ) {
+			for ( var i = 0, il = vertices.length; i < il; i += 3 ) {
 
-				vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
+				vector.set( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] );
 				box.addPoint( vector );
 
 			}
@@ -9412,9 +9412,9 @@ THREE.Geometry2.prototype = {
 
 			var maxRadiusSq = 0;
 
-			for ( var i = 0, il = positions.length; i < il; i += 3 ) {
+			for ( var i = 0, il = vertices.length; i < il; i += 3 ) {
 
-				vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
+				vector.set( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] );
 				maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
 
 			}
@@ -31946,28 +31946,14 @@ THREE.BoxGeometry2 = function ( width, height, depth, widthSegments, heightSegme
 
 	var vector = new THREE.Vector3();
 
-	var vertices = [];
-	var positions = [];
-
-	var addPosition = function ( a, b, c ) {
-
-		positions.push(
-			vertices[ a ],
-			vertices[ a + 1 ],
-			vertices[ a + 2 ]
-		);
+	var vectors = [];
+	var vertices = this.vertices;
 
-		positions.push(
-			vertices[ b ],
-			vertices[ b + 1 ],
-			vertices[ b + 2 ]
-		);
+	var addVertex = function ( a, b, c ) {
 
-		positions.push(
-			vertices[ c ],
-			vertices[ c + 1 ],
-			vertices[ c + 2 ]
-		);
+		vertices.push( vectors[ a ], vectors[ a + 1 ], vectors[ a + 2 ] );
+		vertices.push( vectors[ b ], vectors[ b + 1 ], vectors[ b + 2 ] );
+		vertices.push( vectors[ c ], vectors[ c + 1 ], vectors[ c + 2 ] );
 
 	};
 
@@ -31985,7 +31971,7 @@ THREE.BoxGeometry2 = function ( width, height, depth, widthSegments, heightSegme
 		gridY = scope.heightSegments,
 		width_half = width / 2,
 		height_half = height / 2,
-		offset = vertices.length;
+		offset = vectors.length;
 
 		if ( ( u === 'x' && v === 'y' ) || ( u === 'y' && v === 'x' ) ) {
 
@@ -32019,7 +32005,7 @@ THREE.BoxGeometry2 = function ( width, height, depth, widthSegments, heightSegme
 				vector[ v ] = ( iy * segment_height - height_half ) * vdir;
 				vector[ w ] = depth;
 
-				vertices.push( vector.x, vector.y, vector.z );
+				vectors.push( vector.x, vector.y, vector.z );
 
 			}
 
@@ -32034,8 +32020,8 @@ THREE.BoxGeometry2 = function ( width, height, depth, widthSegments, heightSegme
 				var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 				var d = ( ix + 1 ) + gridX1 * iy;
 
-				addPosition( a * 3 + offset, b * 3 + offset, d * 3 + offset );
-				addPosition( b * 3 + offset, c * 3 + offset, d * 3 + offset );
+				addVertex( a * 3 + offset, b * 3 + offset, d * 3 + offset );
+				addVertex( b * 3 + offset, c * 3 + offset, d * 3 + offset );
 
 			}
 
@@ -32043,7 +32029,7 @@ THREE.BoxGeometry2 = function ( width, height, depth, widthSegments, heightSegme
 
 	}
 
-	this.positions = new Float32Array( positions );
+	this.vertices = new Float32Array( vertices );
 
 };
 
@@ -33299,7 +33285,7 @@ THREE.PlaneGeometry2 = function ( width, height, widthSegments, heightSegments )
 
 	THREE.Geometry2.call( this, ( widthSegments * heightSegments ) * 2 * 3 );
 
-	var positions = this.positions;
+	var vertices = this.vertices;
 	var normals = this.normals;
 	var uvs = this.uvs;
 
@@ -33332,33 +33318,33 @@ THREE.PlaneGeometry2 = function ( width, height, widthSegments, heightSegments )
 			var x1 = ix * segmentWidth - widthHalf;
 			var x2 = ( ix + 1 ) * segmentWidth - widthHalf;
 
-			positions[ offset ++ ] = x1;
-			positions[ offset ++ ] = y1;
+			vertices[ offset ++ ] = x1;
+			vertices[ offset ++ ] = y1;
 
 			offset ++;
 
-			positions[ offset ++ ] = x2;
-			positions[ offset ++ ] = y1;
+			vertices[ offset ++ ] = x2;
+			vertices[ offset ++ ] = y1;
 
 			offset ++;
 
-			positions[ offset ++ ] = x1;
-			positions[ offset ++ ] = y2;
+			vertices[ offset ++ ] = x1;
+			vertices[ offset ++ ] = y2;
 
 			offset ++;
 
-			positions[ offset ++ ] = x2;
-			positions[ offset ++ ] = y1;
+			vertices[ offset ++ ] = x2;
+			vertices[ offset ++ ] = y1;
 
 			offset ++;
 
-			positions[ offset ++ ] = x2;
-			positions[ offset ++ ] = y2;
+			vertices[ offset ++ ] = x2;
+			vertices[ offset ++ ] = y2;
 
 			offset ++;
 
-			positions[ offset ++ ] = x1;
-			positions[ offset ++ ] = y2;
+			vertices[ offset ++ ] = x1;
+			vertices[ offset ++ ] = y2;
 
 			offset ++;
 

+ 12 - 12
build/three.min.js

@@ -166,15 +166,15 @@ if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone())
 X=new THREE.Matrix4,S,fa=new THREE.Matrix4,Y=new THREE.Matrix3,la=new THREE.Matrix3,Q=new THREE.Vector3,ha=new THREE.Frustum,U=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);X.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(X)};this.unprojectVector=function(){var a=new THREE.Matrix4;return function(b,c){a.getInverse(c.projectionMatrix);X.multiplyMatrices(c.matrixWorld,a);return b.applyProjection(X)}}();
 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)};var R=function(a){if(g===k){var b=new THREE.RenderableObject;h.push(b);k++;g++;f=b}else f=h[g++];f.id=a.id;f.object=a;null!==a.renderDepth?f.z=a.renderDepth:(y.setFromMatrixPosition(a.matrixWorld),y.applyProjection(X),f.z=y.z);return f},ma=function(a){if(!1!==a.visible){a instanceof THREE.Light?B.lights.push(a):a instanceof
 THREE.Mesh||a instanceof THREE.Line?!1!==a.frustumCulled&&!0!==ha.intersectsObject(a)||B.objects.push(R(a)):a instanceof THREE.Sprite&&B.sprites.push(R(a));for(var b=0,c=a.children.length;b<c;b++)ma(a.children[b])}},da=new function(){var d=null,e=function(a){var b=a.positionWorld,c=a.positionScreen;b.copy(a.position).applyMatrix4(S);c.copy(b).applyMatrix4(X);b=1/c.w;c.x*=b;c.y*=b;c.z*=b;a.visible=-1<=c.x&&1>=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},f=function(a,b,c){E[0]=a.positionScreen;E[1]=b.positionScreen;
-E[2]=c.positionScreen;return!0===a.visible||!0===b.visible||!0===c.visible||D.isIntersectionBox(z.setFromPoints(E))?0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x):!1};return{setObject:function(a){d=a},projectVertex:e,checkTriangleVisibility:f,handleVertex:function(b,c,d){l=a();l.position.set(b,c,d);e(l)},handleLine:function(a,b){var e=q[a],f=q[b];w=c();w.id=d.id;w.v1.copy(e);w.v2.copy(f);
-r.z=(e.positionScreen.z+f.positionScreen.z)/2;w.material=d.material;B.elements.push(w)},handleTriangle:function(a,c,e){a=q[a];c=q[c];e=q[e];!0===f(a,c,e)&&(r=b(),r.id=d.id,r.v1.copy(a),r.v2.copy(c),r.v3.copy(e),r.z=(a.positionScreen.z+c.positionScreen.z+e.positionScreen.z)/3,r.material=d.material,B.elements.push(r))}}};this.projectScene=function(f,h,k,l){var p,s,v,x,y,A,D,E,R;P=u=t=0;B.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();F.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));
-X.multiplyMatrices(h.projectionMatrix,F);la.getNormalMatrix(F);ha.setFromMatrix(X);g=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;ma(f);!0===k&&B.objects.sort(d);f=0;for(k=B.objects.length;f<k;f++)if(p=B.objects[f].object,s=p.geometry,da.setObject(p),S=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)da.handleVertex(A[p],A[p+1],A[p+2]);if(void 0!==x.index)for(x=x.index.array,
-p=0,s=x.length;p<s;p+=3)da.handleTriangle(x[p],x[p+1],x[p+2]);else for(p=0,s=A.length/3;p<s;p+=3)da.handleTriangle(p,p+1,p+2)}}else if(s instanceof THREE.Geometry2){A=s.positions;p=0;for(s=A.length;p<s;p+=3)da.handleVertex(A[p],A[p+1],A[p+2]);p=0;for(s=A.length/3;p<s;p+=3)da.handleTriangle(p,p+1,p+2)}else{if(s instanceof THREE.Geometry){v=s.vertices;x=s.faces;A=s.faceVertexUvs;Y.getNormalMatrix(S);E=p.material instanceof THREE.MeshFaceMaterial;R=!0===E?p.material:null;for(var z=0,ya=v.length;z<ya;z++){var za=
-v[z];da.handleVertex(za.x,za.y,za.z)}z=0;for(ya=x.length;z<ya;z++)if(v=x[z],za=!0===E?R.materials[v.materialIndex]:p.material,void 0!==za){D=za.side;y=q[v.a];var ja=q[v.b],Ea=q[v.c];if(!0===za.morphTargets){var Fa=s.morphTargets,pa=p.morphTargetInfluences,Aa=y.position,Ba=ja.position,$a=Ea.position;L.set(0,0,0);H.set(0,0,0);J.set(0,0,0);for(var Na=0,ga=Fa.length;Na<ga;Na++){var ia=pa[Na];if(0!==ia){var Ga=Fa[Na].vertices;L.x+=(Ga[v.a].x-Aa.x)*ia;L.y+=(Ga[v.a].y-Aa.y)*ia;L.z+=(Ga[v.a].z-Aa.z)*ia;H.x+=
+E[2]=c.positionScreen;return!0===a.visible||!0===b.visible||!0===c.visible||D.isIntersectionBox(z.setFromPoints(E))?0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x):!1};return{setObject:function(a){d=a},projectVertex:e,checkTriangleVisibility:f,pushVertex:function(b,c,d){l=a();l.position.set(b,c,d);e(l)},pushLine:function(a,b){var e=q[a],f=q[b];w=c();w.id=d.id;w.v1.copy(e);w.v2.copy(f);
+r.z=(e.positionScreen.z+f.positionScreen.z)/2;w.material=d.material;B.elements.push(w)},pushTriangle:function(a,c,e){a=q[a];c=q[c];e=q[e];!0===f(a,c,e)&&(r=b(),r.id=d.id,r.v1.copy(a),r.v2.copy(c),r.v3.copy(e),r.z=(a.positionScreen.z+c.positionScreen.z+e.positionScreen.z)/3,r.material=d.material,B.elements.push(r))}}};this.projectScene=function(f,h,k,l){var p,s,v,x,y,A,D,E,R;P=u=t=0;B.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();F.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));
+X.multiplyMatrices(h.projectionMatrix,F);la.getNormalMatrix(F);ha.setFromMatrix(X);g=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;ma(f);!0===k&&B.objects.sort(d);f=0;for(k=B.objects.length;f<k;f++)if(p=B.objects[f].object,s=p.geometry,da.setObject(p),S=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)da.pushVertex(A[p],A[p+1],A[p+2]);if(void 0!==x.index)for(x=x.index.array,
+p=0,s=x.length;p<s;p+=3)da.pushTriangle(x[p],x[p+1],x[p+2]);else for(p=0,s=A.length/3;p<s;p+=3)da.pushTriangle(p,p+1,p+2)}}else if(s instanceof THREE.Geometry2){v=s.vertices;p=0;for(s=v.length;p<s;p+=3)da.pushVertex(v[p],v[p+1],v[p+2]);p=0;for(s=v.length/3;p<s;p+=3)da.pushTriangle(p,p+1,p+2)}else{if(s instanceof THREE.Geometry){v=s.vertices;x=s.faces;A=s.faceVertexUvs;Y.getNormalMatrix(S);E=p.material instanceof THREE.MeshFaceMaterial;R=!0===E?p.material:null;for(var z=0,ya=v.length;z<ya;z++){var za=
+v[z];da.pushVertex(za.x,za.y,za.z)}z=0;for(ya=x.length;z<ya;z++)if(v=x[z],za=!0===E?R.materials[v.materialIndex]:p.material,void 0!==za){D=za.side;y=q[v.a];var ja=q[v.b],Ea=q[v.c];if(!0===za.morphTargets){var Fa=s.morphTargets,pa=p.morphTargetInfluences,Aa=y.position,Ba=ja.position,$a=Ea.position;L.set(0,0,0);H.set(0,0,0);J.set(0,0,0);for(var Na=0,ga=Fa.length;Na<ga;Na++){var ia=pa[Na];if(0!==ia){var Ga=Fa[Na].vertices;L.x+=(Ga[v.a].x-Aa.x)*ia;L.y+=(Ga[v.a].y-Aa.y)*ia;L.z+=(Ga[v.a].z-Aa.z)*ia;H.x+=
 (Ga[v.b].x-Ba.x)*ia;H.y+=(Ga[v.b].y-Ba.y)*ia;H.z+=(Ga[v.b].z-Ba.z)*ia;J.x+=(Ga[v.c].x-$a.x)*ia;J.y+=(Ga[v.c].y-$a.y)*ia;J.z+=(Ga[v.c].z-$a.z)*ia}}y.position.add(L);ja.position.add(H);Ea.position.add(J);da.projectVertex(y);da.projectVertex(ja);da.projectVertex(Ea)}Fa=da.checkTriangleVisibility(y,ja,Ea);if(Fa!==(D===THREE.BackSide)){r=b();r.id=p.id;r.v1.copy(y);r.v2.copy(ja);r.v3.copy(Ea);r.normalModel.copy(v.normal);!1!==Fa||D!==THREE.BackSide&&D!==THREE.DoubleSide||r.normalModel.negate();r.normalModel.applyMatrix3(Y).normalize();
 r.normalModelView.copy(r.normalModel).applyMatrix3(la);r.centroidModel.copy(v.centroid).applyMatrix4(S);y=v.vertexNormals;ja=0;for(Ea=Math.min(y.length,3);ja<Ea;ja++)pa=r.vertexNormalsModel[ja],pa.copy(y[ja]),!1!==Fa||D!==THREE.BackSide&&D!==THREE.DoubleSide||pa.negate(),pa.applyMatrix3(Y).normalize(),r.vertexNormalsModelView[ja].copy(pa).applyMatrix3(la);r.vertexNormalsLength=y.length;y=0;for(ja=Math.min(A.length,3);y<ja;y++)if(D=A[y][z],void 0!==D)for(Ea=0,Fa=D.length;Ea<Fa;Ea++)r.uvs[y][Ea]=D[Ea];
-r.color=v.color;r.material=za;Q.copy(r.centroidModel).applyProjection(X);r.z=Q.z;B.elements.push(r)}}}}else if(p instanceof THREE.Line)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)da.handleVertex(A[p],A[p+1],A[p+2]);if(void 0!==x.index)for(x=x.index.array,p=0,s=x.length;p<s;p+=2)da.handleLine(x[p],x[p+1]);else for(p=0,s=A.length/3-1;p<s;p++)da.handleLine(p,p+1)}}else if(s instanceof THREE.Geometry)for(fa.multiplyMatrices(X,
-S),v=p.geometry.vertices,y=a(),y.positionScreen.copy(v[0]).applyMatrix4(fa),s=p.type===THREE.LinePieces?2:1,z=1,ya=v.length;z<ya;z++)y=a(),y.positionScreen.copy(v[z]).applyMatrix4(fa),0<(z+1)%s||(ja=q[n-2],U.copy(y.positionScreen),M.copy(ja.positionScreen),!0===e(U,M)&&(U.multiplyScalar(1/U.w),M.multiplyScalar(1/M.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(U),w.v2.positionScreen.copy(M),w.z=Math.max(U.z,M.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[z]),
+r.color=v.color;r.material=za;Q.copy(r.centroidModel).applyProjection(X);r.z=Q.z;B.elements.push(r)}}}}else if(p instanceof THREE.Line)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)da.pushVertex(A[p],A[p+1],A[p+2]);if(void 0!==x.index)for(x=x.index.array,p=0,s=x.length;p<s;p+=2)da.pushLine(x[p],x[p+1]);else for(p=0,s=A.length/3-1;p<s;p++)da.pushLine(p,p+1)}}else if(s instanceof THREE.Geometry)for(fa.multiplyMatrices(X,S),
+v=p.geometry.vertices,y=a(),y.positionScreen.copy(v[0]).applyMatrix4(fa),s=p.type===THREE.LinePieces?2:1,z=1,ya=v.length;z<ya;z++)y=a(),y.positionScreen.copy(v[z]).applyMatrix4(fa),0<(z+1)%s||(ja=q[n-2],U.copy(y.positionScreen),M.copy(ja.positionScreen),!0===e(U,M)&&(U.multiplyScalar(1/U.w),M.multiplyScalar(1/M.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(U),w.v2.positionScreen.copy(M),w.z=Math.max(U.z,M.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[z]),
 w.vertexColors[1].copy(p.geometry.colors[z-1])),B.elements.push(w)));f=0;for(k=B.sprites.length;f<k;f++)p=B.sprites[f].object,S=p.matrixWorld,N.set(S.elements[12],S.elements[13],S.elements[14],1),N.applyMatrix4(X),s=1/N.w,N.z*=s,-1<=N.z&&1>=N.z&&(P===C?(x=new THREE.RenderableSprite,I.push(x),C++,P++,G=x):G=I[P++],G.id=p.id,G.x=N.x*s,G.y=N.y*s,G.z=N.z,G.object=p,G.rotation=p.rotation,G.scale.x=p.scale.x*Math.abs(G.x-(N.x+h.projectionMatrix.elements[0])/(N.w+h.projectionMatrix.elements[12])),G.scale.y=
 p.scale.y*Math.abs(G.y-(N.y+h.projectionMatrix.elements[5])/(N.w+h.projectionMatrix.elements[13])),G.material=p.material,B.elements.push(G));!0===l&&B.elements.sort(d);return B}};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();
@@ -191,8 +191,8 @@ l=f[0],n=f[1],q=f[2],f=h.x-g.x,s=k.x-g.x,r=h.y-g.y,t=k.y-g.y,h=h.z-g.z,g=k.z-g.z
 G.crossVectors(e.vertexNormals[c],v),d=G.dot(u[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(A.x,A.y,A.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
 this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<g;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=
 a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},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.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.Geometry2=function(a){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.positions=void 0!==a?new Float32Array(3*a):[];this.normals=void 0!==a?new Float32Array(3*a):[];this.uvs=void 0!==a?new Float32Array(2*a):[];this.boundingSphere=this.boundingBox=null};
-THREE.Geometry2.prototype={constructor:THREE.Geometry2,applyMatrix:function(a){a.multiplyVector3Array(this.positions)},computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);a.makeEmpty();for(var c=this.positions,d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));
+dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.Geometry2=function(a){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=void 0!==a?new Float32Array(3*a):[];this.normals=void 0!==a?new Float32Array(3*a):[];this.uvs=void 0!==a?new Float32Array(2*a):[];this.boundingSphere=this.boundingBox=null};
+THREE.Geometry2.prototype={constructor:THREE.Geometry2,applyMatrix:function(a){a.multiplyVector3Array(this.vertices)},computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);a.makeEmpty();for(var c=this.vertices,d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));
 this.boundingSphere.radius=Math.sqrt(g)}}(),dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry2.prototype);THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.dynamic=!0;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c,d){this.attributes[a]={itemSize:d,array:new b(c*d)}},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,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(){var a=
@@ -609,8 +609,8 @@ THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;t
 0;e<u;e++)for(f=0;f<w;f++)A=f+P*e,a=f+P*(e+1),b=f+1+P*(e+1),c=f+1+P*e,d=new THREE.Vector2(f/w,1-e/u),g=new THREE.Vector2(f/w,1-(e+1)/u),v=new THREE.Vector2((f+1)/w,1-(e+1)/u),x=new THREE.Vector2((f+1)/w,1-e/u),A=new THREE.Face3(A+G,a+G,c+G),A.normal.copy(L),A.vertexNormals.push(L.clone(),L.clone(),L.clone()),A.materialIndex=p,h.faces.push(A),h.faceVertexUvs[0].push([d,g,x]),A=new THREE.Face3(a+G,b+G,c+G),A.normal.copy(L),A.vertexNormals.push(L.clone(),L.clone(),L.clone()),A.materialIndex=p,h.faces.push(A),
 h.faceVertexUvs[0].push([g.clone(),v,x.clone()])}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.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.BoxGeometry2=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,n){var A;n=h.widthSegments;var G=h.heightSegments,P=e/2,I=f/2,C=l.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)A="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)A="y",G=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)A="x",n=h.depthSegments;var B=n+1,L=G+1,H=e/n,J=f/G;(new THREE.Vector3)[A]=0<g?1:-1;for(e=0;e<L;e++)for(f=0;f<B;f++)k[a]=(f*H-P)*c,k[b]=(e*J-I)*d,k[A]=g,l.push(k.x,k.y,k.z);for(e=0;e<G;e++)for(f=0;f<n;f++)a=f+
-B*(e+1),b=f+1+B*(e+1),c=f+1+B*e,q(3*(f+B*e)+C,3*a+C,3*c+C),q(3*a+C,3*b+C,3*c+C)}THREE.Geometry2.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;var k=new THREE.Vector3,l=[],n=[],q=function(a,b,c){n.push(l[a],l[a+1],l[a+2]);n.push(l[b],l[b+1],l[b+2]);n.push(l[c],l[c+1],l[c+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.positions=new Float32Array(n)};THREE.BoxGeometry2.prototype=Object.create(THREE.Geometry2.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.radius=a=a||50;this.segments=b=void 0!==b?Math.max(3,b):8;this.thetaStart=c=void 0!==c?c:0;this.thetaLength=d=void 0!==d?d:2*Math.PI;var 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,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,
+B*(e+1),b=f+1+B*(e+1),c=f+1+B*e,q(3*(f+B*e)+C,3*a+C,3*c+C),q(3*a+C,3*b+C,3*c+C)}THREE.Geometry2.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;var k=new THREE.Vector3,l=[],n=this.vertices,q=function(a,b,c){n.push(l[a],l[a+1],l[a+2]);n.push(l[b],l[b+1],l[b+2]);n.push(l[c],l[c+1],l[c+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.vertices=new Float32Array(n)};THREE.BoxGeometry2.prototype=Object.create(THREE.Geometry2.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.radius=a=a||50;this.segments=b=void 0!==b?Math.max(3,b):8;this.thetaStart=c=void 0!==c?c:0;this.thetaLength=d=void 0!==d?d:2*Math.PI;var 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,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,
 e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),g.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=THREE.BoxGeometry;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.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var g=c/2,h,k,l=[],n=[];for(k=0;k<=e;k++){var q=[],s=[],r=k/e,t=r*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,v=new THREE.Vector3;v.x=t*Math.sin(p*Math.PI*2);v.y=-r*c+g;v.z=t*Math.cos(p*Math.PI*2);this.vertices.push(v);q.push(this.vertices.length-1);s.push(new THREE.Vector2(p,
 1-r))}l.push(q);n.push(s)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[l[0][h]].clone(),s=this.vertices[l[0][h+1]].clone()):(q=this.vertices[l[1][h]].clone(),s=this.vertices[l[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*c).normalize(),k=0;k<e;k++){var r=l[k][h],t=l[k+1][h],p=l[k+1][h+1],v=l[k][h+1],w=q.clone(),u=q.clone(),x=s.clone(),A=s.clone(),G=n[k][h].clone(),P=n[k+1][h].clone(),I=n[k+1][h+1].clone(),C=n[k][h+1].clone();this.faces.push(new THREE.Face3(r,
 t,v,[w,u,A]));this.faceVertexUvs[0].push([G,P,C]);this.faces.push(new THREE.Face3(t,p,v,[u.clone(),x,A.clone()]));this.faceVertexUvs[0].push([P.clone(),I,C.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)r=l[0][h],t=l[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),G=n[0][h].clone(),P=n[0][h+1].clone(),I=new THREE.Vector2(P.x,0),this.faces.push(new THREE.Face3(r,t,p,[w,u,x])),this.faceVertexUvs[0].push([G,
@@ -629,7 +629,7 @@ THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THRE
 THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,l=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse(),e=0,f=l.length;e<f;e++)g=l[e],THREE.Shape.Utils.isClockWise(g)&&(l[e]=g.reverse());var n=THREE.Shape.Utils.triangulateShape(k,l);e=0;for(f=l.length;e<f;e++)g=l[e],
 k=k.concat(g);l=k.length;f=n.length;for(e=0;e<l;e++)g=k[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)l=n[e],k=l[0]+h,g=l[1]+h,l=l[2]+h,this.faces.push(new THREE.Face3(k,g,l,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,k,g,l))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var k=c+g*f*d,l=Math.cos(k),n=Math.sin(k),k=0,q=a.length;k<q;k++){var s=a[k],r=new THREE.Vector3;r.x=l*s.x-n*s.y;r.y=n*s.x+l*s.y;r.z=s.z;this.vertices.push(r)}c=a.length;g=0;for(h=b;g<h;g++)for(k=0,q=a.length-1;k<q;k++){b=n=k+c*g;d=n+c;var l=n+1+c,n=n+1,s=g*f,r=k*e,t=s+f,p=r+e;this.faces.push(new THREE.Face3(b,d,n));this.faceVertexUvs[0].push([new THREE.Vector2(s,
 r),new THREE.Vector2(t,r),new THREE.Vector2(s,p)]);this.faces.push(new THREE.Face3(d,l,n));this.faceVertexUvs[0].push([new THREE.Vector2(t,r),new THREE.Vector2(t,p),new THREE.Vector2(s,p)])}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;var e=a/2,f=b/2;c=this.widthSegments;d=this.heightSegments;var g=c+1,h=d+1,k=this.width/c,l=this.height/d,n=new THREE.Vector3(0,0,1);for(a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*k-e,-(a*l-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var q=b+g*a,e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,k=new THREE.Vector2(b/c,1-a/d),l=new THREE.Vector2(b/c,1-(a+
-1)/d),s=new THREE.Vector2((b+1)/c,1-(a+1)/d),r=new THREE.Vector2((b+1)/c,1-a/d),q=new THREE.Face3(q,e,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([k,l,r]);q=new THREE.Face3(e,f,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([l.clone(),s,r.clone()])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry2=function(a,b,c,d){THREE.Geometry2.call(this,c*d*6);var e=this.positions;this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;a/=2;b/=2;c=this.widthSegments;d=this.heightSegments;var f=this.width/c,g=this.height/d,h=0;new THREE.Vector3(0,0,1);for(var k=0;k<d;k++)for(var l=k*g-b,n=(k+1)*g-b,q=0;q<c;q++){var s=q*f-a,r=(q+1)*f-a;e[h++]=s;e[h++]=l;h++;e[h++]=r;e[h++]=l;h++;e[h++]=s;e[h++]=n;h++;e[h++]=r;e[h++]=l;h++;e[h++]=r;e[h++]=n;h++;e[h++]=s;e[h++]=n;h++}};
+1)/d),s=new THREE.Vector2((b+1)/c,1-(a+1)/d),r=new THREE.Vector2((b+1)/c,1-a/d),q=new THREE.Face3(q,e,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([k,l,r]);q=new THREE.Face3(e,f,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([l.clone(),s,r.clone()])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry2=function(a,b,c,d){THREE.Geometry2.call(this,c*d*6);var e=this.vertices;this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;a/=2;b/=2;c=this.widthSegments;d=this.heightSegments;var f=this.width/c,g=this.height/d,h=0;new THREE.Vector3(0,0,1);for(var k=0;k<d;k++)for(var l=k*g-b,n=(k+1)*g-b,q=0;q<c;q++){var s=q*f-a,r=(q+1)*f-a;e[h++]=s;e[h++]=l;h++;e[h++]=r;e[h++]=l;h++;e[h++]=s;e[h++]=n;h++;e[h++]=r;e[h++]=l;h++;e[h++]=r;e[h++]=n;h++;e[h++]=s;e[h++]=n;h++}};
 THREE.PlaneGeometry2.prototype=Object.create(THREE.Geometry2.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);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;var g,h=[],k=a,l=(b-a)/d;for(a=0;a<=d;a++){for(g=0;g<=c;g++){var n=new THREE.Vector3,q=e+g/c*f;n.x=k*Math.cos(q);n.y=k*Math.sin(q);this.vertices.push(n);h.push(new THREE.Vector2((n.x/b+1)/2,(n.y/b+1)/2))}k+=l}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*c,g=0;g<=c;g++)q=g+e,f=q+a,l=q+c+a,n=q+c+1+a,this.faces.push(new THREE.Face3(f,
 l,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[n].clone()]),f=q+a,l=q+c+1+a,n=q+1+a,this.faces.push(new THREE.Face3(f,l,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[n].clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,k)};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,k,l=[],n=[];for(k=0;k<=c;k++){var q=[],s=[];for(h=0;h<=b;h++){var r=h/b,t=k/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+r*e)*Math.sin(f+t*g);p.y=a*Math.cos(f+t*g);
 p.z=a*Math.sin(d+r*e)*Math.sin(f+t*g);this.vertices.push(p);q.push(this.vertices.length-1);s.push(new THREE.Vector2(r,1-t))}l.push(q);n.push(s)}for(k=0;k<this.heightSegments;k++)for(h=0;h<this.widthSegments;h++){b=l[k][h+1];c=l[k][h];d=l[k+1][h];e=l[k+1][h+1];f=this.vertices[b].clone().normalize();g=this.vertices[c].clone().normalize();var q=this.vertices[d].clone().normalize(),s=this.vertices[e].clone().normalize(),r=n[k][h+1].clone(),t=n[k][h].clone(),p=n[k+1][h].clone(),v=n[k+1][h+1].clone();Math.abs(this.vertices[b].y)===