mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 13:50:48 +00:00
- fixed: rollsprites now 'unstretch' properly in regular y-billboarding
This commit is contained in:
parent
a3e61ce33b
commit
586e89954a
1 changed files with 8 additions and 6 deletions
|
@ -355,6 +355,12 @@ void HandleSpriteOffsets(Matrix3x4 *mat, const FRotator *HW, FVector2 *offset, b
|
|||
|
||||
bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
|
||||
{
|
||||
float pixelstretch = 1.2;
|
||||
if (actor && actor->Level)
|
||||
pixelstretch = actor->Level->pixelstretch;
|
||||
else if (particle && particle->subsector && particle->subsector->sector && particle->subsector->sector->Level)
|
||||
pixelstretch = particle->subsector->sector->Level->pixelstretch;
|
||||
|
||||
FVector3 center = FVector3((x1 + x2) * 0.5, (y1 + y2) * 0.5, (z1 + z2) * 0.5);
|
||||
const auto& HWAngles = di->Viewpoint.HWAngles;
|
||||
Matrix3x4 mat;
|
||||
|
@ -421,12 +427,6 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
|
|||
// [Nash] check for special sprite drawing modes
|
||||
if (drawWithXYBillboard || isWallSprite)
|
||||
{
|
||||
float pixelstretch = 1.2;
|
||||
if (actor && actor->Level)
|
||||
pixelstretch = actor->Level->pixelstretch;
|
||||
else if (particle && particle->subsector && particle->subsector->sector && particle->subsector->sector->Level)
|
||||
pixelstretch = particle->subsector->sector->Level->pixelstretch;
|
||||
|
||||
mat.MakeIdentity();
|
||||
mat.Translate(center.X, center.Z, center.Y); // move to sprite center
|
||||
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)
|
|||
float rollDegrees = Angles.Roll.Degrees();
|
||||
|
||||
mat.Translate(center.X, center.Z, center.Y);
|
||||
mat.Scale(1.0, 1.0/pixelstretch, 1.0); // unstretch sprite by level aspect ratio
|
||||
if (useOffsets) mat.Translate(xx, zz, yy);
|
||||
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
|
||||
if (useOffsets) mat.Translate(-xx, -zz, -yy);
|
||||
mat.Scale(1.0, pixelstretch, 1.0); // stretch sprite by level aspect ratio
|
||||
mat.Translate(-center.X, -center.Z, -center.Y);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue