You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix write_obj and write_textured_obj to correctly write out tti if present
The two `write_obj` functions previously didn't write out the texture triangle indices (tti) at all, causing weird artefacts on the top of the head when using them and then opening a textured obj in e.g. MeshLab. This fixes it and writes out tti's into the obj if they're present.
Also added appropriate asserts.
// We invert y because Meshlab's uv origin (0, 0) is on the bottom-left
168
+
// We invert y because MeshLab's uv origin (0, 0) is on the bottom-left
147
169
}
148
170
171
+
// Note: This can't be at the top, otherwise MeshLab displays the mesh in all-black.
149
172
obj_file << "usemtl FaceTexture" << std::endl; // the name of our texture (material) will be 'FaceTexture'
150
173
151
-
for (auto&& v : mesh.tvi)
174
+
for (std::size_t i = 0; i < mesh.tvi.size(); ++i)
152
175
{
153
-
// This assumes mesh.texcoords.size() == mesh.vertices.size(). The texture indices could theoretically be different (for example in the cube-mapped 3D scan).
154
-
// Add one because obj starts counting triangle indices at 1
0 commit comments