/
RootNode.h
80 lines (62 loc) · 1.99 KB
/
RootNode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#include "inamespace.h"
#include "imap.h"
#include "ientity.h"
#include "scene/Node.h"
#include "UndoFileChangeTracker.h"
#include "transformlib.h"
namespace map
{
/** greebo: This is the root node of the map, it gets inserted as
* the top node into the scenegraph. Each entity node is
* inserted as child node to this.
*
* Note: Inserting a child node to this MapRoot automatically
* triggers an instantiation of this child node.
*/
class RootNode :
public scene::Node,
public scene::IMapRootNode,
public IdentityTransform,
protected UndoFileChangeTracker
{
private:
// The actual name of the map
std::string _name;
// The namespace this node belongs to
INamespacePtr _namespace;
// The target tracker
ITargetManagerPtr _targetManager;
AABB _emptyAABB;
public:
// Constructor, pass the name of the map to it
RootNode(const std::string& name);
virtual ~RootNode();
// Returns the reference to the Namespace of this rootnode
const INamespacePtr& getNamespace() override;
IMapFileChangeTracker& getUndoChangeTracker() override;
ITargetManager& getTargetManager() override;
// Renderable implementation (empty)
void renderSolid(RenderableCollector& collector, const VolumeTest& volume) const override
{}
void renderWireframe(RenderableCollector& collector, const VolumeTest& volume) const override
{}
std::size_t getHighlightFlags() override
{
return Highlight::NoHighlight; // never highlighted
}
std::string name() const override;
Type getNodeType() const override;
void setName(const std::string& name);
// Override scene::Node methods
virtual void onChildAdded(const scene::INodePtr& child) override;
virtual void onChildRemoved(const scene::INodePtr& child) override;
virtual void onInsertIntoScene(IMapRootNode& root) override;
virtual void onRemoveFromScene(IMapRootNode& root) override;
const AABB& localAABB() const override
{
return _emptyAABB;
}
};
typedef std::shared_ptr<RootNode> RootNodePtr;
} // namespace map