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.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/gfx/models/obj.impl.cpp b/gfx/models/obj.impl.cpp
index d73d82e..205abc8 100644
--- a/gfx/models/obj.impl.cpp
+++ b/gfx/models/obj.impl.cpp
@@ -19,15 +19,18 @@ 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) {
- 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
- };
+ 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
+ };
+ std::for_each(vertices.begin(), vertices.end(), [&obj2ilt](auto & v) {
v = v * obj2ilt;
});
+ std::for_each(normals.begin(), normals.end(), [&obj2ilt](auto & v) {
+ v = glm::vec4 {v, 0} * obj2ilt;
+ });
}
ObjParser::NamedMeshes