1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Code refactor: replace gDPTextureRectangleFlip by flip parameter in gDPTextureRectangle

This commit is contained in:
Sergey Lipskiy 2016-04-14 13:21:06 +06:00
parent 7c7a7112e7
commit c095fea58a
3 changed files with 15 additions and 20 deletions

View File

@ -290,7 +290,7 @@ void RDP_TexRectFlip( u32 w0, u32 w1 )
const u32 lry = _SHIFTR(w0, 0, 12);
if ((lrx >> 2) < (ulx >> 2) || (lry >> 2) < (uly >> 2))
return;
gDPTextureRectangleFlip(
gDPTextureRectangle(
_FIXED2FLOAT(ulx, 2),
_FIXED2FLOAT(uly, 2),
_FIXED2FLOAT(lrx, 2),
@ -299,7 +299,8 @@ void RDP_TexRectFlip( u32 w0, u32 w1 )
_FIXED2FLOAT((s16)_SHIFTR(w2, 16, 16), 5), // s
_FIXED2FLOAT((s16)_SHIFTR(w2, 0, 16), 5), // t
_FIXED2FLOAT((s16)_SHIFTR(w3, 16, 16), 10), // dsdx
_FIXED2FLOAT((s16)_SHIFTR(w3, 0, 16), 10)); // dsdy
_FIXED2FLOAT((s16)_SHIFTR(w3, 0, 16), 10), // dsdy
true); //flip
}
void RDP_TexRect( u32 w0, u32 w1 )
@ -321,7 +322,8 @@ void RDP_TexRect( u32 w0, u32 w1 )
_FIXED2FLOAT((s16)_SHIFTR(w2, 16, 16), 5), // s
_FIXED2FLOAT((s16)_SHIFTR(w2, 0, 16), 5), // t
_FIXED2FLOAT((s16)_SHIFTR(w3, 16, 16), 10), // dsdx
_FIXED2FLOAT((s16)_SHIFTR(w3, 0, 16), 10)); // dsdy
_FIXED2FLOAT((s16)_SHIFTR(w3, 0, 16), 10), // dsdy
false); // flip
}
void RDP_TriFill( u32 _w0, u32 _w1 )

View File

@ -839,7 +839,7 @@ void gDPSetKeyGB(u32 cG, u32 sG, u32 wG, u32 cB, u32 sB, u32 wB )
CombinerInfo::get().updateKeyColor();
}
void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f32 t, f32 dsdx, f32 dtdy )
void gDPTextureRectangle(f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f32 t, f32 dsdx, f32 dtdy , bool flip)
{
if (gDP.otherMode.cycleType == G_CYC_COPY) {
dsdx = 1.0f;
@ -859,7 +859,7 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f
s = 0.0f;
f32 lrs, lrt;
if (RSP.cmd == G_TEXRECTFLIP) {
if (flip) {
lrs = s + (lry - uly - 1) * dsdx;
lrt = t + (lrx - ulx - 1) * dtdy;
} else {
@ -868,7 +868,7 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f
}
OGLRender::TexturedRectParams params(ulx, uly, lrx, lry, s, t, lrs, lrt, fabsf(dsdx), fabsf(dtdy),
(RSP.cmd == G_TEXRECTFLIP), false, frameBufferList().getCurrent());
flip, false, frameBufferList().getCurrent());
video().getRender().drawTexturedRect(params);
gSP.textureTile[0] = textureTileOrg[0];
@ -881,18 +881,12 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f
gDP.colorImage.height = max( gDP.colorImage.height, (u32)gDP.scissor.lry );
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPTextureRectangle( %f, %f, %f, %f, %i, %i, %f, %f, %f, %f );\n",
ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy );
#endif
}
void gDPTextureRectangleFlip( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f32 t, f32 dsdx, f32 dtdy )
{
gDPTextureRectangle( ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy );
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPTextureRectangleFlip( %f, %f, %f, %f, %i, %f, %f, %f, %f);\n",
ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy );
if (flip)
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPTextureRectangleFlip( %f, %f, %f, %f, %i, %f, %f, %f, %f);\n",
ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy );
else
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPTextureRectangle( %f, %f, %f, %f, %i, %i, %f, %f, %f, %f );\n",
ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy );
#endif
}

View File

@ -270,8 +270,7 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry );
void gDPSetConvert( s32 k0, s32 k1, s32 k2, s32 k3, s32 k4, s32 k5 );
void gDPSetKeyR( u32 cR, u32 sR, u32 wR );
void gDPSetKeyGB(u32 cG, u32 sG, u32 wG, u32 cB, u32 sB, u32 wB );
void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f32 t, f32 dsdx, f32 dtdy );
void gDPTextureRectangleFlip( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f32 t, f32 dsdx, f32 dtdy );
void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f32 t, f32 dsdx, f32 dtdy, bool flip );
void gDPFullSync();
void gDPTileSync();
void gDPPipeSync();