Browse Source

OBJLoader: Added support to vertex/uv for completeness sake.

Mr.doob 13 years ago
parent
commit
80f5016f17
1 changed files with 11 additions and 0 deletions
  1. 11 0
      examples/js/loaders/OBJLoader.js

+ 11 - 0
examples/js/loaders/OBJLoader.js

@@ -46,6 +46,17 @@ THREE.OBJLoader.prototype.parse = function ( data, callback ) {
 
 
 	}
 	}
 
 
+	// faces: vertex/uv
+
+	pattern = /f ([\d]+)\/([\d]+) ([\d]+)\/([\d]+) ([\d]+)\/([\d]+)/g;
+
+	while ( ( result = pattern.exec( data ) ) != null ) {
+
+		var face = new THREE.Face3( parseInt( result[ 1 ] ) - 1, parseInt( result[ 3 ] ) - 1, parseInt( result[ 5 ] ) - 1 );
+		geometry.faces.push( face );
+
+	}
+
 	// faces: vertex/uv/normal
 	// faces: vertex/uv/normal
 
 
 	pattern = /f ([\d]+)\/([\d]+)\/([\d]+) ([\d]+)\/([\d]+)\/([\d]+) ([\d]+)\/([\d]+)\/([\d]+)/g;
 	pattern = /f ([\d]+)\/([\d]+)\/([\d]+) ([\d]+)\/([\d]+)\/([\d]+) ([\d]+)\/([\d]+)\/([\d]+)/g;