Workaround to godot light cull bug

This commit is contained in:
lawnjelly 2019-10-08 09:26:31 +01:00 committed by GitHub
parent 0f8094e9f3
commit 5e31db0b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -59,16 +59,29 @@ VisualInstance * LSob::GetVI() const
return pVI;
}
void LSob::Show(bool bShow)
{
Spatial * pS = GetSpatial();
if (!pS)
return;
// noop
if (pS->is_visible() == bShow)
return;
if (bShow)
pS->show();
else
pS->hide();
GeometryInstance * pGI = Object::cast_to<GeometryInstance>(pS);
if (pGI)
{
// godot visible bug workaround
pGI->set_extra_cull_margin(0.0f);
}
}

View File

@ -182,6 +182,15 @@ void LRoom::SoftShow(VisualInstance * pVI, uint32_t show_flags)
pVI->set_layer_mask(mask);
// test godot bug
// GeometryInstance * pGI = Object::cast_to<GeometryInstance>(pVI);
// if (pGI)
// {
// // godot visible bug workaround
// pGI->set_extra_cull_margin(0.0f);
// }
// test the visual server - NOT A BOTTLENECK. set_layer_mask is cheap
}