// Author: Juan Carlos De Abreu (jcabreur@gmail.com)
//
// This file define a class inherent from SceneNode that allow agroup scene 
// nodes.
//
// An use of this class can be;
// SmartPointer<ISceneNode> group_node = new GroupNode();
// group_node->addNode(new TranslateNode(1,0,0));
// group_node->addNode(new LightNode());
// group_node->apply();

#ifndef SCENE_GROUP_NODE_H__
#define SCENE_GROUP_NODE_H__

#include "../../global.h"
#include "scene_node.h"
#include "../../Base/Memory/SmartPointer.h"

BEGIN_TEG_NAMESPACE();

class GroupNode : public ISceneNode {
 public:
  // GroupNode constructors and destructor.
  GroupNode();
  GroupNode(const std::vector< SmartPointer<ISceneNode> >& nodes);
  ~GroupNode();

  // Accessor and mutator methods to GroupNode attributes.
  const std::vector< SmartPointer<ISceneNode> >& nodes() const;

  // Methods to add, get and erase a scene node in the group.
  void ClearSceneNodes();
  void EraseSceneNode(int index);
  void AddSceneNode(const SmartPointer<ISceneNode>& scene_node);
  const SmartPointer<ISceneNode>& GetSceneNode(int index) const;

  // Method to call the method apply() of each node.
  virtual void apply();

  // Method to make a GroupNode copy.
  virtual SmartPointer<ISceneNode> copy();
  AUTO_SIZE();

 private:
  // GroupNode attributes, scene nodes in the group.
  std::vector< SmartPointer<ISceneNode> > nodes_;
  DISALLOW_COPY_AND_ASSIGN(GroupNode);
};

END_TEG_NAMESPACE();

#endif  // SCENE_GROUP_NODE_H__
