Rotate normals also.

This commit is contained in:
lzwdgc 2017-07-27 18:17:56 +03:00
parent 26f276ff94
commit 3ae21d2eca
2 changed files with 7 additions and 4 deletions

View file

@ -187,10 +187,13 @@ std::string vertex::printVertex(bool rotate_x_90) const
return s; return s;
} }
std::string vertex::printNormal() const std::string vertex::printNormal(bool rotate_x_90) const
{ {
string s; string s;
s = "vn " + to_string(-normal.x) + " " + to_string(normal.y) + " " + to_string(-normal.z); if (rotate_x_90)
s = "vn " + to_string(-normal.x) + " " + to_string(-normal.z) + " " + to_string(normal.y);
else
s = "vn " + to_string(-normal.x) + " " + to_string(normal.y) + " " + to_string(-normal.z);
return s; return s;
} }
@ -305,7 +308,7 @@ std::string block::printObj(int group_offset, bool rotate_x_90) const
s += v.printVertex(rotate_x_90) + "\n"; s += v.printVertex(rotate_x_90) + "\n";
s += "\n"; s += "\n";
for (auto &v : vertices) for (auto &v : vertices)
s += v.printNormal() + "\n"; s += v.printNormal(rotate_x_90) + "\n";
s += "\n"; s += "\n";
for (auto &v : vertices) for (auto &v : vertices)
s += v.printTex() + "\n"; s += v.printTex() + "\n";

View file

@ -98,7 +98,7 @@ struct vertex
void load(const buffer &b, uint32_t flags); void load(const buffer &b, uint32_t flags);
std::string printVertex(bool rotate_x_90 = false) const; std::string printVertex(bool rotate_x_90 = false) const;
std::string printNormal() const; std::string printNormal(bool rotate_x_90 = false) const;
std::string printTex() const; std::string printTex() const;
}; };