diff --git a/src/mod_converter/model.cpp b/src/mod_converter/model.cpp index d646441..d5f367a 100644 --- a/src/mod_converter/model.cpp +++ b/src/mod_converter/model.cpp @@ -187,10 +187,13 @@ std::string vertex::printVertex(bool rotate_x_90) const return s; } -std::string vertex::printNormal() const +std::string vertex::printNormal(bool rotate_x_90) const { 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; } @@ -305,7 +308,7 @@ std::string block::printObj(int group_offset, bool rotate_x_90) const s += v.printVertex(rotate_x_90) + "\n"; s += "\n"; for (auto &v : vertices) - s += v.printNormal() + "\n"; + s += v.printNormal(rotate_x_90) + "\n"; s += "\n"; for (auto &v : vertices) s += v.printTex() + "\n"; diff --git a/src/mod_converter/model.h b/src/mod_converter/model.h index 51dcb17..a4a2a63 100644 --- a/src/mod_converter/model.h +++ b/src/mod_converter/model.h @@ -98,7 +98,7 @@ struct vertex void load(const buffer &b, uint32_t flags); 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; };