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


C++ CDXUTDialogResourceManager::OnD3D11ResizedSwapChain方法代码示例

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


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

示例1: XMVectorGetByIndex

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                          const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
  UNREFERENCED_PARAMETER(pSwapChain);
  UNREFERENCED_PARAMETER(pUserContext);

  HRESULT hr;
  XMVECTOR vMeshExtents = g_Scene.GetSceneAABBMax() - g_Scene.GetSceneAABBMin();
  XMVECTOR vMeshLength = XMVector3Length( vMeshExtents );
  FLOAT    fMeshLength = XMVectorGetByIndex( vMeshLength, 0);
  
  V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
  V_RETURN( g_D3DSettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
  
  g_fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT ) pBackBufferSurfaceDesc->Height;
  
  g_ViewerCamera.SetProjParams( XM_PI / 4, g_fAspectRatio, 0.05f, fMeshLength);
  
  g_Scene.OnResize(pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height);
     
  g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 );
  g_HUD.SetSize( 170, 170 );
  g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 170, pBackBufferSurfaceDesc->Height - 300 );
  g_SampleUI.SetSize( 170, 300 );
  
  return S_OK;
}
开发者ID:JasSra,项目名称:GPU-Pro-6,代码行数:30,代码来源:AdvancedLighting.cpp

示例2:

HRESULT CALLBACK OnD3D11ResizedSwapChain(ID3D11Device* d3dDevice, IDXGISwapChain* swapChain,
                                          const DXGI_SURFACE_DESC* backBufferSurfaceDesc, void* userContext)
{
    HRESULT hr;

    V_RETURN(gDialogResourceManager.OnD3D11ResizedSwapChain(d3dDevice, backBufferSurfaceDesc));
    V_RETURN(gD3DSettingsDlg.OnD3D11ResizedSwapChain(d3dDevice, backBufferSurfaceDesc));

    gAspectRatio = backBufferSurfaceDesc->Width / (float)backBufferSurfaceDesc->Height;

    // NOTE: Complementary Z (1-z) buffer used here, so swap near/far!
    gViewerCamera.SetProjParams(D3DX_PI / 4.0f, gAspectRatio, 300.0f, 0.05f);

    // Standard HUDs
    const int border = 20;
    int y = border;
    for (int i = 0; i < HUD_EXPERT; ++i) {
        gHUD[i].SetLocation(backBufferSurfaceDesc->Width - gHUD[i].GetWidth() - border, y);
        y += gHUD[i].GetHeight() + border;
    }

    // Expert HUD
    gHUD[HUD_EXPERT].SetLocation(border, 80);

    // If there's no app, it'll pick this up when it gets lazily created so just ignore it
    if (gApp) {
        gApp->OnD3D11ResizedSwapChain(d3dDevice, backBufferSurfaceDesc);
    }

    return S_OK;
}
开发者ID:NickABoen,项目名称:Awe,代码行数:31,代码来源:main.cpp

示例3:

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain(ID3D11Device* pd3dDevice, IDXGISwapChain* /*pSwapChain*/,
    const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* /*pUserContext*/)
{
    HRESULT hr;

    V_RETURN(g_DialogResourceManager.OnD3D11ResizedSwapChain(pd3dDevice, pBackBufferSurfaceDesc));
    V_RETURN(g_D3DSettingsDlg.OnD3D11ResizedSwapChain(pd3dDevice, pBackBufferSurfaceDesc));

    g_nFrameWidth = pBackBufferSurfaceDesc->Width;
    g_nFrameHeight = pBackBufferSurfaceDesc->Height;

    // Setup the camera's projection parameters    
    float fAspectRatio = pBackBufferSurfaceDesc->Width / (FLOAT)pBackBufferSurfaceDesc->Height;
    g_Camera.SetProjParams(XM_PI / 4, fAspectRatio, 0.1f, 5000.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);

    g_OIT.OnD3D11ResizedSwapChain(pBackBufferSurfaceDesc, pd3dDevice);

    return S_OK;
}
开发者ID:marselas,项目名称:Zombie-Direct3D-Samples,代码行数:28,代码来源:main.cpp

示例4:

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                         const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr;

    V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
    V_RETURN( g_SettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );

    // Setup the camera's projection parameters
    float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height / 2;
	g_Context.m_Camera.SetProjParams(XM_PI / 4, fAspectRatio, 0.1f, 1000.0f);
