diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2014-07-11 09:11:25 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2014-07-11 09:14:30 +0400 |
commit | 315609ec0c1e28eb12bde3e8bbd2a5b03672b1a9 (patch) | |
tree | 66b2e264934e18944d9699e39ac81f5ba6969ef3 /source/gameengine/Ketsji/KX_KetsjiEngine.cpp | |
parent | d419e2e90cc3bb3fd6aa89baab8b4f4caa2001e1 (diff) |
Fix T40257: Frustum culling not working properly
This is mostly the same fix as before, but now code depending on culling
checks is executed after KX_Scene->CalculateVisibleMeshes(). As a
side-effect, LoD checks and animation culling now use the current
frame's culling information rather than the previous frame's.
Diffstat (limited to 'source/gameengine/Ketsji/KX_KetsjiEngine.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 7d7e15a5141..dde9e0c194d 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -140,7 +140,6 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_frameTime(0.f), m_clockTime(0.f), m_previousClockTime(0.f), - m_previousAnimTime(0.f), m_exitcode(KX_EXIT_REQUEST_NO_REQUEST), @@ -686,16 +685,6 @@ bool KX_KetsjiEngine::NextFrame() SG_SetActiveStage(SG_STAGE_ACTUATOR_UPDATE); scene->UpdateParents(m_frameTime); - // update levels of detail - scene->UpdateObjectLods(); - - if (!GetRestrictAnimationFPS()) - { - m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE); - scene->UpdateAnimations(m_frameTime); - } - m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_PHYSICS2); scene->GetPhysicsEnvironment()->BeginFrame(); @@ -797,27 +786,6 @@ bool KX_KetsjiEngine::NextFrame() m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); } } - - - // Handle the animations independently of the logic time step - if (GetRestrictAnimationFPS()) - { - double clocktime = m_kxsystem->GetTimeInSeconds(); - m_logger->StartLog(tc_animations, clocktime, true); - SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE); - - double anim_timestep = 1.0/KX_GetActiveScene()->GetAnimationFPS(); - if (clocktime - m_previousAnimTime > anim_timestep) - { - // Sanity/debug print to make sure we're actually going at the fps we want (should be close to anim_timestep) - // printf("Anim fps: %f\n", 1.0/(m_clockTime - m_previousAnimTime)); - m_previousAnimTime = clocktime; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit) - { - (*sceneit)->UpdateAnimations(clocktime); - } - } - } // Start logging time spend outside main loop m_logger->StartLog(tc_outside, m_kxsystem->GetTimeInSeconds(), true); @@ -1186,8 +1154,15 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene) raslight->BindShadowBuffer(m_canvas, cam, camtrans); /* update scene */ + m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); scene->CalculateVisibleMeshes(m_rasterizer, cam, raslight->GetShadowLayer()); + m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true); + scene->UpdateAnimations(GetFrameTime()); + + m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true); + + /* render */ m_rasterizer->ClearDepthBuffer(); m_rasterizer->ClearColorBuffer(); @@ -1319,6 +1294,11 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) scene->CalculateVisibleMeshes(m_rasterizer,cam); + m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true); + SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE); + + scene->UpdateAnimations(GetFrameTime()); + m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_RENDER); |