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


C++ CDXUTSDKMesh类代码示例

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


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

示例1: RenderGBuffer

void App::RenderGBuffer(ID3D11DeviceContext* d3dDeviceContext,
                        CDXUTSDKMesh& mesh_opaque,
                        CDXUTSDKMesh& mesh_alpha,
                        const CFirstPersonCamera* viewerCamera,
                        const D3D11_VIEWPORT* viewport,
                        const UIConstants* ui)
{
    // Clear GBuffer
    // NOTE: We actually only need to clear the depth buffer here since we replace unwritten (i.e. far plane) samples
    // with the skybox. We use the depth buffer to reconstruct position and only in-frustum positions are shaded.
    // NOTE: Complementary Z buffer: clear to 0 (far)!
    d3dDeviceContext->ClearDepthStencilView(mDepthBuffer->GetDepthStencil(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 0.0f, 0);

    d3dDeviceContext->IASetInputLayout(mMeshVertexLayout);

    d3dDeviceContext->VSSetConstantBuffers(0, 1, &mPerFrameConstants);
    d3dDeviceContext->VSSetShader(mGeometryVS->GetShader(), 0, 0);
    
    d3dDeviceContext->GSSetShader(0, 0, 0);

    d3dDeviceContext->RSSetViewports(1, viewport);

    d3dDeviceContext->PSSetConstantBuffers(0, 1, &mPerFrameConstants);
    d3dDeviceContext->PSSetSamplers(0, 1, &mDiffuseSampler);
    // Diffuse texture set per-material by DXUT mesh routines

    // Set up render GBuffer render targets
    d3dDeviceContext->OMSetDepthStencilState(mDepthState, 0);
    d3dDeviceContext->OMSetRenderTargets(static_cast<UINT>(mGBufferRTV.size()), &mGBufferRTV.front(), mDepthBuffer->GetDepthStencil());
    d3dDeviceContext->OMSetBlendState(mGeometryBlendState, 0, 0xFFFFFFFF);
    
    // Render opaque geometry
    if (mesh_opaque.IsLoaded()) {
        d3dDeviceContext->RSSetState(mRasterizerState);
        d3dDeviceContext->PSSetShader(mGBufferPS->GetShader(), 0, 0);
        mesh_opaque.Render(d3dDeviceContext, 0);
    }

    // Render alpha tested geometry
    if (mesh_alpha.IsLoaded()) {
        d3dDeviceContext->RSSetState(mDoubleSidedRasterizerState);
        d3dDeviceContext->PSSetShader(mGBufferAlphaTestPS->GetShader(), 0, 0);
        mesh_alpha.Render(d3dDeviceContext, 0);
    }

    // Cleanup (aka make the runtime happy)
    d3dDeviceContext->OMSetRenderTargets(0, 0, 0);
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例2: DXUTGetGlobalResourceCache

//--------------------------------------------------------------------------------------
// Release D3D9 resources created in the OnD3D9CreateDevice callback 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D10DestroyDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D10DestroyDevice();
    g_SettingsDlg.OnD3D10DestroyDevice();
    DXUTGetGlobalResourceCache().OnDestroyDevice();

    g_Terrain.OnDestroyDevice();
    g_BallMesh.Destroy();
    g_SkyMesh.Destroy();

    SAFE_RELEASE( g_pFont10 );
    SAFE_RELEASE( g_pSprite10 );
    SAFE_DELETE( g_pTxtHelper );

    SAFE_RELEASE( g_pEffect10 );
    SAFE_RELEASE( g_pBasicDecl10 );
    SAFE_RELEASE( g_pBallDecl10 );
    SAFE_RELEASE( g_pGrassDecl10 );

    SAFE_RELEASE( g_pHeightTexRV );
    SAFE_RELEASE( g_pNormalTexRV );
    SAFE_RELEASE( g_pGrassTexRV );
    SAFE_RELEASE( g_pDirtTexRV );
    SAFE_RELEASE( g_pGroundGrassTexRV );
    SAFE_RELEASE( g_pMaskTexRV );
    SAFE_RELEASE( g_pShadeNormalTexRV );
    SAFE_RELEASE( g_pStreamDataVB10 );
    SAFE_RELEASE( g_pGrassDataVB10 );
}
开发者ID:KNeal,项目名称:Oculus,代码行数:32,代码来源:Exercise01_D3D10.cpp

示例3: DXUTGetGlobalResourceCache

//--------------------------------------------------------------------------------------
// Release D3D11 resources created in OnD3D11CreateDevice 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11DestroyDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D11DestroyDevice();
    g_D3DSettingsDlg.OnD3D11DestroyDevice();
    DXUTGetGlobalResourceCache().OnDestroyDevice();
    SAFE_DELETE( g_pTxtHelper );
    SAFE_DELETE( g_pTxtHelper1 );

    g_SceneMesh.Destroy();
    g_Poles.Destroy();

    SAFE_RELEASE( g_pSceneVS );
    SAFE_RELEASE( g_pScenePS );
    SAFE_RELEASE( g_pSM_VS );
    SAFE_RELEASE( g_pcbConstants );
    SAFE_RELEASE( g_pRSMDepthStencilTexture );
    SAFE_RELEASE( g_pDepthStencilTextureDSV );
    SAFE_RELEASE( g_pDepthTextureSRV );
    SAFE_RELEASE( g_pSceneVertexLayout );
    SAFE_RELEASE( g_pBlendStateNoBlend );
    SAFE_RELEASE( g_pBlendStateColorWritesOff );
    SAFE_RELEASE( g_pSamplePoint );
    SAFE_RELEASE( g_pSamplePointCmp );
    SAFE_RELEASE( g_pSampleLinear );
}
开发者ID:KNeal,项目名称:Oculus,代码行数:28,代码来源:ContactHardeningShadows11.cpp

