Rendering fixes ahoy!

- Fix squished sky in Software 3P/4P
- Fix reversed sky in OpenGL Mirror Mode
- Fix MD2 culling in Mirror Mode
This commit is contained in:
TehRealSalt 2017-12-29 14:50:16 -05:00
parent c70a2f51aa
commit 4a23c4704d
4 changed files with 20 additions and 9 deletions

View file

@ -5433,9 +5433,14 @@ static void HWR_DrawSkyBackground(player_t *player)
// The only time this will probably be an issue is when a sky wider than 1024 is used as a sky AND a regular wall texture
angle = (dup_viewangle + gr_xtoviewangle[0]);
dimensionmultiply = ((float)textures[skytexture]->width/256.0f);
if (atransform.mirror)
{
angle = InvAngle(angle);
dimensionmultiply *= -1;
}
v[0].sow = v[3].sow = ((float) angle / ((ANGLE_90-1)*dimensionmultiply));
v[2].sow = v[1].sow = (-1.0f/dimensionmultiply)+((float) angle / ((ANGLE_90-1)*dimensionmultiply));

View file

@ -1523,6 +1523,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
p.flip = atransform.flip;
p.mirror = atransform.mirror;
HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color);
}

View file

@ -1874,14 +1874,16 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
pglEnable(GL_CULL_FACE);
// pos->flip is if the screen is flipped too
if (flipped != pos->flip) // If either are active, but not both, invert the model's culling
// flipped is if the object is flipped
// pos->flip is if the screen is flipped vertically
// pos->mirror is if the screen is flipped horizontally
// XOR all the flips together to figure out what culling to use!
{
pglCullFace(GL_FRONT);
}
else
{
pglCullFace(GL_BACK);
boolean reversecull = (flipped ^ pos->flip ^ pos->mirror);
if (reversecull)
pglCullFace(GL_FRONT);
else
pglCullFace(GL_BACK);
}
#ifndef KOS_GL_COMPATIBILITY

View file

@ -80,5 +80,8 @@ void R_SetupSkyDraw(void)
void R_SetSkyScale(void)
{
fixed_t difference = vid.fdupx-(vid.dupx<<FRACBITS);
skyscale = FixedDiv(FRACUNIT, vid.fdupx+difference);
fixed_t scr = FRACUNIT;
if (splitscreen > 1)
scr *= 2;
skyscale = FixedDiv(scr, vid.fdupx+difference);
}