Fix D3D z-buffer problem by having separate GetOrthoMatrix functions for OGL and D3D.

I don't understand why the two APIs create an ortho matrix so differently, but I'm tried of messing with it for now.
This commit is contained in:
Chris Danford
2003-05-25 00:43:44 +00:00
parent c9b4efb861
commit a75cd6e7b1
8 changed files with 97 additions and 80 deletions
+14 -1
View File
@@ -745,7 +745,8 @@ bool RageDisplay::IsZBufferEnabled() const
void RageDisplay::SetZBuffer( bool b )
{
g_pd3dDevice->SetRenderState( D3DRS_ZENABLE, b );
g_pd3dDevice->SetRenderState( D3DRS_ZENABLE, b ? D3DZB_TRUE : D3DZB_FALSE );
g_pd3dDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESSEQUAL );
g_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, b );
}
void RageDisplay::ClearZBuffer()
@@ -905,3 +906,15 @@ void RageDisplay::SetAlphaTest( bool b )
g_pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
g_pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATER );
}
RageMatrix RageDisplay::GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf )
{
// D3DXMatrixOrthoOffCenterRH
RageMatrix m(
2/(r-l), 0, 0, 0,
0, 2/(t-b), 0, 0,
0, 0, 1/(zn-zf), 0,
(l+r)/(l-r), (t+b)/(b-t), zn/(zn-zf), 1 );
return m;
}