unity3d-jp / MeshSync

A package for synchronizing meshes/models editing in DCC tools into Unity in real time.
Other
1.55k stars 174 forks source link

Index issue in mesh::refine #934

Open Luoshetiange30 opened 9 months ago

Luoshetiange30 commented 9 months ago

in the function 'MeshRefiner::refine()', why the index of new2old_points and attributes are different, it seems to cause mismatch between points and uvs

auto find_or_emit_vertex = [&](int vi, int ii) { int offset = connection.v2f_offsets[vi]; int connection_count = connection.v2f_counts[vi]; for (int ci = 0; ci < connection_count; ++ci) { int& ni = old2new_indices[connection.v2f_indices[offset + ci]]; if (ni != -1 && compare_all_attributes(ni, ii)) { return ni; } else { ni = (int)new_points.size(); new_points.push_back(points[vi]); new2old_points.push_back(vi); for (auto& attr : attributes) attr->emit(ii); return ni; } } return 0; };

new2old_points saves vi while attr saves ii, does it right?