scg3
0.6
|
Base class for all nodes (composite pattern, abstract). More...
#include "Node.h"
Public Member Functions | |
Node () | |
virtual | ~Node ()=0 |
virtual void | clear () |
virtual void | destroy () |
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 | traverse (Traverser *traverser)=0 |
virtual void | accept (Traverser *traverser) |
virtual void | render (RenderState *renderState) |
Protected Member Functions | |
void | addSibling_ (NodeSP sibling) |
void | removeSibling_ (Node *node, bool &result) |
void | processCores_ (RenderState *renderState) |
void | postProcessCores_ (RenderState *renderState) |
Protected Attributes | |
NodeSP | rightSibling_ |
Composite * | parent_ |
std::vector< CoreSP > | cores_ |
bool | isVisible_ |
std::unordered_map< std::string, std::string > | metaInfo_ |
Friends | |
class | Composite |
Base class for all nodes (composite pattern, abstract).
The node tree of the scene graph is organized as a left-child right-sibling tree. While all nodes may have siblings and a parent, only composite nodes may have children (cf. Composite). Certain nodes may possess one or several cores (cf. Core).
Note: When the node is rendered, its cores are procesed in the order they have been added to the node.
scg::Node::Node | ( | ) |
Constructor.
|
pure virtual |
Destructor.
|
virtual |
Accept traverser (visitor pattern).
Reimplemented in scg::Camera, scg::Light, scg::Transformation, scg::Shape, scg::LightPosition, and scg::Group.
|
protected |
Add sibling to this node, i.e., child to its parent (recursively). Called by Composite::addChild().
|
virtual |
Clear node data.
|
virtual |
Remove node from scene graph, clear node data.
Reimplemented in scg::Composite.
const std::string& scg::Node::getMetaInfo | ( | const std::string & | key | ) | const |
Get meta-information value for a given key.
key | key to search for |
int scg::Node::getNCores | ( | ) | const |
Get number of cores associated with this node.
bool scg::Node::isVisible | ( | ) | const |
Check if node is visible.
|
protected |
Post-process node cores by calling their renderPost() methods, accessing vector from last to first element.
|
protected |
Process node cores by calling their render() methods, accessing vector from first to last element.
|
protected |
Remove sibling from this node, i.e., child from its parent (recursively). Called by Composite::removeChild().
node | pointer to node to be removed |
result | true if node has been found and removed |
|
virtual |
Render node.
Reimplemented in scg::Camera, scg::Light, scg::Transformation, scg::StereoCamera, scg::Shape, and scg::Group.
void scg::Node::setMetaInfo | ( | const std::string & | key, |
const std::string & | value | ||
) |
Set meta-information as key-value pair.
key | key; if there is already a key with that name, the value is overwritten |
value | value for the key |
void scg::Node::setVisible | ( | bool | isVisible = true | ) |
Set visibility of this node.
|
pure virtual |
Traverse node tree (depth-first, pre-order) with given traverser.
Implemented in scg::Composite, and scg::Leaf.
|
mutableprotected |