From b7fadd730a78671a0eaf55c36df24c04661ef2c3 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 16 Nov 2021 00:07:48 +0000 Subject: Swap y,z axis This was a pain... but all the coords make much more sense now and a lot of mystery negation has disappeared. --- gfx/models/obj.impl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gfx/models/obj.impl.cpp') 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 #include +ObjParser::ObjParser(const std::filesystem::path & fileName) : ObjParser {std::make_unique(fileName)} { } + +ObjParser::ObjParser(std::unique_ptr 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 { -- cgit v1.2.3