本文整理汇总了C++中CDXUTDialog::AddComboBox方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTDialog::AddComboBox方法的具体用法?C++ CDXUTDialog::AddComboBox怎么用?C++ CDXUTDialog::AddComboBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDXUTDialog
的用法示例。
在下文中一共展示了CDXUTDialog::AddComboBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22, VK_F3 );
g_HUD.AddButton( IDC_TOGGLEWARP, L"Toggle WARP (F4)", 35, iY += 24, 125, 22, VK_F4 );
g_SampleUI.SetCallback( OnGUIEvent );
// Title font for comboboxes
g_SampleUI.SetFont( 1, L"Arial", 14, FW_BOLD );
CDXUTElement* pElement = g_SampleUI.GetDefaultElement( DXUT_CONTROL_STATIC, 0 );
if( pElement )
{
pElement->iFont = 1;
pElement->dwTextFormat = DT_LEFT | DT_BOTTOM;
}
int checkboxY = 0;
g_SampleUI.AddStatic( IDC_STATIC, L"(S)ubset", 20, checkboxY+=0, 105, 25 );
g_SampleUI.AddComboBox( IDC_SUBSET, 20, checkboxY+=25, 140, 24, 'S' );
g_SampleUI.AddStatic( IDC_STATIC, L"Scene (R)asterizer Mode", 20, checkboxY+=25, 105, 25 );
g_SampleUI.AddComboBox( IDC_SCENERASTERIZER_MODE, 20, checkboxY+=25, 140, 24, 'S' );
g_SampleUI.AddStatic( IDC_STATIC, L"AABB Levels", 20, checkboxY+=25, 105, 25 );
g_SampleUI.AddComboBox( IDC_AABBSUBLEVEL, 20, checkboxY+=25, 140, 24, 'S' );
}
示例2: initApp
void initApp() {
hud.Init(&dialogResourceManager);
hud.SetCallback(onGUIEvent); int iY = 10;
hud.AddButton(IDC_TOGGLE_FULLSCREEN, L"Toggle full screen", 35, iY, HUD_WIDTH, 22);
iY += 24;
hud.AddComboBox(IDC_PRESET, 35, iY += 24, HUD_WIDTH, 22, 0, false);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Low", (LPVOID) 0);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Medium", (LPVOID) 1);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA High", (LPVOID) 2);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Ultra", (LPVOID) 3);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Custom", (LPVOID) 4);
hud.GetComboBox(IDC_PRESET)->SetSelectedByData((LPVOID) 2);
hud.AddComboBox(IDC_DETECTION_MODE, 35, iY += 24, HUD_WIDTH, 22, 0, false);
hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Luma edge det.", (LPVOID) 0);
hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Color edge det.", (LPVOID) 1);
hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Depth edge det.", (LPVOID) 2);
hud.AddCheckBox(IDC_ANTIALIASING, L"SMAA Anti-Aliasing", 35, iY += 24, HUD_WIDTH, 22, true);
hud.AddCheckBox(IDC_PROFILE, L"Profile", 35, iY += 24, 125, 22, false);
wstringstream s;
s << L"Threshold: " << commandlineOptions.threshold;
hud.AddStatic(IDC_THRESHOLD_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_THRESHOLD, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.threshold / 0.5f));
hud.GetStatic(IDC_THRESHOLD_LABEL)->SetVisible(false);
hud.GetSlider(IDC_THRESHOLD)->SetVisible(false);
s = wstringstream();
s << L"Max Search Steps: " << commandlineOptions.searchSteps;
hud.AddStatic(IDC_MAX_SEARCH_STEPS_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_MAX_SEARCH_STEPS, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.searchSteps / 98.0f));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_LABEL)->SetVisible(false);
hud.GetSlider(IDC_MAX_SEARCH_STEPS)->SetVisible(false);
s = wstringstream();
s << L"Max Diag. Search Steps: " << commandlineOptions.diagSearchSteps;
hud.AddStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_MAX_SEARCH_STEPS_DIAG, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.diagSearchSteps / 20.0f));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL)->SetVisible(false);
hud.GetSlider(IDC_MAX_SEARCH_STEPS_DIAG)->SetVisible(false);
s = wstringstream();
s << L"Corner Rounding: " << commandlineOptions.cornerRounding;
hud.AddStatic(IDC_CORNER_ROUNDING_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_CORNER_ROUNDING, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.cornerRounding / 100.0f));
hud.GetStatic(IDC_CORNER_ROUNDING_LABEL)->SetVisible(false);
hud.GetSlider(IDC_CORNER_ROUNDING)->SetVisible(false);
}
示例3: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_D3DSettingsDlg.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); INT iY = 10;
// Add tons of GUI stuff
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 23 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 23, VK_F2 );
g_HUD.AddButton( IDC_TOGGLEWARP, L"Toggle WARP (F4)", 0, iY += 26, 170, 23, VK_F4 );
g_HUD.AddCheckBox( IDC_TOGGLEDYNAMICLIGHTS, L"Dynamic Lights", 0, iY+=26, 170, 23, true, VK_F8 );
g_HUD.AddComboBox( IDC_DEBUGRENDERING, 0, iY +=26, 170, 23, VK_F9, false, &g_DebugRenderingCombo );
g_DebugRenderingCombo->AddItem( L"Scene", ULongToPtr( DEBUG_RENDERING_NONE ) );
g_DebugRenderingCombo->AddItem( L"Normals", ULongToPtr( DEBUG_RENDERING_NORMALS ) );
g_DebugRenderingCombo->AddItem( L"Colors", ULongToPtr( DEBUG_RENDERING_COLORS ) );
g_DebugRenderingCombo->AddItem( L"LLL", ULongToPtr( DEBUG_RENDERING_LLL ) );
g_SampleUI.SetCallback( OnGUIEvent ); iY = 10;
}
示例4: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent ); iY = 10;
// Title font for comboboxes
g_SampleUI.SetFont( 1, L"Arial", 14, FW_BOLD );
CDXUTElement* pElement = g_SampleUI.GetDefaultElement( DXUT_CONTROL_STATIC, 0 );
if( pElement )
{
pElement->iFont = 1;
pElement->dwTextFormat = DT_LEFT | DT_BOTTOM;
}
g_SampleUI.AddStatic( IDC_STATIC, L"(S)ubset", 20, 0, 105, 25 );
g_SampleUI.AddComboBox( IDC_SUBSET, 20, 25, 140, 24, 'S' );
g_SampleUI.AddButton( IDC_SAVETOX, L"Save Mesh To X file", 20, 50, 140, 24, 'X' );
}
示例5: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent );
int iY = 30;
int iYo = 26;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += iYo, 170, 22, VK_F2 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += iYo, 170, 22, VK_F3 );
g_HUD.AddButton( IDC_TOGGLEWARP, L"Toggle WARP (F4)", 0, iY += iYo, 170, 22, VK_F4 );
g_SampleUI.SetCallback( OnGUIEvent );
CDXUTComboBox* pComboBox = nullptr;
g_SampleUI.AddStatic( IDC_STATIC, L"(G)roup", 10, 0, 170, 25 );
g_SampleUI.AddComboBox( IDC_GROUP, 0, 25, 170, 24, 'G', false, &pComboBox );
if( pComboBox )
pComboBox->SetDropHeight( 50 );
pComboBox->AddItem( L"Frustum", IntToPtr( 0 ) );
pComboBox->AddItem( L"Axis-aligned Box", IntToPtr( 1 ) );
pComboBox->AddItem( L"Oriented Box", IntToPtr( 2 ) );
pComboBox->AddItem( L"Ray", IntToPtr( 3 ) );
InitializeObjects();
}
示例6: InitGUI
//--------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------
void InitGUI()
{
// Initialize dialogs
g_SettingsDlg.Init(&g_DialogResourceManager);
g_HUD.Init(&g_DialogResourceManager);
g_HUD.SetCallback(OnGUIEvent);
g_TextRenderer.Init(&g_DialogResourceManager);
int iY = 10;
g_HUD.AddButton (IDC_TOGGLEFULLSCREEN, L"Toggle full screen" , 35, iY, 160, 22);
g_HUD.AddButton (IDC_TOGGLEREF, L"Toggle REF (F3)" , 35, iY += 24, 160, 22, VK_F3);
g_HUD.AddButton (IDC_CHANGEDEVICE, L"Change device (F2)" , 35, iY += 24, 160, 22, VK_F2);
iY += 20;
g_HUD.AddCheckBox(IDC_DEINTERLEAVE, L"Deinterleaved Texturing", 35, iY += 28, 125, 22, g_UseDeinterleavedTexturing);
g_HUD.AddCheckBox(IDC_RANDOMIZE, L"Randomize Samples", 35, iY += 28, 125, 22, g_RandomizeSamples);
g_HUD.AddCheckBox(IDC_BLUR_AO, L"Blur AO", 35, iY += 28, 125, 22, g_BlurAO);
iY += 24;
CDXUTComboBox *pComboBox;
g_HUD.AddComboBox(IDC_CHANGESCENE, 35, iY += 24, 160, 22, 'M', false, &pComboBox);
for (int i = 0; i < ARRAYSIZE(g_MeshDesc); i++)
{
pComboBox->AddItem(g_MeshDesc[i].Name, NULL);
}
iY += 24;
WCHAR sz[100];
int dy = 20;
StringCchPrintf(sz, 100, UI_RADIUS_MULT L"%0.2f", g_AOParams.Radius);
g_HUD.AddStatic(IDC_RADIUS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_RADIUS_SLIDER, 50, iY += dy, 100, 22, 0, 100, int(g_AOParams.Radius / MAX_RADIUS_MULT * 100));
StringCchPrintf(sz, 100, UI_AO_BIAS L"%g", g_AOParams.Bias);
g_HUD.AddStatic(IDC_BIAS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_BIAS_SLIDER, 50, iY += dy, 100, 22, 0, 500, int(g_AOParams.Bias * 1000));
StringCchPrintf(sz, 100, UI_POW_EXPONENT L"%0.2f", g_AOParams.PowerExponent);
g_HUD.AddStatic(IDC_EXPONENT_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_EXPONENT_SLIDER, 50, iY += dy, 100, 22, 0, 400, (int)(100.0f*g_AOParams.PowerExponent));
StringCchPrintf(sz, 100, UI_BLUR_SHARPNESS L"%0.2f", g_AOParams.Blur.Sharpness);
g_HUD.AddStatic(IDC_BLUR_SHARPNESS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_BLUR_SHARPNESS_SLIDER, 50, iY += dy, 100, 22, 0, 1600, (int)(100.0f*g_AOParams.Blur.Sharpness));
UINT ButtonGroup = 0;
iY += 24;
g_HUD.AddRadioButton( IDC_1xMSAA, ButtonGroup, L"1X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_1X) );
g_HUD.AddRadioButton( IDC_2xMSAA, ButtonGroup, L"2X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_2X) );
g_HUD.AddRadioButton( IDC_4xMSAA, ButtonGroup, L"4X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_4X) );
g_HUD.AddRadioButton( IDC_8xMSAA, ButtonGroup, L"8X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_8X) );
++ButtonGroup;
iY += 24;
g_HUD.AddRadioButton( IDC_PER_PIXEL_AO, ButtonGroup, L"PER_PIXEL_AO", 35, iY += 24, 125, 22, (g_AOParams.Output.MSAAMode == GFSDK_SSAO_PER_PIXEL_AO) );
g_HUD.AddRadioButton( IDC_PER_SAMPLE_AO, ButtonGroup, L"PER_SAMPLE_AO", 35, iY += 24, 125, 22, (g_AOParams.Output.MSAAMode == GFSDK_SSAO_PER_SAMPLE_AO) );
}
示例7: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
//g_LightControl.SetLightDirection( D3DXVECTOR3(-0.29f, 0.557f, 0.778f) );
g_LightControl.SetLightDirection( D3DXVECTOR3( -0.789f, 0.527f, 0.316f ) );
g_LightControl.SetButtonMask( MOUSE_MIDDLE_BUTTON );
// Initialize dialogs
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iX = 15; int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", iX, iY, 125, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", iX, iY += 24, 125, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", iX, iY += 24, 125, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent ); iX = 15; iY = 10;
// Title font for static
g_SampleUI.SetFont( 1, L"Arial", 14, FW_NORMAL );
CDXUTElement* pElement = g_SampleUI.GetDefaultElement( DXUT_CONTROL_STATIC, 0 );
if( pElement )
{
pElement->iFont = 1;
pElement->dwTextFormat = DT_RIGHT | DT_VCENTER;
}
// Technique
g_SampleUI.AddStatic( -1, L"Technique", iX, iY += 24, 115, 22 );
g_SampleUI.AddComboBox( IDC_TECHNIQUE, iX + 125, iY, 150, 22 );
g_SampleUI.GetComboBox( IDC_TECHNIQUE )->SetScrollBarWidth( 0 );
g_SampleUI.GetComboBox( IDC_TECHNIQUE )->AddItem( L"Local-deformable PRT", ( void* )"LDPRT" );
g_SampleUI.GetComboBox( IDC_TECHNIQUE )->AddItem( L"N dot L lighting", ( void* )"NdotL" );
// Animation speed
iY += 10;
g_SampleUI.AddStatic( -1, L"Animation Speed", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_ANIMATION_SPEED, iX + 125, iY, 125, 22, 0, 3000, 700 );
// Light intensity
iY += 10;
g_SampleUI.AddStatic( -1, L"Light Intensity", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_SLIDER, iX + 125, iY, 125, 22, 0, 1000, 500 );
g_SampleUI.AddStatic( IDC_ENV_LABEL, L"Env Intensity", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_ENV_SLIDER, iX + 125, iY, 125, 22, 0, 3000, 600 );
// Color transmission
iY += 10;
g_SampleUI.AddStatic( IDC_RED_TRANSMIT_LABEL, L"Transmit Red", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_RED_TRANSMIT_SLIDER, iX + 125, iY, 125, 22, 0, 3000, 1200 );
g_SampleUI.AddStatic( IDC_GREEN_TRANSMIT_LABEL, L"Transmit Green", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_GREEN_TRANSMIT_SLIDER, iX + 125, iY, 125, 22, 0, 3000, 800 );
g_SampleUI.AddStatic( IDC_BLUE_TRANSMIT_LABEL, L"Transmit Blue", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_BLUE_TRANSMIT_SLIDER, iX + 125, iY, 125, 22, 0, 3000, 350 );
}
示例8: InitApp
// Initialize the app
void InitApp()
{
// Initialize dialogs
gD3DSettingsDlg.Init(&gDialogResourceManager);
gHUD.Init(&gDialogResourceManager);
gSampleUI.Init(&gDialogResourceManager);
gHUD.SetCallback(OnGUIEvent);
int x = 0;
int y = 10;
gHUD.AddButton(IDC_TOGGLEFULLSCREEN, L"Toggle full screen", x, y, 170, 23);
gHUD.AddButton(IDC_TOGGLEREF, L"Toggle REF (F3)", x, y += 26, 170, 23, VK_F3);
gHUD.AddButton(IDC_CHANGEDEVICE, L"Change device (F2)", x, y += 26, 170, 23, VK_F2);
gHUD.SetSize( 170, 170 );
gSampleUI.SetCallback(OnGUIEvent);
x = 0;
y = 0;
gSampleUI.AddStatic(IDC_TEXT, L"", x, y, 1, 1); y += 5*22;
gSampleUI.AddComboBox(IDC_PROFILE, x, y, 226, 22); y += 26;
gSampleUI.AddCheckBox(IDC_MT, L"Multithreaded", x, y, 125, 22, gMultithreaded);
gSampleUI.AddButton(IDC_RECOMPRESS, L"Recompress", x + 131, y, 125, 22); y += 26;
gSampleUI.AddComboBox(IDC_IMAGEVIEW, x, y, 145, 22);
gSampleUI.AddCheckBox(IDC_ALPHA, L"Show Alpha", x + 151, y, 105, 22); y += 26;
gSampleUI.AddSlider(IDC_EXPOSURE, x, y, 250, 22); y += 26;
gSampleUI.AddButton(IDC_LOAD_TEXTURE, L"Load Texture", x, y, 125, 22);
gSampleUI.AddButton(IDC_SAVE_TEXTURE, L"Save Texture", x + 131, y, 125, 22); y += 26;
gSampleUI.SetSize( 276, y+150 );
{
CDXUTComboBox *comboBox = gSampleUI.GetComboBox(IDC_IMAGEVIEW);
comboBox->AddItem(L"Uncompressed", (void *)(eImageView_Uncompressed));
comboBox->AddItem(L"Compressed", (void *)(eImageView_Compressed));
//comboBox->AddItem(L"Error", (void *)(eImageView_Error));
//comboBox->AddItem(L"All", (void *)(eImageView_All));
comboBox->SetSelectedByData((void *)(gImageView));
}
gSampleUI.SendEvent(IDC_TEXT, true, gSampleUI.GetStatic(IDC_TEXT));
}
示例9: REF
//--------------------------------------------------------------------------------------
// Create any D3D9 resources that will live through a device reset (D3DPOOL_MANAGED)
// and aren't tied to the back buffer size
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D9CreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_DialogResourceManager.OnD3D9CreateDevice( pd3dDevice );
g_SettingsDlg.OnD3D9CreateDevice( pd3dDevice );
g_HUD.SetCallback( OnGUIEvent );
int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22, VK_F3 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent );
iY = 10;
g_SampleUI.AddCheckBox( IDC_DISABLEALBEDO, L"Disable albedo", 35, iY += 24, 160, 22, g_DisableAlbedo );
g_SampleUI.AddCheckBox( IDC_PAUSEANIMATION, L"Pause animation", 35, iY += 24, 160, 22, g_PauseAnimation );
g_SampleUI.AddCheckBox( IDC_DISABLESKINING, L"Disable skining", 35, iY += 24, 160, 22, g_DisableSkining );
g_SampleUI.AddCheckBox( IDC_SHOWNORMALS, L"Show normals", 35, iY += 24, 160, 22, g_ShowNormals );
CDXUTComboBox* pCombo;
g_SampleUI.AddComboBox( IDC_TECHNIQUECOMBO, 35, iY += 30, 160, 22, 0, false, &pCombo );
if( pCombo )
{
pCombo->SetDropHeight( 100 );
pCombo->AddItem( L"Unpacked TBN", ( LPVOID )0x0 );
pCombo->AddItem( L"Packed TBN", ( LPVOID )0x1 );
pCombo->AddItem( L"Unpacked Quaternion", ( LPVOID )0x2 );
pCombo->AddItem( L"Packed Quaternion", ( LPVOID )0x3 );
pCombo->SetSelectedByIndex(g_TechniqueIndex);
}
iY = 10;
D3DXCreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial", &g_pFont9 );
d3dAnimation.Create(pd3dDevice);
d3dMesh.Create(pd3dDevice);
d3dFloor.Create(pd3dDevice);
FBXImporter importer;
const char* fbxFileName = ".\\data\\MilitaryMechanic.fbx";
importer.Import(fbxFileName, &d3dMesh, &d3dAnimation);
return S_OK;
}
示例10: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
g_D3DSettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22, VK_F3 );
g_HUD.AddButton( IDC_TOGGLEWARP, L"Toggle WARP (F4)", 35, iY += 24, 125, 22, VK_F4 );
g_SampleUI.SetCallback( OnGUIEvent ); iY = 10;
CDXUTCheckBox* pCheckBox = NULL;
g_SampleUI.AddCheckBox( IDC_TOGGLE_BLUR, L"Use Motion Blur", 0, 105, 140, 24, true, 0, false, &pCheckBox );
g_SampleUI.AddCheckBox( IDC_RENDER_OGRE, L"Render Ogre", 0, 129, 140, 24, true, 0, false, &pCheckBox );
g_SampleUI.AddStatic( IDC_STATIC, L"MSAA (S)amples", 0, 180, 105, 25 );
CDXUTComboBox* pComboBox = NULL;
g_SampleUI.AddComboBox( IDC_SAMPLE_COUNT, 0, 205, 140, 24, 'S', false, &pComboBox );
if( pComboBox )
pComboBox->SetDropHeight( 30 );
}
示例11: InitUI
void InitUI()
{
// Setup default UI state
// NOTE: All of these are made directly available in the shader constant buffer
// This is convenient for development purposes.
#pragma region set UIConstants
gUIConstants.lightingOnly = 0;
gUIConstants.faceNormals = 0;
gUIConstants.visualizeLightCount = 0;
gUIConstants.visualizePerSampleShading = 0;
gUIConstants.lightCullTechnique = CULL_QUAD_DEFERRED_LIGHTING;
#pragma endregion
gD3DSettingsDlg.Init(&gDialogResourceManager);
for (int i = 0; i < HUD_NUM; ++i) {
gHUD[i].Init(&gDialogResourceManager);
gHUD[i].SetCallback(OnGUIEvent);
}
int width = 200;
#pragma region Generate Hud
// Generic HUD
{
CDXUTDialog* HUD = &gHUD[HUD_GENERIC];
int y = 0;
HUD->AddButton(UI_TOGGLEFULLSCREEN, L"Toggle full screen", 0, y, width, 23);
y += 26;
// Warp doesn't support DX11 yet
//HUD->AddButton(UI_TOGGLEWARP, L"Toggle WARP (F3)", 0, y, width, 23, VK_F3);
//y += 26;
HUD->AddButton(UI_CHANGEDEVICE, L"Change device (F2)", 0, y, width, 23, VK_F2);
y += 26;
#pragma region Add MSAA select Combo Box Items
HUD->AddComboBox(UI_MSAA, 0, y, width, 23, 0, false, &gMSAACombo);
y += 26;
gMSAACombo->AddItem(L"No MSAA", ULongToPtr(1));
gMSAACombo->AddItem(L"2x MSAA", ULongToPtr(2));
gMSAACombo->AddItem(L"4x MSAA", ULongToPtr(4));
gMSAACombo->AddItem(L"8x MSAA", ULongToPtr(8));
#pragma endregion
#pragma region Add Scene/mesh select Combo Box items
HUD->AddComboBox(UI_SELECTEDSCENE, 0, y, width, 23, 0, false, &gSceneSelectCombo);
y += 26;
gSceneSelectCombo->AddItem(L"Cube World (AWE)", ULongToPtr(CUBE_WORLD));
gSceneSelectCombo->AddItem(L"Power Plant", ULongToPtr(POWER_PLANT_SCENE));
gSceneSelectCombo->AddItem(L"Sponza", ULongToPtr(SPONZA_SCENE));
gSceneSelectCombo->AddItem(L"Multi Object Scene", ULongToPtr(MULTI_SCENE));
gSceneSelectCombo->AddItem(L"CUBES", ULongToPtr(CUBES));
#pragma endregion
#pragma region Add Options Checkboxes and sliders
HUD->AddCheckBox(UI_ANIMATELIGHT, L"Animate Lights", 0, y, width, 23, false, VK_SPACE, false, &gAnimateLightCheck);
y += 26;
HUD->AddCheckBox(UI_LIGHTINGONLY, L"Lighting Only", 0, y, width, 23, gUIConstants.lightingOnly != 0);
y += 26;
HUD->AddCheckBox(UI_FACENORMALS, L"Face Normals", 0, y, width, 23, gUIConstants.faceNormals != 0);
y += 26;
HUD->AddCheckBox(UI_VISUALIZELIGHTCOUNT, L"Visualize Light Count", 0, y, width, 23, gUIConstants.visualizeLightCount != 0);
y += 26;
HUD->AddCheckBox(UI_VISUALIZEPERSAMPLESHADING, L"Visualize Shading Freq.", 0, y, width, 23, gUIConstants.visualizePerSampleShading != 0);
y += 26;
HUD->AddStatic(UI_LIGHTSTEXT, L"Lights:", 0, y, width, 23);
y += 26;
HUD->AddSlider(UI_LIGHTS, 0, y, width, 23, 0, MAX_LIGHTS_POWER, MAX_LIGHTS_POWER, false, &gLightsSlider);
y += 26;
#pragma endregion
#pragma region Add Lighting method select Combo box items
HUD->AddComboBox(UI_CULLTECHNIQUE, 0, y, width, 23, 0, false, &gCullTechniqueCombo);
y += 26;
gCullTechniqueCombo->AddItem(L"No Cull Forward", ULongToPtr(CULL_FORWARD_NONE));
gCullTechniqueCombo->AddItem(L"No Cull Pre-Z", ULongToPtr(CULL_FORWARD_PREZ_NONE));
gCullTechniqueCombo->AddItem(L"No Cull Deferred", ULongToPtr(CULL_DEFERRED_NONE));
gCullTechniqueCombo->AddItem(L"Quad", ULongToPtr(CULL_QUAD));
gCullTechniqueCombo->AddItem(L"Quad Deferred Light", ULongToPtr(CULL_QUAD_DEFERRED_LIGHTING));
gCullTechniqueCombo->AddItem(L"Compute Shader Tile", ULongToPtr(CULL_COMPUTE_SHADER_TILE));
gCullTechniqueCombo->SetSelectedByData(ULongToPtr(gUIConstants.lightCullTechnique));
#pragma endregion
HUD->SetSize(width, y);
}
// Expert HUD
{
CDXUTDialog* HUD = &gHUD[HUD_EXPERT];
int y = 0;
//.........这里部分代码省略.........
示例12: InitApp
static void InitApp()
{
g_pCamManager = new S3UTCameraManager();
g_pCamManager->ConfigCameras("Cameras.txt");
g_pCamManager->DumpCameraStatus("DumpResult.txt");
g_D3DSettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 10;
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY, 125, 22, VK_F2 );
g_SampleUI.EnableKeyboardInput( true );
g_SampleUI.SetCallback( OnGUIEvent );
iY = 10;
g_SampleUI.AddStatic( IDC_SHADOW_ALGORITHM_LABEL, L"Shadow algorithm:", 35, iY, 125, 22 );
CDXUTComboBox *pComboBox;
g_SampleUI.AddComboBox( IDC_SHADOW_ALGORITHM, 35, iY += 20, 125, 30, 0, false, &pComboBox);
pComboBox->AddItem(L"StandardBP", NULL);
pComboBox->AddItem(L"BP_MSSM_KERNEL", NULL);
pComboBox->AddItem(L"STD_VSM", NULL);
pComboBox->AddItem(L"MipVSM", NULL);
pComboBox->AddItem(L"HirBP", NULL);
pComboBox->AddItem(L"BPGI", NULL);
pComboBox->AddItem(L"NoShadows", NULL);
pComboBox->AddItem(L"SingleLight", NULL);
pComboBox->AddItem(L"PCSS", NULL);
g_SampleUI.AddStatic( IDC_COMMON_LABEL, L"Light Zn", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_ZN, 160, iY, 124, 22, 0, 100, g_fCtrledLightZn*5 );
g_SampleUI.AddStatic( IDC_COMMON_LABEL, L"Light Zf", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_ZF, 160, iY, 124, 22, 0, 100, g_fCtrledLightZf - 10 );
g_SampleUI.AddStatic( IDC_COMMON_LABEL, L"Light FOV", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_FOV, 160, iY, 124, 22, 0, 100, g_fCtrledLightFov * 100 );
g_SampleUI.AddStatic( IDC_LIGHT_SIZE_LABEL, L"Light source size:", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_SIZE, 160, iY, 124, 22, 0, 100, 0 );
g_SampleUI.AddStatic(IDC_COMMON_LABEL, L"NumLightSample", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider(IDC_NUM_LIGHT_SAMPLE, 160, iY, 124, 22, 0, 16, 0 );
g_SampleUI.AddStatic(IDC_COMMON_LABEL, L"fDefaultDepthBias", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider(IDC_fDefaultDepthBias, 160, iY, 124, 22, 0, 100, 40 );
g_SampleUI.AddStatic(IDC_COMMON_LABEL, L"3rd depth delta", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider(IDC_BIAS_3RD_DEPTH, 160, iY, 124, 22, 0, 100, 40 );
g_SampleUI.AddStatic(IDC_COMMON_LABEL, L"1st depth delta", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider(IDC_BIAS_1ST_DEPTH, 160, iY, 124, 22, 0, 100, 40 );
g_SampleUI.AddCheckBox( IDC_BTEXTURED, L"Enable Texturing", 15, iY += 25, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_SHOW_3DWIDGET, L"Show 3D Widget", 150, iY, 124, 22, true);
g_SampleUI.AddCheckBox( IDC_BMOVECAMERA, L"Move Camera", 15, iY += 25, 124, 22, true);
g_SampleUI.AddCheckBox( IDC_FRAME_DUMP, L"Dump Frame", 150, iY, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_BDUMP_SHADOWMAP, L"Dump Shadow Map", 15, iY+=25, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_BDUMP_LIGHT_PAR, L"Dump Light Para", 150, iY, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_STATIC, L"Freeze Model", 15, iY += 25, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_ANIMATE, L"Show Animated Model", 150, iY, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_SCENE, L"Show scene", 15, iY += 25, 124, 22, true);
g_SampleUI.AddCheckBox( IDC_FAN, L"Show Fan", 150, iY, 124, 22, false);
g_CameraUI.Init( &g_DialogResourceManager );
g_CameraUI.EnableKeyboardInput( true );
g_CameraUI.SetCallback( OnGUIEvent );
{
g_pCamManager->SetupCameraUI( g_CameraUI );
}
}
示例13: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent );
g_SampleUI.SetFont( 1, L"Comic Sans MS", 24, FW_NORMAL );
g_SampleUI.SetFont( 2, L"Courier New", 16, FW_NORMAL );
// Static
g_SampleUI.AddStatic( IDC_STATIC, L"This is a static control.", 0, 0, 200, 30 );
g_SampleUI.AddStatic( IDC_OUTPUT,
L"This static control provides feedback for your action. It will change as you interact with the UI controls.", 20, 50, 620, 300 );
g_SampleUI.GetStatic( IDC_OUTPUT )->SetTextColor( D3DCOLOR_ARGB( 255, 255, 0, 0 ) ); // Change color to red
g_SampleUI.GetStatic( IDC_STATIC )->SetTextColor( D3DCOLOR_ARGB( 255, 0, 255, 0 ) ); // Change color to green
g_SampleUI.GetControl( IDC_OUTPUT )->GetElement( 0 )->dwTextFormat = DT_LEFT | DT_TOP | DT_WORDBREAK;
g_SampleUI.GetControl( IDC_OUTPUT )->GetElement( 0 )->iFont = 2;
g_SampleUI.GetControl( IDC_STATIC )->GetElement( 0 )->dwTextFormat = DT_CENTER | DT_VCENTER | DT_WORDBREAK;
// Buttons
g_SampleUI.AddButton( IDC_ENABLEIME, L"Enable (I)ME", 30, 390, 80, 35, L'I' );
g_SampleUI.AddButton( IDC_DISABLEIME, L"Disable I(M)E", 30, 430, 80, 35, L'M' );
// Edit box
g_SampleUI.AddEditBox( IDC_EDITBOX1, L"Edit control with default styles. Type text here and press Enter", 20, 440,
600, 32 );
// IME-enabled edit box
CDXUTIMEEditBox* pIMEEdit;
CDXUTIMEEditBox::InitDefaultElements( &g_SampleUI );
if( SUCCEEDED( CDXUTIMEEditBox::CreateIMEEditBox( &g_SampleUI, IDC_EDITBOX2,
L"IME-capable edit control with custom styles. Type and press Enter", 20, 390, 600, 45, false, &pIMEEdit ) ) )
{
g_SampleUI.AddControl( pIMEEdit );
pIMEEdit->GetElement( 0 )->iFont = 1;
pIMEEdit->GetElement( 1 )->iFont = 1;
pIMEEdit->GetElement( 9 )->iFont = 1;
pIMEEdit->GetElement( 0 )->TextureColor.Init( D3DCOLOR_ARGB( 128, 255, 255, 255 ) ); // Transparent center
pIMEEdit->SetBorderWidth( 7 );
pIMEEdit->SetTextColor( D3DCOLOR_ARGB( 255, 64, 64, 64 ) );
pIMEEdit->SetCaretColor( D3DCOLOR_ARGB( 255, 64, 64, 64 ) );
pIMEEdit->SetSelectedTextColor( D3DCOLOR_ARGB( 255, 255, 255, 255 ) );
pIMEEdit->SetSelectedBackColor( D3DCOLOR_ARGB( 255, 40, 72, 72 ) );
}
// Slider
g_SampleUI.AddSlider( IDC_SLIDER, 200, 450, 200, 24, 0, 100, 50, false );
// Checkbox
g_SampleUI.AddCheckBox( IDC_CHECKBOX, L"This is a checkbox with hotkey. Press 'C' to toggle the check state.",
170, 450, 350, 24, false, L'C', false );
g_SampleUI.AddCheckBox( IDC_CLEAREDIT,
L"This checkbox controls whether edit control text is cleared when Enter is pressed. (T)",
170, 460, 450, 24, false, L'T', false );
// Combobox
CDXUTComboBox* pCombo;
g_SampleUI.AddComboBox( IDC_COMBOBOX, 0, 0, 200, 24, L'O', false, &pCombo );
if( pCombo )
{
pCombo->SetDropHeight( 100 );
pCombo->AddItem( L"Combobox item (O)", ( LPVOID )0x11111111 );
pCombo->AddItem( L"Placeholder (O)", ( LPVOID )0x12121212 );
pCombo->AddItem( L"One more (O)", ( LPVOID )0x13131313 );
pCombo->AddItem( L"I can't get enough (O)", ( LPVOID )0x14141414 );
pCombo->AddItem( L"Ok, last one, I promise (O)", ( LPVOID )0x15151515 );
}
// Radio buttons
g_SampleUI.AddRadioButton( IDC_RADIO1A, 1, L"Radio group 1 Amy (1)", 0, 50, 220, 24, false, L'1' );
g_SampleUI.AddRadioButton( IDC_RADIO1B, 1, L"Radio group 1 Brian (2)", 0, 50, 220, 24, false, L'2' );
g_SampleUI.AddRadioButton( IDC_RADIO1C, 1, L"Radio group 1 Clark (3)", 0, 50, 220, 24, false, L'3' );
g_SampleUI.AddRadioButton( IDC_RADIO2A, 2, L"Single (4)", 0, 50, 90, 24, false, L'4' );
g_SampleUI.AddRadioButton( IDC_RADIO2B, 2, L"Double (5)", 0, 50, 90, 24, false, L'5' );
g_SampleUI.AddRadioButton( IDC_RADIO2C, 2, L"Triple (6)", 0, 50, 90, 24, false, L'6' );
// List box
g_SampleUI.AddListBox( IDC_LISTBOX, 30, 400, 200, 150, 0 );
for( int i = 0; i < 15; ++i )
{
WCHAR wszText[50];
swprintf_s( wszText, 50, L"Single-selection listbox item %d", i );
g_SampleUI.GetListBox( IDC_LISTBOX )->AddItem( wszText, ( LPVOID )( size_t )i );
}
g_SampleUI.AddListBox( IDC_LISTBOXM, 30, 400, 200, 150, CDXUTListBox::MULTISELECTION );
for( int i = 0; i < 30; ++i )
{
WCHAR wszText[50];
//.........这里部分代码省略.........
示例14: init
int init(PCALLBACKDXUTGUIEVENT on_gui_event, int spacing, UINT ew, UINT eh)
{
const int dd = spacing;
const int db = dd * 2;
// add to dialog manager
hud.Init(&dlg_manager);
hud_light.Init(&dlg_manager);
hud_gi.Init(&dlg_manager);
hud_postp1.Init(&dlg_manager);
hud_postp2.Init(&dlg_manager);
hud_debug_info.Init(&dlg_manager);
// set callbacks
hud.SetCallback(on_gui_event);
hud_light.SetCallback(on_gui_event);
hud_gi.SetCallback(on_gui_event);
hud_postp1.SetCallback(on_gui_event);
hud_postp2.SetCallback(on_gui_event);
hud_debug_info.SetCallback(on_gui_event);
int x = 0, y = 10, w = ew, h = eh;
hud.AddStatic(IDC_FPS_COUNTER, L"FPS: ", x, y, w, h);
hud.AddStatic(-1, L"Render targets:", x, y += db, w, h);
hud.AddComboBox(IDC_TARGETS, x, y += dd, w, h + 2, 0, false, &combo_render_targets);
hud.AddStatic(-1, L"Settings for:", x, y += db, w, h);
hud.AddComboBox(IDC_SETTINGS, x, y += dd, w, h + 2, 0, false, &combo_settings);
int start = y;
combo_settings->AddItem(L"", 0);
// Lights settings
y = start;
combo_settings->AddItem(L"Lights", reinterpret_cast<void*>(&hud_light));
hud_light.AddStatic(-1, L"Light direction:", x, y += db, w, h);
hud_light.AddSlider(IDC_LIGHT_DIRECTION, x, y += dd, w, h);
hud_light.AddStatic(-1, L"Light position X/Y/Z:", x, y += db, w, h);
hud_light.AddSlider(IDC_LIGHT_POS_X, x, y += dd, w, h);
hud_light.AddSlider(IDC_LIGHT_POS_Y, x, y += dd, w, h);
hud_light.AddSlider(IDC_LIGHT_POS_Z, x, y += dd, w, h);
hud_light.AddStatic(-1, L"Flux factor:", x, y += db, w, h);
hud_light.AddSlider(IDC_FLUX_SCALE, x, y += dd, w, h, 0, 1000, 100);
hud_light.AddStatic(-1, L"Warmth:", x, y += db, w, h);
hud_light.AddSlider(IDC_LIGHT_WARMTH, x, y += dd, w, h, 0, 100, 0);
// VPL settings
y = start;
combo_settings->AddItem(L"GI", reinterpret_cast<void*>(&hud_gi));
hud_gi.AddStatic(-1, L"GI scale:", x, y += db, w, h);
hud_gi.AddSlider(IDC_GI_SCALE, x, y += dd, w, h, 0, 100, 0);
#if defined(LPV) || defined(DLPV)
hud_gi.AddStatic(IDC_GI_INFO1, L"LPV propagations: 0", x, y += db, w, h);
hud_gi.AddSlider(IDC_GI_PARAMETER1, x, y += dd, w, h, 0, LPV_SIZE * 2, 0);
hud_gi.AddStatic(-1, L"LPV Flux amplifier:", x, y += db, w, h);
#else
hud_gi.AddStatic(-1, L"Surface roughness:", x, y += db, w, h);
#endif
hud_gi.AddSlider(IDC_GI_PARAMETER2, x, y += db, w, h, 0, 1000, 500);
hud_gi.AddCheckBox(IDC_GI_DEBUG1, L"Debug GI", x, y += db, w, h, false);
#if defined(LPV) || defined(DLPV)
hud_gi.AddCheckBox(IDC_GI_DEBUG2, L"Show LPV", x, y += db, w, h, false);
#endif
// Postprocessing 1 settings
y = start;
combo_settings->AddItem(L"Postprocess 1", reinterpret_cast<void*>(&hud_postp1));
hud_postp1.AddCheckBox(IDC_FXAA_ENABLED, L"FXAA", x, y += db, w, h, true);
hud_postp1.AddCheckBox(IDC_SSAO_ENABLED, L"SSAO", x, y += db, w, h, true);
hud_postp1.AddStatic(-1, L"SSAO factor:", x, y += db, w, h);
hud_postp1.AddSlider(IDC_SSAO_SCALE, x, y += dd, w, h, 0, 100, 10);
hud_postp1.AddCheckBox(IDC_GODRAYS_ENABLED, L"Godrays", x, y += db, w, h, false);
hud_postp1.AddStatic(-1, L"Godrays tau:", x, y += db, w, h);
hud_postp1.AddSlider(IDC_GODRAYS_TAU, x, y += dd, w, h, 1, 10, 5);
hud_postp1.AddCheckBox(IDC_EXPOSURE_ADAPT, L"Adapt exposure", x, y += db, w, h, false);
hud_postp1.AddStatic(-1, L"Exposure key value:", x, y += db, w, h, true);
hud_postp1.AddSlider(IDC_EXPOSURE_KEY, x, y += dd, w, h, 0, 100, 50);
hud_postp1.AddStatic(-1, L"Adaptation speed:", x, y += db, w, h, true);
hud_postp1.AddSlider(IDC_EXPOSURE_SPEED, x, y += dd, w, h, 1, 100, 20);
// Postprocessing 2 settings
y = start;
combo_settings->AddItem(L"Postprocess 2", reinterpret_cast<void*>(&hud_postp2));
hud_postp2.AddCheckBox(IDC_CRT_ENABLED, L"CRT monitor", x, y += db, w, h, false);
//.........这里部分代码省略.........
示例15: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
g_CascadeConfig.m_nCascadeLevels = 3;
g_CascadeConfig.m_iBufferSize = 1024;
g_CascadedShadow.m_iCascadePartitionsZeroToOne[0] = 5;
g_CascadedShadow.m_iCascadePartitionsZeroToOne[1] = 15;
g_CascadedShadow.m_iCascadePartitionsZeroToOne[2] = 60;
g_CascadedShadow.m_iCascadePartitionsZeroToOne[3] = 100;
g_CascadedShadow.m_iCascadePartitionsZeroToOne[4] = 100;
g_CascadedShadow.m_iCascadePartitionsZeroToOne[5] = 100;
g_CascadedShadow.m_iCascadePartitionsZeroToOne[6] = 100;
g_CascadedShadow.m_iCascadePartitionsZeroToOne[7] = 100;
// Pick some arbitrary intervals for the Cascade Maps
//g_CascadedShadow.m_iCascadePartitionsZeroToOne[0] = 2;
//g_CascadedShadow.m_iCascadePartitionsZeroToOne[1] = 4;
//g_CascadedShadow.m_iCascadePartitionsZeroToOne[2] = 6;
//g_CascadedShadow.m_iCascadePartitionsZeroToOne[3] = 9;
//g_CascadedShadow.m_iCascadePartitionsZeroToOne[4] = 13;
//g_CascadedShadow.m_iCascadePartitionsZeroToOne[5] = 26;
//g_CascadedShadow.m_iCascadePartitionsZeroToOne[6] = 36;
//g_CascadedShadow.m_iCascadePartitionsZeroToOne[7] = 70;
g_CascadedShadow.m_iCascadePartitionsMax = 100;
// Initialize dialogs
g_D3DSettingsDlg.Init(&g_DialogResourceManager);
g_HUD.Init(&g_DialogResourceManager);
g_SampleUI.Init(&g_DialogResourceManager);
g_HUD.SetCallback(OnGUIEvent); INT iY = 10;
// Add tons of GUI stuff
g_HUD.AddButton(IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 23);
g_HUD.AddButton(IDC_TOGGLEWARP, L"Toggle WARP (F3)", 0, iY += 26, 170, 23, VK_F3);
g_HUD.AddButton(IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 23, VK_F2);
g_HUD.AddCheckBox(IDC_TOGGLEVISUALIZECASCADES, L"Visualize Cascades", 0, iY += 26, 170, 23, g_bVisualizeCascades, VK_F8);
g_HUD.AddComboBox(IDC_DEPTHBUFFERFORMAT, 0, iY += 26, 170, 23, VK_F10, false, &g_DepthBufferFormatCombo);
g_DepthBufferFormatCombo->AddItem(L"32 bit Buffer", ULongToPtr(CASCADE_DXGI_FORMAT_R32_TYPELESS));
g_DepthBufferFormatCombo->AddItem(L"16 bit Buffer", ULongToPtr(CASCADE_DXGI_FORMAT_R16_TYPELESS));
g_DepthBufferFormatCombo->AddItem(L"24 bit Buffer", ULongToPtr(CASCADE_DXGI_FORMAT_R24G8_TYPELESS));
SHADOW_TEXTURE_FORMAT sbt = (SHADOW_TEXTURE_FORMAT)PtrToUlong(g_DepthBufferFormatCombo->GetSelectedData());
g_CascadeConfig.m_ShadowBufferFormat = sbt;
WCHAR desc[256];
swprintf_s(desc, L"Texture Size: %d ", g_CascadeConfig.m_iBufferSize);
g_HUD.AddStatic(IDC_BUFFER_SIZETEXT, desc, 0, iY + 26, 30, 10);
g_HUD.AddSlider(IDC_BUFFER_SIZE, 0, iY += 46, 128, 15, 1, 128, g_CascadeConfig.m_iBufferSize / 32);
g_HUD.AddStatic(IDC_PCF_SIZETEXT, L"PCF Blur: 3", 0, iY + 16, 30, 10);
g_HUD.AddSlider(IDC_PCF_SIZE, 90, iY += 20, 64, 15, 1, 16, g_CascadedShadow.m_iPCFBlurSize / 2 + 1);
swprintf_s(desc, L" Offset: %0.03f", g_CascadedShadow.m_fPCFOffset);
g_HUD.AddStatic(IDC_PCF_OFFSET_SIZETEXT, desc, 0, iY + 16, 30, 10);
g_HUD.AddSlider(IDC_PCF_OFFSET_SIZE, 115, iY += 20, 50, 15, 0, 50, (INT)(g_CascadedShadow.m_fPCFOffset * 1000.0f));
swprintf_s(desc, L"Cascade Blur %0.03f", g_CascadedShadow.m_fBlurBetweenCascadesAmount);
bool bValue;
if (g_CascadedShadow.m_iBlurBetweenCascades == 0) bValue = false;
else bValue = true;
g_HUD.AddCheckBox(IDC_BLEND_BETWEEN_MAPS_CHECK, desc, 0, iY + 15, 170, 23, bValue);
g_HUD.AddSlider(IDC_BLEND_MAPS_SLIDER, 40, iY + 33, 100, 15, 0, 100, (INT)
(g_CascadedShadow.m_fBlurBetweenCascadesAmount * 2000.0f));
iY += 26;
if (g_CascadedShadow.m_iDerivativeBasedOffset == 0) bValue = false;
else bValue = true;
g_HUD.AddCheckBox(IDC_TOGGLE_DERIVATIVE_OFFSET, L"DDX, DDY offset", 0, iY += 26, 170, 23, bValue);
WCHAR dta[60];
g_HUD.AddComboBox(IDC_SELECTED_SCENE, 0, iY += 26, 170, 23, VK_F8, false, &g_SceneSelectCombo);
g_SceneSelectCombo->AddItem(L"Power Plant", ULongToPtr(POWER_PLANT_SCENE));
g_SceneSelectCombo->AddItem(L"Test Scene", ULongToPtr(TEST_SCENE));
g_HUD.AddComboBox(IDC_SELECTED_CAMERA, 0, iY += 26, 170, 23, VK_F9, false, &g_CameraSelectCombo);
swprintf_s(dta, L"Eye Camera %ld", EYE_CAMERA + 1);
g_CameraSelectCombo->AddItem(dta, ULongToPtr(EYE_CAMERA));
swprintf_s(dta, L"Light Camera %ld", LIGHT_CAMERA + 1);
g_CameraSelectCombo->AddItem(dta, ULongToPtr(LIGHT_CAMERA));
for (int index = 0; index < g_CascadeConfig.m_nCascadeLevels; ++index)
{
swprintf_s(dta, L"Cascade Cam %d", index + 1);
g_CameraSelectCombo->AddItem(dta, ULongToPtr(ORTHO_CAMERA1 + index));
}
g_HUD.AddCheckBox(IDC_MOVE_LIGHT_IN_TEXEL_INC, L"Fit Light to Texels",
0, iY += 26, 170, 23, g_bMoveLightTexelSize, VK_F8);
//.........这里部分代码省略.........