summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-11-16 00:37:46 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-11-16 00:37:46 +0000
commit2eb5faa1fe73793fdf206105d8f8a7d3b7278113 (patch)
treed59799d0ef6fa7429c464ba398ae981e8a416ba2
parentSwap y,z axis (diff)
downloadilt-2eb5faa1fe73793fdf206105d8f8a7d3b7278113.tar.bz2
ilt-2eb5faa1fe73793fdf206105d8f8a7d3b7278113.tar.xz
ilt-2eb5faa1fe73793fdf206105d8f8a7d3b7278113.zip
Transform obj to ILT was a static mat4
-rw-r--r--gfx/models/obj.impl.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/gfx/models/obj.impl.cpp b/gfx/models/obj.impl.cpp
index 0701d13..02996da 100644
--- a/gfx/models/obj.impl.cpp
+++ b/gfx/models/obj.impl.cpp
@@ -17,8 +17,13 @@ ObjParser::ObjParser(std::unique_ptr<std::istream> in) : yyFlexLexer(in.get())
ObjParser::yylex();
assert(in->good());
std::for_each(vertices.begin(), vertices.end(), [](auto & v) {
- std::swap(v.y, v.z);
- v.x = -v.x;
+ constexpr const glm::mat4 obj2ilt {
+ -1, 0, 0, 0, // x
+ 0, 0, 1, 0, // y
+ 0, 1, 0, 0, // z
+ 0, 0, 0, 0, // w
+ };
+ v = v * obj2ilt;
});
}