From a6fb8318941b08c6fdde49f78f25738e96c59dea Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 6 Oct 2022 00:30:36 +0200 Subject: [PATCH] - scaling demessification in the voxel renderer (needs thorough testing!!!) --- source/core/rendering/scene/hw_sprites.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/core/rendering/scene/hw_sprites.cpp b/source/core/rendering/scene/hw_sprites.cpp index 41b7c0f14..70a432ce7 100644 --- a/source/core/rendering/scene/hw_sprites.cpp +++ b/source/core/rendering/scene/hw_sprites.cpp @@ -378,12 +378,12 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int float xoff = tilexoff * sx; float yoff = tileyoff * sy; - if (xsize & 1) xoff -= sx * 0.5; // Odd xspans (taken from polymost as-is) + if (xsize & 1) xoff -= sx * 0.5f; // Odd xspans (taken from polymost as-is) if (spr->cstat & CSTAT_SPRITE_YCENTER) { - yoff -= height * 0.5; - if (ysize & 1) yoff -= spr->yrepeat * (0.125f / 16.f); // Odd yspans (taken from polymost as-is) + yoff -= height * 0.5f; + if (ysize & 1) yoff -= sy * 0.5f; // Odd yspans (taken from polymost as-is) } if (flags & CSTAT_SPRITE_XFLIP) xoff = -xoff; @@ -478,14 +478,14 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, tspritetype* spr, s FVector3 scalevec = { voxel->scale, voxel->scale, voxel->scale }; FVector3 translatevec = { 0, 0, voxel->zadd * voxel->scale }; - float basescale = voxel->bscale / 64.f; - float sprxscale = (float)spr->ScaleX() * (256.f / 5) * basescale; + float basescale = voxel->bscale; + float sprxscale = (float)spr->ScaleX() * 0.8f * basescale; if ((spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_WALL) { sprxscale *= 1.25f; auto rvec = ownerActor->sprext.rot.Yaw.ToVector(); - translatevec.Y -= spr->xoffset * rvec.X / 64; - translatevec.X += spr->xoffset * rvec.Y / 64; + translatevec.Y -= spr->xoffset * rvec.X; + translatevec.X += spr->xoffset * rvec.Y; } if (spr->cstat & CSTAT_SPRITE_YFLIP) @@ -504,13 +504,13 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, tspritetype* spr, s translatevec.X *= sprxscale; scalevec.Y *= sprxscale; translatevec.Y *= sprxscale; - float sprzscale = (float)spr->yrepeat * basescale; + float sprzscale = (float)spr->ScaleY() * basescale; scalevec.Z *= sprzscale; translatevec.Z *= sprzscale; float zpos = (float)(spr->pos.Z + ownerActor->sprext.position_offset.Z); - float zscale = ((spr->cstat & CSTAT_SPRITE_YFLIP) && (spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -1.f/64.f : 1.f/64.f; - zpos -= (spr->yoffset * spr->yrepeat) * zscale * voxel->bscale; + float zscale = ((spr->cstat & CSTAT_SPRITE_YFLIP) && (spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -1.f : 1.f; + zpos -= (spr->yoffset * spr->ScaleY()) * zscale * basescale; x = (spr->pos.X + ownerActor->sprext.position_offset.X); z = -zpos;