Przeglądaj źródła

OBJExporter: Fix uv and normal indexes in face values

Before, only the vertex value was altered to reflect the 1-indexed nature of OBJs. This fixes uvs and normal values as well.
Daniel Hritzkiv 9 lat temu
rodzic
commit
b14b902ac5
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      examples/js/exporters/OBJExporter.js

+ 3 - 3
examples/js/exporters/OBJExporter.js

@@ -121,9 +121,9 @@ THREE.OBJExporter.prototype = {
 					var face = faces[ i ];
 					var face = faces[ i ];
 
 
 					output += 'f ';
 					output += 'f ';
-					output += ( indexVertex + face.a + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j     ) : '' ) + '/' + ( indexNormals + j     ) + ' ';
-					output += ( indexVertex + face.b + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + 1 ) : '' ) + '/' + ( indexNormals + j + 1 ) + ' ';
-					output += ( indexVertex + face.c + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + 2 ) : '' ) + '/' + ( indexNormals + j + 2 ) + '\n';
+					output += ( indexVertex + face.a + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + 0 + 1 ) : '' ) + '/' + ( indexNormals + j + 0 + 1 ) + ' ';
+					output += ( indexVertex + face.b + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + 1 + 1 ) : '' ) + '/' + ( indexNormals + j + 1 + 1 ) + ' ';
+					output += ( indexVertex + face.c + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + 2 + 1 ) : '' ) + '/' + ( indexNormals + j + 2 + 1 ) + '\n';
 
 
 				}
 				}