1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
MG_MESSAGE refreshZStencilBuffer( HWND hwnd )
{
char* caZStencilLabel;
D3DFORMAT* testZStencilFormat;
// z stencil formate für die Auswahl
const D3DFORMAT aFormat[] = {D3DFMT_D32, D3DFMT_D24X8, D3DFMT_D16};
const UINT iZStencilFormatCount = sizeof( aFormat ) / sizeof( D3DFORMAT );
// holen des aktuellen Adapters
const UINT iSelectedAdapterIndex = (UINT)SendDlgItemMessage( hwnd, IDC_D3DS_ADAPTERS, CB_SETCURSEL, 0, 0 );
const UINT iSelectedAdapter = (UINT)SendDlgItemMessage( hwnd, IDC_D3DS_ADAPTERS, CB_GETITEMDATA, iSelectedAdapterIndex, 0 );
// holen des aktuellen Video Modus
// dieser ist bereits abgeglichen mit windowes / not windowed
int iSelectedMode = (int)SendDlgItemMessage( hwnd, IDC_D3DS_VIDEO_MODES, CB_SETCURSEL, 0, 0 );
D3DDISPLAYMODE* pSelectedMode = (D3DDISPLAYMODE*)SendDlgItemMessage( hwnd, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedMode, 0 );
// holen des aktuell gewählten Rasterizer
const UINT iSelectedRasterizer = (UINT)SendDlgItemMessage( hwnd, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0 );
const D3DDEVTYPE* currentRasterizer = (D3DDEVTYPE*)SendDlgItemMessage( hwnd, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedAdapter, 0 );
// ist der Fenstermodus gewählt?
BOOL bWindowed = IsDlgButtonChecked( hwnd, IDC_D3DS_WINDOWED_MODE ) == BST_CHECKED;
D3DDISPLAYMODE adapterMode;
if( bWindowed )
{
g_pD3D->GetAdapterDisplayMode( iSelectedAdapter, &adapterMode );
}
else
{
adapterMode = *pSelectedMode;
}
// reseten der Combobox
clearPointerList( hwnd, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS );
for( UINT iNextZStencilFormatIndex = 0; iNextZStencilFormatIndex < iZStencilFormatCount; iNextZStencilFormatIndex++ )
{
// Überprüfen ob das Z-Buffer Stencil Format verfügbar ist und wenn, dann zur Auswahl stellen
if( SUCCEEDED( g_pD3D->CheckDepthStencilMatch( iSelectedAdapter, *currentRasterizer, adapterMode.Format, pSelectedMode->Format, aFormat[iNextZStencilFormatIndex] ) ) )
{
D3DFORMAT* pZStencilFormat = new D3DFORMAT;
*pZStencilFormat = aFormat[iNextZStencilFormatIndex];
caZStencilLabel = getLabelForZStencilFormat( aFormat[iNextZStencilFormatIndex] );
SendDlgItemMessage( hwnd, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_ADDSTRING, iNextZStencilFormatIndex, (LPARAM)caZStencilLabel );
SendDlgItemMessage( hwnd, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_SETITEMDATA, iNextZStencilFormatIndex, (LPARAM)pZStencilFormat );
testZStencilFormat = (D3DFORMAT*)SendDlgItemMessage( hwnd, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETITEMDATA, iNextZStencilFormatIndex, 0 );
}
}
if( 0 < (UINT) SendDlgItemMessage( hwnd, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETCOUNT, 0, 0 ) )
{
SendDlgItemMessage( hwnd, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_SETCURSEL, 0, 0 );
}
return MG_DIALOG_OK;
}
|