- Fixed sprites sunk into water on Carmack with HQ resize modes.

This commit is contained in:
drfrag 2020-04-01 14:18:50 +02:00
parent 4bfb0e937f
commit 8336e80f48

View file

@ -133,11 +133,13 @@ namespace swrenderer
if (thing->renderflags & RF_SPRITEFLIP) if (thing->renderflags & RF_SPRITEFLIP)
renderflags ^= RF_XFLIP; renderflags ^= RF_XFLIP;
double yscale; double yscale, origyscale;
int resizeMult = gl_texture_hqresizemult;
origyscale = spriteScale.Y / tex->GetScale().Y;
if (gl_texture_hqresizemode == 0 || gl_texture_hqresizemult < 1 || !(gl_texture_hqresize_targets & 2)) if (gl_texture_hqresizemode == 0 || gl_texture_hqresizemult < 1 || !(gl_texture_hqresize_targets & 2))
yscale = spriteScale.Y / tex->GetScale().Y; resizeMult = 1;
else yscale = origyscale / resizeMult;
yscale = spriteScale.Y / tex->GetScale().Y / gl_texture_hqresizemult;
// store information in a vissprite // store information in a vissprite
RenderSprite *vis = thread->FrameMemory->NewObject<RenderSprite>(); RenderSprite *vis = thread->FrameMemory->NewObject<RenderSprite>();
@ -147,8 +149,8 @@ namespace swrenderer
vis->CurrentPortalUniq = renderportal->CurrentPortalUniq; vis->CurrentPortalUniq = renderportal->CurrentPortalUniq;
vis->yscale = float(viewport->InvZtoScale * yscale / wallc.sz1); vis->yscale = float(viewport->InvZtoScale * yscale / wallc.sz1);
vis->idepth = float(1 / wallc.sz1); vis->idepth = float(1 / wallc.sz1);
vis->floorclip = thing->Floorclip / yscale; vis->floorclip = thing->Floorclip / origyscale;
vis->texturemid = tex->GetTopOffsetSW() - (viewport->viewpoint.Pos.Z - pos.Z + thing->Floorclip) / yscale; vis->texturemid = tex->GetTopOffsetSW() - (viewport->viewpoint.Pos.Z - pos.Z + thing->Floorclip / resizeMult) / yscale;
vis->x1 = wallc.sx1 < renderportal->WindowLeft ? renderportal->WindowLeft : wallc.sx1; vis->x1 = wallc.sx1 < renderportal->WindowLeft ? renderportal->WindowLeft : wallc.sx1;
vis->x2 = wallc.sx2 > renderportal->WindowRight ? renderportal->WindowRight : wallc.sx2; vis->x2 = wallc.sx2 > renderportal->WindowRight ? renderportal->WindowRight : wallc.sx2;
vis->heightsec = heightsec; vis->heightsec = heightsec;