- Kaunas, Lithuania
- https://aras-p.info/
- Joined on
2022-01-20
Similar here: fmt/format.h
includes feel like they are not much needed.
std::ifstream
will fail on Windows when file path contains non-English characters. Use blender::fstream
wrapper from BLI_fileops.hh
instead.
Minor for future cleanup: this is the same code as OBJ set_world_axes_transform (and possibly others?). Would be nice to share.
Minor: feels like fmt/format.h
things are already included via ply_file_buffer.hh
above; should be no need to repeat them here. And fmt functionality is not directly used in FileBufferAscii
class anyway.
Minor: these comments don't add much, it's very clear from the code flow what for example write_header
does.
Minor for future cleanup: forward_axis_update
and up_axis_update
are exactly the same between OBJ and PLY code now. Might be good idea to move it into some shared place at some point (and while at it, maybe look whether Collada could share it).
Minor: row
is not needed for laying this out. I assume it came initially from OBJ code back when it was using axis-choices-as-inline-buttons style. It should be enough to just do:
What colorspace are PLY vertex colors defined in? Since they seem to be 8 bits per component, I would assume they are sRGB (linear colors would not have enough precision at just 8 bits). My impression is that Blender colors are in linear color space, when they are stored as floats. So the reading code here (and likewise, exporting code elsewhere) might need a sRGB<->Linear conversion.
Code looks good to me! Would be nice to have some test coverage; do you have a relatively simple .obj file that uses this?