#pragma once #include #include #include "vde/foundation/math_types.h" namespace vde::foundation { struct ObjMeshData { std::vector vertices; std::vector texcoords; std::vector normals; /// Vertex indices per face (0-based internally). /// Always populated regardless of face format. std::vector> faces; /// Texcoord indices per face (0-based). Empty if the file had no vt data. /// Same length as faces; each sub-vector same length as corresponding face. std::vector> face_texcoords; /// Normal indices per face (0-based). Empty if the file had no vn data. std::vector> face_normals; /// Material name per face group (appears before the faces that use it). /// The i-th entry gives the material active for the i-th face. std::vector face_materials; /// Helpers [[nodiscard]] bool has_texcoords() const { return !texcoords.empty(); } }; ObjMeshData read_obj(const std::string& filepath); void write_obj(const std::string& filepath, const ObjMeshData& data); } // namespace vde::foundation