mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -06:00
BBox: read from the proper world matrix index when transforming vertexes to screen coordinates.
Fixes some remaining bbox related bugs in Mickey's Magical Mirror and a slight graphical glitch in Paper Mario: TTYD when flipping and Vivian as your companion (I've been scratching my head for days to find this one).
This commit is contained in:
@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
//BBox
|
//BBox
|
||||||
#include "XFMemory.h"
|
#include "XFMemory.h"
|
||||||
extern float GC_ALIGNED16(g_fProjectionMatrix[16]);
|
|
||||||
#ifndef _M_GENERIC
|
#ifndef _M_GENERIC
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#define USE_JIT
|
#define USE_JIT
|
||||||
@ -45,7 +44,7 @@ NativeVertexFormat *g_nativeVertexFmt;
|
|||||||
|
|
||||||
// Matrix components are first in GC format but later in PC format - we need to store it temporarily
|
// Matrix components are first in GC format but later in PC format - we need to store it temporarily
|
||||||
// when decoding each vertex.
|
// when decoding each vertex.
|
||||||
static u8 s_curposmtx;
|
static u8 s_curposmtx = MatrixIndexA.PosNormalMtxIdx;
|
||||||
static u8 s_curtexmtx[8];
|
static u8 s_curtexmtx[8];
|
||||||
static int s_texmtxwrite = 0;
|
static int s_texmtxwrite = 0;
|
||||||
static int s_texmtxread = 0;
|
static int s_texmtxread = 0;
|
||||||
@ -101,6 +100,9 @@ void LOADERDECL PosMtx_Write()
|
|||||||
DataWrite<u8>(0);
|
DataWrite<u8>(0);
|
||||||
DataWrite<u8>(0);
|
DataWrite<u8>(0);
|
||||||
DataWrite<u8>(0);
|
DataWrite<u8>(0);
|
||||||
|
|
||||||
|
// Resetting current position matrix to default is needed for bbox to behave
|
||||||
|
s_curposmtx = (u8) MatrixIndexA.PosNormalMtxIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL UpdateBoundingBoxPrepare()
|
void LOADERDECL UpdateBoundingBoxPrepare()
|
||||||
@ -219,7 +221,7 @@ void LOADERDECL UpdateBoundingBox()
|
|||||||
// We need to get the raw projection values for the bounding box calculation
|
// We need to get the raw projection values for the bounding box calculation
|
||||||
// to work properly. That means, no projection hacks!
|
// to work properly. That means, no projection hacks!
|
||||||
const float * const orig_point = s_bbox_vertex_buffer;
|
const float * const orig_point = s_bbox_vertex_buffer;
|
||||||
const float * const world_matrix = (float*)xfmem + MatrixIndexA.PosNormalMtxIdx * 4;
|
const float * const world_matrix = (float*)xfmem + s_curposmtx * 4;
|
||||||
const float * const proj_matrix = xfregs.projection.rawProjection;
|
const float * const proj_matrix = xfregs.projection.rawProjection;
|
||||||
|
|
||||||
// Transform by world matrix
|
// Transform by world matrix
|
||||||
|
Reference in New Issue
Block a user