scg3  0.6
scg::Composite Class Referenceabstract

Base class for all composite nodes, i.e., nodes with children (composite pattern, abstract). More...

#include "Composite.h"

Inheritance diagram for scg::Composite:
[legend]
Collaboration diagram for scg::Composite:
[legend]

Public Member Functions

 Composite ()
 
virtual ~Composite ()=0
 
virtual void destroy ()
 
CompositeaddChild (NodeSP child)
 
CompositeremoveChild (Node *node, bool &result)
 
CompositeremoveChild (Node *node)
 
virtual void traverse (Traverser *traverser)
 
virtual void acceptPost (Traverser *traverser)
 
virtual void renderPost (RenderState *renderState)
 
- Public Member Functions inherited from scg::Node
 Node ()
 
virtual ~Node ()=0
 
virtual void clear ()
 
int getNCores () const
 
const std::string & getMetaInfo (const std::string &key) const
 
void setMetaInfo (const std::string &key, const std::string &value)
 
bool isVisible () const
 
void setVisible (bool isVisible=true)
 
virtual void accept (Traverser *traverser)
 
virtual void render (RenderState *renderState)
 

Protected Attributes

NodeSP leftChild_
 
- Protected Attributes inherited from scg::Node
NodeSP rightSibling_
 
Compositeparent_
 
std::vector< CoreSPcores_
 
bool isVisible_
 
std::unordered_map< std::string, std::string > metaInfo_
 

Additional Inherited Members

- Protected Member Functions inherited from scg::Node
void addSibling_ (NodeSP sibling)
 
void removeSibling_ (Node *node, bool &result)
 
void processCores_ (RenderState *renderState)
 
void postProcessCores_ (RenderState *renderState)
 

Detailed Description

Base class for all composite nodes, i.e., nodes with children (composite pattern, abstract).

Definition at line 37 of file Composite.h.

Constructor & Destructor Documentation

◆ Composite()

scg::Composite::Composite ( )

Constructor.

◆ ~Composite()

virtual scg::Composite::~Composite ( )
pure virtual

Destructor.

Member Function Documentation

◆ acceptPost()

virtual void scg::Composite::acceptPost ( Traverser traverser)
virtual

Accept traverser after traversing sub-tree (visitor pattern).

Reimplemented in scg::Camera, scg::Light, scg::Transformation, and scg::Group.

◆ addChild()

Composite* scg::Composite::addChild ( NodeSP  child)

Add child to composite node.

Returns
this pointer for method chaining
Examples
scg3_minimal_example.cpp, and scg3_table_scene_example.cpp.

◆ destroy()

virtual void scg::Composite::destroy ( )
virtual

Remove node from scene graph, destroy nodes of sub-tree (if any).

Reimplemented from scg::Node.

◆ removeChild() [1/2]

Composite* scg::Composite::removeChild ( Node node,
bool &  result 
)

Remove child from composite node.

Parameters
nodepointer to node to be removed
resulttrue if node has been found and removed
Returns
this pointer for method chaining

◆ removeChild() [2/2]

Composite* scg::Composite::removeChild ( Node node)

Remove child from composite node (ignore result).

Returns
this pointer for method chaining

◆ renderPost()

virtual void scg::Composite::renderPost ( RenderState renderState)
virtual

Render node after traversing sub-tree, e.g., to restore previous state.

Reimplemented in scg::Camera, scg::Light, scg::Transformation, and scg::Group.

◆ traverse()

virtual void scg::Composite::traverse ( Traverser traverser)
virtual

Traverse node tree (depth-first, pre-order) with given traverser.

Implements scg::Node.

Member Data Documentation

◆ leftChild_

NodeSP scg::Composite::leftChild_
protected

Definition at line 93 of file Composite.h.


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