diff options
| author | crudelios <crudelios@gmail.com> | 2014-01-25 18:04:15 +0000 |
|---|---|---|
| committer | crudelios <crudelios@gmail.com> | 2014-01-25 18:04:15 +0000 |
| commit | 5f14f0e3ce407d32760491a12830f0dff8284b5e (patch) | |
| tree | 54af56d8d3ddaa00906e0e9e5db3e83a8d9accf9 /Source/Core/VideoCommon/VertexLoader.cpp | |
| parent | cdfe58f7ede09ff11b13adf5a911da5a50927870 (diff) | |
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).
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoader.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoader.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index cb7e29e488..a13d72ad8f 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -27,7 +27,6 @@ //BBox #include "XFMemory.h" -extern float GC_ALIGNED16(g_fProjectionMatrix[16]); #ifndef _M_GENERIC #ifndef __APPLE__ #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 // when decoding each vertex. -static u8 s_curposmtx; +static u8 s_curposmtx = MatrixIndexA.PosNormalMtxIdx; static u8 s_curtexmtx[8]; static int s_texmtxwrite = 0; static int s_texmtxread = 0; @@ -101,6 +100,9 @@ void LOADERDECL PosMtx_Write() 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() @@ -219,7 +221,7 @@ void LOADERDECL UpdateBoundingBox() // We need to get the raw projection values for the bounding box calculation // to work properly. That means, no projection hacks! 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; // Transform by world matrix |
