Fix minor miscalculation with rotation in texture definition

This commit is contained in:
2017-07-08 00:31:28 -07:00
parent 5d1d46e2cf
commit 9ce83797ec

View File

@ -30,7 +30,7 @@ void brushdef_gtk(std::stringstream &x, const vector<TPlanePoints> &y) {
std::string texdef_net(const TPlanePoints &b) { std::string texdef_net(const TPlanePoints &b) {
// Reflex's material files haven't been reversed so there isn't actually a texture file to make use of // Reflex's material files haven't been reversed so there isn't actually a texture file to make use of
#define REFLEX_TEXRES_PLACEHOLDER 64 #define REFLEX_TEXRES_PLACEHOLDER 64
#define MIN_PRECISION 6 #define MAX_PRECISION 6 // note: netradiant supports up to 10
float inverse_xscale = 0; float inverse_xscale = 0;
if (b.hscale != 0) { if (b.hscale != 0) {
inverse_xscale = 1 / (b.hscale * REFLEX_TEXRES_PLACEHOLDER); // WIDTH inverse_xscale = 1 / (b.hscale * REFLEX_TEXRES_PLACEHOLDER); // WIDTH
@ -41,8 +41,8 @@ std::string texdef_net(const TPlanePoints &b) {
} }
// a lot of reflex's values for rotation are 0.0 or 1.0 // a lot of reflex's values for rotation are 0.0 or 1.0
// likely values are stored in radians. // likely values are stored in radians.
float c = cos(b.rotation); float c = cos(-b.rotation);
float s = sin(b.rotation); float s = sin(-b.rotation);
// horizontal values for texture definition // horizontal values for texture definition
float h1, h2, h3; float h1, h2, h3;
@ -56,7 +56,7 @@ std::string texdef_net(const TPlanePoints &b) {
v3 = -b.vshift / -REFLEX_TEXRES_PLACEHOLDER; // HEIGHT v3 = -b.vshift / -REFLEX_TEXRES_PLACEHOLDER; // HEIGHT
std::stringstream ss; std::stringstream ss;
ss << std::setprecision(6) ss << std::setprecision(MAX_PRECISION)
<< "( " << h1 << ' ' << h2 << ' ' << h3 << " ) " << "( " << h1 << ' ' << h2 << ' ' << h3 << " ) "
<< "( " << v1 << ' ' << v2 << ' ' << v3 << " )"; << "( " << v1 << ' ' << v2 << ' ' << v3 << " )";
return ss.str(); return ss.str();