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) { - }