示例4:

//--------------------------------------------------------------------------------------
// Release D3D11 resources created in OnD3D11CreateDevice 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11DestroyDevice(void* /*pUserContext*/)
{
    g_MeshPowerPlant.Destroy();
    g_MeshTestScene.Destroy();

    DestroyD3DComponents();
}
开发者ID:marselas,项目名称:Zombie-Direct3D-Samples,代码行数:10,代码来源:VarianceShadows11.cpp

示例5:

//--------------------------------------------------------------------------------------
// Release D3D11 resources created in OnD3D11CreateDevice 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11DestroyDevice( void* pUserContext )
{  
  UNREFERENCED_PARAMETER(pUserContext);

  g_MeshPowerPlant.Destroy();
  g_TeapotMesh.Destroy();
  DestroyD3DComponents();
}
开发者ID:JasSra,项目名称:GPU-Pro-6,代码行数:11,代码来源:AdvancedLighting.cpp

示例6:

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that aren't dependant on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11CreateDevice(ID3D11Device* pd3dDevice, const DXGI_SURFACE_DESC* /*pBackBufferSurfaceDesc*/,
    void* /*pUserContext*/)
{
    HRESULT hr = S_OK;
    V_RETURN(g_MeshPowerPlant.Create(pd3dDevice, L"powerplant\\powerplant.sdkmesh"));
    V_RETURN(g_MeshTestScene.Create(pd3dDevice, L"ShadowColumns\\testscene.sdkmesh"));
    g_pSelectedMesh = &g_MeshPowerPlant;
    return CreateD3DComponents(pd3dDevice);
}
开发者ID:marselas,项目名称:Zombie-Direct3D-Samples,代码行数:12,代码来源:CascadedShadowMaps11.cpp

示例7: DXUTGetGlobalResourceCache

//--------------------------------------------------------------------------------------
// Release D3D10 resources created in OnD3D10CreateDevice 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D10DestroyDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D10DestroyDevice();
    g_D3DSettingsDlg.OnD3D10DestroyDevice();
    DXUTGetGlobalResourceCache().OnDestroyDevice();
    SAFE_RELEASE( g_pFont );
    SAFE_RELEASE( g_pSprite );
    SAFE_DELETE( g_pTxtHelper );
    SAFE_RELEASE( g_pVertexLayout );
    SAFE_RELEASE( g_pEffect );
    g_Mesh.Destroy();
}
开发者ID:KNeal,项目名称:Oculus,代码行数:15,代码来源:Tutorial13.cpp

示例8: DXUTGetGlobalResourceCache

//--------------------------------------------------------------------------------------
// Release D3D9 resources created in the OnD3D9ResetDevice callback 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D9LostDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D9LostDevice();
    g_SettingsDlg.OnD3D9LostDevice();
    DXUTGetGlobalResourceCache().OnLostDevice();
    if( g_pFont9 ) g_pFont9->OnLostDevice();
    if( g_pEffect9 ) g_pEffect9->OnLostDevice();
    SAFE_RELEASE( g_pSprite9 );
    SAFE_DELETE( g_pTxtHelper );
    g_Mesh.Destroy();
    SAFE_RELEASE( g_pTexture9 );
}
开发者ID:KNeal,项目名称:Oculus,代码行数:15,代码来源:DDSWithoutD3DX9.cpp

