TrueReality  v0.1.1912
trCore/Nodes/Node.h
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3.0 of the License, or (at your option)
8 * any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @author Maxim Serebrennik
20 */
21 
22 #pragma once
23 
24 #include <trCore/Export.h>
25 
26 #include <trBase/Base.h>
27 #include <trBase/SmrtPtr.h>
28 #include <trUtil/RefStr.h>
29 
30 #include <vector>
31 
32 namespace trBase
33 {
34  class UserDataContainer;
35 }
36 
37 namespace osg
38 {
39  class Group;
40  class Node;
41  class NodeVisitor;
42 }
43 
44 namespace trCore::Nodes
45 {
55  {
56  public:
57 
59 
60  const static trUtil::RefStr CLASS_TYPE;
61 
75  using NodeMask = unsigned int;
76 
84  Node(const std::string name = CLASS_TYPE);
85 
94  Node(osg::Node& node, const std::string name = CLASS_TYPE);
95 
103  virtual const std::string& GetType() const override;
104 
112  virtual void SetName(const std::string& name);
113 
121  virtual osg::Node* AsOSGNode();
122 
130  virtual const osg::Node* AsOSGNode() const;
131 
139  virtual void Accept(osg::NodeVisitor& nv);
140 
148  virtual void Ascend(osg::NodeVisitor& nv);
149 
157  virtual void Traverse(osg::NodeVisitor& nv);
158 
159  protected:
160 
163 
169  ~Node();
170  };
171 
176  using NodePath = std::vector<trBase::SmrtPtr<Node>>;
177 }
trBase::SmrtPtr< osg::Node > mNode
The node.
#define TR_CORE_EXPORT
Definition: trCore/Export.h:33
std::vector< trBase::SmrtPtr< Node > > NodePath
A vector of Nodes pointers which is used to describe the path from a root node to a descendant...
unsigned int NodeMask
Holds the class type name for efficient comparisons.
A string wrapper that will make sure that all of the strings with the same value will point to the sa...
Definition: RefStr.h:50
static const trUtil::RefStr CLASS_TYPE
Adds an easy and swappable access to the base class.
This class is part of the internal garbage collection system.
Definition: SmrtClass.h:38
This is a Base class that carries the Class name and Unique ID of all the derived classes...
Definition: trBase/Base.h:36
Class for wrapping the osg node Internally it contains an OSG Group, that can be accessed by user if ...
Definition: FrameStamp.h:37