From 2bacf8071f4faade5d5b8db282c30faf8fed4f7e Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 3 Feb 2013 12:27:52 +0100 Subject: [PATCH] Fix RotateUV. Apparently the rules are reversed in through mode. --- GPU/GLES/TransformPipeline.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index cf763cc7a8..534455fd24 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -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];