From 67f45793da69bd6d5eea591037e5d2bb5808c464 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Fri, 15 Jan 2021 23:22:51 +0100 Subject: [PATCH] Bugfix: forced DrawVisitor was not forcing actual draw() --- DrawVisitor.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/DrawVisitor.cpp b/DrawVisitor.cpp index 853aef0..9c6fa33 100644 --- a/DrawVisitor.cpp +++ b/DrawVisitor.cpp @@ -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) { - }