Skip to content

Commit 586e899

Browse files
- fixed: rollsprites now 'unstretch' properly in regular y-billboarding
1 parent a3e61ce commit 586e899

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/rendering/hwrenderer/scene/hw_sprites.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ void HandleSpriteOffsets(Matrix3x4 *mat, const FRotator *HW, FVector2 *offset, b
355355

356356
bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
357357
{
358+
float pixelstretch = 1.2;
359+
if (actor && actor->Level)
360+
pixelstretch = actor->Level->pixelstretch;
361+
else if (particle && particle->subsector && particle->subsector->sector && particle->subsector->sector->Level)
362+
pixelstretch = particle->subsector->sector->Level->pixelstretch;
363+
358364
FVector3 center = FVector3((x1 + x2) * 0.5, (y1 + y2) * 0.5, (z1 + z2) * 0.5);
359365
const auto& HWAngles = di->Viewpoint.HWAngles;
360366
Matrix3x4 mat;
@@ -421,12 +427,6 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
421427
// [Nash] check for special sprite drawing modes
422428
if (drawWithXYBillboard || isWallSprite)
423429
{
424-
float pixelstretch = 1.2;
425-
if (actor && actor->Level)
426-
pixelstretch = actor->Level->pixelstretch;
427-
else if (particle && particle->subsector && particle->subsector->sector && particle->subsector->sector->Level)
428-
pixelstretch = particle->subsector->sector->Level->pixelstretch;
429-
430430
mat.MakeIdentity();
431431
mat.Translate(center.X, center.Z, center.Y); // move to sprite center
432432
mat.Scale(1.0, 1.0/pixelstretch, 1.0); // unstretch sprite by level aspect ratio
@@ -509,9 +509,11 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
509509
float rollDegrees = Angles.Roll.Degrees();
510510

511511
mat.Translate(center.X, center.Z, center.Y);
512+
mat.Scale(1.0, 1.0/pixelstretch, 1.0); // unstretch sprite by level aspect ratio
512513
if (useOffsets) mat.Translate(xx, zz, yy);
513514
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
514515
if (useOffsets) mat.Translate(-xx, -zz, -yy);
516+
mat.Scale(1.0, pixelstretch, 1.0); // stretch sprite by level aspect ratio
515517
mat.Translate(-center.X, -center.Z, -center.Y);
516518
}
517519

0 commit comments

Comments
 (0)