adding tree node classes, updated addChild() and added addChildren() to Node
git-svn-id: svn://anubis/fart/trunk@107 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
3014a39bb0
commit
9849ba06b5
@ -0,0 +1,14 @@
|
||||
|
||||
#include "nodes.h"
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
void Node::addChildren(refptr<Node> other)
|
||||
{
|
||||
for (typeof(other.m_children)::const_iterator it = other.m_children.begin();
|
||||
it != other.m_children.end();
|
||||
it++)
|
||||
{
|
||||
addChild(*it);
|
||||
}
|
||||
}
|
@ -8,6 +8,9 @@ class Node
|
||||
{
|
||||
public:
|
||||
void addChild(refptr<Node> child) { m_children.push_back(child); }
|
||||
void addChildren(refptr<Node> other);
|
||||
|
||||
virtual void process(refptr<Scene> scene) {}
|
||||
|
||||
virtual refptr<Material> getMaterial()
|
||||
{
|
||||
@ -18,7 +21,7 @@ class Node
|
||||
std::vector< refptr<Node> > m_children;
|
||||
};
|
||||
|
||||
class SceneNode
|
||||
class SceneItemsNode : public Node
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -329,9 +329,9 @@ plane_items: shape_items { $$ = $1; }
|
||||
|
||||
scene_items: /* empty */
|
||||
| scene_item scene_items {
|
||||
$$ = new Node();
|
||||
$$->the_Node = $1;
|
||||
$$->the_tail = $2;
|
||||
$$ = new SceneItemsNode();
|
||||
$$->addChild($1);
|
||||
$$->addChildren($2);
|
||||
}
|
||||
;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user