Closed wallisc closed 3 years ago
Thanks. I fixed it for reading, but not the writing case.
https://github.com/microsoft/DirectXMesh/commit/66451d179b8c14506fa05fde33548967c79b82f1
Fixed in https://github.com/microsoft/DirectXMesh/commit/c8e34c3e6f84cc96e58819520b634c3530de028c
UVAtlas is partially fixed with https://github.com/microsoft/UVAtlas/commit/30c839cfb778a1d2b70787d4cbbbe9afa8369606. It will be fully fixed when I refresh the NuGet packages it uses for WaveFrontReader.h early next week.
Fixed in the November 2021 release
https://github.com/microsoft/DirectXMesh/releases/tag/nov2021
When exporting OBJ files, the OBJ file will be broken on most 3D viewers including the one built into Windows when the indices exceed 999. The reason is because the face indices are formatted with comma separation which is not expected for OBJ files.
I've root caused this to the call to the following code called right at the start of wmain that causes the output of uint's to have comma separation.
std::locale::global(std::locale(""));
An easy fix is to drop in the following right at the start of Mesh::ExportToOBJ:
// Revert the locale to classic so that indices aren't comma separated. Comma separation will trip up most obj viewers os.imbue(std::locale::classic());