TrueReality  v0.1.1912
trCore::Nodes::Node Class Reference

Class for wrapping the osg node Internally it contains an OSG Group, that can be accessed by user if additional functionality is required. More...

#include <Node.h>

Inheritance diagram for trCore::Nodes::Node:
Collaboration diagram for trCore::Nodes::Node:

Public Types

using BaseClass = trBase::Base
 
using NodeMask = unsigned int
 Holds the class type name for efficient comparisons. More...
 
- Public Types inherited from trBase::Base
using BaseClass = trBase::SmrtClass
 
- Public Types inherited from trBase::SmrtClass
using BaseClass = osg::Referenced
 

Public Member Functions

 Node (const std::string name=CLASS_TYPE)
 Constructor. More...
 
 Node (osg::Node &node, const std::string name=CLASS_TYPE)
 Constructor. More...
 
virtual const std::string & GetType () const override
 Returns the class type. More...
 
virtual void SetName (const std::string &name)
 Sets this instances name. More...
 
virtual osg::Node * AsOSGNode ()
 Returns a pointer to the internal OSG Node. More...
 
virtual const osg::Node * AsOSGNode () const
 Returns a constant pointer to the internal OSG Node. More...
 
virtual void Accept (osg::NodeVisitor &nv)
 Visitor Pattern : calls the apply method of a NodeVisitor with this node's type. More...
 
virtual void Ascend (osg::NodeVisitor &nv)
 Traverse upwards : calls parents' accept method with NodeVisitor. More...
 
virtual void Traverse (osg::NodeVisitor &nv)
 Traverse downwards : calls children's accept method with NodeVisitor. More...
 
- Public Member Functions inherited from trBase::Base
 Base (const std::string &name=CLASS_TYPE)
 Holds the class type name for efficient comparisons. More...
 
virtual const std::string & GetName ()
 Returns this instances name. More...
 
virtual const std::string & GetName () const
 Returns this instances name. More...
 
virtual void SetUUID (const trBase::UniqueId &id)
 Overwrites the default internal UUID with the passed in one. More...
 
virtual const trBase::UniqueIdGetUUID (void)
 Returns the instances Universally Unique ID. More...
 
- Public Member Functions inherited from trBase::SmrtClass
 SmrtClass ()
 Adds an easy and swappable access to the base class. More...
 
 SmrtClass (bool threadSafeRefUnref)
 Constructor. More...
 
 SmrtClass (const SmrtClass &inst)
 Copy constructor. More...
 
virtual bool GetThreadSafeRefUnref ()
 Get whether a mutex is used to ensure Ref() and UnRef() are thread safe. More...
 
OpenThreads::Mutex * GetRefMutex () const
 Get the mutex used to ensure thread safety of Ref()/UnRef(). More...
 
int Ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
int Unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int UnRefNoDelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int ReferenceCount () const
 Return the number of pointers currently referencing this object. More...
 

Static Public Attributes

static const trUtil::RefStr CLASS_TYPE = trUtil::RefStr("trCore::Nodes::Node")
 Adds an easy and swappable access to the base class. More...
 
- Static Public Attributes inherited from trBase::Base
static const trUtil::RefStr CLASS_TYPE = trUtil::RefStr("trBase::Base")
 Adds an easy and swappable access to the base class. More...
 

Protected Member Functions

 ~Node ()
 dtor. More...
 
- Protected Member Functions inherited from trBase::Base
 ~Base ()
 Base destructor. More...
 
- Protected Member Functions inherited from trBase::SmrtClass
 ~SmrtClass ()
 

Protected Attributes

trBase::SmrtPtr< osg::Node > mNode
 The node. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from trBase::SmrtClass
static OpenThreads::Mutex * GetGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all trBase::SmrtClass. More...
 

Detailed Description

Class for wrapping the osg node Internally it contains an OSG Group, that can be accessed by user if additional functionality is required.

Author
Maxim Serebrennik

Definition at line 54 of file trCore/Nodes/Node.h.

Member Typedef Documentation

◆ BaseClass

◆ NodeMask

using trCore::Nodes::Node::NodeMask = unsigned int

Holds the class type name for efficient comparisons.

This is a set of bits (flags) that represent the Node. The default value is 0xffffffff (all bits set).

The most common use of these is during traversal of the scene graph.

