Fix RotateUV. Apparently the rules are reversed in through mode.

This commit is contained in:
Henrik Rydgard
2013-02-03 12:27:52 +01:00
parent 7a22b4694b
commit 2bacf8071f
+21 -5
View File
@@ -348,11 +348,24 @@ static void SwapUVs(TransformedVertex &a, TransformedVertex &b) {
// 1 0 0 1 1 2 3 0
// Used by Star Soldier and Ys vs Sora.
static void RotateUVs(TransformedVertex v[4]) {
if (/* (v[0].x > v[2].x && v[0].y < v[2].y) || */ // This first check seems wrong..
(v[0].x < v[2].x && v[0].y > v[2].y)) {
static void RotateUV(TransformedVertex v[4]) {
float x1 = v[2].x;
float x2 = v[0].x;
float y1 = v[2].y;
float y2 = v[0].y;
if ((x1 < x2 && y1 < y2) || (x1 > x2 && y1 > y2))
SwapUVs(v[1], v[3]);
}
static void RotateUVThrough(TransformedVertex v[4]) {
float x1 = v[2].x;
float x2 = v[0].x;
float y1 = v[2].y;
float y2 = v[0].y;
if ((x1 < x2 && y1 > y2) || (x1 > x2 && y1 < y2))
SwapUVs(v[1], v[3]);
}
}
// This is the software transform pipeline, which is necessary for supporting RECT
@@ -620,7 +633,10 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
trans[3].u = saved.u;
// That's the four corners. Now process UV rotation.
RotateUVs(trans);
if (throughmode)
RotateUVThrough(trans);
else
RotateUV(trans);
// bottom right
trans[4] = trans[0];