//    g_Context.m_Camera.SetProjParams(XM_PI / 4, fAspectRatio, 0.1f, 10000.0f);

	g_Context.m_Light.SetRadius(10.0f);
	g_Context.m_Light.SetLightDirection(XMFLOAT3(0.6f, 0.4f, 0.3f));
	g_Context.m_Light.SetButtonMask(MOUSE_RIGHT_BUTTON);

	g_Context.m_fbWidth = (float)pBackBufferSurfaceDesc->Width;
	g_Context.m_fbHeight = (float)pBackBufferSurfaceDesc->Height;

    // Set the location and size of the AMD standard HUD
    g_HUD.m_GUI.SetLocation( pBackBufferSurfaceDesc->Width - AMD::HUD::iDialogWidth, 0 );
    g_HUD.m_GUI.SetSize( AMD::HUD::iDialogWidth, pBackBufferSurfaceDesc->Height );
    g_HUD.OnResizedSwapChain( pBackBufferSurfaceDesc );
	
	assert( D3D_OK == hr );
	        
    return S_OK;
}
开发者ID:AnilVarmaBiruduraju,项目名称:LiquidVR,代码行数:32,代码来源:AffinityGPUControl.cpp

示例5: XMMatrixPerspectiveFovLH

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                         const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr;

    V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
    V_RETURN( g_SettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );

    FLOAT fAspect = (FLOAT)pBackBufferSurfaceDesc->Width / (FLOAT)pBackBufferSurfaceDesc->Height;

    // Setup the camera's projection parameters
    XMMATRIX matProjection = XMMatrixPerspectiveFovLH( XM_PIDIV4, fAspect, 0.001f, 100.0f );
    XMStoreFloat4x4A( &g_matProjection, matProjection );

    g_pTerrainView->GetCamera()->SetProjParams( XM_PIDIV4, fAspect, 0.01f, 1000.0f );

    g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 );
    g_HUD.SetSize( 170, 170 );

    INT UIWidth = 250;
    INT UIHeight = 110;
    g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - UIWidth, pBackBufferSurfaceDesc->Height - UIHeight );
    g_SampleUI.SetSize( UIWidth, UIHeight );

    g_HalfClientWidthPixels = (FLOAT)pBackBufferSurfaceDesc->Width * 0.5f;
    g_HalfClientHeightPixels = (FLOAT)pBackBufferSurfaceDesc->Height * 0.5f;

    ResidencySampleRender::ResizeRenderView( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height );

    return S_OK;
}
开发者ID:kingofthebongo2008,项目名称:examples,代码行数:34,代码来源:TiledResources11.cpp

示例6: on_resize

        void CALLBACK on_resize(ID3D11Device* pd3dDevice, IDXGISwapChain *pSwapChain, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext)
        {
            dune::assert_hr(dlg_manager.OnD3D11ResizedSwapChain(pd3dDevice, pBackBufferSurfaceDesc));

            for (size_t i = 0; i < dlg_manager.m_Dialogs.size(); ++i)
                dlg_manager.m_Dialogs[i]->SetLocation(pBackBufferSurfaceDesc->Width - 165, 0);
        }
开发者ID:thefranke,项目名称:dirtchamber,代码行数:7,代码来源:common_gui.cpp

示例7:

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
										  const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
	//pSwapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);

	vegetationRendering->onResetDevice(pd3dDevice);

	dialogResourceManager.OnD3D11ResizedSwapChain(pd3dDevice, pBackBufferSurfaceDesc);

	return S_OK;
}
开发者ID:steinbergerbernd,项目名称:Vegetationrendering,代码行数:14,代码来源:Main.cpp

示例8:

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                          const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr;

    V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
    V_RETURN( g_D3DSettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );

    // Setup the camera's projection parameters
    float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height;
    g_Camera.SetProjParams( D3DX_PI / 4, fAspectRatio, 2.0f, 4000.0f );
	//    g_Camera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height );
	//    g_Camera.SetButtonMasks( MOUSE_MIDDLE_BUTTON, MOUSE_WHEEL, MOUSE_LEFT_BUTTON );


	D3DXVECTOR3 vMin = D3DXVECTOR3( -1000.0f, -1000.0f, -1000.0f );
    D3DXVECTOR3 vMax = D3DXVECTOR3( 1000.0f, 1000.0f, 1000.0f );
    g_Camera.SetRotateButtons(TRUE, FALSE, FALSE);
	
	
    g_Camera.SetScalers( 0.01f, 30.0f );
    g_Camera.SetDrag( true );
    g_Camera.SetEnableYAxisMovement( true );
    g_Camera.SetClipToBoundary( TRUE, &vMin, &vMax );
    g_Camera.FrameMove( 0 );


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

	//Turn off backface culling
	D3D11_RASTERIZER_DESC rsDesc;
	ZeroMemory(&rsDesc,sizeof(D3D11_RASTERIZER_DESC) );
	rsDesc.CullMode = D3D11_CULL_NONE;
	rsDesc.FillMode = D3D11_FILL_SOLID;
	//rsDesc.FillMode = D3D11_FILL_WIREFRAME;
	
	
	ID3D11RasterizerState *pRasterizerState = NULL;
	pd3dDevice->CreateRasterizerState(&rsDesc, &pRasterizerState);
	
	DXUTGetD3D11DeviceContext()->RSSetState(pRasterizerState);

	SAFE_RELEASE(pRasterizerState);

    return S_OK;
}
开发者ID:AndreAhmed,项目名称:directxgameengine,代码行数:52,代码来源:cloth_renderer.cpp

