polymost.cpp: fix polymost_dorotatesprite() issue where sprites could be rendered with fractional positions and sizes leading to GL filtering imperfections.

git-svn-id: https://svn.eduke32.com/eduke32@6698 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2018-02-26 11:26:40 +00:00
parent cb9ee858bf
commit c0b0ed2240

View file

@ -6427,8 +6427,8 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
}
vec2f_t const fofs = { (float)ofs.x, (float)ofs.y };
float const cx = (float)sx * (1.0f / 65536.f) - fofs.x * cosang2 + fofs.y * sinang2;
float const cy = (float)sy * (1.0f / 65536.f) - fofs.x * sinang - fofs.y * cosang;
float const cx = floorf((float)sx * (1.0f / 65536.f) - fofs.x * cosang2 + fofs.y * sinang2);
float const cy = floorf((float)sy * (1.0f / 65536.f) - fofs.x * sinang - fofs.y * cosang);
vec2f_t pxy[8] = { { cx, cy },
{ cx + (float)siz.x * cosang2, cy + (float)siz.x * sinang },
@ -6438,6 +6438,13 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
pxy[2].x = pxy[1].x + pxy[3].x - pxy[0].x;
pxy[2].y = pxy[1].y + pxy[3].y - pxy[0].y;
// Round after calculating pxy[2] so that it is calculated correctly
// Rounding pxy[0].x & pxy[0].y is unnecessary so long as pxy[0] can never have fractional values
//pxy[0].x = roundf(pxy[0].x); pxy[0].y = roundf(pxy[0].y);
pxy[1].x = roundf(pxy[1].x); pxy[1].y = roundf(pxy[1].y);
pxy[2].x = roundf(pxy[2].x); pxy[2].y = roundf(pxy[2].y);
pxy[3].x = roundf(pxy[3].x); pxy[3].y = roundf(pxy[3].y);
int32_t n = 4;
xtex.d = 0; ytex.d = 0; otex.d = 1.f;