#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 unsigned int | availableDrawModes () const |
| virtual void | boundingBox (Vec3f &, Vec3f &) |
| virtual void | enter (GLState &, unsigned int) |
| virtual void | draw (GLState &, unsigned int) |
| virtual void | leave (GLState &, unsigned int) |
| virtual void | enterPick (GLState &_state, PickTarget _target, unsigned int _drawMode) |
| virtual void | pick (GLState &, PickTarget) |
| virtual void | leavePick (GLState &_state, PickTarget _target, unsigned int _drawMode) |
| void | enablePicking (bool _enable) |
| bool | pickingEnabled () |
| virtual void | mouseEvent (GLState &, QMouseEvent *) |
| Handle mouse event (some interaction, e.g. modeling). | |
| GLenum | depthFunc () const |
| get glDepthFunc() parameter | |
| void | depthFunc (GLenum _func) |
| set glDepthFunc parameter (it's GL_LESS by default) | |
| 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 |
| unsigned int | drawMode () const |
| Return the own draw modes of this node. | |
| void | drawMode (unsigned int _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. | |
| unsigned int | drawMode_ |
| private draw mode | |
| GLenum | depth_func_ |
| depth func | |
| 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__ = 0 |
| used to provide unique IDs to nodes | |
This is the base for all scenegraph nodes. All virtual functions should be reimplemented when inheriting from this class.
Definition at line 118 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 327 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 376 of file BaseNode.hh.
| virtual unsigned int ACG::SceneGraph::BaseNode::availableDrawModes | ( | ) | const [inline, virtual] |
Return a list of available draw modes for this node: should be OR'ed from the items of the enum DrawModeIDs.
Reimplemented in ACG::SceneGraph::BoundingBoxNode, ACG::SceneGraph::CoordFrameNode, ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::GridNode, ACG::SceneGraph::LineNode, ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::OBJNode, ACG::SceneGraph::PlaneNode, ACG::SceneGraph::PointNode, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::QuadNode, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::SliceNode, ACG::SceneGraph::StatusNodeT< Mesh, Mod >, ACG::SceneGraph::TriangleNode, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > >, ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > >, ACG::SceneGraph::StatusNodeT< Mesh, SelectionModT< Mesh > >, ACG::SceneGraph::StatusNodeT< Mesh, LockModT< Mesh > >, ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > >, and ACG::SceneGraph::StatusNodeT< MeshT, SelectionModT< MeshT > >.
Definition at line 150 of file BaseNode.hh.
| virtual void ACG::SceneGraph::BaseNode::boundingBox | ( | Vec3f & | , | |
| Vec3f & | ||||
| ) | [inline, virtual] |
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 ACG::SceneGraph::CoordFrameNode, ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::GridNode, ACG::SceneGraph::LineNode, ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::OBJNode, ACG::SceneGraph::PlaneNode, ACG::SceneGraph::PointNode, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::QuadNode, ACG::SceneGraph::SliceNode, ACG::SceneGraph::StatusNodeT< Mesh, Mod >, ACG::SceneGraph::TranslationManipulatorNode, ACG::SceneGraph::TriangleNode, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > >, ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > >, ACG::SceneGraph::StatusNodeT< Mesh, SelectionModT< Mesh > >, ACG::SceneGraph::StatusNodeT< Mesh, LockModT< Mesh > >, ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > >, and ACG::SceneGraph::StatusNodeT< MeshT, SelectionModT< MeshT > >.
Definition at line 157 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.
Definition at line 162 of file BaseNode.cc.
References children_.
Referenced by BaseObjectData::cleanup(), and BaseObjectData::~BaseObjectData().
| virtual void ACG::SceneGraph::BaseNode::draw | ( | GLState & | , | |
| unsigned int | ||||
| ) | [inline, virtual] |
Draw this node using the draw modes _drawMode
Reimplemented in ACG::SceneGraph::BoundingBoxNode, ACG::SceneGraph::CoordFrameNode, ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::GridNode, ACG::SceneGraph::LineNode, ACG::SceneGraph::ManipulatorNode, ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::OBJNode, ACG::SceneGraph::PlaneNode, ACG::SceneGraph::PointNode, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::QuadNode, ACG::SceneGraph::SliceNode, ACG::SceneGraph::StatusNodeT< Mesh, Mod >, ACG::SceneGraph::TrackballNode, ACG::SceneGraph::TranslationManipulatorNode, ACG::SceneGraph::TriangleNode, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > >, ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > >, ACG::SceneGraph::StatusNodeT< Mesh, SelectionModT< Mesh > >, ACG::SceneGraph::StatusNodeT< Mesh, LockModT< Mesh > >, ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > >, and ACG::SceneGraph::StatusNodeT< MeshT, SelectionModT< MeshT > >.
Definition at line 168 of file BaseNode.hh.
| void ACG::SceneGraph::BaseNode::drawMode | ( | unsigned int | _drawMode | ) | [inline] |
Set this node's own draw mode. It will be used for drawing instead of the the global draw mode.
Definition at line 371 of file BaseNode.hh.
| void ACG::SceneGraph::BaseNode::enablePicking | ( | bool | _enable | ) | [inline] |
Enable or Disable picking for this node ( default: enabled )
Definition at line 199 of file BaseNode.hh.
Referenced by PlaneObject::enablePicking(), and MeshObject< MeshT, objectDataType >::enablePicking().
| virtual void ACG::SceneGraph::BaseNode::enter | ( | GLState & | , | |
| unsigned int | ||||
| ) | [inline, virtual] |
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.
Reimplemented in ACG::SceneGraph::CartesianClippingNode, ACG::SceneGraph::ClippingNode, ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::LightSourceNode, ACG::SceneGraph::Material2Node, ACG::SceneGraph::MaterialNode, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::StencilRefNode, ACG::SceneGraph::Texture3DNode, ACG::SceneGraph::TextureNode, and ACG::SceneGraph::TransformNode.
Definition at line 165 of file BaseNode.hh.
Referenced by enterPick().
| void ACG::SceneGraph::BaseNode::enterPick | ( | GLState & | _state, | |
| PickTarget | _target, | |||
| unsigned int | _drawMode | |||
| ) | [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.
Reimplemented in ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::MaterialNode, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::StencilRefNode, and ACG::SceneGraph::TextureNode.
Definition at line 172 of file BaseNode.cc.
References enter().
| BaseNode* ACG::SceneGraph::BaseNode::find | ( | const std::string & | _name | ) | [inline] |
Find a node of a given name
Definition at line 296 of file BaseNode.hh.
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 287 of file BaseNode.hh.
Referenced by set_parent(), CoreWidget::slotCoordSysVisibility(), CoreWidget::updatePopupMenuBackground(), and ~BaseNode().
| unsigned int ACG::SceneGraph::BaseNode::id | ( | ) | const [inline] |
Get unique ID of node. IDs are always positive and may be used e.g. for picking.
Definition at line 361 of file BaseNode.hh.
Referenced by PlaneObject::picked(), MeshObject< MeshT, objectDataType >::picked(), and CoreWidget::updatePopupMenuNode().
| virtual void ACG::SceneGraph::BaseNode::leave | ( | GLState & | , | |
| unsigned int | ||||
| ) | [inline, virtual] |
The leave function is used to restore GL states the have been changed. This function must restore the status before enter() !
Reimplemented in ACG::SceneGraph::CartesianClippingNode, ACG::SceneGraph::ClippingNode, ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::LightSourceNode, ACG::SceneGraph::Material2Node, ACG::SceneGraph::MaterialNode, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::StencilRefNode, ACG::SceneGraph::Texture3DNode, ACG::SceneGraph::TextureNode, and ACG::SceneGraph::TransformNode.
Definition at line 173 of file BaseNode.hh.
Referenced by leavePick().
| void ACG::SceneGraph::BaseNode::leavePick | ( | GLState & | _state, | |
| PickTarget | _target, | |||
| unsigned int | _drawMode | |||
| ) | [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.
Reimplemented in ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::MaterialNode, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::StencilRefNode, and ACG::SceneGraph::TextureNode.
Definition at line 180 of file BaseNode.cc.
References leave().
| virtual void ACG::SceneGraph::BaseNode::pick | ( | GLState & | , | |
| PickTarget | ||||
| ) | [inline, virtual] |
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 ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::GridNode, ACG::SceneGraph::ManipulatorNode, ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::OBJNode, ACG::SceneGraph::PlaneNode, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::QuadNode, ACG::SceneGraph::SliceNode, ACG::SceneGraph::StatusNodeT< Mesh, Mod >, ACG::SceneGraph::TranslationManipulatorNode, ACG::SceneGraph::TriangleNode, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > >, ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > >, ACG::SceneGraph::StatusNodeT< Mesh, SelectionModT< Mesh > >, ACG::SceneGraph::StatusNodeT< Mesh, LockModT< Mesh > >, ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > >, and ACG::SceneGraph::StatusNodeT< MeshT, SelectionModT< MeshT > >.
Definition at line 187 of file BaseNode.hh.
| bool ACG::SceneGraph::BaseNode::pickingEnabled | ( | ) | [inline] |
Check if picking is enabled for this node
Definition at line 203 of file BaseNode.hh.
Referenced by PlaneObject::pickingEnabled(), and MeshObject< MeshT, objectDataType >::pickingEnabled().
| void ACG::SceneGraph::BaseNode::remove | ( | ChildIter | _pos | ) | [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 271 of file BaseNode.hh.
Referenced by set_parent(), and ~BaseNode().
| 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.
Definition at line 138 of file BaseNode.cc.
References childrenEnd(), find(), parent_, push_back(), and remove().
Referenced by BaseNode().
bool ACG::SceneGraph::BaseNode::pickingEnabled_ [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 427 of file BaseNode.hh.