Browse Source

Merge branch 'dev' into triangulation

Juergen Ahting 11 years ago
parent
commit
cfee7ff328

+ 2 - 2
docs/api/renderers/WebGLRenderer.html

@@ -259,8 +259,8 @@
 		<h3>.render( [page:Scene scene], [page:Camera camera], [page:WebGLRenderTarget renderTarget], [page:Boolean forceClear] )</h3>
 		<h3>.render( [page:Scene scene], [page:Camera camera], [page:WebGLRenderTarget renderTarget], [page:Boolean forceClear] )</h3>
 		<div>Render a scene using a camera.</div>
 		<div>Render a scene using a camera.</div>
 		<div>The render is done to the renderTarget (if specified) or to the canvas as usual.</div>
 		<div>The render is done to the renderTarget (if specified) or to the canvas as usual.</div>
-		<div>If forceClear is true, the canvas will be cleared before rendering, even if the renderer's autoClear property is false.</div>
-
+        <div>If forceClear is true the depth, stencil and color buffers will be cleared before rendering even if the renderer's autoClear property is false.</div>
+        <div>Even with forceClear set to true you can prevent certain buffers being cleared by setting either the .autoClearColor, .autoClearStencil or .autoClearDepth properties to false.</div>
 
 
 		<h3>.renderImmediateObject( camera, lights, fog, material, object )</h3>
 		<h3>.renderImmediateObject( camera, lights, fog, material, object )</h3>
 		<div>TODO.</div>
 		<div>TODO.</div>

+ 20 - 57
editor/js/Editor.js

@@ -175,82 +175,45 @@ Editor.prototype = {
 
 
 		return function ( object ) {
 		return function ( object ) {
 
 
-			if ( object instanceof THREE.Camera ) {
-
-				var picker = new THREE.Mesh( geometry, material );
-				picker.name = 'picker';
-				picker.userData.object = object;
-				picker.visible = false;
+			var helper;
 
 
-				var helper = new THREE.CameraHelper( object, 10 );
-				helper.add( picker );
-			
-				this.sceneHelpers.add( helper );
-				this.helpers[ object.id ] = helper;
+			if ( object instanceof THREE.Camera ) {
 
 
-				this.signals.helperAdded.dispatch( helper );
+				helper = new THREE.CameraHelper( object, 10 );
 
 
 			} else if ( object instanceof THREE.PointLight ) {
 			} else if ( object instanceof THREE.PointLight ) {
 
 
-				var picker = new THREE.Mesh( geometry, material );
-				picker.name = 'picker';
-				picker.userData.object = object;
-				picker.visible = false;
-
-				var helper = new THREE.PointLightHelper( object, 10 );
-				helper.add( picker );
-			
-				this.sceneHelpers.add( helper );
-				this.helpers[ object.id ] = helper;
-
-				this.signals.helperAdded.dispatch( helper );
+				helper = new THREE.PointLightHelper( object, 10 );
 
 
 			} else if ( object instanceof THREE.DirectionalLight ) {
 			} else if ( object instanceof THREE.DirectionalLight ) {
 
 
-				var picker = new THREE.Mesh( geometry, material );
-				picker.name = 'picker';
-				picker.userData.object = object;
-				picker.visible = false;
-
-				var helper = new THREE.DirectionalLightHelper( object, 20 );
-				helper.add( picker );
-
-				this.sceneHelpers.add( helper );
-				this.helpers[ object.id ] = helper;
-
-				this.signals.helperAdded.dispatch( helper );
+				helper = new THREE.DirectionalLightHelper( object, 20 );
 
 
 			} else if ( object instanceof THREE.SpotLight ) {
 			} else if ( object instanceof THREE.SpotLight ) {
 
 
-				var picker = new THREE.Mesh( geometry, material );
-				picker.name = 'picker';
-				picker.userData.object = object;
-				picker.visible = false;
-
-				var helper = new THREE.SpotLightHelper( object, 10 );
-				helper.add( picker );
+				helper = new THREE.SpotLightHelper( object, 10 );
 
 
-				this.sceneHelpers.add( helper );
-				this.helpers[ object.id ] = helper;
+			} else if ( object instanceof THREE.HemisphereLight ) {
 
 
-				this.signals.helperAdded.dispatch( helper );
+				helper = new THREE.HemisphereLightHelper( object, 10 );
 
 
-			} else if ( object instanceof THREE.HemisphereLight ) {
+			} else {
 
 
-				var picker = new THREE.Mesh( geometry, material );
-				picker.name = 'picker';
-				picker.userData.object = object;
-				picker.visible = false;
+				// no helper for this object type
+				return;
 
 
-				var helper = new THREE.HemisphereLightHelper( object, 10 );
-				helper.add( picker );
+			}
 
 
-				this.sceneHelpers.add( helper );
-				this.helpers[ object.id ] = helper;
+			var picker = new THREE.Mesh( geometry, material );
+			picker.name = 'picker';
+			picker.userData.object = object;
+			picker.visible = false;
+			helper.add( picker );
 
 
-				this.signals.helperAdded.dispatch( helper );
+			this.sceneHelpers.add( helper );
+			this.helpers[ object.id ] = helper;
 
 
-			}
+			this.signals.helperAdded.dispatch( helper );
 
 
 		};
 		};
 
 

+ 16 - 4
editor/js/Viewport.js

@@ -242,12 +242,24 @@ var Viewport = function ( editor ) {
 
 
 	} );
 	} );
 
 