示例9:

//--------------------------------------------------------------------------------------
// Release D3D10 resources created in OnD3D10CreateDevice 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D10DestroyDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D10DestroyDevice();
    g_D3DSettingsDlg.OnD3D10DestroyDevice();
    CDXUTDirectionWidget::StaticOnD3D10DestroyDevice();

    SAFE_RELEASE( g_pFont10 );
    SAFE_RELEASE( g_pSprite10 );
    SAFE_RELEASE( g_pEffect10 );
    SAFE_RELEASE( g_pVertexLayout );
    g_Mesh.Destroy();
    SAFE_RELEASE( g_pMeshTexRV );
}
开发者ID:KNeal,项目名称:Oculus,代码行数:16,代码来源:Exercise03.cpp

示例10: DXUTGetGlobalResourceCache

//--------------------------------------------------------------------------------------
// Release D3D10 resources created in OnD3D10CreateDevice 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D10DestroyDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D10DestroyDevice();
    g_D3DSettingsDlg.OnD3D10DestroyDevice();
    CDXUTDirectionWidget::StaticOnD3D10DestroyDevice();
    DXUTGetGlobalResourceCache().OnDestroyDevice();

    SAFE_RELEASE( g_pEffect );
    SAFE_RELEASE( g_pFont10 );
    SAFE_RELEASE( g_pSprite10 );
    SAFE_DELETE( g_pTxtHelper );
    SAFE_RELEASE( g_pStaticVertexLayout );
    SAFE_RELEASE( g_pSkinnedVertexLayout );

    g_SceneMesh.Destroy();
    g_FanMesh.Destroy();
    for( UINT iMesh = 0; iMesh < g_NumLinkedMeshes; iMesh++ )
        g_pLinkedMeshes[iMesh].Destroy();
    SAFE_DELETE_ARRAY( g_pLinkedMeshes );

    g_AnimMesh.Destroy();
}
开发者ID:marselas,项目名称:Zombie-Direct3D-Samples,代码行数:25,代码来源:MotionBlur10.cpp

示例11: DXUTGetGlobalResourceCache

//--------------------------------------------------------------------------------------
// Release D3D11 resources created in OnD3D11CreateDevice 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11DestroyDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D11DestroyDevice();
    g_D3DSettingsDlg.OnD3D11DestroyDevice();
    CDXUTDirectionWidget::StaticOnD3D11DestroyDevice();
    DXUTGetGlobalResourceCache().OnDestroyDevice();
    SAFE_DELETE( g_pTxtHelper );

    g_Mesh11.Destroy();

    SAFE_RELEASE( g_pEffect );
    
    SAFE_RELEASE( g_pVertexLayout11 );
    SAFE_RELEASE( g_pVertexBuffer );
    SAFE_RELEASE( g_pIndexBuffer );

    SAFE_RELEASE( g_pEnvironmentMapSRV );
}
开发者ID:AndreAhmed,项目名称:directx-sdk-samples,代码行数:21,代码来源:DynamicShaderLinkageFX11.cpp

示例12: RenderSky

//--------------------------------------------------------------------------------------
// RenderSky
//--------------------------------------------------------------------------------------
void RenderSky( ID3D10Device* pd3dDevice )
{
    D3DXMATRIX mWorld;
    D3DXVECTOR3 vEye;
    D3DXVECTOR3 vDir;
    D3DXMATRIX mCamWorld;
    D3DXMATRIX mView;
    D3DXMATRIX mProj;

    D3DXMatrixRotationY( &mWorld, -D3DX_PI / 2.5f );
    GetCameraData( &mCamWorld, &mView, &mProj, &vEye, &vDir );
    mView._41 = mView._42 = mView._43 = 0.0f;
    D3DXMATRIX mWVP = mWorld * mCamWorld * mView * mProj;

    g_pmWorldViewProj->SetMatrix( ( float* )&mWVP );
    g_pmWorld->SetMatrix( ( float* )&mWorld );

    pd3dDevice->IASetInputLayout( g_pBasicDecl10 );
    g_SkyMesh.Render( pd3dDevice, g_pRenderSky, g_ptxDiffuse );
}
开发者ID:KNeal,项目名称:Oculus,代码行数:23,代码来源:Exercise01_D3D10.cpp

