(Continuing fixing / discussion from https://graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/merge_requests/51)
This merge request is fixing an issue that came up as a follow-up of the following merge request: https://graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/merge_requests/51
The problem it fixes occurs for some kinds of OBJ data, where vertices and face data are stored interleaved and, at the same time, the mesh contains some non-manifold geometry. As non-manifold geometry triggers the on-the-fly creation of new vertices during parsing, the indices from the OBJ file do not match any more and the result gets messed up.
The straightforward solution applied on this branch is to parse to whole OBJ file in two passes, first the vertices and then the material data and faces. This way, possible extra vertices will always be added to the back, not interfering with indices from the OBJ file
I tested the performance on a 1.1 GB OBJ file. The loading time on my machine increased to~59 seconds from ~65 seconds, so I believe the performance overhead could probably be considered acceptable.
Looking forward to your feedback!