Skip to content

Commit

Permalink
UPBGE: Enable occluder for invisible objects. (#808)
Browse files Browse the repository at this point in the history
Previously objects were considered as occluder if the occluder option
was checked and that the object was visible. The last constraint is
bothering for the user that could define a simplified mesh for occlusion
that naturally will not be visible.

This commit is introducing the condition "visible || occluder" for the
call activating the graphic controller in KX_GameObject::SetVisible/
SetOccluder and the initialization of the graphic controller.

Fix issue #807.
  • Loading branch information
panzergame authored Sep 1, 2018
1 parent af46b84 commit fa68fed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_BlenderDataConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,8 @@ static void BL_CreateGraphicObjectNew(KX_GameObject *gameobj, KX_Scene *kxscene,
gameobj->SetGraphicController(ctrl);
ctrl->SetNewClientInfo(&gameobj->GetClientInfo());
if (isActive) {
// add first, this will create the proxy handle, only if the object is visible
if (gameobj->GetVisible()) {
// add first, this will create the proxy handle, only if the object is visible or occluder
if (gameobj->GetVisible() || gameobj->GetOccluder()) {
env->AddCcdGraphicController(ctrl);
}
}
Expand Down
7 changes: 5 additions & 2 deletions source/gameengine/Ketsji/KX_GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ static void setGraphicController_recursive(SG_Node *node)
void KX_GameObject::ActivateGraphicController(bool recurse)
{
if (m_graphicController) {
m_graphicController->Activate(m_bVisible);
m_graphicController->Activate(m_bVisible || m_bOccluder);
}
if (recurse) {
setGraphicController_recursive(m_sgNode.get());
Expand Down Expand Up @@ -899,7 +899,7 @@ void KX_GameObject::SetVisible(bool v,
{
m_bVisible = v;
if (m_graphicController) {
m_graphicController->Activate(m_bVisible);
m_graphicController->Activate(m_bVisible || m_bOccluder);
}
if (recursive) {
setVisible_recursive(m_sgNode.get(), v);
Expand All @@ -926,6 +926,9 @@ void KX_GameObject::SetOccluder(bool v,
bool recursive)
{
m_bOccluder = v;
if (m_graphicController) {
m_graphicController->Activate(m_bVisible || m_bOccluder);
}
if (recursive) {
setOccluder_recursive(m_sgNode.get(), v);
}
Expand Down

0 comments on commit fa68fed

Please sign in to comment.