Carna  Version 3.3.2
Node.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef NODE_H_6014714286
13 #define NODE_H_6014714286
14 
15 #include <Carna/base/Spatial.h>
16 #include <memory>
17 
22 namespace Carna
23 {
24 
25 namespace base
26 {
27 
28 
29 
30 // ----------------------------------------------------------------------------------
31 // Node
32 // ----------------------------------------------------------------------------------
33 
44 class CARNA_LIB Node : public Spatial
45 {
46 
47  struct Details;
48  const std::unique_ptr< Details > pimpl;
49 
50 public:
51 
57  explicit Node( const std::string& tag = "" );
58 
62  virtual ~Node();
63 
68  void addNodeListener( NodeListener& listener );
69 
74  void removeNodeListener( NodeListener& listener );
75 
81  void invalidate() override;
82 
89  void attachChild( Spatial* child );
90 
99  Spatial* detachChild( Spatial& child );
100 
105  bool hasChild( const Spatial& child ) const;
106 
110  void deleteAllChildren();
111 
115  std::size_t children() const;
116 
120  void visitChildren( bool recursively, const MutableVisitor& visit );
121 
124  void visitChildren( bool recursively, const ImmutableVisitor& visit ) const;
125 
131  virtual void updateWorldTransform() override;
132 
133 }; // Node
134 
135 
136 
137 } // namespace Carna :: base
138 
139 } // namespace Carna
140 
141 #endif // NODE_H_6014714286
std::function< void(Spatial &) > MutableVisitor
Declares an entity that visits mutable Spatial instances.
Definition: Spatial.h:74
Defines Carna::base::Spatial.
std::function< void(const Spatial &) > ImmutableVisitor
Declares an entity that visits mutable Spatial instances.
Definition: Spatial.h:79
Defines the inner node of a scene graph. Implements a spatial scene element that is allowed to have c...
Definition: Node.h:44
Represents a spatial scene element. It&#39;s location is determined relatively to another spatial that is...
Definition: Spatial.h:44
Notified by Node objects.
Definition: NodeListener.h:39