TrueReality  v0.1.1912
trSG/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 <trSG/Export.h>
25 
26 #include <trBase/Base.h>
27 #include <trBase/SmrtPtr.h>
28 #include <trUtil/RefStr.h>
29 
30 namespace trBase
31 {
32  class UserDataContainer;
33 }
34 
35 namespace osg
36 {
37  class Group;
38  class Node;
39  class NodeVisitor;
40 }
41 
42 namespace trSG
43 {
44 
50  {
51  public:
52 
54 
55  const static trUtil::RefStr CLASS_TYPE;
56 
70  using NodeMask = unsigned int;
71 
79  Node(const std::string name = CLASS_TYPE);
80 
88  virtual const std::string& GetType() const override;
89 
97  virtual void SetName(const std::string& name);
98 
106  virtual osg::Node* AsOSGNode();
107 
115  virtual const osg::Node* AsOSGNode() const;
116 
118  //virtual void accept(NodeVisitor& nv);
119 
121  //virtual void ascend(NodeVisitor& nv);
122 
124  //virtual void traverse(NodeVisitor& /*nv*/) {}
125 
126  protected:
127 
129 
135  ~Node();
136  };
137 }
138 
static const trUtil::RefStr CLASS_TYPE
Adds an easy and swappable access to the base class.
Definition: trSG/Node.h:55
#define TR_SG_EXPORT
Definition: trSG/Export.h:34
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
unsigned int NodeMask
Holds the class type name for efficient comparisons.
Definition: trSG/Node.h:70
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 Node, that can be accessed by user if a...
Definition: trSG/Node.h:49
trBase::SmrtPtr< osg::Node > mNode
Visitor Pattern : calls the apply method of a NodeVisitor with this node&#39;s type.
Definition: trSG/Node.h:128
Definition: trSG/Node.h:42
Definition: FrameStamp.h:37