From 315609ec0c1e28eb12bde3e8bbd2a5b03672b1a9 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 10 Jul 2014 22:11:25 -0700 Subject: 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. --- source/gameengine/Ketsji/KX_GameObject.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp') diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index de528aeac63..f61d08e7f71 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -928,6 +928,27 @@ KX_GameObject::SetVisible( } } +bool KX_GameObject::GetCulled() +{ + // If we're set to not cull, double-check with + // the mesh slots first. This is kind of nasty, but + // it allows us to get proper culling information. + if (!m_bCulled) + { + SG_QList::iterator mit(m_meshSlots); + for (mit.begin(); !mit.end(); ++mit) + { + if ((*mit)->m_bCulled) + { + m_bCulled = true; + break; + } + } + } + + return m_bCulled; +} + static void setOccluder_recursive(SG_Node* node, bool v) { NodeList& children = node->GetSGChildren(); -- cgit v1.2.3