Fix hotspots being shown for a single frame after startup
FGRenderer::update() happens after the CameraGroup is updated, which causes the Compositor to use the previous frame cull mask. Setting the cull masks explicitly during FGRenderer::update() fixes the issue.
This commit is contained in:
parent
94c202375c
commit
558a498850
3 changed files with 19 additions and 8 deletions
|
@ -816,6 +816,15 @@ CameraGroup* CameraGroup::buildCameraGroup(osgViewer::View* view,
|
|||
return cgroup;
|
||||
}
|
||||
|
||||
void CameraGroup::setCameraCullMasks(osg::Node::NodeMask nm)
|
||||
{
|
||||
for (auto& info : _cameras) {
|
||||
if (info->flags & CameraInfo::GUI)
|
||||
continue;
|
||||
info->compositor->setCullMask(nm);
|
||||
}
|
||||
}
|
||||
|
||||
void CameraGroup::resized()
|
||||
{
|
||||
for (const auto &info : _cameras)
|
||||
|
|
|
@ -176,6 +176,9 @@ public:
|
|||
* current viewport.
|
||||
*/
|
||||
void setCameraParameters(float vfov, float aspectRatio);
|
||||
/** Set the cull mask on all non-GUI cameras
|
||||
*/
|
||||
void setCameraCullMasks(osg::Node::NodeMask nm);
|
||||
/** Update camera properties after a resize event.
|
||||
*/
|
||||
void resized();
|
||||
|
|
|
@ -854,15 +854,14 @@ FGRenderer::update( ) {
|
|||
l->get_sun_angle()*SGD_RADIANS_TO_DEGREES);
|
||||
_updateVisitor->setVisibility(actual_visibility);
|
||||
simgear::GroundLightManager::instance()->update(_updateVisitor.get());
|
||||
osg::Node::NodeMask cullMask = ~simgear::LIGHTS_BITS & ~simgear::PICK_BIT;
|
||||
cullMask |= simgear::GroundLightManager::instance()
|
||||
->getLightNodeMask(_updateVisitor.get());
|
||||
if (_panel_hotspots->getBoolValue())
|
||||
cullMask |= simgear::PICK_BIT;
|
||||
camera->setCullMask(cullMask);
|
||||
camera->setCullMaskLeft(cullMask);
|
||||
camera->setCullMaskRight(cullMask);
|
||||
}
|
||||
|
||||
osg::Node::NodeMask cullMask = ~simgear::LIGHTS_BITS & ~simgear::PICK_BIT;
|
||||
cullMask |= simgear::GroundLightManager::instance()
|
||||
->getLightNodeMask(_updateVisitor.get());
|
||||
if (_panel_hotspots->getBoolValue())
|
||||
cullMask |= simgear::PICK_BIT;
|
||||
CameraGroup::getDefault()->setCameraCullMasks(cullMask);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Reference in a new issue