VOID Render() { SetupMatrix() ; OnFrameMove() ; g_pCamera->Update(0.1f, 1.0f) ; // Clear the back-buffer to a RED color g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255,255,255), 1.0f, 0 ); // Begin the scene if( SUCCEEDED( g_pd3dDevice->BeginScene() ) ) { RenderTerrain() ; RenderTree() ; RenderTeapot() ; // End the scene g_pd3dDevice->EndScene(); } // Present the back-buffer contents to the display g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); }
/// /// 定时器响应消息 /// @param[in] UINT_PTR nIDEvent 定时器ID void CWndAnimate::OnTimer(UINT_PTR nIDEvent) { if (!m_bShowWindow) { ShowWindow(SW_HIDE); return; } if (TIME_RENDER == nIDEvent) { /// 渲染动画 RenderAnimate(); } else if (TIME_FRAME == nIDEvent) { OnFrameMove(); } }
//------------------------------------------------------------------------------------------------- // メインループです. //------------------------------------------------------------------------------------------------- void App::MainLoop() { MSG msg = { 0 }; while( WM_QUIT != msg.message ) { auto gotMsg = PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ); if ( gotMsg ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { OnFrameMove(); OnFrameRender(); } } }