mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-22 12:11:21 +00:00
- scaling demessification in the voxel renderer
(needs thorough testing!!!)
This commit is contained in:
parent
91c318b708
commit
a6fb831894
1 changed files with 10 additions and 10 deletions
|
@ -378,12 +378,12 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int
|
||||||
float xoff = tilexoff * sx;
|
float xoff = tilexoff * sx;
|
||||||
float yoff = tileyoff * sy;
|
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)
|
if (spr->cstat & CSTAT_SPRITE_YCENTER)
|
||||||
{
|
{
|
||||||
yoff -= height * 0.5;
|
yoff -= height * 0.5f;
|
||||||
if (ysize & 1) yoff -= spr->yrepeat * (0.125f / 16.f); // Odd yspans (taken from polymost as-is)
|
if (ysize & 1) yoff -= sy * 0.5f; // Odd yspans (taken from polymost as-is)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & CSTAT_SPRITE_XFLIP) xoff = -xoff;
|
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 scalevec = { voxel->scale, voxel->scale, voxel->scale };
|
||||||
FVector3 translatevec = { 0, 0, voxel->zadd * voxel->scale };
|
FVector3 translatevec = { 0, 0, voxel->zadd * voxel->scale };
|
||||||
|
|
||||||
float basescale = voxel->bscale / 64.f;
|
float basescale = voxel->bscale;
|
||||||
float sprxscale = (float)spr->ScaleX() * (256.f / 5) * basescale;
|
float sprxscale = (float)spr->ScaleX() * 0.8f * basescale;
|
||||||
if ((spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_WALL)
|
if ((spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_WALL)
|
||||||
{
|
{
|
||||||
sprxscale *= 1.25f;
|
sprxscale *= 1.25f;
|
||||||
auto rvec = ownerActor->sprext.rot.Yaw.ToVector();
|
auto rvec = ownerActor->sprext.rot.Yaw.ToVector();
|
||||||
translatevec.Y -= spr->xoffset * rvec.X / 64;
|
translatevec.Y -= spr->xoffset * rvec.X;
|
||||||
translatevec.X += spr->xoffset * rvec.Y / 64;
|
translatevec.X += spr->xoffset * rvec.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr->cstat & CSTAT_SPRITE_YFLIP)
|
if (spr->cstat & CSTAT_SPRITE_YFLIP)
|
||||||
|
@ -504,13 +504,13 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, tspritetype* spr, s
|
||||||
translatevec.X *= sprxscale;
|
translatevec.X *= sprxscale;
|
||||||
scalevec.Y *= sprxscale;
|
scalevec.Y *= sprxscale;
|
||||||
translatevec.Y *= sprxscale;
|
translatevec.Y *= sprxscale;
|
||||||
float sprzscale = (float)spr->yrepeat * basescale;
|
float sprzscale = (float)spr->ScaleY() * basescale;
|
||||||
scalevec.Z *= sprzscale;
|
scalevec.Z *= sprzscale;
|
||||||
translatevec.Z *= sprzscale;
|
translatevec.Z *= sprzscale;
|
||||||
|
|
||||||
float zpos = (float)(spr->pos.Z + ownerActor->sprext.position_offset.Z);
|
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;
|
float zscale = ((spr->cstat & CSTAT_SPRITE_YFLIP) && (spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -1.f : 1.f;
|
||||||
zpos -= (spr->yoffset * spr->yrepeat) * zscale * voxel->bscale;
|
zpos -= (spr->yoffset * spr->ScaleY()) * zscale * basescale;
|
||||||
|
|
||||||
x = (spr->pos.X + ownerActor->sprext.position_offset.X);
|
x = (spr->pos.X + ownerActor->sprext.position_offset.X);
|
||||||
z = -zpos;
|
z = -zpos;
|
||||||
|
|
Loading…
Reference in a new issue