mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
GPU: Sort line verts to correct bias.
We want it to consistently go down and right. This improves Persona 2 UI significantly (see #3332.)
This commit is contained in:
parent
a8cbc792d9
commit
ec1d980b30
1 changed files with 12 additions and 7 deletions
|
@ -792,17 +792,22 @@ void SoftwareTransform::ExpandLines(int vertexCount, int &maxIndex, u16 *&inds,
|
|||
|
||||
maxIndex = 4 * (vertexCount / 2);
|
||||
for (int i = 0; i < vertexCount; i += 2) {
|
||||
const TransformedVertex &transVtxTL = transformed[indsIn[i + 0]];
|
||||
TransformedVertex transVtxBL = transformed[indsIn[i + 1]];
|
||||
const TransformedVertex &transVtx1 = transformed[indsIn[i + 0]];
|
||||
const TransformedVertex &transVtx2 = transformed[indsIn[i + 1]];
|
||||
|
||||
// Okay, let's calculate the perpendicular biased toward the bottom right.
|
||||
const TransformedVertex &transVtxT = transVtx1.y <= transVtx2.y ? transVtx1 : transVtx2;
|
||||
const TransformedVertex &transVtxB = transVtx1.y <= transVtx2.y ? transVtx2 : transVtx1;
|
||||
const TransformedVertex &transVtxL = transVtx1.x <= transVtx2.x ? transVtx1 : transVtx2;
|
||||
const TransformedVertex &transVtxR = transVtx1.x <= transVtx2.x ? transVtx2 : transVtx1;
|
||||
|
||||
// Sort the points so our perpendicular will bias the right direction.
|
||||
const TransformedVertex &transVtxTL = transVtxT.y != transVtxB.y || transVtxT.x > transVtxB.x ? transVtxT : transVtxB;
|
||||
const TransformedVertex &transVtxBL = transVtxT.y != transVtxB.y || transVtxT.x > transVtxB.x ? transVtxB : transVtxT;
|
||||
|
||||
// Okay, let's calculate the perpendicular.
|
||||
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue