From d2b167f2d1ca15e42a177b65cdf34f35592452f7 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 13 Feb 2021 14:52:03 +0000 Subject: New .obj parser, packer, mesher --- gfx/models/obj.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 gfx/models/obj.h (limited to 'gfx/models/obj.h') diff --git a/gfx/models/obj.h b/gfx/models/obj.h new file mode 100644 index 0000000..96c5e94 --- /dev/null +++ b/gfx/models/obj.h @@ -0,0 +1,36 @@ +#ifndef OBJ_H +#define OBJ_H + +#ifndef yyFlexLexer +# define yyFlexLexer objbaseFlexLexer +# include +#endif +#include +#include +#include +#include +#include + +class ObjParser : yyFlexLexer { +public: + explicit ObjParser(const std::filesystem::path & fileName) : ObjParser {std::make_unique(fileName)} + { + } + + explicit ObjParser(std::unique_ptr in) : yyFlexLexer(in.get()) + { + ObjParser::yylex(); + } + + int yylex() override; + + std::vector vertices; + std::vector texCoords; + std::vector normals; + using FaceElement = glm::vec<3, int>; + using Face = std::vector; + std::vector faces; + glm::length_t axis {0}; +}; + +#endif -- cgit v1.2.3