本文整理汇总了C++中Scene::DoTick方法的典型用法代码示例。如果您正苦于以下问题:C++ Scene::DoTick方法的具体用法?C++ Scene::DoTick怎么用?C++ Scene::DoTick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scene
的用法示例。
在下文中一共展示了Scene::DoTick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoTick
void Game::DoTick( U32 _currentTime )
{
GPUDevice* device = GPUDevice::Instance();
{
//GRINLIZ_PERFTRACK
PROFILE_FUNC();
currentTime = _currentTime;
if ( previousTime == 0 ) {
previousTime = currentTime-1;
}
U32 deltaTime = currentTime - previousTime;
if ( markFrameTime == 0 ) {
markFrameTime = currentTime;
frameCountsSinceMark = 0;
framesPerSecond = 0.0f;
}
else {
++frameCountsSinceMark;
if ( currentTime - markFrameTime > 500 ) {
framesPerSecond = 1000.0f*(float)(frameCountsSinceMark) / ((float)(currentTime - markFrameTime));
// actually K-tris/second
markFrameTime = currentTime;
frameCountsSinceMark = 0;
}
}
// Limit so we don't ever get big jumps:
if ( deltaTime > 100 )
deltaTime = 100;
device->ResetState();
Scene* scene = sceneStack.Top()->scene;
Color4F cc = scene->ClearColor();
device->Clear( cc.x, cc.y, cc.z, cc.w );
scene->DoTick( deltaTime );
{
//GRINLIZ_PERFTRACK_NAME( "Game::DoTick 3D" );
PROFILE_BLOCK( DoTick3D );
screenport.SetPerspective();
scene->Draw3D( deltaTime );
}
{
//GRINLIZ_PERFTRACK_NAME( "Game::DoTick UI" );
PROFILE_BLOCK( DoTickUI );
GLASSERT( scene );
// UI Pass
screenport.SetUI();
if ( renderUI ) {
screenport.SetUI();
scene->RenderGamui2D();
}
}
}
int Y = 0;
int space = 16;
#ifndef GRINLIZ_DEBUG_MEM
// const int memNewCount = 0;
#endif
#if 1
UFOText* ufoText = UFOText::Instance();
if (SettingsManager::Instance()->DebugFPS()) {
ufoText->Draw(0, Y, "%s %5.1ffps %4.1fK/f %3ddc/f fver=%d",
VERSION,
framesPerSecond,
(float)device->TrianglesDrawn() / 1000.0f,
device->DrawCalls(),
CURRENT_FILE_VERSION);
}
if ( debugText ) {
sceneStack.Top()->scene->DrawDebugText();
}
Y += space;
#endif
#ifdef EL_SHOW_MODELS
int k=0;
while ( k < nModelResource ) {
int total = 0;
for( unsigned i=0; i<modelResource[k].nGroups; ++i ) {
total += modelResource[k].atom[i].trisRendered;
}
UFODrawText( 0, 12+12*k, "%16s %5d K", modelResource[k].name, total );
++k;
}
#endif
#ifdef GRINLIZ_PROFILE
PROFILE_UPDATE();
//.........这里部分代码省略.........