mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Rewrote bounding box algotithm. Fixes issues 5967, 6154, 6196, 6211.
Instead of being vertex-based, it is now primitive (point, line or dissected triangle) based, with proper clipping. Also, screen position is now calculated based on viewport values, instead of "guesstimating". This fixes many graphical glitches in Paper Mario: TTYD and Super Paper Mario. Also, the new code allows Mickey's Magical Mirror and Disney's Hide & Sneak to work (mostly) bug-free. I changed their inis to use bbox. These changes have a slight cost in performance when bbox is being used (rare), mostly due to the new clipping algorithm. Please check for any regressions or crashes.
This commit is contained in:
@ -372,35 +372,15 @@ void BPWritten(const BPCmd& bp)
|
||||
// -------------------------
|
||||
case BPMEM_CLEARBBOX1:
|
||||
case BPMEM_CLEARBBOX2:
|
||||
// Don't compute bounding box if this frame is being skipped!
|
||||
// Wrong but valid values are better than bogus values...
|
||||
if (g_ActiveConfig.bUseBBox && !g_bSkipCurrentFrame)
|
||||
{
|
||||
if(g_ActiveConfig.bUseBBox)
|
||||
{
|
||||
// Don't compute bounding box if this frame is being skipped!
|
||||
// Wrong but valid values are better than bogus values...
|
||||
if(g_bSkipCurrentFrame)
|
||||
break;
|
||||
u8 offset = bp.address & 2;
|
||||
|
||||
if (bp.address == BPMEM_CLEARBBOX1)
|
||||
{
|
||||
int right = bp.newvalue >> 10;
|
||||
int left = bp.newvalue & 0x3ff;
|
||||
|
||||
// We should only set these if bbox is calculated properly.
|
||||
PixelEngine::bbox[0] = left;
|
||||
PixelEngine::bbox[1] = right;
|
||||
PixelEngine::bbox_active = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bottom = bp.newvalue >> 10;
|
||||
int top = bp.newvalue & 0x3ff;
|
||||
|
||||
// We should only set these if bbox is calculated properly.
|
||||
PixelEngine::bbox[2] = top;
|
||||
PixelEngine::bbox[3] = bottom;
|
||||
PixelEngine::bbox_active = true;
|
||||
}
|
||||
}
|
||||
PixelEngine::bbox[offset] = bp.newvalue & 0x3ff;
|
||||
PixelEngine::bbox[offset | 1] = bp.newvalue >> 10;
|
||||
PixelEngine::bbox_active = true;
|
||||
}
|
||||
break;
|
||||
case BPMEM_TEXINVALIDATE:
|
||||
|
Reference in New Issue
Block a user