示例13: LoadMesh

//--------------------------------------------------------------------------------------
// Helper to load a VB and IB from a mesh 
//--------------------------------------------------------------------------------------
HRESULT LoadMesh( ID3D10Device* pd3dDevice )
{
    HRESULT hr = S_OK;

    struct OLD_VERT
    {
        D3DXVECTOR3 Pos;
        D3DXVECTOR3 Norm;
        D3DXVECTOR2 Tex;
    };

    V_RETURN( g_Mesh.Create( pd3dDevice, L"rook.sdkmesh", true ) );

    // Load the Texture
    WCHAR strPath[MAX_PATH] = {0};
    DXUTFindDXSDKMediaFileCch( strPath, sizeof( strPath ) / sizeof( WCHAR ), L"rook_diff.dds" );
    hr = D3DX10CreateShaderResourceViewFromFile( pd3dDevice, strPath, NULL, NULL, &g_pMeshTexRV, NULL );

    return hr;
}
开发者ID:KNeal,项目名称:Oculus,代码行数:23,代码来源:Exercise03.cpp

示例14: V

//--------------------------------------------------------------------------------------
// Render the scene using the D3D9 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D9FrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
    HRESULT hr = S_OK;

    // 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;
    }

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

    // Clear the render target and the zbuffer 
    V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 160, 160, 250 ), 1.0f, 0 ) );

    // Render the scene
    if( SUCCEEDED( pd3dDevice->BeginScene() ) )
    {
        g_pEffect9->SetMatrix( g_hmWorld, &mWorld );
        g_pEffect9->SetMatrix( g_hmWorldViewProjection, &mWorldViewProjection );
        g_pEffect9->SetTexture( g_htxDiffuse, g_pTexture9 );

        pd3dDevice->SetVertexDeclaration( g_pDecl9 );

        g_Mesh.Render( pd3dDevice, g_pEffect9, g_hRenderScene );

        DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"HUD / Stats" ); // These events are to help PIX identify what the code is doing
        RenderText();
        V( g_HUD.OnRender( fElapsedTime ) );
        V( g_SampleUI.OnRender( fElapsedTime ) );
        DXUT_EndPerfEvent();

        V( pd3dDevice->EndScene() );
    }
}
开发者ID:KNeal,项目名称:Oculus,代码行数:42,代码来源:DDSWithoutD3DX9.cpp

示例15: CDXUTTextHelper

//--------------------------------------------------------------------------------------
// Create any D3D9 resources that won't live through a device reset (D3DPOOL_DEFAULT) 
// or that are tied to the back buffer size 
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D9ResetDevice( IDirect3DDevice9* pd3dDevice,
                                    const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr;

    V_RETURN( g_DialogResourceManager.OnD3D9ResetDevice() );
    V_RETURN( g_SettingsDlg.OnD3D9ResetDevice() );

    if( g_pFont9 ) V_RETURN( g_pFont9->OnResetDevice() );
    if( g_pEffect9 ) V_RETURN( g_pEffect9->OnResetDevice() );

    V_RETURN( D3DXCreateSprite( pd3dDevice, &g_pSprite9 ) );
    g_pTxtHelper = new CDXUTTextHelper( g_pFont9, g_pSprite9, NULL, NULL, 15 );

    // Setup the camera's projection parameters
    float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height;
    g_Camera.SetProjParams( D3DX_PI / 4, fAspectRatio, 0.1f, 1000.0f );
    g_Camera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height );

    g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 );
    g_HUD.SetSize( 170, 170 );
    g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 170, pBackBufferSurfaceDesc->Height - 350 );
    g_SampleUI.SetSize( 170, 300 );

    // load the mesh
    V_RETURN( g_Mesh.Create( pd3dDevice, L"misc\\ball.sdkmesh" ) );

    // Load the texture
    WCHAR str[MAX_PATH];
    V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"misc\\seafloor.dds" ) );
    V_RETURN( CreateDDSTextureFromFile( pd3dDevice, str, &g_pTexture9 ) );

    if( DXUTIsWindowed() )
        g_SampleUI.GetButton( IDC_LOAD_TEXTURE )->SetEnabled( true );
    else
        g_SampleUI.GetButton( IDC_LOAD_TEXTURE )->SetEnabled( false );

    return S_OK;
}
开发者ID:KNeal,项目名称:Oculus,代码行数:43,代码来源:DDSWithoutD3DX9.cpp


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