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


C++ Timer::GetMiliseconds方法代码示例

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


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

示例1: DoFrame

//--------------------------------------------------------------------------------------
// Process and render one frame. Called by the main loop
//--------------------------------------------------------------------------------------
void DoFrame()
{
	Timer mainTimer;

    // Clear backbuffer and begin frame
    float ClearColor[4] = { 0.0f, 0.125f, 0.3f, 1.0f }; //red,green,blue,alpha
	pRenderSystem->BeginFrame( ClearColor, 1.0f, 0 );
	
	static double t = 0, dt = 0;
	dt=t;
	t = globalTimer.GetSeconds();
	dt = t-dt;

	if (dt > 1/30.0f)
		dt = 1/30.0f;

	Timer updateTimer;
	scene.Update( dt );
	double t_update = updateTimer.GetMiliseconds();

	scene.RenderDeferred();
	pRenderSystem->EndFrame();

	double t_main = mainTimer.GetMiliseconds();


	// Wait for render thread to finish. Only necessary if we run multithreaded
	pRenderSystem->WaitForFrameToFinish();

	double t_waitrender = mainTimer.GetMiliseconds() - t_main;
	
	char str[20];

	if ( KEYDOWN('T') )
	{
		_gcvt( t_waitrender, 5, str );
		DEBUG_OUTPUT( "main thread wait: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t" );

		_gcvt( t_main, 5, str );
		DEBUG_OUTPUT( "main thread: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );

		_gcvt( scene.t_physics, 5, str );
		DEBUG_OUTPUT( "physics: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );

		/*_gcvt( scene.t_ocean, 5, str );
		DEBUG_OUTPUT( "ocean: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );*/

		_gcvt( t_update, 5, str );
		DEBUG_OUTPUT( "Scene::update: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );

		_gcvt( pRenderSystem->GetRenderDispatcher()->t_renderthread, 5, str );
		DEBUG_OUTPUT( "render thread: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );
		/*
		_gcvt( pRenderSystem->t_renderstarve, 5, str );
		DEBUG_OUTPUT( "starve: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );
		*/
		_gcvt( pRenderSystem->t_commands, 5, str );
		DEBUG_OUTPUT( "render commands: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );

		_gcvt( pRenderSystem->GetRenderDispatcher()->t_bindparams, 6, str );
		DEBUG_OUTPUT( "Bind shader params: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );

		_gcvt( scene.t_scenerender, 6, str );
		DEBUG_OUTPUT( "Scene::render(): " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );
		/*
		_gcvt( pRenderSystem->GetRenderDispatcher()->t_1, 6, str );
		DEBUG_OUTPUT( "(t_1: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms\t  " );

		_gcvt( pRenderSystem->GetRenderDispatcher()->t_2, 6, str );
		DEBUG_OUTPUT( "t_2: " );
		DEBUG_OUTPUT( str );
		DEBUG_OUTPUT( "ms)\t  " );
	
		_gcvt( pRenderSystem->GetRenderDispatcher()->t_bindtextures, 6, str );
		DEBUG_OUTPUT( "Bind textures: " );
//.........这里部分代码省略.........
开发者ID:rizandigp,项目名称:Iteration12,代码行数:101,代码来源:Iteration12.cpp


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