示例9:

// Create any D3D11 resources that depend on the back buffer
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                          const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr;
    V_RETURN( gDialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
    V_RETURN( gD3DSettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );

	gSurfaceWidth = pBackBufferSurfaceDesc->Width;
	gSurfaceHeight = pBackBufferSurfaceDesc->Height;

    gHUD.SetLocation( gSurfaceWidth - gHUD.GetWidth(), 0 );
	gSampleUI.SetLocation( gSurfaceWidth-gSampleUI.GetWidth(), gSurfaceHeight-gSampleUI.GetHeight() );

    return S_OK;
}
开发者ID:Nuos,项目名称:ISPCTextureCompressor,代码行数:16,代码来源:main.cpp

示例10: UpdateViewerCameraNearFar

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain(ID3D11Device* pd3dDevice, IDXGISwapChain* /*pSwapChain*/,
    const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* /*pUserContext*/)
{
    HRESULT hr;

    V_RETURN(g_DialogResourceManager.OnD3D11ResizedSwapChain(pd3dDevice, pBackBufferSurfaceDesc));
    V_RETURN(g_D3DSettingsDlg.OnD3D11ResizedSwapChain(pd3dDevice, pBackBufferSurfaceDesc));

    g_fAspectRatio = pBackBufferSurfaceDesc->Width / (FLOAT)pBackBufferSurfaceDesc->Height;

    UpdateViewerCameraNearFar();

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

    return S_OK;
}
开发者ID:marselas,项目名称:Zombie-Direct3D-Samples,代码行数:22,代码来源:CascadedShadowMaps11.cpp

示例11:

//--------------------------------------------------------------------------------------
// Callback function for changed window size
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                         const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr;

    V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
    V_RETURN( g_D3DSettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );

    // Setup the camera's projection parameters    
    float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height;
    g_Camera.SetProjParams( D3DX_PI / 4, fAspectRatio, 0.5f, 100.0f );
    g_LCamera.SetProjParams( D3DX_PI / 4, fAspectRatio, 10.0f, 100.0f );

    g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 );
    g_HUD.SetSize( 170, 170 );
    g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 170, pBackBufferSurfaceDesc->Height - 240 );
    g_SampleUI.SetSize( 150, 110 );

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

示例12:

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                          const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr = S_OK;

    V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
    V_RETURN( g_D3DSettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );

    // Setup the camera's projection parameters
    float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height;
    g_Camera.SetProjParams( XM_PI / 4, fAspectRatio, 2.0f, 4000.0f );
    g_Camera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height );
    g_Camera.SetButtonMasks( MOUSE_LEFT_BUTTON, MOUSE_WHEEL, MOUSE_MIDDLE_BUTTON );

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

    return hr;
}
开发者ID:AndreAhmed,项目名称:directx-sdk-samples,代码行数:24,代码来源:DynamicShaderLinkageFX11.cpp

示例13: DXUTTRACE

//--------------------------------------------------------------------------------------
// SwapChain has changed and may have new attributes such as size.
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain(ID3D11Device* pd3dDevice, IDXGISwapChain *pSwapChain, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext)
{
    HRESULT hr;

    DXUTTRACE(L"OnD3D11ResizedSwapChain called\n");

    V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain(pd3dDevice, pBackBufferSurfaceDesc) );
    V_RETURN( g_SettingsDlg.OnD3D11ResizedSwapChain(pd3dDevice, pBackBufferSurfaceDesc) );

    g_BackBufferWidth   = pBackBufferSurfaceDesc->Width;
    g_BackBufferHeight  = pBackBufferSurfaceDesc->Height;

    g_FullViewport.TopLeftX = 0.f;
    g_FullViewport.TopLeftY = 0.f;
    g_FullViewport.MinDepth = 0.f;
    g_FullViewport.MaxDepth = 1.f;
    g_FullViewport.Width    = (FLOAT)g_BackBufferWidth;
    g_FullViewport.Height   = (FLOAT)g_BackBufferHeight;

    // Setup the camera's projection parameters
    float AspectRatio  = (float)g_BackBufferWidth / (float)g_BackBufferHeight;
    g_OrbitalCamera.SetProjParams (FOVY, AspectRatio, ZNEAR, ZFAR);
    g_OrbitalCamera.SetWindow     (g_BackBufferWidth, g_BackBufferHeight);
    g_OrbitalCamera.SetButtonMasks(MOUSE_LEFT_BUTTON, MOUSE_WHEEL, 0);

    g_FirstPersonCamera.SetProjParams (FOVY, AspectRatio, ZNEAR, ZFAR);
    g_FirstPersonCamera.SetRotateButtons( 1, 1, 1 );

    UINT HudWidth = 256;
    float HudOpacity = 0.32f;
    g_HUD.SetLocation(g_BackBufferWidth - HudWidth, 0);
    g_HUD.SetSize    (HudWidth, g_BackBufferHeight);
    g_HUD.SetBackgroundColors(D3DCOLOR_COLORVALUE(0,0,0,HudOpacity));

    // Allocate our own screen-sized buffers, as the SwapChain only contains a non-MSAA color buffer.
    ResizeScreenSizedBuffers(pd3dDevice);

    return hr;
}
开发者ID:151706061,项目名称:D3DSamples,代码行数:43,代码来源:DeinterleavedTexturing.cpp

