Skip to content

Commit 111fd48

Browse files
- stretch billboarding sprites properly according to the level's aspect ratio
1 parent f2d3275 commit 111fd48

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/rendering/hwrenderer/scene/hw_sprites.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,15 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
421421
// [Nash] check for special sprite drawing modes
422422
if (drawWithXYBillboard || isWallSprite)
423423
{
424-
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+
425430
mat.MakeIdentity();
426431
mat.Translate(center.X, center.Z, center.Y); // move to sprite center
427-
432+
mat.Scale(1.0, 1.0/pixelstretch, 1.0); // unstretch sprite by level aspect ratio
428433

429434
// [MC] Sprite offsets.
430435
if (!offset.isZero())
@@ -480,6 +485,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
480485
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
481486
}
482487

488+
mat.Scale(1.0, pixelstretch, 1.0); // stretch sprite by level aspect ratio
483489
mat.Translate(-center.X, -center.Z, -center.Y); // retreat from sprite center
484490

485491
v[0] = mat * FVector3(x1, z1, y1);

0 commit comments

Comments
 (0)