Skip to content

Commit

Permalink
#5584: Faces remove their windings from the render buffers when the o…
Browse files Browse the repository at this point in the history
…wning brush goes invisible
  • Loading branch information
codereader committed Nov 7, 2021
1 parent 97f2834 commit 1714797
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions radiantcore/brush/BrushNode.cpp
Expand Up @@ -664,3 +664,14 @@ void BrushNode::_applyTransformation()

_untransformedOriginChanged = true;
}

void BrushNode::onVisibilityChanged(bool isVisibleNow)
{
SelectableNode::onVisibilityChanged(isVisibleNow);

// Let each face know about the change
forEachFaceInstance([=](FaceInstance& face)
{
face.getFace().onBrushVisibilityChanged(isVisibleNow);
});
}
2 changes: 2 additions & 0 deletions radiantcore/brush/BrushNode.h
Expand Up @@ -177,6 +177,8 @@ class BrushNode :
void onPostRedo() override;

protected:
virtual void onVisibilityChanged(bool isVisibleNow) override;

virtual void setForcedVisibility(bool forceVisible, bool includeChildren) override;

// Gets called by the Transformable implementation whenever
Expand Down
14 changes: 14 additions & 0 deletions radiantcore/brush/Face.cpp
Expand Up @@ -730,6 +730,20 @@ bool Face::isVisible() const
return _faceIsVisible;
}

void Face::onBrushVisibilityChanged(bool visible)
{
if (!visible)
{
// Disconnect our renderable when the owning brush goes invisible
_windingSurface.clear();
}
else
{
// Update the vertex buffers next we need to render
_windingSurface.queueUpdate();
}
}

void Face::updateFaceVisibility()
{
auto newValue = contributes() && getFaceShader().getGLShader()->getMaterial()->isVisible();
Expand Down
3 changes: 3 additions & 0 deletions radiantcore/brush/Face.h
Expand Up @@ -212,6 +212,9 @@ class Face :

bool isVisible() const override;

// Called when the owning brush changes its visibility status
void onBrushVisibilityChanged(bool visible);

void updateFaceVisibility();

// Signal for external code to get notified each time the texdef of any face changes
Expand Down

0 comments on commit 1714797

Please sign in to comment.