Bugfix: forced DrawVisitor was not forcing actual draw()

This commit is contained in:
brunoherbelin
2021-01-15 23:22:51 +01:00
parent 5a2949609e
commit 67f45793da

View File

@@ -25,6 +25,11 @@ void DrawVisitor::loop(int num, glm::mat4 transform)
void DrawVisitor::visit(Node &n)
{
// force visible status if required
bool v = n.visible_;
if (force_)
n.visible_ = true;
// draw the target
if ( target_ && n.id() == target_->id()) {
@@ -37,6 +42,9 @@ void DrawVisitor::visit(Node &n)
done_ = true;
}
// restore visibility
n.visible_ = v;
if (done_) return;
// update transform
@@ -72,11 +80,11 @@ void DrawVisitor::visit(Switch &n)
// traverse acive child
glm::mat4 mv = modelview_;
n.activeChild()->accept(*this);
if ( n.activeChild()->visible_ || force_)
n.activeChild()->accept(*this);
modelview_ = mv;
}
void DrawVisitor::visit(Primitive &n)
{
}