示例14: sizeof

//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                          const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr;

    V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
    V_RETURN( g_D3DSettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );

    // Setup the camera's projection parameters
	width =  pBackBufferSurfaceDesc->Width;
	height = pBackBufferSurfaceDesc->Height;
    float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height;
    g_Camera.SetProjParams( D3DX_PI / 4, fAspectRatio, 2.0f, 100000.0f );
    //g_Camera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height );
   //g_Camera.SetButtonMasks( MOUSE_MIDDLE_BUTTON, MOUSE_WHEEL, MOUSE_LEFT_BUTTON );
    g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 );
    g_HUD.SetSize( 170, 170 );
    g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 170, pBackBufferSurfaceDesc->Height - 300 );
    g_SampleUI.SetSize( 170, 300 );
	//deboard.OnD3D11ResizedSwapChain(pd3dDevice,pSwapChain,pBackBufferSurfaceDesc,pUserContext);

		DXGI_FORMAT format;
	D3D11_TEXTURE2D_DESC info ;
	ZeroMemory (& info , sizeof ( info ));
	info.Width = pBackBufferSurfaceDesc->Width;
	info.Height = pBackBufferSurfaceDesc->Height;
	info.MipLevels = 1;
	info.ArraySize = 1;
	info.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
	info.SampleDesc . Count = 1;
	info.Usage = D3D11_USAGE_DEFAULT;
	info.BindFlags = D3D11_BIND_RENDER_TARGET|D3D11_BIND_SHADER_RESOURCE ;
	info.CPUAccessFlags = 0;
	info.MiscFlags = 0;
	hr = pd3dDevice->CreateTexture2D(&info,nullptr,&original_texture);
	hr = pd3dDevice->CreateTexture2D(&info,nullptr,&texture1);
	hr = pd3dDevice->CreateTexture2D(&info,nullptr,&texture2);
	format = info.Format;

 	D3D11_SAMPLER_DESC sampDesc;
    ZeroMemory( &sampDesc, sizeof(sampDesc) );
    sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP        ;
    sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP        ;
    sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP        ;
    sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
    sampDesc.MinLOD = 0;
    sampDesc.MaxLOD = 0;
    hr = pd3dDevice->CreateSamplerState( &sampDesc, &g_pSamLinear );

	// render target view
	D3D11_RENDER_TARGET_VIEW_DESC target_info;
	target_info.Format = format;
	target_info.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
	target_info.Texture2D.MipSlice = 0;
	hr = pd3dDevice->CreateRenderTargetView(original_texture, &target_info ,&rtv_render_to_texture_ori);
	hr = pd3dDevice->CreateRenderTargetView(texture1, &target_info ,&rtv_render_to_texture_1);
	hr = pd3dDevice->CreateRenderTargetView(texture2, &target_info ,&rtv_render_to_texture_2);

	D3D11_SHADER_RESOURCE_VIEW_DESC shader_resource_info;
	shader_resource_info.Format = format;
	shader_resource_info.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
	shader_resource_info.Texture2D . MostDetailedMip = 0;
	shader_resource_info.Texture2D . MipLevels = 1;
	hr = pd3dDevice->CreateShaderResourceView(original_texture, &shader_resource_info ,&sr_texture_original);
	hr = pd3dDevice->CreateShaderResourceView(texture1, &shader_resource_info ,&sr_texture1);
	hr = pd3dDevice->CreateShaderResourceView(texture2, &shader_resource_info ,&sr_texture2);
    return S_OK;
}
开发者ID:AlexKLM,项目名称:DX11-Shader-Language-Coursework,代码行数:72,代码来源:BasicHLSL11.cpp


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