Move Zfreeze code out individual backends into videoCommon

Also:
 * Implement support for per-vertex PosMatrixIndex
 * Only update zslope constant once when zfreeze is activated.
 * Added a bunch of comments.
This commit is contained in:
Scott Mansell
2015-01-24 03:15:09 +13:00
parent daf760b202
commit 5510c86b81
10 changed files with 59 additions and 40 deletions

View File

@ -690,10 +690,12 @@ void VertexShaderManager::ResetView()
bProjectionChanged = true;
}
void VertexShaderManager::TransformToClipSpace(const float* data, float *out)
void VertexShaderManager::TransformToClipSpace(const float* data, float *out, u32 MtxIdx)
{
// Can we use constants.posnormalmatrix here instead?
const float *world_matrix = (const float *)xfmem.posMatrices + g_main_cp_state.matrix_index_a.PosNormalMtxIdx * 4;
const float *world_matrix = (const float *)xfmem.posMatrices + (MtxIdx & 0x3f) * 4;
// We use the projection matrix calculated by vertexShaderManager, because it
// includes any free look transformations.
// Make sure VertexManager::SetConstants() has been called first.
const float *proj_matrix = &g_fProjectionMatrix[0];
float t[3];