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
Provide OBJ and PLY reader/writer functions for Mesh, supporting vertex normals, vertex colors, N-gon faces, and a single UV-mapped texture image per mesh. Readers/writers use if constexpr + C++17 detection idiom to silently skip attributes the target mesh type does not carry.
Dependencies
Mesh Class Redesign #12 — Mesh Class Redesign (WithNormal, WithColor traits, adjacency, face normals)
expandAtSeams belongs in utils/MeshUtils.hpp (not the IO layer) — also useful for GPU vertex buffer upload
PLY UV round-trip loss: written mesh may have more vertices than the original due to seam expansion; geometry is lossless but seam topology is not recoverable
MTL parsing covers map_Kd only; full material support is out of scope
Multiple UV channels / texture images per mesh: future feature
Track ID:
mesh-io_20260323Summary
Provide OBJ and PLY reader/writer functions for
Mesh, supporting vertex normals, vertex colors, N-gon faces, and a single UV-mapped texture image per mesh. Readers/writers useif constexpr+ C++17 detection idiom to silently skip attributes the target mesh type does not carry.Dependencies
WithNormal,WithColortraits, adjacency, face normals)Acceptance Criteria
readOBJ/writeOBJ: positions, N-gon faces, per-wedge UVs (viaUVMap), vertex normals (ifWithNormal), vertex colors (ifWithColor); MTL texture path returned from readerreadPLY/writePLY: positions, N-gon faces, vertex normals (ifWithNormal), vertex colors (ifWithColor); ASCII write, ASCII + binary-LE readwritePLY(path, mesh, uvmap)overload: seam-expansion adapter duplicates vertices at UV seam edges to produce per-vertex UVs; round-trip vertex count loss documentedMeshT; absent traits handled viaif constexpr— no runtime branchingio/Implementation Plan
Phase 1: Trait Detection Infrastructure
has_normal<V>/has_color<V>(compile-timestatic_assert)include/educelab/core/types/detail/MeshTraits.hppwithstd::void_tdetection helpersPhase 2: OBJ IO
writeOBJ(path, mesh)writeOBJ(path, mesh, uvmap)overloadreadOBJ(path, mesh)readOBJ(path, mesh, uvmap)overloadPhase 3: PLY IO
expandAtSeams(mesh, uvmap)expandAtSeamsinutils/MeshUtils.hppwritePLY(path, mesh)writePLY(path, mesh, uvmap)— callsexpandAtSeamsinternallyreadPLY(path, mesh)— ASCII + binary-LENotes
expandAtSeamsbelongs inutils/MeshUtils.hpp(not the IO layer) — also useful for GPU vertex buffer uploadmap_Kdonly; full material support is out of scope