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_Scene.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_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 3d71327828e..d57c9b78587 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1529,6 +1529,9 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int MarkVisible(rasty, static_cast<KX_GameObject*>(m_objectlist->GetValue(i)), cam, layer); } } + + // Now that we know visible meshes, update LoDs + UpdateObjectLods(); } // logic stuff @@ -1634,6 +1637,20 @@ static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(t void KX_Scene::UpdateAnimations(double curtime) { + KX_KetsjiEngine *engine = KX_GetActiveEngine(); + + if (engine->GetRestrictAnimationFPS()) + { + // Handle the animations independently of the logic time step + double anim_timestep = 1.0 / GetAnimationFPS(); + if (curtime - m_previousAnimTime < anim_timestep) + return; + + // 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 = curtime; + } + TaskPool *pool = BLI_task_pool_create(KX_GetActiveEngine()->GetTaskScheduler(), &curtime); for (int i=0; i<m_animatedlist->GetCount(); ++i) { |