|
@@ -372,20 +372,20 @@ void mainLoop()
|
|
|
prevUpdateTime = crntTime;
|
|
prevUpdateTime = crntTime;
|
|
|
crntTime = HighRezTimer::getCrntTime();
|
|
crntTime = HighRezTimer::getCrntTime();
|
|
|
|
|
|
|
|
|
|
+ //
|
|
|
|
|
+ // Update
|
|
|
|
|
+ //
|
|
|
mainLoopExtra();
|
|
mainLoopExtra();
|
|
|
-
|
|
|
|
|
AppSingleton::getInstance().execStdinScpripts();
|
|
AppSingleton::getInstance().execStdinScpripts();
|
|
|
SceneSingleton::getInstance().getPhysMasterContainer().update(prevUpdateTime, crntTime);
|
|
SceneSingleton::getInstance().getPhysMasterContainer().update(prevUpdateTime, crntTime);
|
|
|
SceneSingleton::getInstance().updateAllWorldStuff();
|
|
SceneSingleton::getInstance().updateAllWorldStuff();
|
|
|
SceneSingleton::getInstance().doVisibilityTests(*AppSingleton::getInstance().getActiveCam());
|
|
SceneSingleton::getInstance().doVisibilityTests(*AppSingleton::getInstance().getActiveCam());
|
|
|
SceneSingleton::getInstance().updateAllControllers();
|
|
SceneSingleton::getInstance().updateAllControllers();
|
|
|
Event::ManagerSingleton::getInstance().updateAllEvents(prevUpdateTime, crntTime);
|
|
Event::ManagerSingleton::getInstance().updateAllEvents(prevUpdateTime, crntTime);
|
|
|
-
|
|
|
|
|
MainRendererSingleton::getInstance().render(*AppSingleton::getInstance().getActiveCam());
|
|
MainRendererSingleton::getInstance().render(*AppSingleton::getInstance().getActiveCam());
|
|
|
|
|
|
|
|
painter->setPosition(Vec2(0.0, 0.1));
|
|
painter->setPosition(Vec2(0.0, 0.1));
|
|
|
painter->setColor(Vec4(1.0));
|
|
painter->setColor(Vec4(1.0));
|
|
|
-
|
|
|
|
|
//painter->drawText("A");
|
|
//painter->drawText("A");
|
|
|
painter->drawText("Once upon a time in a place called Kickapoo.");
|
|
painter->drawText("Once upon a time in a place called Kickapoo.");
|
|
|
|
|
|
|
@@ -406,39 +406,42 @@ void mainLoop()
|
|
|
|
|
|
|
|
AppSingleton::getInstance().swapBuffers();
|
|
AppSingleton::getInstance().swapBuffers();
|
|
|
|
|
|
|
|
- HighRezTimer::Scalar a = timer.getElapsedTime();
|
|
|
|
|
- HighRezTimer::Scalar b = AppSingleton::getInstance().getTimerTick();
|
|
|
|
|
- HighRezTimer::Scalar timeToSpendForRsrcPostProcess;
|
|
|
|
|
- if(a < b)
|
|
|
|
|
- {
|
|
|
|
|
- timeToSpendForRsrcPostProcess = b - a;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- timeToSpendForRsrcPostProcess = 0.001;
|
|
|
|
|
- }
|
|
|
|
|
- ResourceManagerSingleton::getInstance().postProcessFinishedLoadingRequests(timeToSpendForRsrcPostProcess);
|
|
|
|
|
|
|
|
|
|
- if(1)
|
|
|
|
|
|
|
+ //
|
|
|
|
|
+ // Async resource loading
|
|
|
|
|
+ //
|
|
|
|
|
+ if(ResourceManagerSingleton::getInstance().getAsyncLoadingRequestsNum() > 0)
|
|
|
{
|
|
{
|
|
|
- //AppSingleton::getInstance().waitForNextFrame();
|
|
|
|
|
-
|
|
|
|
|
- timer.stop();
|
|
|
|
|
- if(timer.getElapsedTime() < AppSingleton::getInstance().getTimerTick())
|
|
|
|
|
|
|
+ HighRezTimer::Scalar a = timer.getElapsedTime();
|
|
|
|
|
+ HighRezTimer::Scalar b = AppSingleton::getInstance().getTimerTick();
|
|
|
|
|
+ HighRezTimer::Scalar timeToSpendForRsrcPostProcess;
|
|
|
|
|
+ if(a < b)
|
|
|
{
|
|
{
|
|
|
- SDL_Delay(AppSingleton::getInstance().getTimerTick() - timer.getElapsedTime());
|
|
|
|
|
|
|
+ timeToSpendForRsrcPostProcess = b - a;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if(MainRendererSingleton::getInstance().getFramesNum() == 100)
|
|
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- break;
|
|
|
|
|
|
|
+ timeToSpendForRsrcPostProcess = 0.001;
|
|
|
}
|
|
}
|
|
|
|
|
+ ResourceManagerSingleton::getInstance().postProcessFinishedLoadingRequests(timeToSpendForRsrcPostProcess);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //
|
|
|
|
|
+ // Sleep
|
|
|
|
|
+ //
|
|
|
|
|
+ timer.stop();
|
|
|
|
|
+ if(timer.getElapsedTime() < AppSingleton::getInstance().getTimerTick())
|
|
|
|
|
+ {
|
|
|
|
|
+ SDL_Delay((AppSingleton::getInstance().getTimerTick() - timer.getElapsedTime()) * 1000.0);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /*if(MainRendererSingleton::getInstance().getFramesNum() == 100)
|
|
|
|
|
+ {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }*/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- INFO("Exiting main loop (" << mainLoopTimer.getElapsedTime() << ")");
|
|
|
|
|
|
|
+ INFO("Exiting main loop (" << mainLoopTimer.getElapsedTime() << " sec)");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|