The half-pixel offset fix has been in world space: the theme's resolution
is usually 640x480, and we shifted by -0.5x-0.5 there. That works for 640x480, but is incorrect for other resolutions. Do this in projection space, just like the centering matrix. An easy way to test this is to set 1280x960 (2x resolution), create a 1280x960 texture, and display it fullscreen in-game. Just like at 640x480 with a 640x480 graphic, the texture should be displayed pixel-for-pixel identically to the source (when in 32-bit).
This commit is contained in:
@@ -778,18 +778,17 @@ VideoModeParams RageDisplay_D3D::GetActualVideoModeParams() const
|
||||
|
||||
void RageDisplay_D3D::SendCurrentMatrices()
|
||||
{
|
||||
RageMatrix m;
|
||||
RageMatrixMultiply( &m, GetCentering(), GetProjectionTop() );
|
||||
|
||||
/* Convert to OpenGL-style "pixel-centered" coords */
|
||||
RageMatrix m2 = GetCenteringMatrix( -0.5f, -0.5f, 0, 0 );
|
||||
RageMatrix projection;
|
||||
RageMatrixMultiply( &projection, GetCentering(), GetProjectionTop() );
|
||||
RageMatrixMultiply( &projection, &m2, &m );
|
||||
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)&projection );
|
||||
|
||||
g_pd3dDevice->SetTransform( D3DTS_VIEW, (D3DMATRIX*)GetViewTop() );
|
||||
|
||||
/* Convert to OpenGL-style "pixel-centered" coords */
|
||||
RageMatrix m;
|
||||
RageMatrixTranslation( &m, -0.5f, -0.5f, 0 );
|
||||
RageMatrixMultiply( &m, &m, GetWorldTop() );
|
||||
g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)&m );
|
||||
|
||||
g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)GetWorldTop() );
|
||||
|
||||
FOREACH_ENUM2( TextureUnit, tu )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user