LOG750-LAB2/src/glnodes/scenegroup.cpp
2016-10-28 16:36:45 -04:00

43 lines
791 B
C++

#include "scenegroup.h"
SceneGroup::SceneGroup()
{
}
std::vector<GlNode*>* SceneGroup::getChildren() {
return &children;
}
GlNode* SceneGroup::childAt(int i) {
return children.at(i);
}
GlNode* SceneGroup::getChild(){
// Automatically loops
if(childIndex >= children.size() || childIndex < 0){ //just in case
childIndex = 0;
}
return children.at(childIndex++);
}
bool SceneGroup::hasNext()
{
if(childIndex >= children.size() || childIndex < 0) {
childIndex = 0;
return false;
}
return true;
}
void SceneGroup::addChild(GlNode* child){
children.push_back(child);
//children.push_back(std::shared_ptr<GlNode>(child));
}
void SceneGroup::accept(Visitor &v) {
v.visit(*this);
}