本文整理汇总了C++中CDXUTSDKMesh::GetPrimitiveType11方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTSDKMesh::GetPrimitiveType11方法的具体用法?C++ CDXUTSDKMesh::GetPrimitiveType11怎么用?C++ CDXUTSDKMesh::GetPrimitiveType11使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDXUTSDKMesh
的用法示例。
在下文中一共展示了CDXUTSDKMesh::GetPrimitiveType11方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: V
//--------------------------------------------------------------------------------------
// Render the scene using the D3D11 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext,
double fTime, float fElapsedTime, void* pUserContext )
{
// If the settings dialog is being shown, then render it instead of rendering the app's scene
if( g_SettingsDlg.IsActive() )
{
g_SettingsDlg.OnRender( fElapsedTime );
return;
}
//
// Clear the back buffer
//
auto pRTV = DXUTGetD3D11RenderTargetView();
pd3dImmediateContext->ClearRenderTargetView( pRTV, Colors::MidnightBlue );
//
// Clear the depth stencil
//
auto pDSV = DXUTGetD3D11DepthStencilView();
pd3dImmediateContext->ClearDepthStencilView( pDSV, D3D11_CLEAR_DEPTH, 1.0, 0 );
XMMATRIX mView = g_Camera.GetViewMatrix();
XMMATRIX mProj = g_Camera.GetProjMatrix();
XMMATRIX mWorldViewProjection = g_World * mView * mProj;
//
// Update variables that change once per frame
//
g_pProjectionVariable->SetMatrix( ( float* )&mProj );
g_pViewVariable->SetMatrix( ( float* )&mView );
g_pWorldVariable->SetMatrix( ( float* )&g_World );
g_pTimeVariable->SetFloat( ( float )fTime );
//
// Set the Vertex Layout
//
pd3dImmediateContext->IASetInputLayout( g_pVertexLayout );
//
// Render the mesh
//
UINT Strides[1];
UINT Offsets[1];
ID3D11Buffer* pVB[1];
pVB[0] = g_Mesh.GetVB11( 0, 0 );
Strides[0] = ( UINT )g_Mesh.GetVertexStride( 0, 0 );
Offsets[0] = 0;
pd3dImmediateContext->IASetVertexBuffers( 0, 1, pVB, Strides, Offsets );
pd3dImmediateContext->IASetIndexBuffer( g_Mesh.GetIB11( 0 ), g_Mesh.GetIBFormat11( 0 ), 0 );
D3DX11_TECHNIQUE_DESC techDesc;
HRESULT hr;
V( g_pTechnique->GetDesc( &techDesc ) );
for( UINT p = 0; p < techDesc.Passes; ++p )
{
for( UINT subset = 0; subset < g_Mesh.GetNumSubsets( 0 ); ++subset )
{
auto pSubset = g_Mesh.GetSubset( 0, subset );
auto PrimType = g_Mesh.GetPrimitiveType11( ( SDKMESH_PRIMITIVE_TYPE )pSubset->PrimitiveType );
pd3dImmediateContext->IASetPrimitiveTopology( PrimType );
auto pDiffuseRV = g_Mesh.GetMaterial( pSubset->MaterialID )->pDiffuseRV11;
g_ptxDiffuseVariable->SetResource( pDiffuseRV );
g_pTechnique->GetPassByIndex( p )->Apply( 0, pd3dImmediateContext );
pd3dImmediateContext->DrawIndexed( ( UINT )pSubset->IndexCount, 0, ( UINT )pSubset->VertexStart );
}
}
//
// Render the UI
//
g_HUD.OnRender( fElapsedTime );
g_SampleUI.OnRender( fElapsedTime );
RenderText();
}