For example, if a Node has a NodeMask value of 0x02 (only 2nd bit set) and the Camera has a CullMask of 0x4 (2nd bit not set) then during cull traversal, which takes it's TraversalMask from the Camera's CullMask, the node and any children would be ignored and thereby treated as "culled" and thus not rendered. Conversely, if the Camera CullMask were 0x3 (2nd bit set) then the node would be processed and child Nodes would be examined.

Definition at line 75 of file trCore/Nodes/Node.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

trCore::Nodes::Node::Node ( const std::string  name = CLASS_TYPE)

Constructor.

Parameters
name(Optional) The name.

Definition at line 34 of file trCore/Nodes/Node.cpp.

References mNode.

◆ Node() [2/2]

trCore::Nodes::Node::Node ( osg::Node &  node,
const std::string  name = CLASS_TYPE 
)

Constructor.

Parameters
[in,out]nodeThe node.
name(Optional) The name.

Definition at line 41 of file trCore/Nodes/Node.cpp.

References mNode.

◆ ~Node()

trCore::Nodes::Node::~Node ( )
protected

dtor.

Definition at line 47 of file trCore/Nodes/Node.cpp.

Member Function Documentation

◆ Accept()

void trCore::Nodes::Node::Accept ( osg::NodeVisitor &  nv)
virtual

Visitor Pattern : calls the apply method of a NodeVisitor with this node's type.

Parameters
[in,out]nvThe nv.

Definition at line 77 of file trCore/Nodes/Node.cpp.

References mNode.

◆ Ascend()

void trCore::Nodes::Node::Ascend ( osg::NodeVisitor &  nv)
virtual

Traverse upwards : calls parents' accept method with NodeVisitor.

Parameters
[in,out]nvThe nv.

Definition at line 83 of file trCore/Nodes/Node.cpp.

References mNode.

◆ AsOSGNode() [1/2]

osg::Node * trCore::Nodes::Node::AsOSGNode ( )
virtual

Returns a pointer to the internal OSG Node.

Returns
Null if it fails, else a pointer to an osg::Node.

Definition at line 65 of file trCore/Nodes/Node.cpp.

References trBase::SmrtPtr< T >::Get(), and mNode.

Referenced by trCore::Nodes::NodeVisitor::PushOntoNodePath(), trCore::Nodes::NodeVisitor::Traverse(), and trCore::Nodes::NodeVisitor::ValidNodeMask().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AsOSGNode() [2/2]

const osg::Node * trCore::Nodes::Node::AsOSGNode ( ) const
virtual

Returns a constant pointer to the internal OSG Node.

Returns
Null if it fails, else a pointer to a const osg::Node.

Definition at line 71 of file trCore/Nodes/Node.cpp.

References trBase::SmrtPtr< T >::Get(), and mNode.

Here is the call graph for this function:

◆ GetType()

const std::string & trCore::Nodes::Node::GetType ( ) const
overridevirtual

Returns the class type.

Returns
The type.

Implements trBase::Base.

Definition at line 52 of file trCore/Nodes/Node.cpp.

References CLASS_TYPE.

◆ SetName()

void trCore::Nodes::Node::SetName ( const std::string &  name)
virtual

Sets this instances name.

Parameters
nameThe name.

Reimplemented from trBase::Base.

Definition at line 58 of file trCore/Nodes/Node.cpp.

References mNode, and trBase::Base::SetName().

Here is the call graph for this function:

◆ Traverse()

void trCore::Nodes::Node::Traverse ( osg::NodeVisitor &  nv)
virtual

Traverse downwards : calls children's accept method with NodeVisitor.

Parameters
[in,out]nvThe nv.

Definition at line 89 of file trCore/Nodes/Node.cpp.

References mNode.

Member Data Documentation

◆ CLASS_TYPE

const trUtil::RefStr trCore::Nodes::Node::CLASS_TYPE = trUtil::RefStr("trCore::Nodes::Node")
static

Adds an easy and swappable access to the base class.

Definition at line 60 of file trCore/Nodes/Node.h.

Referenced by GetType().

◆ mNode

trBase::SmrtPtr<osg::Node> trCore::Nodes::Node::mNode
protected

The node.

Definition at line 162 of file trCore/Nodes/Node.h.

Referenced by Accept(), Ascend(), AsOSGNode(), Node(), SetName(), and Traverse().


The documentation for this class was generated from the following files: