本文整理汇总了C++中CD3DSettingsDlg::OnRender方法的典型用法代码示例。如果您正苦于以下问题:C++ CD3DSettingsDlg::OnRender方法的具体用法?C++ CD3DSettingsDlg::OnRender怎么用?C++ CD3DSettingsDlg::OnRender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CD3DSettingsDlg
的用法示例。
在下文中一共展示了CD3DSettingsDlg::OnRender方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderPreFrame
//--------------------------------------------------------------------------------------
// Render the scene using the D3D11 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double fTime,
float fElapsedTime, void* pUserContext )
{
XMMATRIX matView = XMLoadFloat4x4A( &g_matView );
XMMATRIX matProj = XMLoadFloat4x4A( &g_matProjection );
XMMATRIX matVP = matView * matProj;
RenderPreFrame( pd3dDevice, pd3dImmediateContext, matView, matProj, fElapsedTime );
// 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;
}
if( g_bDrawTerrain )
{
g_pTerrainView->Render( pd3dImmediateContext );
}
else
{
RenderTestObjects( pd3dImmediateContext, matVP );
}
RenderHUD( pd3dImmediateContext, fElapsedTime );
static DWORD dwTimefirst = GetTickCount();
if ( GetTickCount() - dwTimefirst > 5000 )
{
OutputDebugString( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) );
OutputDebugString( L"\n" );
dwTimefirst = GetTickCount();
}
}
示例2: OnFrameRender
//--------------------------------------------------------------------------------------
// Render the scene using the D3D9 device
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, 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;
}
HRESULT hr;
// Clear the render target and the zbuffer
V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 45, 50, 70 ), 1.0f, 0 ) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
UINT iPass, cPasses;
V( g_pEffect->Begin( &cPasses, 0 ) );
for( iPass = 0; iPass < cPasses; iPass++ )
{
V( g_pEffect->BeginPass( iPass ) );
V( g_Mesh.Render( pd3dDevice ) );
g_pEffect->EndPass();
}
g_pEffect->End();
RenderText();
V( g_HUD.OnRender( fElapsedTime ) );
V( pd3dDevice->EndScene() );
}
}
示例3: RenderText
//--------------------------------------------------------------------------------------
// Render the scene using the D3D11 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double fTime,
FLOAT fElapsedTime, void* pUserContext )
{
UNREFERENCED_PARAMETER(pUserContext);
UNREFERENCED_PARAMETER(pd3dDevice);
UNREFERENCED_PARAMETER(fTime);
if( g_D3DSettingsDlg.IsActive() )
{
g_D3DSettingsDlg.OnRender( fElapsedTime );
return;
}
auto pRTV = DXUTGetD3D11RenderTargetView();
// Clear color
pd3dImmediateContext->ClearRenderTargetView( pRTV, Colors::DimGray );
// Start the frame
g_Scene.InitFrame(&g_ViewerCamera, &g_LightCamera);
// Draw Shadows
g_Scene.RenderShadowCascades( &g_MeshPowerPlant );
// Render the GBuffer
g_Scene.RenderGBuffer(&g_MeshPowerPlant);
// Process the light linked list
g_Scene.ProcessLinkedList();
// Composite the scene
g_Scene.CompositeScene(pRTV);
// Blended elements
g_Scene.DrawAlpha(&g_TeapotMesh);
// End the frame
g_Scene.EndFrame(pRTV);
// Hud
{
D3D11_VIEWPORT vp;
vp.Width = (FLOAT)DXUTGetDXGIBackBufferSurfaceDesc()->Width;
vp.Height = (FLOAT)DXUTGetDXGIBackBufferSurfaceDesc()->Height;
vp.MinDepth = 0;
vp.MaxDepth = 1;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
pd3dImmediateContext->RSSetViewports( 1, &vp);
pd3dImmediateContext->OMSetRenderTargets( 1, &pRTV, nullptr );
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"HUD / Stats" );
g_HUD.OnRender( fElapsedTime );
g_SampleUI.OnRender( fElapsedTime );
RenderText();
DXUT_EndPerfEvent();
}
}
示例4: OnFrameRender
//--------------------------------------------------------------------------------------
// This callback function will be called at the end of every frame to perform all the
// rendering calls for the scene, and it will also be called if the window needs to be
// repainted. After this function has returned, DXUT will call
// IDirect3DDevice9::Present to display the contents of the next buffer in the swap chain
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, 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;
}
HRESULT hr;
D3DXMATRIXA16 mWorld;
D3DXMATRIXA16 mView;
D3DXMATRIXA16 mProj;
D3DXMATRIXA16 mWorldViewProjection;
// Clear the render target and the zbuffer
V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 141, 153, 191 ), 1.0f, 0 ) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
// Get the projection & view matrix from the camera class
mWorld = *g_Camera.GetWorldMatrix();
mView = *g_Camera.GetViewMatrix();
mProj = *g_Camera.GetProjMatrix();
mWorldViewProjection = mWorld * mView * mProj;
// Update the effect's variables.
V( g_pEffect->SetMatrix( g_hWorldViewProjection, &mWorldViewProjection ) );
V( g_pEffect->SetMatrix( g_hWorld, &mWorld ) );
V( g_pEffect->SetFloat( g_hTime, ( float )fTime ) );
V( g_pEffect->SetValue( g_hCameraPosition, g_Camera.GetEyePt(), sizeof( D3DXVECTOR3 ) ) );
UINT iCurSubset = ( UINT )( INT_PTR )g_SampleUI.GetComboBox( IDC_SUBSET )->GetSelectedData();
// A subset of -1 was arbitrarily chosen to represent all subsets
if( iCurSubset == -1 )
{
// Iterate through subsets, changing material properties for each
for( UINT iSubset = 0; iSubset < g_MeshLoader.GetNumMaterials(); iSubset++ )
{
RenderSubset( iSubset );
}
}
else
{
RenderSubset( iCurSubset );
}
RenderText();
V( g_HUD.OnRender( fElapsedTime ) );
V( g_SampleUI.OnRender( fElapsedTime ) );
V( pd3dDevice->EndScene() );
}
}
示例5: OnFrameRender
//--------------------------------------------------------------------------------------
// Render the scene using the D3D9 device
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
if( g_SettingsDlg.IsActive() )
{
g_SettingsDlg.OnRender( fElapsedTime );
return;
}
HRESULT hr;
D3DXMATRIXA16 mWorld;
D3DXMATRIXA16 mView;
D3DXMATRIXA16 mProj;
D3DXMATRIXA16 mWorldViewProjection;
// Clear the render target and the zbuffer
V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 45, 50, 170 ), 1.0f, 0 ) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
// Get the projection & view matrix from the camera class
mWorld = *g_Camera.GetWorldMatrix();
mProj = *g_Camera.GetProjMatrix();
mView = g_mView;
mWorldViewProjection = mWorld * mView * mProj;
// Update the effect's variables. Instead of using strings, it would
// be more efficient to cache a handle to the parameter by calling
// ID3DXEffect::GetParameterByName
V( g_pEffect->SetMatrix( "g_mWorldViewProjection", &mWorldViewProjection ) );
V( g_pEffect->SetMatrix( "g_mWorld", &mWorld ) );
V( g_pEffect->SetFloat( "g_fTime", ( float )fTime ) );
g_pEffect->SetTechnique( "RenderScene" );
UINT cPasses;
g_pEffect->Begin( &cPasses, 0 );
ID3DXMesh* pMesh = g_Mesh.GetMesh();
for( UINT p = 0; p < cPasses; ++p )
{
g_pEffect->BeginPass( p );
for( UINT m = 0; m < g_Mesh.m_dwNumMaterials; ++m )
{
g_pEffect->SetTexture( "g_txScene", g_Mesh.m_pTextures[m] );
g_pEffect->CommitChanges();
pMesh->DrawSubset( m );
}
g_pEffect->EndPass();
}
g_pEffect->End();
RenderText();
V( g_HUD.OnRender( fElapsedTime ) );
V( g_SampleUI.OnRender( fElapsedTime ) );
V( pd3dDevice->EndScene() );
}
}
示例6: OnFrameRender
void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
if( g_SettingsDlg.IsActive() )
{ // If the settings dialog is being shown, then render it instead of rendering the app's scene
g_SettingsDlg.OnRender( fElapsedTime );
return;
}
g_pGameRoot->OnFrameRender();
}
示例7: vLightDir
//--------------------------------------------------------------------------------------
// Render the scene using the D3D9 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D10FrameRender( ID3D10Device* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
HRESULT hr = S_OK;
float ClearColor[4] = { 0,0,0,0 };
ID3D10RenderTargetView* pRTV = DXUTGetD3D10RenderTargetView();
pd3dDevice->ClearRenderTargetView( pRTV, ClearColor );
ID3D10DepthStencilView* pDSV = DXUTGetD3D10DepthStencilView();
pd3dDevice->ClearDepthStencilView( pDSV, D3D10_CLEAR_DEPTH, 1.0, 0 );
// 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;
}
// Render the scene
{
D3DXVECTOR4 vLightDir( -1,1,-1,1 );
D3DXVec4Normalize( &vLightDir, &vLightDir );
g_pvWorldLightDir->SetFloatVector( ( float* )&vLightDir );
g_pfTime->SetFloat( ( float )fTime );
g_pfElapsedTime->SetFloat( fElapsedTime );
VisibilityCullTiles();
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"Render Sky" );
RenderSky( pd3dDevice );
DXUT_EndPerfEvent();
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"Render Terrain" );
RenderTerrain( pd3dDevice );
DXUT_EndPerfEvent();
if( g_bRenderBalls )
{
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"Render Balls" );
RenderBalls( pd3dDevice );
DXUT_EndPerfEvent();
}
if( g_bRenderGrass )
{
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"Render Grass" );
RenderGrass( pd3dDevice );
DXUT_EndPerfEvent();
}
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();
}
}
示例8: OnFrameRender
//--------------------------------------------------------------------------------------
// This callback function will be called at the end of every frame to perform all the
// rendering calls for the scene, and it will also be called if the window needs to be
// repainted. After this function has returned, DXUT will call
// IDirect3DDevice9::Present to display the contents of the next buffer in the swap chain
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, 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;
}
HRESULT hr;
// Clear the render target and the zbuffer
V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 50, 50, 50 ), 1.0f, 0 ) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
// Get the projection & view matrix from the camera class
D3DXMATRIXA16 mViewProjection = ( *g_Camera.GetViewMatrix() ) * ( *g_Camera.GetProjMatrix() );
g_Skybox.SetDrawSH( false );
g_Skybox.Render( &mViewProjection, 1.0f, 1.0f );
V( g_pEffect->SetMatrix( "g_mViewProjection", &mViewProjection ) );
V( g_pEffect->SetFloat( "g_fTime", ( float )fTime ) );
// Set the amount of transmitted light per color channel
D3DXVECTOR3 vColorTransmit;
vColorTransmit.x = g_SampleUI.GetSlider( IDC_RED_TRANSMIT_SLIDER )->GetValue() / 1000.0f;
vColorTransmit.y = g_SampleUI.GetSlider( IDC_GREEN_TRANSMIT_SLIDER )->GetValue() / 1000.0f;
vColorTransmit.z = g_SampleUI.GetSlider( IDC_BLUE_TRANSMIT_SLIDER )->GetValue() / 1000.0f;
V( g_pEffect->SetFloatArray( "g_vColorTransmit", vColorTransmit, 3 ) );
// for Cubic degree rendering
V( g_pEffect->SetFloat( "g_fLightIntensity", g_fLightIntensity ) );
V( g_pEffect->SetFloatArray( "g_vLightDirection", g_vLightDirection, 3 * sizeof( float ) ) );
V( g_pEffect->SetFloatArray( "g_vLightCoeffsR", m_fRLC, 4 * sizeof( float ) ) );
V( g_pEffect->SetFloatArray( "g_vLightCoeffsG", m_fGLC, 4 * sizeof( float ) ) );
V( g_pEffect->SetFloatArray( "g_vLightCoeffsB", m_fBLC, 4 * sizeof( float ) ) );
pd3dDevice->SetRenderState( D3DRS_FILLMODE, g_bWireFrame ? D3DFILL_WIREFRAME : D3DFILL_SOLID );
DrawFrame( pd3dDevice, g_pFrameRoot );
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 ) );
V( g_LightControl.OnRender9( D3DXCOLOR( 1, 1, 1, 1 ), ( D3DXMATRIX* )g_Camera.GetViewMatrix(),
( D3DXMATRIX* )g_Camera.GetProjMatrix(), g_Camera.GetEyePt() ) );
DXUT_EndPerfEvent();
V( pd3dDevice->EndScene() );
}
}
示例9: RenderObjects
//--------------------------------------------------------------------------------------
// 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;
}
auto pRTV = DXUTGetD3D11RenderTargetView();
pd3dImmediateContext->ClearRenderTargetView( pRTV, Colors::MidnightBlue );
// Clear the depth stencil
auto pDSV = DXUTGetD3D11DepthStencilView();
pd3dImmediateContext->ClearDepthStencilView( pDSV, D3D11_CLEAR_DEPTH, 1.0, 0 );
// Get the projection & view matrix from the camera class
XMMATRIX mWorld = g_Camera.GetWorldMatrix();
XMMATRIX mView = g_Camera.GetViewMatrix();
XMMATRIX mProj = g_Camera.GetProjMatrix();
g_BatchEffect->SetWorld( mWorld );
g_BatchEffect->SetView( mView );
g_BatchEffect->SetProjection( mProj );
// Draw objects
RenderObjects();
// Render HUD
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"HUD / Stats" );
g_HUD.OnRender( fElapsedTime );
g_SampleUI.OnRender( fElapsedTime );
RenderText();
DXUT_EndPerfEvent();
static ULONGLONG timefirst = GetTickCount64();
if ( GetTickCount64() - timefirst > 5000 )
{
OutputDebugString( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) );
OutputDebugString( L"\n" );
timefirst = GetTickCount64();
}
}
示例10: V
//--------------------------------------------------------------------------------------
// Render the scene using the D3D9 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D9FrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
HRESULT hr;
D3DXMATRIXA16 mWorld;
D3DXMATRIXA16 mView;
D3DXMATRIXA16 mProj;
D3DXMATRIXA16 mWorldViewProjection;
// 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 render target and the zbuffer
V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 45, 50, 170 ), 1.0f, 0 ) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
// Get the projection & view matrix from the camera class
mWorld = *g_Camera.GetWorldMatrix();
mProj = *g_Camera.GetProjMatrix();
mView = *g_Camera.GetViewMatrix();
mWorldViewProjection = mWorld * mView * mProj;
// Update the effect's variables. Instead of using strings, it would
// be more efficient to cache a handle to the parameter by calling
// ID3DXEffect::GetParameterByName
V( g_pEffect9->SetMatrix( g_hmWorldViewProjection, &mWorldViewProjection ) );
V( g_pEffect9->SetMatrix( g_hmWorld, &mWorld ) );
V( g_pEffect9->SetFloat( g_hfTime, ( float )fTime ) );
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() );
}
}
示例11: ResizeScreenSizedBuffers
//--------------------------------------------------------------------------------------
// Callback function that renders the frame. This function sets up the rendering
// matrices and renders the scene and UI.
//--------------------------------------------------------------------------------------
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;
}
// Reallocate the render targets and depth buffer if the MSAA mode has been changed in the GUI.
if (g_RenderTargetsDirty)
{
g_RenderTargetsDirty = false;
ResizeScreenSizedBuffers(pd3dDevice);
}
SceneMesh *pMesh = g_Scenes[g_CurrentSceneId].pMesh;
g_AOParams.UseDeinterleavedTexturing = g_UseDeinterleavedTexturing;
g_AOParams.RandomizeSamples = g_RandomizeSamples;
g_AOParams.Blur.Enable = g_BlurAO;
ID3D11RenderTargetView* pBackBufferRTV = DXUTGetD3D11RenderTargetView(); // does not addref
if (pMesh)
{
RenderAOFromMesh(pd3dDevice,
pd3dImmediateContext,
pBackBufferRTV,
pMesh);
}
//--------------------------------------------------------------------------------------
// Render the GUI
//--------------------------------------------------------------------------------------
if (g_DrawUI)
{
g_HUD.OnRender(fElapsedTime);
g_TextRenderer.OnRender(fElapsedTime);
}
}
示例12: RenderText
//--------------------------------------------------------------------------------------
// Render the scene using the D3D11 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender(ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double /*fTime*/,
FLOAT fElapsedTime, void* /*pUserContext*/)
{
if (g_D3DSettingsDlg.IsActive())
{
g_D3DSettingsDlg.OnRender(fElapsedTime);
return;
}
FLOAT ClearColor[4] = { 0.0f, 0.25f, 0.25f, 0.55f };
ID3D11RenderTargetView* pRTV = DXUTGetD3D11RenderTargetView();
ID3D11DepthStencilView* pDSV = DXUTGetD3D11DepthStencilView();
pd3dImmediateContext->ClearRenderTargetView(pRTV, ClearColor);
pd3dImmediateContext->ClearDepthStencilView(pDSV, D3D11_CLEAR_DEPTH, 1.0, 0);
g_VarianceShadow.InitFrame(pd3dDevice, g_pSelectedMesh);
g_VarianceShadow.RenderShadowsForAllCascades(pd3dDevice, pd3dImmediateContext, g_pSelectedMesh);
D3D11_VIEWPORT vp;
vp.Width = (FLOAT)DXUTGetDXGIBackBufferSurfaceDesc()->Width;
vp.Height = (FLOAT)DXUTGetDXGIBackBufferSurfaceDesc()->Height;
vp.MinDepth = 0;
vp.MaxDepth = 1;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
g_VarianceShadow.RenderScene(
pd3dImmediateContext, pRTV, pDSV, g_pSelectedMesh, g_pActiveCamera, &vp, g_bVisualizeCascades);
pd3dImmediateContext->RSSetViewports(1, &vp);
pd3dImmediateContext->OMSetRenderTargets(1, &pRTV, pDSV);
DXUT_BeginPerfEvent(DXUT_PERFEVENTCOLOR, L"HUD / Stats");
g_HUD.OnRender(fElapsedTime);
g_SampleUI.OnRender(fElapsedTime);
RenderText();
DXUT_EndPerfEvent();
}
示例13: RenderText
//--------------------------------------------------------------------------------------
// 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_D3DSettingsDlg.IsActive())
{
g_D3DSettingsDlg.OnRender(fElapsedTime);
return;
}
// Get the projection & view matrix from the camera class
XMMATRIX mWorld;
XMMATRIX mView;
XMMATRIX mProj;
XMMATRIX mWorldViewProjection;
mWorld = g_Camera.GetWorldMatrix();
mView = g_Camera.GetViewMatrix();
mProj = g_Camera.GetProjMatrix();
mWorldViewProjection = mWorld * mView * mProj;
// Store off original render target and depth/stencil
ID3D11RenderTargetView* pOrigRTV = NULL;
ID3D11DepthStencilView* pOrigDSV = NULL;
pd3dImmediateContext->OMGetRenderTargets(1, &pOrigRTV, &pOrigDSV);
g_OIT.Render(pd3dImmediateContext, pd3dDevice, &g_Scene, mWorldViewProjection, pOrigRTV, pOrigDSV);
pd3dImmediateContext->OMSetRenderTargets(1, &pOrigRTV, pOrigDSV);
// Restore original render targets, and then draw UI
SAFE_RELEASE(pOrigRTV);
SAFE_RELEASE(pOrigDSV);
DXUT_BeginPerfEvent(DXUT_PERFEVENTCOLOR, L"HUD / Stats");
g_HUD.OnRender(fElapsedTime);
g_SampleUI.OnRender(fElapsedTime);
RenderText();
DXUT_EndPerfEvent();
}
示例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() );
}
}
示例15: V
//--------------------------------------------------------------------------------------
// Render the scene using the D3D9 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D9FrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
HRESULT hr;
// 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 render target and the zbuffer
V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f, 0 ) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
g_pMain->Render();
V( pd3dDevice->EndScene() );
}
}