2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Properly align plates by compensating for the half-pixel offset of Direct3D 9.

This commit is contained in:
Christian Walther
2011-04-16 20:35:16 +02:00
parent 868ce660d9
commit 259f07462f

View File

@ -11664,7 +11664,11 @@ void plDXPlateManager::IDrawToDevice( plPipeline *pipe )
fD3DDevice->SetFVF(dxPipe->fSettings.fCurrFVFFormat = PLD3D_PLATEFVF); fD3DDevice->SetFVF(dxPipe->fSettings.fCurrFVFFormat = PLD3D_PLATEFVF);
fD3DDevice->SetStreamSource( 0, fVertBuffer, 0, sizeof( plPlateVertex ) ); fD3DDevice->SetStreamSource( 0, fVertBuffer, 0, sizeof( plPlateVertex ) );
plProfile_Inc(VertexChange); plProfile_Inc(VertexChange);
fD3DDevice->SetTransform( D3DTS_VIEW, &d3dIdentityMatrix ); // To get plates properly pixel-aligned, we need to compensate for D3D9's weird half-pixel
// offset (see http://drilian.com/2008/11/25/understanding-half-pixel-and-half-texel-offsets/
// or http://msdn.microsoft.com/en-us/library/bb219690(VS.85).aspx).
D3DXMatrixTranslation(&mat, -0.5f/scrnWidthDiv2, -0.5f/scrnHeightDiv2, 0.0f);
fD3DDevice->SetTransform( D3DTS_VIEW, &mat );
oldCullMode = dxPipe->fCurrCullMode; oldCullMode = dxPipe->fCurrCullMode;
for( plate = fPlates; plate != nil; plate = plate->GetNext() ) for( plate = fPlates; plate != nil; plate = plate->GetNext() )