Bugfix draw visitor (ensure clean start when visiting scene)

This commit is contained in:
brunoherbelin
2021-01-10 09:51:22 +01:00
parent 805baa75f4
commit 6b5ccb4450

View File

@@ -60,11 +60,17 @@ void DrawVisitor::visit(Group &n)
void DrawVisitor::visit(Scene &n) void DrawVisitor::visit(Scene &n)
{ {
done_ = false;
modelview_ = glm::identity<glm::mat4>();
n.root()->accept(*this); n.root()->accept(*this);
} }
void DrawVisitor::visit(Switch &n) void DrawVisitor::visit(Switch &n)
{ {
// no need to traverse deeper if this node was drawn already
if (done_) return;
// traverse acive child
glm::mat4 mv = modelview_; glm::mat4 mv = modelview_;
n.activeChild()->accept(*this); n.activeChild()->accept(*this);
modelview_ = mv; modelview_ = mv;