|
Developer Documentation
|
#include <ACG/Scenegraph/BaseNode.hh>
Public Types | |
| enum | StatusMode { Active = 0x1, HideNode = 0x2, HideChildren = 0x4, HideSubtree = 0x8 } |
| Status modi. More... | |
| enum | TraverseMode { NodeFirst = 0x1, ChildrenFirst = 0x2, SecondPass = 0x4 } |
| Node traverse types. More... | |
|
typedef std::list< BaseNode * > ::const_iterator | ConstChildIter |
| allows to iterate over children | |
|
typedef std::list< BaseNode * > ::iterator | ChildIter |
| allows to iterate over children | |
|
typedef std::list< BaseNode * > ::const_reverse_iterator | ConstChildRIter |
| allows to reverse iterate over children | |
|
typedef std::list< BaseNode * > ::reverse_iterator | ChildRIter |
| allows to reverse iterate over children | |
Public Member Functions | |
| BaseNode (BaseNode *_parent=0, std::string _name="<unknown>") | |
| Default constructor. | |
| BaseNode (BaseNode *_parent, BaseNode *_child, std::string _name="<unknown>") | |
| Put this node between _parent and _child. | |
| virtual | ~BaseNode () |
| Destructor. | |
| void | delete_subtree () |
| Delete the whole subtree of this node. | |
| virtual const std::string & | className () const =0 |
| Return class name (implemented by the ACG_CLASSNAME macro) | |
| virtual DrawModes::DrawMode | availableDrawModes () const |
| virtual void | boundingBox (Vec3d &, Vec3d &) |
| virtual void | enter (GLState &, const DrawModes::DrawMode &) |
| virtual void | draw (GLState &, const DrawModes::DrawMode &) |
| Draw this node using the draw modes _drawMode. | |
| virtual void | getRenderObjects (IRenderer *, GLState &, const DrawModes::DrawMode &) |
| Deferred draw call with shader based renderer. | |
| virtual void | leave (GLState &, const DrawModes::DrawMode &) |
| virtual void | enterPick (GLState &_state, PickTarget _target, const DrawModes::DrawMode &_drawMode) |
| virtual void | pick (GLState &, PickTarget) |
| virtual void | leavePick (GLState &_state, PickTarget _target, const DrawModes::DrawMode &_drawMode) |
| void | enablePicking (bool _enable) |
| bool | pickingEnabled () |
| virtual void | mouseEvent (GLState &, QMouseEvent *) |
| Handle mouse event (some interaction, e.g. modeling) | |
| void | setDirty (bool _dirty=true) |
| mark node for redrawn | |
| bool | isDirty () const |
| Check if node should be redrawn. | |
| ChildIter | childrenBegin () |
| Returns: begin-iterator of children. | |
| ConstChildIter | childrenBegin () const |
Same but cont. | |
| ChildIter | childrenEnd () |
| Returns: end-iterator of children. | |
| ConstChildIter | childrenEnd () const |
Same but const. | |
| ChildRIter | childrenRBegin () |
| Returns: reverse begin-iterator of children. | |
| ConstChildRIter | childrenRBegin () const |
| Same but const. | |
| ChildRIter | childrenREnd () |
| Returns: reverse end-iterator of children. | |
| ConstChildRIter | childrenREnd () const |
Same but const. | |
| void | push_back (BaseNode *_node) |
| Insert _node at the end of the list of children. | |
| void | remove (ChildIter _pos) |
| unsigned int | nChildren () const |
| number of children | |
| ChildIter | find (BaseNode *_node) |
| BaseNode * | find (const std::string &_name) |
| BaseNode * | parent () |
| Get the nodes parent node. | |
| void | set_parent (BaseNode *_parent) |
| Set the parent of this node. | |
| StatusMode | status () const |
| Get node's status. | |
| void | set_status (StatusMode _s) |
| Set the status of this node. | |
| void | hide () |
| Hide Node: set status to HideNode. | |
| void | show () |
| Show node: set status to Active. | |
| bool | visible () |
| Is node visible (status == Active)? | |
| bool | hidden () |
| Is node not visible (status != Active)? | |
| std::string | name () const |
| Returns: name of node (needs not be unique) | |
| void | name (const std::string &_name) |
| rename a node | |
| unsigned int | id () const |
| DrawModes::DrawMode | drawMode () const |
| Return the own draw modes of this node. | |
| void | drawMode (DrawModes::DrawMode _drawMode) |
| unsigned int | traverseMode () const |
| Return how the node should be traversed. | |
| void | setTraverseMode (unsigned int _mode) |
| Set traverse mode for node. | |
Private Member Functions | |
| BaseNode (const BaseNode &) | |
| Copy constructor. Disabled. | |
| void | operator= (const BaseNode &) |
| Assigment operator. Disabled. | |
Private Attributes | |
| BaseNode * | parent_ |
| pointer to parent node | |
| std::string | name_ |
| name of node | |
| StatusMode | status_ |
| node status() | |
| std::list< BaseNode * > | children_ |
| list of children | |
| unsigned int | id_ |
| ID of node. | |
| DrawModes::DrawMode | drawMode_ |
| private draw mode | |
| bool | pickingEnabled_ |
| bool | dirty_ |
| Flag indicating that the node has to be redrawn. | |
| unsigned int | traverseMode_ |
| traverse mode | |
Static Private Attributes | |
| static unsigned int | last_id_used__ |
| used to provide unique IDs to nodes | |
Render pass controls | |
The render pass controls are only used during multipass traversal. There are two types of multipass controls. One type controls if the enter and leave functions of the nodes are used (RenderStatusPass) or if the actual draw function is called (RenderDrawPass). The bitmasks define if the functions are called by the traverse_multipass operation. The bitmask are initialized to run in the first path. | |
| enum | PASSES { NOPASS = 0, ALLPASSES = 1 << 0, PASS_1 = 1 << 1, PASS_2 = 1 << 2, PASS_3 = 1 << 3, PASS_4 = 1 << 4, PASS_5 = 1 << 5, PASS_6 = 1 << 6, PASS_7 = 1 << 7, PASS_8 = 1 << 8 } |
| This enum should be used to enable rendering of a node in different. | |
| typedef unsigned int | MultipassBitMask |
| Multipass pass bit mask type. | |
| MultipassBitMask | multipassStatus_ |
| MultipassBitMask | multipassNode_ |
| MultipassBitMask | multipassStatus () const |
| Get the current multipass settings for the nodes status functions. | |
| void | setMultipassStatus (const MultipassBitMask _passStatus) |
| Set multipass settings for the nodes status functions. | |
| void | multipassStatusSetActive (const unsigned int _i, bool _active) |
| Set multipass status to traverse in a specific pass. | |
| bool | multipassStatusActive (const unsigned int _i) const |
| Get multipass status to traverse in a specific pass. | |
| MultipassBitMask | multipassNode () const |
| Get the current multipass settings for the node. | |
| void | setMultipassNode (const MultipassBitMask _passNode) |
| Set multipass settings for the node. | |
| void | multipassNodeSetActive (const unsigned int _i, bool _active) |
| Set Node status to traverse in a specific pass. | |
| bool | multipassNodeActive (const unsigned int _i) const |
| Get Node status to traverse in a specific pass. | |
This is the base for all scenegraph nodes. All virtual functions should be reimplemented when inheriting from this class.
Definition at line 125 of file BaseNode.hh.
Status modi.
| Active |
Draw node & children. |
| HideNode |
Hide this node, but draw children. |
| HideChildren |
Draw this node, but hide children. |
| HideSubtree |
Hide this node and its children. |
Definition at line 344 of file BaseNode.hh.
Node traverse types.
| NodeFirst |
Execute action on node first and then on its children. |
| ChildrenFirst |
Execute action the children first and then on this node. |
| SecondPass |
Draw node in second pass. |
Definition at line 393 of file BaseNode.hh.
|
inlinevirtual |
Return a list of available draw modes for this node: should be OR'ed from the items of the enum DrawModeIDs.
Reimplemented in PlaneNode.
Definition at line 157 of file BaseNode.hh.
Compute the bounding box of this node and update the values _bbMin and _bbMax accordingly. Do not initialize _bbMin and _bbMax since they may already store values of previous nodes' bounding box computation.
Reimplemented in PlaneNode.
Definition at line 164 of file BaseNode.hh.
| void ACG::SceneGraph::BaseNode::delete_subtree | ( | ) |
Delete the whole subtree of this node.
This function will remove the whole subtree below this node. All children in this nodes bubtree will be automatically removed from the tree and their destructor is called. The node itself will be removed from the list of its parents children. Afterwards it will also call its own destructor.
|
inlinevirtual |
Draw this node using the draw modes _drawMode.
This function is called when the scenegraph is traversed by the classical draw routines.
In this call the node should draw it's content via OpenGL.
Reimplemented in PlaneNode.
Definition at line 184 of file BaseNode.hh.
|
inline |
Set this node's own draw mode. It will be used for drawing instead of the the global draw mode.
Definition at line 388 of file BaseNode.hh.
|
inline |
Enable or Disable picking for this node ( default: enabled )
Definition at line 223 of file BaseNode.hh.
|
inlinevirtual |
This function is called when traversing the scene graph and arriving at this node. It can be used to store GL states that will be changed in order to restore then in the leave() function.
Definition at line 172 of file BaseNode.hh.
|
virtual |
This function is called when traversing the scene graph during picking and arriving at this node. It can be used to store GL states that will be changed in order to restore then in the leavePick() function. Its default implementation will call the enter() function.
Find a specific node in the list of children.
This method is designed to convert a node pointer to an iterator that may be used e.g. for insert()'ing a new node at a distinct position.
Returns childrenEnd() if no appropriate node is found.
Definition at line 304 of file BaseNode.hh.
|
inline |
Find a node of a given name
Definition at line 313 of file BaseNode.hh.
|
inlinevirtual |
Deferred draw call with shader based renderer.
The renderer calls this function to collect the geometry that should be rendered from the nodes.
Add any renderable geometry to the renderer via _renderer->addRenderObject()
Definition at line 194 of file BaseNode.hh.
|
inline |
Get unique ID of node. IDs are always positive and may be used e.g. for picking.
Definition at line 378 of file BaseNode.hh.
|
inlinevirtual |
The leave function is used to restore GL states the have been changed. This function must restore the status before enter() !
Definition at line 199 of file BaseNode.hh.
|
virtual |
The leavePick function is used to restore GL states the have been changed. This function must restore the status before enterPick() ! Its default implementation will call the leave() function.
|
inline |
Get the current multipass settings for the node.
Get a bitmask defining in which traverse path an action is applied to the node. (1-indexed) Use the PASSES enum above to control multipass rendering!
Definition at line 492 of file BaseNode.hh.
| bool ACG::SceneGraph::BaseNode::multipassNodeActive | ( | const unsigned int | _i | ) | const |
Get Node status to traverse in a specific pass.
Check multipass setting for the node if an action will be applied in the given pass. Use the PASSES enum above to control multipass rendering!
| _i | Check this pass if an action will be applied to the node. |
| void ACG::SceneGraph::BaseNode::multipassNodeSetActive | ( | const unsigned int | _i, |
| bool | _active | ||
| ) |
Set Node status to traverse in a specific pass.
Change multipass setting for the node. An action will be applied to this node in the given pass. Use the PASSES enum above to control multipass rendering!
| _i | Pass in which the node should be rendered |
| _active | Enable or disable node in this pass? |
|
inline |
Get the current multipass settings for the nodes status functions.
Get a bitmask defining in which traverse pass the enter and leave nodes are used. Use the PASSES enum above to control multipass rendering!
Definition at line 448 of file BaseNode.hh.
| bool ACG::SceneGraph::BaseNode::multipassStatusActive | ( | const unsigned int | _i | ) | const |
Get multipass status to traverse in a specific pass.
Check multipass setting for the nodes status functions if they should be called in the given render pass. Use the PASSES enum above to control multipass rendering!
| _i | Check this pass if the nodes enter/leave functions are active |
| void ACG::SceneGraph::BaseNode::multipassStatusSetActive | ( | const unsigned int | _i, |
| bool | _active | ||
| ) |
Set multipass status to traverse in a specific pass.
Change multipass setting for the nodes status functions. The node will call its enter and leave functions in the given pass if its set active. Use the PASSES enum above to control multipass rendering!
| _i | Pass in which the node should be rendered |
| _active | Activate or deactivate in this pass? |
|
inlinevirtual |
Draw the node using the GL picking name stack. The node's ID will already be on the name stack, so only names identifing e.g. faces should be used ( by glLoadName() ).
Reimplemented in PlaneNode.
Definition at line 212 of file BaseNode.hh.
|
inline |
Check if picking is enabled for this node
Definition at line 227 of file BaseNode.hh.
|
inline |
Remove child node at position _pos. This _pos must be reachable from childrenBegin().
This method has no effect if called with childrenEnd() as parameter.
Definition at line 288 of file BaseNode.hh.
| void ACG::SceneGraph::BaseNode::set_parent | ( | BaseNode * | _parent | ) |
Set the parent of this node.
This function will remove this node from its original parents children, if the parent exists. And will add it to the new parents children.
|
inline |
Set multipass settings for the node.
Set a bitmask defining in which traverse path an action is applied to the node. (1-indexed) Set to ALLPASSES if you want to render in all passes. Use the PASSES enum above to control multipass rendering!
| _passNode | Bitmask defining in which traverse passes an action is applied to the node. |
Definition at line 504 of file BaseNode.hh.
|
inline |
Set multipass settings for the nodes status functions.
Set a bitmask defining in which traverse pass the enter and leave nodes are used. Use the PASSES enum above to control multipass rendering!
Set to ALLPASSES if you want to render in all passes
| _passStatus | Bitmask defining in which traverse pass the enter and leave nodes are used |
Definition at line 460 of file BaseNode.hh.
|
private |
multi pass bit mask (1-indexed) Defines in which multipass runs an action should be applied to the node. (Only applies during multipass traversal!)
Definition at line 539 of file BaseNode.hh.
|
private |
multi pass bit mask (1-indexed) Defines in which multipass runs the enter and leave functions should be called. (Only applies during multipass traversal!)
Definition at line 533 of file BaseNode.hh.
|
private |
Flag indicating if picking should be done for this object This flag has to be checked by your node if you implement picking
Definition at line 575 of file BaseNode.hh.