mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
softgpu: rotate uvs in throughmode.
This commit is contained in:
parent
62eb701fa0
commit
55fe5a950e
1 changed files with 18 additions and 3 deletions
|
@ -15,10 +15,12 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "../GPUState.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "Clipper.h"
|
||||
#include "Rasterizer.h"
|
||||
#include "GPU/GPUState.h"
|
||||
|
||||
#include "GPU/Software/Clipper.h"
|
||||
#include "GPU/Software/Rasterizer.h"
|
||||
|
||||
namespace Clipper {
|
||||
|
||||
|
@ -123,6 +125,17 @@ static inline int CalcClipMask(const ClipCoords& v)
|
|||
} \
|
||||
}
|
||||
|
||||
static void RotateUVThrough(VertexData &tl, VertexData &tr, VertexData &bl, VertexData &br) {
|
||||
const fixed16 x1 = tl.screenpos.x;
|
||||
const fixed16 x2 = br.screenpos.x;
|
||||
const fixed16 y1 = tl.screenpos.y;
|
||||
const fixed16 y2 = br.screenpos.y;
|
||||
|
||||
if ((x1 < x2 && y1 > y2) || (x1 > x2 && y1 < y2)) {
|
||||
std::swap(bl.texturecoords, tr.texturecoords);
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessQuad(const VertexData& v0, const VertexData& v1)
|
||||
{
|
||||
if (!gstate.isModeThrough()) {
|
||||
|
@ -198,6 +211,8 @@ void ProcessQuad(const VertexData& v0, const VertexData& v1)
|
|||
bottomright = &buf[i];
|
||||
}
|
||||
|
||||
RotateUVThrough(*topleft, *topright, *bottomleft, *bottomright);
|
||||
|
||||
// Four triangles to do backfaces as well. Two of them will get backface culled.
|
||||
Rasterizer::DrawTriangle(*topleft, *topright, *bottomright);
|
||||
Rasterizer::DrawTriangle(*bottomright, *topright, *topleft);
|
||||
|
|
Loading…
Add table
Reference in a new issue