mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Extend mechanism of visitor for all important classes that has
attributes of a scene (for saving in XML, or other visitors)
This commit is contained in:
26
Scene.cpp
26
Scene.cpp
@@ -1,6 +1,8 @@
|
||||
|
||||
#include "Scene.h"
|
||||
#include "Shader.h"
|
||||
#include "Primitives.h"
|
||||
#include "Visitor.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <glad/glad.h>
|
||||
@@ -32,6 +34,11 @@ void Node::update( float dt )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Node::accept(Visitor& v) {
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
// Primitive
|
||||
|
||||
Primitive::~Primitive()
|
||||
@@ -110,6 +117,13 @@ void Primitive::draw(glm::mat4 modelview, glm::mat4 projection)
|
||||
}
|
||||
}
|
||||
|
||||
void Primitive::accept(Visitor& v)
|
||||
{
|
||||
Node::accept(v);
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
|
||||
void Primitive::deleteGLBuffers_()
|
||||
{
|
||||
if ( arrayBuffer_ ) glDeleteBuffers ( 1, &arrayBuffer_);
|
||||
@@ -124,6 +138,12 @@ Group::~Group()
|
||||
children_.clear();
|
||||
}
|
||||
|
||||
void Group::accept(Visitor& v)
|
||||
{
|
||||
Node::accept(v);
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
void Group::init()
|
||||
{
|
||||
visible_ = true;
|
||||
@@ -159,7 +179,7 @@ void Group::draw(glm::mat4 modelview, glm::mat4 projection)
|
||||
|
||||
void Group::addChild(Node *child)
|
||||
{
|
||||
children_.push_back ( child );
|
||||
children_.push_back( child );
|
||||
child->parent_ = this;
|
||||
}
|
||||
|
||||
@@ -176,3 +196,7 @@ int Group::numChildren()
|
||||
return children_.size();
|
||||
}
|
||||
|
||||
|
||||
void Scene::accept(Visitor& v) {
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user