Skip to content

Commit

Permalink
fix obj loader when face have duplicated vertex indices
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Nov 30, 2023
1 parent 32805f5 commit 59807bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wrap/io_trimesh/import_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ class ImporterOBJ
// verifying validity of vertex indices
std::vector<int> tmp = ff.v;
std::sort(tmp.begin(),tmp.end());
std::unique(tmp.begin(),tmp.end());
if(tmp.size() != ff.v.size()) {
auto it = std::unique(tmp.begin(), tmp.end()); // returns the new end of the vector with unique indices
if(it != tmp.end()) { // if the end is changed, there were duplicated indices...
result = E_VERTICES_WITH_SAME_IDX_IN_FACE;
extraTriangles--;
continue;
Expand Down

0 comments on commit 59807bd

Please sign in to comment.