summaryrefslogtreecommitdiff
path: root/gfx/models/obj.impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/models/obj.impl.cpp')
-rw-r--r--gfx/models/obj.impl.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/gfx/models/obj.impl.cpp b/gfx/models/obj.impl.cpp
index 330e851..0701d13 100644
--- a/gfx/models/obj.impl.cpp
+++ b/gfx/models/obj.impl.cpp
@@ -9,6 +9,19 @@
#include <utility>
#include <vector>
+ObjParser::ObjParser(const std::filesystem::path & fileName) : ObjParser {std::make_unique<std::ifstream>(fileName)} { }
+
+ObjParser::ObjParser(std::unique_ptr<std::istream> in) : yyFlexLexer(in.get())
+{
+ assert(in);
+ ObjParser::yylex();
+ assert(in->good());
+ std::for_each(vertices.begin(), vertices.end(), [](auto & v) {
+ std::swap(v.y, v.z);
+ v.x = -v.x;
+ });
+}
+
ObjParser::NamedMeshes
ObjParser::createMeshes() const
{