From 52ec9b3737c569c169c59a7250db96b496e7691b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 26 Mar 2006 22:06:19 +0000 Subject: [PATCH] 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). --- stepmania/src/RageDisplay_D3D.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index 849acf3f6f..6c574cd75b 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -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 ) {