void CMyCamera::RenderPass( int32 i_iPass ) { if( i_iPass == -1 || i_iPass == ePass_Lighting ) { CScene *pScene = pGetParent()->pGetParent()->pGetScene(); uint32 iNumLights = pScene->iGetNumLights(); for( uint32 i = 0; i < iNumLights; ++i ) { pScene->SetCurrentLight( i ); pScene->Render( ePass_Lighting ); } } }
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); #ifdef _DEBUG // 디버그용 콘솔창 CPrintLog pPrintLog; pPrintLog.Init(); printf_s("CONSOLE WINDOW OPENED\n"); #endif // _DEBUG CMainWindow & window = CMainWindow::GetInstance(); if ( ! window.Create( L"Meteor", WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX ) ) return 0; window.ShowWindow( nCmdShow ); #ifdef _DEBUG // TODO: Remove test code CD2DRenderer::GetInstance().Init(); CScene * scene = new CScene(); CD2DText * text = new CD2DText(); text->SetFont( L"굴림", 12.f ); // FPS Calculation DWORD startTime = timeGetTime(); DWORD lastTime = startTime; DWORD elapsedTimeSum = 0; DWORD elapsedTimeSum1 = 0; DWORD frameCount = 0; DWORD frameCount1 = 0; double framePerSecond = 0; #endif MSG msg = {}; // Main message loop: while ( msg.message != WM_QUIT ) { if ( msg.message == WM_DESTROY ) { SafeDelete( text ); SafeDelete( scene ); } if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage(&msg); DispatchMessage(&msg); } #ifdef _DEBUG // TODO: Remove test code DWORD currentTime = timeGetTime(); DWORD elapsedTime = currentTime - lastTime; elapsedTimeSum += elapsedTime; frameCount++; if ( elapsedTimeSum >= 1000 ) { framePerSecond = ( frameCount + frameCount1 ) * 1000.0f / ( elapsedTimeSum + elapsedTimeSum1 ); elapsedTimeSum1 = elapsedTimeSum; elapsedTimeSum = 0; frameCount1 = frameCount; frameCount = 0; } //if ( elapsedTime > ( 1000 / 60 ) ) { CInputManager::GetInstance().UpdateKeyState(); scene->Update( static_cast<float>(currentTime - lastTime) ); CD2DRenderer::GetInstance().Begin(); CD2DRenderer::GetInstance().Clear(); scene->Render(); wchar_t wstrbuf[16]; swprintf_s( wstrbuf, L"Fps: %.2f", framePerSecond ); text->SetText( std::wstring(wstrbuf) ); text->Render(); CD2DRenderer::GetInstance().End(); lastTime = currentTime; } #endif } return (int) msg.wParam; }