Browse Source

Fix OBJ loader with empty uvs or normals

Fernando Serrano 7 years ago
parent
commit
171de9dfbb
1 changed files with 2 additions and 4 deletions
  1. 2 4
      examples/js/loaders/OBJLoader.js

+ 2 - 4
examples/js/loaders/OBJLoader.js

@@ -286,19 +286,17 @@ THREE.OBJLoader = ( function () {
 
 				this.addVertex( ia, ib, ic );
 
-				if ( ua !== undefined ) {
+				if ( ua !== undefined && ua !== '' ) {
 
 					var uvLen = this.uvs.length;
-
 					ia = this.parseUVIndex( ua, uvLen );
 					ib = this.parseUVIndex( ub, uvLen );
 					ic = this.parseUVIndex( uc, uvLen );
-
 					this.addUV( ia, ib, ic );
 
 				}
 
-				if ( na !== undefined ) {
+				if ( na !== undefined && na !== '' ) {
 
 					// Normals are many times the same. If so, skip function call and parseInt.
 					var nLen = this.normals.length;