+	var saveTimeout;
+
 	signals.cameraChanged.add( function () {
 	signals.cameraChanged.add( function () {
 
 
-		editor.config.setKey( 'camera', {
-			position: camera.position.toArray(),
-			target: controls.center.toArray()
-		} );
+		if ( saveTimeout !== undefined ) {
+
+			clearTimeout( saveTimeout );
+
+		}
+
+		saveTimeout = setTimeout( function () {
+
+			editor.config.setKey( 'camera', {
+				position: camera.position.toArray(),
+				target: controls.center.toArray()
+			} );
+
+		}, 1000 );
 
 
 		render();
 		render();
 
 

+ 3 - 2
examples/js/controls/FirstPersonControls.js

@@ -265,8 +265,9 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 	this.domElement.addEventListener( 'mousemove', bind( this, this.onMouseMove ), false );
 	this.domElement.addEventListener( 'mousemove', bind( this, this.onMouseMove ), false );
 	this.domElement.addEventListener( 'mousedown', bind( this, this.onMouseDown ), false );
 	this.domElement.addEventListener( 'mousedown', bind( this, this.onMouseDown ), false );
 	this.domElement.addEventListener( 'mouseup', bind( this, this.onMouseUp ), false );
 	this.domElement.addEventListener( 'mouseup', bind( this, this.onMouseUp ), false );
-	this.domElement.addEventListener( 'keydown', bind( this, this.onKeyDown ), false );
-	this.domElement.addEventListener( 'keyup', bind( this, this.onKeyUp ), false );
+	
+	window.addEventListener( 'keydown', bind( this, this.onKeyDown ), false );
+	window.addEventListener( 'keyup', bind( this, this.onKeyUp ), false );
 
 
 	function bind( scope, fn ) {
 	function bind( scope, fn ) {
 
 

+ 2 - 2
examples/js/controls/FlyControls.js

@@ -260,8 +260,8 @@ THREE.FlyControls = function ( object, domElement ) {
 	this.domElement.addEventListener( 'mousedown', bind( this, this.mousedown ), false );
 	this.domElement.addEventListener( 'mousedown', bind( this, this.mousedown ), false );
 	this.domElement.addEventListener( 'mouseup',   bind( this, this.mouseup ), false );
 	this.domElement.addEventListener( 'mouseup',   bind( this, this.mouseup ), false );
 
 
-	this.domElement.addEventListener( 'keydown', bind( this, this.keydown ), false );
-	this.domElement.addEventListener( 'keyup',   bind( this, this.keyup ), false );
+	window.addEventListener( 'keydown', bind( this, this.keydown ), false );
+	window.addEventListener( 'keyup',   bind( this, this.keyup ), false );
 
 
 	this.updateMovementVector();
 	this.updateMovementVector();
 	this.updateRotationVector();
 	this.updateRotationVector();

+ 2 - 2
examples/js/controls/OrbitControls.js

@@ -570,12 +570,12 @@ THREE.OrbitControls = function ( object, domElement ) {
 	this.domElement.addEventListener( 'mousewheel', onMouseWheel, false );
 	this.domElement.addEventListener( 'mousewheel', onMouseWheel, false );
 	this.domElement.addEventListener( 'DOMMouseScroll', onMouseWheel, false ); // firefox
 	this.domElement.addEventListener( 'DOMMouseScroll', onMouseWheel, false ); // firefox
 
 
-	this.domElement.addEventListener( 'keydown', onKeyDown, false );
-
 	this.domElement.addEventListener( 'touchstart', touchstart, false );
 	this.domElement.addEventListener( 'touchstart', touchstart, false );
 	this.domElement.addEventListener( 'touchend', touchend, false );
 	this.domElement.addEventListener( 'touchend', touchend, false );
 	this.domElement.addEventListener( 'touchmove', touchmove, false );
 	this.domElement.addEventListener( 'touchmove', touchmove, false );
 
 
+	window.addEventListener( 'keydown', onKeyDown, false );
+
 };
 };
 
 
 THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
 THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );

+ 17 - 65
examples/js/exporters/GeometryExporter.js

@@ -39,7 +39,6 @@ THREE.GeometryExporter.prototype = {
 
 
 			var face = geometry.faces[ i ];
 			var face = geometry.faces[ i ];
 
 
-			var isTriangle = face instanceof THREE.Face3;
 			var hasMaterial = false; // face.materialIndex !== undefined;
 			var hasMaterial = false; // face.materialIndex !== undefined;
 			var hasFaceUv = false; // deprecated
 			var hasFaceUv = false; // deprecated
 			var hasFaceVertexUv = geometry.faceVertexUvs[ 0 ].length > 0;
 			var hasFaceVertexUv = geometry.faceVertexUvs[ 0 ].length > 0;
@@ -50,7 +49,7 @@ THREE.GeometryExporter.prototype = {
 
 
 			var faceType = 0;
 			var faceType = 0;
 
 
-			faceType = setBit( faceType, 0, ! isTriangle );
+			faceType = setBit( faceType, 0, 0 );
 			faceType = setBit( faceType, 1, hasMaterial );
 			faceType = setBit( faceType, 1, hasMaterial );
 			faceType = setBit( faceType, 2, hasFaceUv );
 			faceType = setBit( faceType, 2, hasFaceUv );
 			faceType = setBit( faceType, 3, hasFaceVertexUv );
 			faceType = setBit( faceType, 3, hasFaceVertexUv );
@@ -60,16 +59,8 @@ THREE.GeometryExporter.prototype = {
 			faceType = setBit( faceType, 7, hasFaceVertexColor );
 			faceType = setBit( faceType, 7, hasFaceVertexColor );
 
 
 			faces.push( faceType );
 			faces.push( faceType );
+			faces.push( face.a, face.b, face.c );
 
 
-			if ( isTriangle ) {
-
-				faces.push( face.a, face.b, face.c );
-
-			} else {
-
-				faces.push( face.a, face.b, face.c, face.d );
-
-			}
 
 
 			/*
 			/*
 			if ( hasMaterial ) {
 			if ( hasMaterial ) {
@@ -83,24 +74,11 @@ THREE.GeometryExporter.prototype = {
 
 
 				var faceVertexUvs = geometry.faceVertexUvs[ 0 ][ i ];
 				var faceVertexUvs = geometry.faceVertexUvs[ 0 ][ i ];
 
 
-				if ( isTriangle ) {
-
-					faces.push(
-						getUvIndex( faceVertexUvs[ 0 ] ),
-						getUvIndex( faceVertexUvs[ 1 ] ),
-						getUvIndex( faceVertexUvs[ 2 ] )
-					);
-
-				} else {
-
-					faces.push(
-						getUvIndex( faceVertexUvs[ 0 ] ),
-						getUvIndex( faceVertexUvs[ 1 ] ),
-						getUvIndex( faceVertexUvs[ 2 ] ),
-						getUvIndex( faceVertexUvs[ 3 ] )
-					);
-
-				}
+				faces.push(
+					getUvIndex( faceVertexUvs[ 0 ] ),
+					getUvIndex( faceVertexUvs[ 1 ] ),
+					getUvIndex( faceVertexUvs[ 2 ] )
+				);
 
 
 			}
 			}
 
 
@@ -114,24 +92,11 @@ THREE.GeometryExporter.prototype = {
 
 
 				var vertexNormals = face.vertexNormals;
 				var vertexNormals = face.vertexNormals;
 
 
-				if ( isTriangle ) {
-
-					faces.push(
-						getNormalIndex( vertexNormals[ 0 ] ),
-						getNormalIndex( vertexNormals[ 1 ] ),
-						getNormalIndex( vertexNormals[ 2 ] )
-					);
-
-				} else {
-
-					faces.push(
-						getNormalIndex( vertexNormals[ 0 ] ),
-						getNormalIndex( vertexNormals[ 1 ] ),
-						getNormalIndex( vertexNormals[ 2 ] ),
-						getNormalIndex( vertexNormals[ 3 ] )
-					);
-
-				}
+				faces.push(
+					getNormalIndex( vertexNormals[ 0 ] ),
+					getNormalIndex( vertexNormals[ 1 ] ),
+					getNormalIndex( vertexNormals[ 2 ] )
+				);
 
 
 			}
 			}
 
 
@@ -145,24 +110,11 @@ THREE.GeometryExporter.prototype = {
 
 
 				var vertexColors = face.vertexColors;
 				var vertexColors = face.vertexColors;
 
 
-				if ( isTriangle ) {
-
-					faces.push(
-						getColorIndex( vertexColors[ 0 ] ),
-						getColorIndex( vertexColors[ 1 ] ),
-						getColorIndex( vertexColors[ 2 ] )
-					);
-
-				} else {
-
-					faces.push(
-						getColorIndex( vertexColors[ 0 ] ),
-						getColorIndex( vertexColors[ 1 ] ),
-						getColorIndex( vertexColors[ 2 ] ),
-						getColorIndex( vertexColors[ 3 ] )
-					);
-
-				}
+				faces.push(
+					getColorIndex( vertexColors[ 0 ] ),
+					getColorIndex( vertexColors[ 1 ] ),
+					getColorIndex( vertexColors[ 2 ] )
+				);
 
 
 			}
 			}
 
 

+ 74 - 55
examples/js/loaders/OBJLoader.js

@@ -30,13 +30,13 @@ THREE.OBJLoader.prototype = {
 
 
 		function vector( x, y, z ) {
 		function vector( x, y, z ) {
 
 
-			return new THREE.Vector3( x, y, z );
+			return new THREE.Vector3( parseFloat( x ), parseFloat( y ), parseFloat( z ) );
 
 
 		}
 		}
 
 
 		function uv( u, v ) {
 		function uv( u, v ) {
 
 
-			return new THREE.Vector2( u, v );
+			return new THREE.Vector2( parseFloat( u ), parseFloat( v ) );
 
 
 		}
 		}
 
 
@@ -48,28 +48,51 @@ THREE.OBJLoader.prototype = {
 		
 		
 		var object = new THREE.Object3D();
 		var object = new THREE.Object3D();
 		var geometry, material, mesh;
 		var geometry, material, mesh;
-		var face_offset = 0;
+
+		function parseVertexIndex( index ) {
+
+			index = parseInt( index );
+
+			return index >= 0 ? index - 1 : index + vertices.length;
+
+		}
+
+		function parseNormalIndex( index ) {
+
+			index = parseInt( index );
+
+			return index >= 0 ? index - 1 : index + normals.length;
+
+		}
+
+		function parseUVIndex( index ) {
+
+			index = parseInt( index );
+
+			return index >= 0 ? index - 1 : index + uvs.length;
+
+		}
 		
 		
 		function add_face( a, b, c, normals_inds ) {
 		function add_face( a, b, c, normals_inds ) {
 
 
 			if ( normals_inds === undefined ) {
 			if ( normals_inds === undefined ) {
 
 
 				geometry.faces.push( face3(
 				geometry.faces.push( face3(
-					parseInt( a ) - (face_offset + 1),
-					parseInt( b ) - (face_offset + 1),
-					parseInt( c ) - (face_offset + 1)
+					vertices[ parseVertexIndex( a ) ] - 1,
+					vertices[ parseVertexIndex( b ) ] - 1,
+					vertices[ parseVertexIndex( c ) ] - 1
 				) );
 				) );
 
 
 			} else {
 			} else {
 
 
 				geometry.faces.push( face3(
 				geometry.faces.push( face3(
-					parseInt( a ) - (face_offset + 1),
-					parseInt( b ) - (face_offset + 1),
-					parseInt( c ) - (face_offset + 1),
+					vertices[ parseVertexIndex( a ) ] - 1,
+					vertices[ parseVertexIndex( b ) ] - 1,
+					vertices[ parseVertexIndex( c ) ] - 1,
 					[
 					[
-						normals[ parseInt( normals_inds[ 0 ] ) - 1 ].clone(),
-						normals[ parseInt( normals_inds[ 1 ] ) - 1 ].clone(),
-						normals[ parseInt( normals_inds[ 2 ] ) - 1 ].clone()
+						normals[ parseNormalIndex( normals_inds[ 0 ] ) ].clone(),
+						normals[ parseNormalIndex( normals_inds[ 1 ] ) ].clone(),
+						normals[ parseNormalIndex( normals_inds[ 2 ] ) ].clone()
 					]
 					]
 				) );
 				) );
 
 
@@ -80,9 +103,9 @@ THREE.OBJLoader.prototype = {
 		function add_uvs( a, b, c ) {
 		function add_uvs( a, b, c ) {
       
       
 			geometry.faceVertexUvs[ 0 ].push( [
 			geometry.faceVertexUvs[ 0 ].push( [
-				uvs[ parseInt( a ) - 1 ].clone(),
-				uvs[ parseInt( b ) - 1 ].clone(),
-				uvs[ parseInt( c ) - 1 ].clone()
+				uvs[ parseUVIndex( a ) ].clone(),
+				uvs[ parseUVIndex( b ) ].clone(),
+				uvs[ parseUVIndex( c ) ].clone()
 			] );
 			] );
 
 
 		}
 		}
@@ -93,7 +116,7 @@ THREE.OBJLoader.prototype = {
 				
 				
 				add_face( faces[ 0 ], faces[ 1 ], faces[ 2 ], normals_inds );
 				add_face( faces[ 0 ], faces[ 1 ], faces[ 2 ], normals_inds );
 				
 				
-				if (!(uvs === undefined) && uvs.length > 0) {
+				if ( uvs !== undefined && uvs.length > 0 ) {
 
 
 					add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 2 ] );
 					add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 2 ] );
 
 
@@ -101,19 +124,19 @@ THREE.OBJLoader.prototype = {
 
 
 			} else {
 			} else {
 				
 				
-				if (!(normals_inds === undefined) && normals_inds.length > 0) {
+				if ( normals_inds !== undefined && normals_inds.length > 0 ) {
 
 
-					add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ], [ normals_inds[ 0 ], normals_inds[ 1 ], normals_inds[ 3 ] ]);
-					add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ], [ normals_inds[ 1 ], normals_inds[ 2 ], normals_inds[ 3 ] ]);
+					add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ], [ normals_inds[ 0 ], normals_inds[ 1 ], normals_inds[ 3 ] ] );
+					add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ], [ normals_inds[ 1 ], normals_inds[ 2 ], normals_inds[ 3 ] ] );
 
 
 				} else {
 				} else {
 
 
-					add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ]);
-					add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ]);
+					add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ] );
+					add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ] );
 
 
 				}
 				}
 				
 				
-				if (!(uvs === undefined) && uvs.length > 0) {
+				if ( uvs !== undefined && uvs.length > 0 ) {
 
 
 					add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] );
 					add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] );
 					add_uvs( uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] );
 					add_uvs( uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] );
@@ -136,7 +159,6 @@ THREE.OBJLoader.prototype = {
 		}
 		}
 
 
 		var vertices = [];
 		var vertices = [];
-		var verticesCount = 0;
 		var normals = [];
 		var normals = [];
 		var uvs = [];
 		var uvs = [];
 
 
@@ -154,19 +176,19 @@ THREE.OBJLoader.prototype = {
 
 
 		// f vertex vertex vertex ...
 		// f vertex vertex vertex ...
 
 
-		var face_pattern1 = /f( +\d+)( +\d+)( +\d+)( +\d+)?/;
+		var face_pattern1 = /f( +-?\d+)( +-?\d+)( +-?\d+)( +-?\d+)?/;
 
 
 		// f vertex/uv vertex/uv vertex/uv ...
 		// f vertex/uv vertex/uv vertex/uv ...
 
 
-		var face_pattern2 = /f( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))?/;
+		var face_pattern2 = /f( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))?/;
 
 
 		// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...
 		// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...
 
 
-		var face_pattern3 = /f( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))?/;
+		var face_pattern3 = /f( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))?/;
 
 
 		// f vertex//normal vertex//normal vertex//normal ... 
 		// f vertex//normal vertex//normal vertex//normal ... 
 
 
-		var face_pattern4 = /f( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))?/
+		var face_pattern4 = /f( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))?/
 
 
 		//
 		//
 
 
@@ -187,36 +209,41 @@ THREE.OBJLoader.prototype = {
 
 
 				// ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
 				// ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
 
 
-				geometry.vertices.push( vector(
-					parseFloat( result[ 1 ] ),
-					parseFloat( result[ 2 ] ),
-					parseFloat( result[ 3 ] )
-				) );
+				vertices.push( 
+					geometry.vertices.push(
+						vector(
+							result[ 1 ], result[ 2 ], result[ 3 ]
+						)
+					)
+				);
 
 
 			} else if ( ( result = normal_pattern.exec( line ) ) !== null ) {
 			} else if ( ( result = normal_pattern.exec( line ) ) !== null ) {
 
 
 				// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
 				// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
 
 
-				normals.push( vector(
-					parseFloat( result[ 1 ] ),
-					parseFloat( result[ 2 ] ),
-					parseFloat( result[ 3 ] )
-				) );
+				normals.push(
+					vector(
+						result[ 1 ], result[ 2 ], result[ 3 ]
+					)
+				);
 
 
 			} else if ( ( result = uv_pattern.exec( line ) ) !== null ) {
 			} else if ( ( result = uv_pattern.exec( line ) ) !== null ) {
 
 
 				// ["vt 0.1 0.2", "0.1", "0.2"]
 				// ["vt 0.1 0.2", "0.1", "0.2"]
 
 
-				uvs.push( uv(
-					parseFloat( result[ 1 ] ),
-					parseFloat( result[ 2 ] )
-				) );
+				uvs.push(
+					uv(
+						result[ 1 ], result[ 2 ]
+					)
+				);
 
 
 			} else if ( ( result = face_pattern1.exec( line ) ) !== null ) {
 			} else if ( ( result = face_pattern1.exec( line ) ) !== null ) {
 
 
 				// ["f 1 2 3", "1", "2", "3", undefined]
 				// ["f 1 2 3", "1", "2", "3", undefined]
 
 
-				handle_face_line([ result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ] ]);
+				handle_face_line(
+					[ result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ] ]
+				);
 
 
 			} else if ( ( result = face_pattern2.exec( line ) ) !== null ) {
 			} else if ( ( result = face_pattern2.exec( line ) ) !== null ) {
 
 
@@ -249,14 +276,6 @@ THREE.OBJLoader.prototype = {
 
 
 			} else if ( /^o /.test( line ) ) {
 			} else if ( /^o /.test( line ) ) {
 
 
-				// object
-
-				if (!(geometry === undefined)) {
-
-					face_offset = face_offset + geometry.vertices.length;
-
-				}
-				
 				geometry = new THREE.Geometry();
 				geometry = new THREE.Geometry();
 				material = new THREE.MeshLambertMaterial();
 				material = new THREE.MeshLambertMaterial();
 
 
@@ -264,8 +283,6 @@ THREE.OBJLoader.prototype = {
 				mesh.name = line.substring( 2 ).trim();
 				mesh.name = line.substring( 2 ).trim();
 				object.add( mesh );
 				object.add( mesh );
 
 
-				verticesCount = 0;
-
 			} else if ( /^g /.test( line ) ) {
 			} else if ( /^g /.test( line ) ) {
 
 
 				// group
 				// group
@@ -292,9 +309,11 @@ THREE.OBJLoader.prototype = {
 
 
 		}
 		}
 
 
-		for ( var i = 0, l = object.children.length; i < l; i ++ ) {
+		var children = object.children;
+
+		for ( var i = 0, l = children.length; i < l; i ++ ) {
 
 
-			var geometry = object.children[ i ].geometry;
+			var geometry = children[ i ].geometry;
 
 
 			geometry.computeCentroids();
 			geometry.computeCentroids();
 			geometry.computeFaceNormals();
 			geometry.computeFaceNormals();
@@ -306,4 +325,4 @@ THREE.OBJLoader.prototype = {
 
 
 	}
 	}
 
 
-};
+};