diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 9e8e58e9dfd..7b781344763 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(); diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 7450be4fdef..f7f40acb8f1 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -852,10 +852,10 @@ public: /** * Was this object culled? */ - inline bool + bool GetCulled( void - ) { return m_bCulled; } + ); /** * Set culled flag of this object