本文整理汇总了C++中CDXUTComboBox::RemoveAllItems方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTComboBox::RemoveAllItems方法的具体用法?C++ CDXUTComboBox::RemoveAllItems怎么用?C++ CDXUTComboBox::RemoveAllItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDXUTComboBox
的用法示例。
在下文中一共展示了CDXUTComboBox::RemoveAllItems方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateMSAASampleCounts
//--------------------------------------------------------------------------------------
// Update the MSAA sample count combo box for this format
//--------------------------------------------------------------------------------------
void UpdateMSAASampleCounts( ID3D10Device* pd3dDevice, DXGI_FORMAT fmt )
{
CDXUTComboBox* pComboBox = NULL;
bool bResetSampleCount = false;
UINT iHighestSampleCount = 0;
pComboBox = g_SampleUI.GetComboBox( IDC_SAMPLE_COUNT );
if( !pComboBox )
return;
pComboBox->RemoveAllItems();
WCHAR val[10];
for( UINT i = 1; i <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; i++ )
{
UINT Quality;
if( SUCCEEDED( pd3dDevice->CheckMultisampleQualityLevels( fmt, i, &Quality ) ) &&
Quality > 0 )
{
swprintf_s( val, 10, L"%d", i );
pComboBox->AddItem( val, IntToPtr( i ) );
iHighestSampleCount = i;
}
else if( g_MSAASampleCount == i )
{
bResetSampleCount = true;
}
}
if( bResetSampleCount )
g_MSAASampleCount = iHighestSampleCount;
pComboBox->SetSelectedByData( IntToPtr( g_MSAASampleCount ) );
}
示例2: OnCreateDevice
//--------------------------------------------------------------------------------------
// This callback function will be called immediately after the Direct3D device has been
// created, which will happen during application initialization and windowed/full screen
// toggles. This is the best location to create D3DPOOL_MANAGED resources since these
// resources need to be reloaded whenever the device is destroyed. Resources created
// here should be released in the OnDestroyDevice callback.
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc,
void* pUserContext )
{
HRESULT hr;
WCHAR str[MAX_PATH];
V_RETURN( g_DialogResourceManager.OnD3D9CreateDevice( pd3dDevice ) );
V_RETURN( g_SettingsDlg.OnD3D9CreateDevice( pd3dDevice ) );
// Initialize the font
V_RETURN( D3DXCreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
L"Arial", &g_pFont ) );
// Create the mesh and load it with data already gathered from a file
V_RETURN( g_MeshLoader.Create( pd3dDevice, L"media\\cup.obj" ) );
// Add the identified material subsets to the UI
CDXUTComboBox* pComboBox = g_SampleUI.GetComboBox( IDC_SUBSET );
pComboBox->RemoveAllItems();
pComboBox->AddItem( L"All", ( void* )( INT_PTR )-1 );
for( UINT i = 0; i < g_MeshLoader.GetNumMaterials(); i++ )
{
Material* pMaterial = g_MeshLoader.GetMaterial( i );
pComboBox->AddItem( pMaterial->strName, ( void* )( INT_PTR )i );
}
// Define DEBUG_VS and/or DEBUG_PS to debug vertex and/or pixel shaders with the
// shader debugger. Debugging vertex shaders requires either REF or software vertex
// processing, and debugging pixel shaders requires REF. The
// D3DXSHADER_FORCE_*_SOFTWARE_NOOPT flag improves the debug experience in the
// shader debugger. It enables source level debugging, prevents instruction
// reordering, prevents dead code elimination, and forces the compiler to compile
// against the next higher available software target, which ensures that the
// unoptimized shaders do not exceed the shader model limitations. Setting these
// flags will cause slower rendering since the shaders will be unoptimized and
// forced into software. See the DirectX documentation for more information about
// using the shader debugger.
DWORD dwShaderFlags = D3DXFX_NOT_CLONEABLE;
#if defined( DEBUG ) || defined( _DEBUG )
// Set the D3DXSHADER_DEBUG flag to embed debug information in the shaders.
// Setting this flag improves the shader debugging experience, but still allows
// the shaders to be optimized and to run exactly the way they will run in
// the release configuration of this program.
dwShaderFlags |= D3DXSHADER_DEBUG;
#endif
#ifdef DEBUG_VS
dwShaderFlags |= D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT;
#endif
#ifdef DEBUG_PS
dwShaderFlags |= D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT;
#endif
// Read the D3DX effect file
V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"MeshFromOBJ.fx" ) );
// If this fails, there should be debug output as to
// they the .fx file failed to compile
V_RETURN( D3DXCreateEffectFromFile( pd3dDevice, str, NULL, NULL, dwShaderFlags,
NULL, &g_pEffect, NULL ) );
// Cache the effect handles
g_hAmbient = g_pEffect->GetParameterBySemantic( 0, "Ambient" );
g_hDiffuse = g_pEffect->GetParameterBySemantic( 0, "Diffuse" );
g_hSpecular = g_pEffect->GetParameterBySemantic( 0, "Specular" );
g_hOpacity = g_pEffect->GetParameterBySemantic( 0, "Opacity" );
g_hSpecularPower = g_pEffect->GetParameterBySemantic( 0, "SpecularPower" );
g_hLightColor = g_pEffect->GetParameterBySemantic( 0, "LightColor" );
g_hLightPosition = g_pEffect->GetParameterBySemantic( 0, "LightPosition" );
g_hCameraPosition = g_pEffect->GetParameterBySemantic( 0, "CameraPosition" );
g_hTexture = g_pEffect->GetParameterBySemantic( 0, "Texture" );
g_hTime = g_pEffect->GetParameterBySemantic( 0, "Time" );
g_hWorld = g_pEffect->GetParameterBySemantic( 0, "World" );
g_hWorldViewProjection = g_pEffect->GetParameterBySemantic( 0, "WorldViewProjection" );
// Setup the camera's view parameters
D3DXVECTOR3 vecEye( 2.0f, 1.0f, 0.0f );
D3DXVECTOR3 vecAt ( 0.0f, 0.0f, -0.0f );
g_Camera.SetViewParams( &vecEye, &vecAt );
return S_OK;
}
示例3: if
//--------------------------------------------------------------------------------------
// Create any D3D10 resources that aren't dependant on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBufferSurfaceDesc,
void* pUserContext )
{
HRESULT hr;
V_RETURN( g_DialogResourceManager.OnD3D10CreateDevice( pd3dDevice ) );
V_RETURN( g_SettingsDlg.OnD3D10CreateDevice( pd3dDevice ) );
V_RETURN( D3DX10CreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
L"Arial", &g_pFont10 ) );
V_RETURN( D3DX10CreateSprite( pd3dDevice, 512, &g_pSprite10 ) );
g_pTxtHelper = new CDXUTTextHelper( NULL, NULL, g_pFont10, g_pSprite10, 15 );
// Read the D3DX effect file
WCHAR str[MAX_PATH];
V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"MeshFromOBJ10.fx" ) );
DWORD dwShaderFlags = D3D10_SHADER_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
// Set the D3D10_SHADER_DEBUG flag to embed debug information in the shaders.
// Setting this flag improves the shader debugging experience, but still allows
// the shaders to be optimized and to run exactly the way they will run in
// the release configuration of this program.
dwShaderFlags |= D3D10_SHADER_DEBUG;
#endif
V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", dwShaderFlags, 0, pd3dDevice, NULL,
NULL, &g_pEffect10, NULL, NULL ) );
// Obtain the technique
g_pTechnique = g_pEffect10->GetTechniqueByName( "NoSpecular" );
g_ptxDiffuseVariable = g_pEffect10->GetVariableByName( "g_MeshTexture" )->AsShaderResource();
g_pAmbient = g_pEffect10->GetVariableByName( "g_vMaterialAmbient" )->AsVector();
g_pDiffuse = g_pEffect10->GetVariableByName( "g_vMaterialDiffuse" )->AsVector();
g_pSpecular = g_pEffect10->GetVariableByName( "g_vMaterialSpecular" )->AsVector();
g_pOpacity = g_pEffect10->GetVariableByName( "g_fMaterialAlpha" )->AsScalar();
g_pSpecularPower = g_pEffect10->GetVariableByName( "g_nMaterialShininess" )->AsScalar();
g_pLightColor = g_pEffect10->GetVariableByName( "g_vLightColor" )->AsVector();
g_pLightPosition = g_pEffect10->GetVariableByName( "g_vLightPosition" )->AsVector();
g_pCameraPosition = g_pEffect10->GetVariableByName( "g_vCameraPosition" )->AsVector();
g_pTime = g_pEffect10->GetVariableByName( "g_fTime" )->AsScalar();
g_pWorld = g_pEffect10->GetVariableByName( "g_mWorld" )->AsMatrix();
g_pWorldViewProjection = g_pEffect10->GetVariableByName( "g_mWorldViewProjection" )->AsMatrix();
// Define the input layout
const D3D10_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },
} ;
UINT numElements = sizeof( layout ) / sizeof( layout[0] );
// Create the input layout
D3D10_PASS_DESC PassDesc;
g_pTechnique->GetPassByIndex( 0 )->GetDesc( &PassDesc );
V_RETURN( pd3dDevice->CreateInputLayout( layout, numElements, PassDesc.pIAInputSignature,
PassDesc.IAInputSignatureSize, &g_pVertexLayout ) );
pd3dDevice->IASetInputLayout( g_pVertexLayout );
// Load the mesh
V_RETURN( g_MeshLoader.Create( pd3dDevice, MESHFILEPATH ) );
// Add the identified subsets to the UI
CDXUTComboBox* pComboBox = g_SampleUI.GetComboBox( IDC_SUBSET );
pComboBox->RemoveAllItems();
pComboBox->AddItem( L"All", ( void* )( INT_PTR )-1 );
for ( UINT subset = 0; subset < g_MeshLoader.GetNumSubsets(); ++subset )
{
Material* pMaterial = g_MeshLoader.GetSubsetMaterial( subset );
pComboBox->AddItem( pMaterial->strName, ( void* )( INT_PTR )subset );
}
// Store the correct technique for each material
for ( UINT i = 0; i < g_MeshLoader.GetNumMaterials(); ++i )
{
Material* pMaterial = g_MeshLoader.GetMaterial( i );
const char* strTechnique = "";
if( pMaterial->pTextureRV10 && pMaterial->bSpecular )
strTechnique = "TexturedSpecular";
else if( pMaterial->pTextureRV10 && !pMaterial->bSpecular )
strTechnique = "TexturedNoSpecular";
else if( !pMaterial->pTextureRV10 && pMaterial->bSpecular )
strTechnique = "Specular";
else if( !pMaterial->pTextureRV10 && !pMaterial->bSpecular )
strTechnique = "NoSpecular";
pMaterial->pTechnique = g_pEffect10->GetTechniqueByName( strTechnique );
}
LoadRasterizerStates(pd3dDevice);
//.........这里部分代码省略.........
示例4: if
//--------------------------------------------------------------------------------------
// Create any D3D10 resources that aren't dependant on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBufferSurfaceDesc,
void* pUserContext )
{
HRESULT hr;
V_RETURN( g_DialogResourceManager.OnD3D10CreateDevice( pd3dDevice ) );
V_RETURN( g_SettingsDlg.OnD3D10CreateDevice( pd3dDevice ) );
V_RETURN( D3DX10CreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
L"Arial", &g_pFont10 ) );
V_RETURN( D3DX10CreateSprite( pd3dDevice, 512, &g_pSprite10 ) );
g_pTxtHelper = new CDXUTTextHelper( NULL, NULL, g_pFont10, g_pSprite10, 15 );
// Read the D3DX effect file
WCHAR str[MAX_PATH];
V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"MeshFromOBJ10.fx" ) );
DWORD dwShaderFlags = D3D10_SHADER_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
// Set the D3D10_SHADER_DEBUG flag to embed debug information in the shaders.
// Setting this flag improves the shader debugging experience, but still allows
// the shaders to be optimized and to run exactly the way they will run in
// the release configuration of this program.
dwShaderFlags |= D3D10_SHADER_DEBUG;
#endif
V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", dwShaderFlags, 0, pd3dDevice, NULL,
NULL, &g_pEffect10, NULL, NULL ) );
// Obtain the technique
g_pTechnique = g_pEffect10->GetTechniqueByName( "NoSpecular" );
g_ptxDiffuseVariable = g_pEffect10->GetVariableByName( "g_MeshTexture" )->AsShaderResource();
g_pAmbient = g_pEffect10->GetVariableByName( "g_vMaterialAmbient" )->AsVector();
g_pDiffuse = g_pEffect10->GetVariableByName( "g_vMaterialDiffuse" )->AsVector();
g_pSpecular = g_pEffect10->GetVariableByName( "g_vMaterialSpecular" )->AsVector();
g_pOpacity = g_pEffect10->GetVariableByName( "g_fMaterialAlpha" )->AsScalar();
g_pSpecularPower = g_pEffect10->GetVariableByName( "g_nMaterialShininess" )->AsScalar();
g_pLightColor = g_pEffect10->GetVariableByName( "g_vLightColor" )->AsVector();
g_pLightPosition = g_pEffect10->GetVariableByName( "g_vLightPosition" )->AsVector();
g_pCameraPosition = g_pEffect10->GetVariableByName( "g_vCameraPosition" )->AsVector();
g_pTime = g_pEffect10->GetVariableByName( "g_fTime" )->AsScalar();
g_pWorld = g_pEffect10->GetVariableByName( "g_mWorld" )->AsMatrix();
g_pWorldViewProjection = g_pEffect10->GetVariableByName( "g_mWorldViewProjection" )->AsMatrix();
// Define the input layout
const D3D10_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },
} ;
UINT numElements = sizeof( layout ) / sizeof( layout[0] );
// Create the input layout
D3D10_PASS_DESC PassDesc;
g_pTechnique->GetPassByIndex( 0 )->GetDesc( &PassDesc );
V_RETURN( pd3dDevice->CreateInputLayout( layout, numElements, PassDesc.pIAInputSignature,
PassDesc.IAInputSignatureSize, &g_pVertexLayout ) );
pd3dDevice->IASetInputLayout( g_pVertexLayout );
// Load the mesh
V_RETURN( g_MeshLoader.Create( pd3dDevice, L"media\\cup.obj" ) );
// Add the identified subsets to the UI
CDXUTComboBox* pComboBox = g_SampleUI.GetComboBox( IDC_SUBSET );
pComboBox->RemoveAllItems();
pComboBox->AddItem( L"All", ( void* )( INT_PTR )-1 );
for ( UINT subset = 0; subset < g_MeshLoader.GetNumSubsets(); ++subset )
{
Material* pMaterial = g_MeshLoader.GetSubsetMaterial( subset );
pComboBox->AddItem( pMaterial->strName, ( void* )( INT_PTR )subset );
}
// Store the correct technique for each material
for ( UINT i = 0; i < g_MeshLoader.GetNumMaterials(); ++i )
{
Material* pMaterial = g_MeshLoader.GetMaterial( i );
const char* strTechnique = "";
if( pMaterial->pTextureRV10 && pMaterial->bSpecular )
strTechnique = "TexturedSpecular";
else if( pMaterial->pTextureRV10 && !pMaterial->bSpecular )
strTechnique = "TexturedNoSpecular";
else if( !pMaterial->pTextureRV10 && pMaterial->bSpecular )
strTechnique = "Specular";
else if( !pMaterial->pTextureRV10 && !pMaterial->bSpecular )
strTechnique = "NoSpecular";
pMaterial->pTechnique = g_pEffect10->GetTechniqueByName( strTechnique );
}
// Setup the camera's view parameters
D3DXVECTOR3 vecEye( 2.0f, 1.0f, 0.0f );
//.........这里部分代码省略.........