当前位置: 首页>>代码示例>>C++>>正文


C++ CDXUTSDKMesh::GetAdjIB10方法代码示例

本文整理汇总了C++中CDXUTSDKMesh::GetAdjIB10方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTSDKMesh::GetAdjIB10方法的具体用法?C++ CDXUTSDKMesh::GetAdjIB10怎么用?C++ CDXUTSDKMesh::GetAdjIB10使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDXUTSDKMesh的用法示例。


在下文中一共展示了CDXUTSDKMesh::GetAdjIB10方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lightDir

//--------------------------------------------------------------------------------------
// Render the scene using the D3D10 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D10FrameRender( ID3D10Device* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
    // Clear the render target
    float ClearColor[4] = { 0.9569f, 0.9569f, 1.0f, 0.0f };
    ID3D10RenderTargetView* pRTV = DXUTGetD3D10RenderTargetView();
    pd3dDevice->ClearRenderTargetView( pRTV, ClearColor );
    ID3D10DepthStencilView* pDSV = DXUTGetD3D10DepthStencilView();
    pd3dDevice->ClearDepthStencilView( pDSV, D3D10_CLEAR_DEPTH, 1.0, 0 );

    D3DXMATRIX mWorld;
    D3DXMATRIX mView;
    D3DXMATRIX mProj;
    D3DXMATRIX mWorldView;
    D3DXMATRIX mWorldViewProj;
    mWorld = *g_Camera.GetWorldMatrix();
    mProj = *g_Camera.GetProjMatrix();
    mView = *g_Camera.GetViewMatrix();
    mWorldView = mWorld * mView;
    mWorldViewProj = mWorldView * mProj;

    // Set variables
    g_pmWorldViewProj->SetMatrix( ( float* )&mWorldViewProj );
    g_pmWorldView->SetMatrix( ( float* )&mWorldView );
    g_pmWorld->SetMatrix( ( float* )&mWorld );
    g_pmProj->SetMatrix( ( float* )&mProj );
    g_pDiffuseTex->SetResource( g_pMeshTexRV );
    D3DXVECTOR3 lightDir( -1,1,-1 );
    D3DXVECTOR3 viewLightDir;
    D3DXVec3TransformNormal( &viewLightDir, &lightDir, &mView );
    D3DXVec3Normalize( &viewLightDir, &viewLightDir );
    g_pViewSpaceLightDir->SetFloatVector( ( float* )&viewLightDir );

    // Get VB and IB
    UINT offset = 0;
    UINT stride = g_Mesh.GetVertexStride( 0, 0 );
    ID3D10Buffer* pVB = g_Mesh.GetVB10( 0, 0 );
    ID3D10Buffer* pIB = g_Mesh.GetAdjIB10( 0 );

    // Set Input Assembler params
    pd3dDevice->IASetInputLayout( g_pVertexLayout );

    pd3dDevice->IASetIndexBuffer( pIB, g_Mesh.GetIBFormat10( 0 ), 0 );
    pd3dDevice->IASetVertexBuffers( 0, 1, &pVB, &stride, &offset );
    pd3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ );

    // Render using the technique g_pRenderTextured
    SDKMESH_SUBSET* pSubset = NULL;

    D3D10_TECHNIQUE_DESC techDesc;
    g_pRenderTextured->GetDesc( &techDesc );
    for( UINT p = 0; p < techDesc.Passes; p++ )
    {
        g_pRenderTextured->GetPassByIndex( p )->Apply( 0 );
        for( UINT subset = 0; subset < g_Mesh.GetNumSubsets( 0 ); subset++ )
        {
            pSubset = g_Mesh.GetSubset( 0, subset );

            pd3dDevice->DrawIndexed( ( UINT )pSubset->IndexCount * 2, ( UINT )pSubset->IndexStart,
                                     ( UINT )pSubset->VertexStart );
        }
    }

    // Render the chess piece just for show
    // Render using the technique g_pRenderPiece
    g_pRenderPiece->GetDesc( &techDesc );
    for( UINT p = 0; p < techDesc.Passes; p++ )
    {
        g_pRenderPiece->GetPassByIndex( p )->Apply( 0 );
        for( UINT subset = 0; subset < g_Mesh.GetNumSubsets( 0 ); subset++ )
        {
            pSubset = g_Mesh.GetSubset( 0, subset );

            pd3dDevice->DrawIndexed( ( UINT )pSubset->IndexCount * 2, ( UINT )pSubset->IndexStart,
                                     ( UINT )pSubset->VertexStart );
        }
    }
}
开发者ID:KNeal,项目名称:Oculus,代码行数:80,代码来源:Exercise03.cpp


注:本文中的CDXUTSDKMesh::GetAdjIB10方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。