//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { // Initialize dialogs g_SampleUI.Init(&g_DialogResourceManager); int iY = 10; g_SampleUI.SetCallback(OnGUIEvent); iY = 10; g_SampleUI.AddStatic(IDC_STATIC_TIMESCALE, L"Time scale", 50, iY, 100, 24); g_SampleUI.AddSlider(IDC_SLIDER_TIMESCALE, 50, iY += 16, 100, 22); g_SampleUI.AddStatic(IDC_STATIC_WEIGHT, L"idle / Walk / run", 50, iY += 20, 100, 24); g_SampleUI.AddSlider(IDC_SLIDER_WEIGHT, 50, iY += 16, 100, 22, 0, 100, 0); g_SampleUI.AddCheckBox(IDC_CHECK_RAGDOLL, L"Ragdoll", 50, iY += 20, 100, 22, false); g_SampleUI.AddCheckBox(IDC_CHECK_GPU_SKINNING, L"GPU Skinning", 50, iY += 30, 100, 22, false); g_SampleUI.AddCheckBox(IDC_CHECK_DIFFUSEMAP, L"Diffusemap", 50, iY += 30, 100, 22, true); g_SampleUI.AddCheckBox(IDC_CHECK_NORMALMAP, L"Normalmap", 50, iY += 20, 100, 22, true); g_SampleUI.AddCheckBox(IDC_CHECK_GLOSS, L"Glossmap", 50, iY += 20, 100, 22, true); g_SampleUI.AddCheckBox(IDC_CHECK_WIREFRAME, L"Wireframe", 50, iY += 20, 100, 22); g_SampleUI.AddCheckBox(IDC_CHECK_DRAW_NORMAL, L"Draw Normal", 50, iY += 20, 100, 22, false); g_SampleUI.AddCheckBox(IDC_CHECK_DRAW_SKELETON, L"Draw Skeleton", 50, iY += 20, 100, 22, false); g_SampleUI.AddCheckBox(IDC_CHECK_DRAW_BOUNDINGBOX, L"Draw Bounding", 50, iY += 20, 100, 22, false); g_SampleUI.AddButton(IDC_BUTTON_ATTACK, L"Attack", 50, iY += 25, 100, 22); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { g_bSpinning = true; 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; WCHAR sz[100]; iY += 24; swprintf_s( sz, 100, L"Explode Amount: %0.2f", g_fExplode ); g_SampleUI.AddStatic( IDC_EXPLODE_STATIC, sz, 35, iY += 24, 125, 22 ); g_SampleUI.AddSlider( IDC_EXPLODE_SCALE, 50, iY += 24, 100, 22, 0, 3000, ( int )( g_fExplode * 100.0f ) ); iY += 24; g_SampleUI.AddCheckBox( IDC_TOGGLESPIN, L"Toggle Spinning", 35, iY += 24, 125, 22, g_bSpinning ); }
//-------------------------------------------------------------------------------------- // 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; }
//-------------------------------------------------------------------------------------- // 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' ); }
void InitApp() { dprintf("rawr\n"); srand(UINT(time(NULL))); g_pGameRoot = new CGameRoot(); g_pGameRoot->AssignWorldFile(LEVEL_TO_LOAD); g_pGameRoot->AssignModelSetFile(MODEL_SET_TO_LOAD); g_pGameRoot->AssignCharacterSetFile(CHAR_SET_TO_LOAD); g_pGameRoot->AssignSpriteAnimationSetFile(SPRITE_SET_TO_LOAD); g_pGameRoot->LoadMasterServersFile(MASTER_SERVERS_TO_LOAD); // Initialize dialogs g_SettingsDlg.Init( &g_DialogResourceManager ); g_HUD.Init( &g_DialogResourceManager ); g_UI.Init( &g_DialogResourceManager ); // Set up HUD g_HUD.SetCallback( OnGUIEvent ); int iY = 0; g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 125, 22 ); g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 24, 125, 22, VK_F2 ); // Set up UI g_UI.SetCallback( OnGUIEvent ); iY = 0; CDXUTEditBox *pEditBox; g_UI.AddEditBox( IDC_FILEHEIGHTMAP, L"rawr", 5, iY, 210, 20, false, &pEditBox ); if( pEditBox ) { pEditBox->SetBorderWidth( 1 ); pEditBox->SetSpacing( 2 ); } g_UI.AddButton( IDC_LOADHEIGHTMAP, L"Load HeightMap", 0, iY += 24, 100, 22 ); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { #ifdef CONSOLE std::cout << "InitApp" << std::endl; #endif 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, 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_Camera.SetRotateButtons( true, false, false ); //g_pCamera = new CGlobalCamera(); D3DVECTOR Vdir={0,-1,0}; memset(&g_light,0,sizeof(D3DLIGHT9)); g_light.Type = D3DLIGHT_DIRECTIONAL; g_light.Diffuse.r = 1.0f; g_light.Diffuse.g = 1.0f; g_light.Diffuse.b = 1.0f; g_light.Diffuse.a = 1.0f; g_light.Direction = Vdir; // Inits Particle Engine }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { // Initialize dialogs g_D3DSettingsDlg.Init( &g_DialogResourceManager ); g_HUD.Init( &g_DialogResourceManager ); g_SampleUI.Init( &g_DialogResourceManager ); g_HUD.SetCallback( OnGUIEvent ); int iY = 20; g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 22 ); g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += 26, 170, 22, VK_F3 ); g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 22, VK_F2 ); g_SampleUI.SetCallback( OnGUIEvent ); iY = 10; WCHAR sz[100]; iY += 24; swprintf_s( sz, L"Patch Divisions: %2.1f", g_fSubdivs ); g_SampleUI.AddStatic( IDC_PATCH_SUBDIVS_STATIC, sz, 10, iY += 26, 150, 22 ); g_SampleUI.AddSlider( IDC_PATCH_SUBDIVS, 10, iY += 24, 150, 22, 10 * MIN_DIVS, 10 * MAX_DIVS, (int)(g_fSubdivs * 10) ); iY += 24; g_SampleUI.AddCheckBox( IDC_TOGGLE_LINES, L"Toggle Wires", 20, iY += 26, 150, 22, g_bDrawWires ); iY += 24; g_SampleUI.AddRadioButton( IDC_PARTITION_INTEGER, IDC_PARTITION_MODE, L"Integer", 20, iY += 26, 170, 22 ); g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_EVEN, IDC_PARTITION_MODE, L"Fractional Even", 20, iY += 26, 170, 22 ); g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_ODD, IDC_PARTITION_MODE, L"Fractional Odd", 20, iY += 26, 170, 22 ); g_SampleUI.GetRadioButton( IDC_PARTITION_INTEGER )->SetChecked( true ); // Setup the camera's view parameters static const XMVECTORF32 s_vecEye = { 1.0f, 1.5f, -3.5f, 0.f }; static const XMVECTORF32 s_vecAt = { 0.0f, 0.0f, 0.0f, 0.f }; g_Camera.SetViewParams( s_vecEye, s_vecAt ); }
//-------------------------------------------------------------------------------------- // 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' ); }
//-------------------------------------------------------------------------------------- // 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(); }
//-------------------------------------------------------------------------------------- // 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 ); }
//-------------------------------------------------------------------------------------- // 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_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; }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { displacement_level = 1.5; tess_lvl = 80; drawwire = false; D3DXVECTOR3 vLightDir( -1, 1, -1 ); D3DXVec3Normalize( &vLightDir, &vLightDir ); g_LightControl.SetLightDirection( vLightDir ); // Initialize dialogs 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", 0, iY, 170, 23 ); g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (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_SampleUI.SetCallback( OnGUIEvent ); iY = -30; WCHAR sz[100]; //iY += 24; swprintf_s( sz, L"Tessellation Level: %2.1f", tess_lvl ); g_SampleUI.AddStatic( IDC_TESSLVL_STATIC, sz, -10, iY += 26, 150, 22 ); g_SampleUI.AddSlider( IDC_TESSLVL, 10, iY += 24, 150, 22, 1, 80, tess_lvl ); iY += 14; swprintf_s( sz, L"Displacement Level: %2.1f", displacement_level ); g_SampleUI.AddStatic( IDC_DISPLACEMENTLVL_STATIC, sz, -10, iY += 26, 150, 22 ); g_SampleUI.AddSlider( IDC_DISPLACEMENTLVL, 10, iY += 24, 150, 22, 0, 150, (float)(displacement_level)/ 100.0f ); iY += 10; g_SampleUI.AddCheckBox( IDC_TOGGLEWIRE, L"Toggle Wires", 20, iY += 26, 150, 22, drawwire ); iY += 10; g_SampleUI.AddCheckBox( IDC_TOGGLEDT, L"Toggle Distanced Based tesselation", -120, iY += 26, 150, 22, true ); iY += 10; g_SampleUI.AddRadioButton( IDC_PARTITION_INTEGER, IDC_PARTITION_MODE, L"Integer", 20, iY += 26, 170, 22 ); g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_EVEN, IDC_PARTITION_MODE, L"Fractional Even", 20, iY += 26, 170, 22 ); g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_ODD, IDC_PARTITION_MODE, L"Fractional Odd", 20, iY += 26, 170, 22 ); g_SampleUI.GetRadioButton( IDC_PARTITION_INTEGER )->SetChecked( true ); iY += 10; g_SampleUI.AddCheckBox( IDC_TOGGLEBUILDING, L"Toggle buildings", 20, iY += 26, 150, 22, true ); }
//-------------------------------------------------------------------------------------- // 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; }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { // Initialize dialogs g_D3DSettingsDlg.Init(&g_DialogResourceManager); g_HUD.Init(&g_DialogResourceManager); g_SampleUI.Init(&g_DialogResourceManager); g_HUD.SetCallback(OnGUIEvent); int iY = 10; g_SampleUI.SetCallback(OnGUIEvent); iY = 0; WCHAR sz[100]; StringCchPrintf(sz, 100, L"Diffusion steps: %d", 8); g_SampleUI.AddStatic(IDC_DIFF_STEPS_STATIC, sz, 35, iY += 48, 125, 22); g_SampleUI.AddSlider(IDC_DIFF_STEPS, 50, iY += 24, 100, 22, 0, 400, 4); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { // Initialize dialogs g_SampleUI.Init(&g_DialogResourceManager); int iY = 10; g_SampleUI.SetCallback(OnGUIEvent); iY = 10; g_SampleUI.AddStatic(IDC_STATIC_TIMESCALE, L"Time scale", 50, iY, 100, 24); g_SampleUI.AddSlider(IDC_SLIDER_TIMESCALE, 50, iY += 16, 100, 22); g_SampleUI.AddStatic(IDC_STATIC_WEIGHT, L"idle / Walk / run", 50, iY += 20, 100, 24); g_SampleUI.AddSlider(IDC_SLIDER_WEIGHT, 50, iY += 16, 100, 22, 0, 100, 0); g_SampleUI.AddStatic(IDC_STATIC_ARM, L"arm", 50, iY += 40, 100, 24); g_SampleUI.AddSlider(IDC_SLIDER_ARM, 50, iY += 16, 100, 22, 0, 100, 50); g_SampleUI.AddStatic(IDC_STATIC_LEG, L"leg", 50, iY += 20, 100, 24); g_SampleUI.AddSlider(IDC_SLIDER_LEG, 50, iY += 16, 100, 22, 0, 100, 50); g_SampleUI.AddStatic(IDC_STATIC_BODY, L"body", 50, iY += 20, 100, 24); g_SampleUI.AddSlider(IDC_SLIDER_BODY, 50, iY += 16, 100, 22, 0, 100, 50); g_SampleUI.AddCheckBox(IDC_CHECK_DIFFUSEMAP, L"Diffusemap", 50, iY += 40, 100, 22, true); g_SampleUI.AddCheckBox(IDC_CHECK_NORMALMAP, L"Normalmap", 50, iY += 20, 100, 22, true); g_SampleUI.AddCheckBox(IDC_CHECK_GLOSS, L"Glossmap", 50, iY += 20, 100, 22, true); g_SampleUI.AddCheckBox(IDC_CHECK_WIREFRAME, L"Wireframe", 50, iY += 20, 100, 22); }
//-------------------------------------------------------------------------------------- // //-------------------------------------------------------------------------------------- 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) ); }
//-------------------------------------------------------------------------------------- // 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", 0, iY, 170, 23 ); g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += 26, 170, 23, VK_F3 ); g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 23, VK_F2 ); iY = 0; g_SampleUI.AddCheckBox( IDC_SHOWTESSELLATED, L"Show (t)essellated", 0, iY += 26, 125, 22, g_bShowTessellated, 'T' ); g_SampleUI.AddRadioButton( IDC_PARTITIONING_INTEGER, 0, L"Integer Partitioning(1)", 0, iY += 39, 125, 22, false, '1' ); g_SampleUI.AddRadioButton( IDC_PARTITIONING_POW2, 0, L"Pow2 Partitioning(2)", 0, iY += 26, 125, 22, false, '2' ); g_SampleUI.AddRadioButton( IDC_PARTITIONING_FRACTIONAL_ODD, 0, L"Odd Fractional Partitioning(3)", 0, iY += 26, 125, 22, false, '3' ); g_SampleUI.AddRadioButton( IDC_PARTITIONING_FRACTIONAL_EVEN, 0, L"Even Fractional Partitioning(4)", 0, iY += 26, 125, 22, true, '4' ); g_SampleUI.SetCallback( OnGUIEvent ); }
//-------------------------------------------------------------------------------------- // 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_TOGGLEREF, L"Toggle REF (F3)", 0, iY += iYo, 170, 22, VK_F3 ); g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += iYo, 170, 22, VK_F2 ); iY = 0; g_SampleUI.AddCheckBox( IDC_TOGGLERESIDENCYVIEWS, L"Show residency view render", 0, iY += iYo, 0, 22, g_bDrawResidencySampleViews ); g_SampleUI.AddCheckBox( IDC_TOGGLETERRAINVIEW, L"Terrain render", 0, iY += iYo, 0, 22, g_bDrawTerrain ); g_SampleUI.AddCheckBox( IDC_PAUSESTREAMING, L"Pause streaming", 0, iY += iYo, 0, 22, g_bPauseStreaming ); g_SampleUI.SetCallback( OnGUIEvent ); }
// 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)); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { D3DXVECTOR3 vLightDir( 1, 0, 0 ); D3DXVec3Normalize( &vLightDir, &vLightDir ); g_LightControl.SetLightDirection( vLightDir ); // Initialize dialogs 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", 0, iY, 170, 23 ); g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (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.AddButton( IDC_PAUSE, L"Pause", 0, iY += 26, 170, 23 ); g_HUD.AddButton( IDC_WIREFRAME, L"Wire frame", 0, iY += 26, 170, 23 ); g_SampleUI.SetCallback( OnGUIEvent ); iY = 10; }
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); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { static const XMVECTORF32 s_vLightDir = { -1.f, 1.f, -1.f, 0.f }; XMVECTOR vLightDir = XMVector3Normalize( s_vLightDir ); g_LightControl.SetLightDirection( vLightDir ); // Initialize dialogs g_D3DSettingsDlg.Init( &g_DialogResourceManager ); g_HUD.Init( &g_DialogResourceManager ); g_SampleUI.Init( &g_DialogResourceManager ); g_HUD.SetCallback( OnGUIEvent ); int iY = 25; g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 22 ); g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += 26, 170, 22, VK_F3 ); g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 22, VK_F2 ); g_HUD.AddButton( IDC_TOGGLEWIRE, L"Toggle Wires (F4)", 0, iY += 26, 170, 22, VK_F4 ); // Material Controls iY = 10; g_SampleUI.AddRadioButton( IDC_MATERIAL_PLASTIC, IDC_MATERIAL_GROUP, L"Plastic", 0, iY += 26, 170, 22 ); g_SampleUI.AddRadioButton( IDC_MATERIAL_PLASTIC_TEXTURED, IDC_MATERIAL_GROUP, L"Plastic Textured", 0, iY += 26, 170, 22 ); g_SampleUI.AddRadioButton( IDC_MATERIAL_ROUGH, IDC_MATERIAL_GROUP, L"Rough", 0, iY += 26, 170, 22 ); g_SampleUI.AddRadioButton( IDC_MATERIAL_ROUGH_TEXTURED, IDC_MATERIAL_GROUP, L"Rough Textured", 0, iY += 26, 170, 22 ); auto pRadioButton = g_SampleUI.GetRadioButton( IDC_MATERIAL_PLASTIC_TEXTURED ); pRadioButton->SetChecked( true ); iY += 24; // Lighting Controls g_SampleUI.AddRadioButton( IDC_LIGHT_CONST_AMBIENT, IDC_AMBIENT_LIGHTING_GROUP, L"Constant Ambient", 0, iY += 26, 170, 22 ); g_SampleUI.AddRadioButton( IDC_LIGHT_HEMI_AMBIENT, IDC_AMBIENT_LIGHTING_GROUP, L"Hemi Ambient", 0, iY += 26, 170, 22 ); pRadioButton = g_SampleUI.GetRadioButton( IDC_LIGHT_CONST_AMBIENT ); pRadioButton->SetChecked( true ); g_SampleUI.AddCheckBox( IDC_LIGHT_DIRECT, L"Direct Lighting", 0, iY += 26, 170, 22, g_bDirectLighting ); g_SampleUI.AddCheckBox( IDC_LIGHTING_ONLY, L"Lighting Only", 0, iY += 26, 170, 22, g_bLightingOnly ); g_SampleUI.SetCallback( OnGUIEvent ); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { WCHAR temp[64]; g_D3DSettingsDlg.Init( &g_DialogResourceManager ); g_HUD.Init( &g_DialogResourceManager ); g_SampleUI.Init( &g_DialogResourceManager ); g_HUD.SetCallback( OnGUIEvent ); int iY = 30; g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 23 ); g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += 26, 170, 23, VK_F3 ); g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 23, VK_F2 ); iY += 180; swprintf_s( temp, L"SunWidth = %2.2f", g_fSunWidth ); g_HUD.AddStatic( IDC_SUNWIDTH_TEXT, temp, 0, iY += 25, 100, 24 ); g_HUD.AddSlider( IDC_SUNWIDTH_SLIDER, 0, iY += 25, 150, 24, 0, 100, int( ( g_fSunWidth / 3.0 ) * 100 ) ); g_Camera.SetRotateButtons( true, false, false ); g_LCamera.SetButtonMasks( MOUSE_RIGHT_BUTTON, 0, 0 ); g_SampleUI.SetCallback( OnGUIEvent ); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { g_bEnablePreshader = true; for( int i = 0; i < MAX_LIGHTS; i++ ) g_LightControl[i].SetLightDirection( D3DXVECTOR3( sinf( D3DX_PI * 2 * i / MAX_LIGHTS - D3DX_PI / 6 ), 0, -cosf( D3DX_PI * 2 * i / MAX_LIGHTS - D3DX_PI / 6 ) ) ); g_nActiveLight = 0; g_nNumActiveLights = 1; g_fLightScale = 1.0f; // 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; WCHAR sz[100]; iY += 24; swprintf_s( sz, 100, L"# Lights: %d", g_nNumActiveLights ); g_SampleUI.AddStatic( IDC_NUM_LIGHTS_STATIC, sz, 35, iY += 24, 125, 22 ); g_SampleUI.AddSlider( IDC_NUM_LIGHTS, 50, iY += 24, 100, 22, 1, MAX_LIGHTS, g_nNumActiveLights ); iY += 24; swprintf_s( sz, 100, L"Light scale: %0.2f", g_fLightScale ); g_SampleUI.AddStatic( IDC_LIGHT_SCALE_STATIC, sz, 35, iY += 24, 125, 22 ); g_SampleUI.AddSlider( IDC_LIGHT_SCALE, 50, iY += 24, 100, 22, 0, 20, ( int )( g_fLightScale * 10.0f ) ); iY += 24; g_SampleUI.AddButton( IDC_ACTIVE_LIGHT, L"Change active light (K)", 35, iY += 24, 125, 22, 'K' ); g_SampleUI.AddCheckBox( IDC_ENABLE_PRESHADER, L"Enable preshaders", 35, iY += 24, 125, 22, g_bEnablePreshader ); }
//-------------------------------------------------------------------------------------- // 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 ); }
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 ); } }
void InitApp() { g_HUD.Init(&g_DialogResourceManager); g_SampleUI.Init(&g_DialogResourceManager); g_WhiteArrowDialog.Init(&g_DialogResourceManager); g_BlackArrowDialog.Init(&g_DialogResourceManager); g_TheWhiteWinnerDialog.Init(&g_DialogResourceManager); g_TheBlackWinnerDialog.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_HIDECONSOLE, L"Console", 35, iY += 24, 125, 22); g_HUD.AddButton(IDC_LAUNCH_RENJU_MANUAL, L"Manual", 35, iY += 24, 125, 22); g_HUD.AddButton(IDC_RESETGAME, L"Start", 35, iY += 24, 125, 22); g_SampleUI.AddRadioButton(IDC_GAMEMODE_HUMAN_HUMAN_RADIO, 1, L"Human - Human", 35, iY += 24, 220, 24, true, L'1'); g_SampleUI.AddRadioButton(IDC_GAMEMODE_AI_IS_BLACK_RADIO, 1, L"AI is Black", 35, iY += 24, 220, 24, false, L'2'); g_SampleUI.AddRadioButton(IDC_GAMEMODE_AI_IS_WHITE_RADIO, 1, L"AI is White", 35, iY += 24, 220, 24, false, L'3'); g_SampleUI.SetCallback(OnGUIEvent); CDXUTStatic* pStatic = NULL; CDXUTElement* pElement = g_WhiteArrowDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0); if(pElement) { pElement->FontColor.Init(D3DCOLOR_ARGB(255, 255, 255, 255)); } g_WhiteArrowDialog.SetSize(150, 100); g_WhiteArrowDialog.SetBackgroundColors(D3DCOLOR_ARGB(0, 255, 255, 255), D3DCOLOR_ARGB(0, 255, 255, 255), D3DCOLOR_ARGB(0, 255, 255, 255), D3DCOLOR_ARGB(0, 255, 255, 255)); g_WhiteArrowDialog.SetCallback(OnGUIEvent); g_WhiteArrowDialog.SetFont(0, L"Arial", 120, FW_BOLD); g_WhiteArrowDialog.AddStatic(IDC_WHITESCORE, L"2", 0, 0, g_WhiteArrowDialog.GetWidth(), g_WhiteArrowDialog.GetHeight(), false, &pStatic); pElement = g_BlackArrowDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0); if(pElement) { pElement->FontColor.Init(D3DCOLOR_ARGB(255, 0, 0, 0)); } g_BlackArrowDialog.SetSize(150, 100); g_BlackArrowDialog.SetBackgroundColors(D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16)); g_BlackArrowDialog.SetCallback(OnGUIEvent); g_BlackArrowDialog.SetFont(0, L"Arial", 120, FW_BOLD); g_BlackArrowDialog.AddStatic(IDC_BLACKSCORE, L"2", 0, 0, g_BlackArrowDialog.GetWidth(), g_BlackArrowDialog.GetHeight(), false, &pStatic); pElement = g_TheWhiteWinnerDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0); if(pElement) { pElement->FontColor.Init(D3DCOLOR_ARGB(255, 255, 255, 255)); } pElement = g_TheWhiteWinnerDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0); g_TheWhiteWinnerDialog.SetSize(500, 100); g_TheWhiteWinnerDialog.SetBackgroundColors(D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16)); g_TheWhiteWinnerDialog.SetCallback(OnGUIEvent); g_TheWhiteWinnerDialog.SetFont(0, L"Arial", 60, FW_BOLD); g_TheWhiteWinnerDialog.AddStatic(IDC_THE_WHITE_WINNER_DIALOG, L"2", 0, 0, g_TheWhiteWinnerDialog.GetWidth(), g_TheWhiteWinnerDialog.GetHeight(), false, &pStatic); pElement = g_TheBlackWinnerDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0); if(pElement) { pElement->FontColor.Init(D3DCOLOR_ARGB(255, 0, 0, 0)); } pElement = g_TheBlackWinnerDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0); g_TheBlackWinnerDialog.SetSize(500, 100); g_TheBlackWinnerDialog.SetBackgroundColors(D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16)); g_TheBlackWinnerDialog.SetCallback(OnGUIEvent); g_TheBlackWinnerDialog.SetFont(0, L"Arial", 60, FW_BOLD); g_TheBlackWinnerDialog.AddStatic(IDC_THE_BLACK_WINNER_DIALOG, L"2", 0, 0, g_TheBlackWinnerDialog.GetWidth(), g_TheBlackWinnerDialog.GetHeight(), false, &pStatic); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { camera = new CCamera; manipulator = new CManipulator; g_SettingsDlg.Init( &g_DialogResourceManager ); g_HUD.Init( &g_DialogResourceManager ); g_SampleUI.Init( &g_DialogResourceManager ); //g_HUD g_HUD.SetCallback( OnGUIEvent ); g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 5, 10, 125, 22, VK_F12 ); //fonts g_HUD.SetFont( 1, L"Arial", 20, FW_BOLD ); g_HUD.SetFont( 2, L"Arial", 16, FW_NORMAL ); g_HUD.AddEditBox( IDC_NEWFILE, L"testconfig.ini", 150, 10, 120, 30 ); g_HUD.AddButton( IDC_NEWFILE_BTN, L"New", 280, 15, 60, 20); g_HUD.AddEditBox( IDC_LOADFILE, L"testconfig.ini", 150, 40, 120, 30 ); g_HUD.AddButton( IDC_LOADFILE_BTN, L"Load", 280, 45, 60, 20); g_HUD.AddEditBox( IDC_SAVEFILE, L"testconfig.ini", 150, 70, 120, 30 ); g_HUD.AddButton( IDC_SAVEFILE_BTN, L"Save", 280, 75, 60, 20); g_HUD.AddEditBox( IDC_CMD, L"", 5, 5, 300, 30 ); g_HUD.AddStatic( IDC_STATIC7, L"status", 5, 5, 300, 30 ); g_HUD.GetStatic( IDC_STATIC7 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_HUD.GetStatic( IDC_STATIC7 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_HUD.GetStatic( IDC_STATIC7 )->GetElement(0)->iFont = 2; //g_SampleUI g_SampleUI.SetCallback( OnGUIEvent ); int iY = 10; g_SampleUI.SetVisible(false); //fonts g_SampleUI.SetFont( 1, L"Arial", 20, FW_BOLD ); g_SampleUI.SetFont( 2, L"Arial", 16, FW_NORMAL ); g_SampleUI.AddStatic( IDC_OBJNAME, L"Pick object", 0, 0, 200, 30 ); g_SampleUI.GetStatic( IDC_OBJNAME )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_OBJNAME )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_OBJNAME )->GetElement(0)->iFont = 1; g_SampleUI.AddStatic( IDC_STATIC7, L"angleX:",210,0,50,30 ); g_SampleUI.GetStatic( IDC_STATIC7 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC7 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC7 )->GetElement(0)->iFont = 2; g_SampleUI.AddStatic( IDC_STATIC8, L"angleY:",260,0,50,30 ); g_SampleUI.GetStatic( IDC_STATIC8 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC8 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC8 )->GetElement(0)->iFont = 2; //width edit box g_SampleUI.AddStatic( IDC_STATIC1, L"Width", 0, 50, 200, 30 ); g_SampleUI.GetStatic( IDC_STATIC1 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC1 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC1 )->GetElement(0)->iFont = 2; g_SampleUI.AddEditBox( IDC_WIDTH, L"", 70, 45, 120, 30 ); g_SampleUI.AddSlider( IDC_WIDTH_SLIDER, 200, 50, 150, 24, 1, 75, 20, false ); //length edit box g_SampleUI.AddStatic( IDC_STATIC2, L"Length", 0, 80, 200, 30 ); g_SampleUI.GetStatic( IDC_STATIC2 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC2 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC2 )->GetElement(0)->iFont = 2; g_SampleUI.AddEditBox( IDC_LENGTH, L"", 70, 75, 120, 30 ); g_SampleUI.AddSlider( IDC_LENGTH_SLIDER, 200, 80, 150, 24, 1, 400, 100, false ); //angle restrictions g_SampleUI.AddStatic( IDC_STATIC3, L"Angles restrictions", 0, 110, 200, 30 ); g_SampleUI.GetStatic( IDC_STATIC3 )->GetElement( 0 )->dwTextFormat = DT_LEFT | DT_TOP; g_SampleUI.GetStatic( IDC_STATIC3 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC3 )->GetElement(0)->iFont = 2; g_SampleUI.AddStatic( IDC_STATIC4, L"X", 20, 130, 200, 30 ); g_SampleUI.GetStatic( IDC_STATIC4 )->GetElement( 0 )->dwTextFormat = DT_LEFT | DT_TOP; g_SampleUI.GetStatic( IDC_STATIC4 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC4 )->GetElement(0)->iFont = 2; g_SampleUI.AddStatic( IDC_STATIC5, L"Y", 20, 160, 200, 30 ); g_SampleUI.GetStatic( IDC_STATIC5 )->GetElement( 0 )->dwTextFormat = DT_LEFT | DT_TOP; g_SampleUI.GetStatic( IDC_STATIC5 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC5 )->GetElement(0)->iFont = 2; g_SampleUI.AddEditBox( IDC_ANGLE_RESTRICT_XL, L"", 70, 125, 100, 30 ); g_SampleUI.AddButton( IDC_ANGLE_RESTRICT_XL_BTN, L"A", 170, 130, 22, 22 ); g_SampleUI.AddEditBox( IDC_ANGLE_RESTRICT_XU, L"", 220, 125, 100, 30 ); g_SampleUI.AddButton( IDC_ANGLE_RESTRICT_XU_BTN, L"A", 320, 130, 22, 22 ); g_SampleUI.AddEditBox( IDC_ANGLE_RESTRICT_YL, L"", 70, 155, 100, 30 ); g_SampleUI.AddButton( IDC_ANGLE_RESTRICT_YL_BTN, L"A", 170, 160, 22, 22 ); g_SampleUI.AddEditBox( IDC_ANGLE_RESTRICT_YU, L"", 220, 155, 100, 30 ); g_SampleUI.AddButton( IDC_ANGLE_RESTRICT_YU_BTN, L"A", 320, 160, 22, 22 ); //add button g_SampleUI.AddButton( IDC_ADDCHAIN, L"Add", 15, 200, 100, 22 ); g_SampleUI.AddButton( IDC_REMOVECHAIN, L"Remove", 115, 200, 100, 22 ); //offset g_SampleUI.AddStatic( IDC_STATIC6, L"Offset", 0, 230, 70, 30 ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC6 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement(0)->iFont = 2; g_SampleUI.AddEditBox( IDC_OFFSET_X, L"", 70, 225, 80, 30 ); g_SampleUI.AddEditBox( IDC_OFFSET_Y, L"", 160, 225, 80, 30 ); g_SampleUI.AddEditBox( IDC_OFFSET_Z, L"", 250, 225, 80, 30 ); //physical stuff g_SampleUI.AddStatic( IDC_STATIC6, L"Displace", 0, 265, 70, 30 ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC6 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement(0)->iFont = 2; g_SampleUI.AddEditBox(IDC_DISPLACE, L"", 70, 265, 80, 30); g_SampleUI.AddStatic( IDC_STATIC6, L"Direction", 0, 305, 70, 30 ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC6 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement(0)->iFont = 2; g_SampleUI.AddEditBox(IDC_DIRECTION, L"", 70, 305, 80, 30); g_SampleUI.AddStatic( IDC_STATIC6, L"Coefficient", 0, 345, 70, 30 ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC6 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement(0)->iFont = 2; g_SampleUI.AddEditBox(IDC_COEFFICIENT, L"", 70, 345, 80, 30); g_SampleUI.AddStatic( IDC_STATIC6, L"Mass", 0, 385, 70, 30 ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC6 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement(0)->iFont = 2; g_SampleUI.AddEditBox(IDC_MASS, L"", 70, 385, 80, 30); g_SampleUI.AddStatic( IDC_STATIC6, L"Tilt", 0, 425, 70, 30 ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC6 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement(0)->iFont = 2; g_SampleUI.AddCheckBox( IDC_TILT, L"", 60, 425, 30, 30 ); g_SampleUI.AddStatic( IDC_STATIC6, L"Pressure", 100, 425, 70, 30 ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC6 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement(0)->iFont = 2; g_SampleUI.AddCheckBox( IDC_PRESSURE, L"", 160, 425, 30, 30 ); g_SampleUI.AddStatic( IDC_STATIC6, L"Laser", 200, 425, 70, 30 ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement( 0 )->dwTextFormat = DT_LEFT; g_SampleUI.GetStatic( IDC_STATIC6 )->SetTextColor( D3DCOLOR_ARGB( 255, 220, 220, 220 ) ); g_SampleUI.GetStatic( IDC_STATIC6 )->GetElement(0)->iFont = 2; g_SampleUI.AddCheckBox( IDC_LASER, L"", 260, 425, 30, 30 ); }
//-------------------------------------------------------------------------------------- // 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]; swprintf_s( wszText, 50, L"Multi-selection listbox item %d", i ); g_SampleUI.GetListBox( IDC_LISTBOXM )->AddItem( wszText, ( LPVOID )( size_t )i ); } }
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); hud_postp2.AddCheckBox(IDC_FILM_GRAIN_ENABLED, L"Film grain", x, y += db, w, h, false); hud_postp2.AddCheckBox(IDC_DOF_ENABLED, L"DOF", x, y += db, w, h, false); hud_postp2.AddStatic(-1, L"DOF focal plane:", x, y += db, w, h); hud_postp2.AddSlider(IDC_DOF_FOCAL_PLANE, x, y += dd, w, h, 0, 5000, 2000); hud_postp2.AddStatic(-1, L"DOF COC scale:", x, y += db, w, h); hud_postp2.AddSlider(IDC_DOF_COC_SCALE, x, y += dd, w, h, 50, 150, 80); hud_postp2.AddCheckBox(IDC_BLOOM_ENABLED, L"Bloom", x, y += db, w, h, false); hud_postp2.AddStatic(-1, L"Bloom sigma:", x, y += db, w, h, true); hud_postp2.AddSlider(IDC_BLOOM_SIGMA, x, y += dd, w, h, 50, 150, 80); hud_postp2.AddStatic(-1, L"Bloom threshold:", x, y += db, w, h, true); hud_postp2.AddSlider(IDC_BLOOM_TRESHOLD, x, y += dd, w, h, 50, 250, 150); // Debug panel y = start; combo_settings->AddItem(L"Debug Info", reinterpret_cast<void*>(&hud_debug_info)); hud_debug_info.AddStatic(IDC_DEBUG_INFO + 0, L"", x, y += db, w, h); // startup config hud.SetVisible(true); hud_light.SetVisible(false); hud_postp1.SetVisible(false); hud_postp2.SetVisible(false); hud_gi.SetVisible(false); hud_debug_info.SetVisible(false); return start; }