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


C++ CScene::Render方法代码示例

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


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

示例1: RenderPass

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 );
		}
	}
}
开发者ID:stephanreiter,项目名称:muli3d,代码行数:13,代码来源:mycamera.cpp

示例2: _tWinMain

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;
}
开发者ID:skatpgusskat,项目名称:meteor,代码行数:91,代码来源:Main.cpp


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