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