summaryrefslogtreecommitdiff
path: root/gfx/models/obj.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/models/obj.h')
-rw-r--r--gfx/models/obj.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/gfx/models/obj.h b/gfx/models/obj.h
index 96c5e94..2921e34 100644
--- a/gfx/models/obj.h
+++ b/gfx/models/obj.h
@@ -11,6 +11,8 @@
#include <memory>
#include <vector>
+class Mesh;
+
class ObjParser : yyFlexLexer {
public:
explicit ObjParser(const std::filesystem::path & fileName) : ObjParser {std::make_unique<std::ifstream>(fileName)}
@@ -19,7 +21,9 @@ public:
explicit ObjParser(std::unique_ptr<std::istream> in) : yyFlexLexer(in.get())
{
+ assert(in);
ObjParser::yylex();
+ assert(in->good());
}
int yylex() override;
@@ -29,8 +33,13 @@ public:
std::vector<glm::vec3> normals;
using FaceElement = glm::vec<3, int>;
using Face = std::vector<FaceElement>;
- std::vector<Face> faces;
+ using Faces = std::vector<Face>;
+ using Object = std::pair<std::string, Faces>;
+ std::vector<Object> objects;
glm::length_t axis {0};
+
+ using NamedMesh = std::pair<std::string, std::shared_ptr<const Mesh>>;
+ [[nodiscard]] std::vector<NamedMesh> createMeshes() const;
};
#endif