From 76e1690646aa210c323baf5bbf11bfebb46e94d1 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 31 Oct 2021 15:49:20 -0700 Subject: [PATCH] GPU: Keep diagonal lines the same width. --- GPU/Common/SoftwareTransformCommon.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/GPU/Common/SoftwareTransformCommon.cpp b/GPU/Common/SoftwareTransformCommon.cpp index d2228c0850..4aeda5d312 100644 --- a/GPU/Common/SoftwareTransformCommon.cpp +++ b/GPU/Common/SoftwareTransformCommon.cpp @@ -796,9 +796,13 @@ void SoftwareTransform::ExpandLines(int vertexCount, int &maxIndex, u16 *&inds, TransformedVertex transVtxBL = transformed[indsIn[i + 1]]; // Okay, let's calculate the perpendicular biased toward the bottom right. - float horizontal = fabsf(transVtxTL.x - transVtxBL.x); - float vertical = fabsf(transVtxTL.y - transVtxBL.y); - Vec2f addWidth = Vec2f(vertical, horizontal).Normalized(); + float horizontal = transVtxTL.x - transVtxBL.x; + float vertical = transVtxTL.y - transVtxBL.y; + Vec2f addWidth = Vec2f(-vertical, horizontal).Normalized(); + // We'll bias mostly straight lines and try to keep diagonal lines at 90 degrees. + if (fabsf(addWidth.y) < fabsf(addWidth.x / 16.0f)) { + addWidth.x = -addWidth.x; + } // bottom right trans[0] = transVtxBL;