Commit 4c35d544 authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'obj-fix-wrong-indices' into 'master'

Fixed broken indices for some cases of OBJ parsing by using two passes

(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 from ~59 seconds to ~65 seconds, so I believe the performance overhead could probably be considered acceptable.

Looking forward to your feedback!


See merge request !84
parents 6b8587fc f53429fd
Pipeline #2920 passed with stage
in 22 minutes and 27 seconds