#include <OpenFlipper/common/BaseObjectData.hh>


Public Member Functions | |
| BaseObjectData (const BaseObjectData &_object) | |
| copy constructor | |
| BaseObjectData () | |
| constructor | |
| virtual | ~BaseObjectData () |
| destructor | |
Data | |
| virtual void | cleanup () |
Picking | |
| virtual bool | picked (uint _node_idx) |
| detect if the node has been picked | |
| virtual void | enablePicking (bool _enable) |
| virtual bool | pickingEnabled () |
Content | |
| virtual void | update () |
| This function is called to update the object. | |
Protected Member Functions | |
| virtual void | init () |
Name and Path handling | |
|
| |
| QString | path_ |
| path to the file from which the object is loaded ( defaults to "." ) | |
| void | setFromFileName (QString _filename) |
| virtual void | setName (QString _name) |
| set the name of the object. ( If you overwrite it, call BaseObjectData::setName(_name ) it in your funtion first) | |
| QString | path () |
| return the path to the object ( defaults to "." if unset ) | |
| void | setPath (QString _path) |
| set the path to the object. | |
Object visualization | |
|
| |
| bool | manipPlaced_ |
| SeparatorNode * | rootNode_ |
| rootNode of global Scenegraph structure | |
| SeparatorNode * | separatorNode_ |
| Separator at top of Scenegraph structure used for this Object. | |
| QtTranslationManipulatorNode * | manipulatorNode_ |
| Manipulator used for this Object. | |
| MaterialNode * | materialNode_ |
| Scenegraph Material Node for the object. | |
| BoundingBoxNode * | boundingBoxNode_ |
| Bounding box node for the object. | |
| StencilRefNode * | stencilRefNode_ |
| Stencil reference node for the object. | |
| virtual void | show () |
| Sets the whole Scenegraph subtree of this node to visible. | |
| virtual void | hide () |
| Sets the whole Scenegraph subtree of this node to invisible. | |
| virtual bool | visible () |
| return visiblity | |
| virtual void | visible (bool _visible) |
| Sets visiblity of the whole Scenegraph subtree of this node. | |
| SeparatorNode * | baseNode () |
| virtual bool | hasNode (BaseNode *_node) |
| Check if the given node is owned by this object. | |
| virtual BaseNode * | primaryNode () |
| QtTranslationManipulatorNode * | manipulatorNode () |
| virtual ACG::SceneGraph::ShaderNode * | shaderNode () |
| MaterialNode * | materialNode () |
| get a pointer to the materialnode | |
| BoundingBoxNode * | boundingBoxNode () |
| get a pointer to the bounding box node | |
| StencilRefNode * | stencilRefNode () |
| get a pointer to the stencil reference node | |
| void | setBaseColor (ACG::Vec4f _color) |
| Set the color of the object. | |
| bool | manipPlaced () |
| Check if the manipulator has been placed. | |
| void | manipPlaced (bool _placed) |
| set the manipulator place status | |
| void | getBoundingBox (ACG::Vec3d &bbmin, ACG::Vec3d &bbmax) |
| get the bounding box of the object | |
Additional nodes | |
|
| |
| std::vector< std::pair < BaseNode *, QString > > | additionalNodes_ |
| template<typename NodeT > | |
| bool | addAdditionalNode (NodeT *_node, QString _pluginName, QString _nodeName, int _id=0) |
| add an additional node to the object | |
| bool | hasAdditionalNode (QString _pluginName, QString _nodeName, int _id=0) |
| check if an object has the additional node | |
| template<typename NodeT > | |
| bool | getAdditionalNode (NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0) |
| get an addition node from the object | |
| template<typename NodeT > | |
| bool | removeAdditionalNode (NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0) |
| remove an additional node from the object | |
This is the basic Data class providing the functions common to all objects which show Objects in the SceneGraph
Definition at line 98 of file BaseObjectData.hh.
| BaseObjectData::BaseObjectData | ( | const BaseObjectData & | _object | ) |
copy constructor
Create new basic scenegraph nodes for this object
Definition at line 66 of file BaseObjectData.cc.
References init().
| bool BaseObjectData::addAdditionalNode | ( | NodeT * | _node, | |
| QString | _pluginName, | |||
| QString | _nodeName, | |||
| int | _id = 0 | |||
| ) | [inline] |
add an additional node to the object
This function can be used to store an additional Scenegraph node. If you add nodes there, you do not need to keep track of deleted, added objects, as this will be done in the main application. You have to create the node yourself as this function does not know the type. You should add the new node below the manipulatorNode ( BaseObjectData::manipulatorNode() ) if you want that it moves with the rest of the data. Otherwise add it below the baseNode ( BaseObjectData::baseNode() of the object.
| _node | Node to add | |
| _pluginName | Name of the current plugin | |
| _nodeName | Name of the New Node | |
| _id | extra index, if there will be multiple nodes with this name( defaults to 0) |
Definition at line 68 of file BaseObjectDataT.cc.
References additionalNodes_, hasAdditionalNode(), and BaseObject::name().
| SeparatorNode * BaseObjectData::baseNode | ( | ) |
get the base node of this object (Use this node to add custom Nodes to the Object which should not be transformed with the manipulator of the Object)
Definition at line 232 of file BaseObjectData.cc.
References separatorNode_.
Referenced by init().
| void BaseObjectData::cleanup | ( | ) | [virtual] |
Clean all data structures of the object
Reimplemented from BaseObject.
Reimplemented in BSplineCurveObject, BSplineSurfaceObject, LightObject, MeshObject< MeshT >, PlaneObject, and SphereObject.
Definition at line 102 of file BaseObjectData.cc.
References additionalNodes_, boundingBoxNode_, ACG::SceneGraph::ACG::SceneGraph::BaseNode::delete_subtree(), init(), manipulatorNode_, materialNode_, path_, and separatorNode_.
| void BaseObjectData::enablePicking | ( | bool | _enable | ) | [virtual] |
Enable or disable picking for this Node The basic function defined here does nothing. It has to be reimplemented in the derived class
Reimplemented in BSplineCurveObject, BSplineSurfaceObject, LightObject, MeshObject< MeshT >, PlaneObject, and SphereObject.
Definition at line 314 of file BaseObjectData.cc.
| bool BaseObjectData::getAdditionalNode | ( | NodeT *& | _node, | |
| QString | _pluginName, | |||
| QString | _nodeName, | |||
| int | _id = 0 | |||
| ) | [inline] |
get an addition node from the object
If you store additional Scenegraph node with the objects you can get these nodes with this function.
| _node | Returns the node | |
| _pluginName | Name of the current plugin | |
| _nodeName | Name of the Node | |
| _id | extra index, if there are multiple nodes with this name ( defaults to 0) |
Definition at line 85 of file BaseObjectDataT.cc.
References additionalNodes_.
| bool BaseObjectData::hasAdditionalNode | ( | QString | _pluginName, | |
| QString | _nodeName, | |||
| int | _id = 0 | |||
| ) |
check if an object has the additional node
If you store additional Scenegraph nodes with the objects you can check if they exist with this function.
| _pluginName | Name of the current plugin | |
| _nodeName | Name of the Node | |
| _id | extra index, if there are multiple nodes with this name( defaults to 0) |
Definition at line 333 of file BaseObjectData.cc.
References additionalNodes_.
Referenced by addAdditionalNode().
| bool BaseObjectData::hasNode | ( | BaseNode * | _node | ) | [virtual] |
Check if the given node is owned by this object.
You can overload this function and return true, if your object generated the given node. Don't forget to call this baseclass function on overload!
Reimplemented in LightObject.
Definition at line 236 of file BaseObjectData.cc.
References BaseObject::child(), ACG::SceneGraph::BaseNode::childrenBegin(), ACG::SceneGraph::BaseNode::childrenEnd(), ACG::SceneGraph::BaseNode::find(), ACG::SceneGraph::BaseNode::push_back(), and separatorNode_.
Referenced by LightObject::hasNode().
| void BaseObjectData::init | ( | ) | [protected, virtual] |
This function creates the scenegraph nodes
Definition at line 122 of file BaseObjectData.cc.
References baseNode(), boundingBoxNode(), boundingBoxNode_, ACG::SceneGraph::BaseNode::HideNode, ACG::SceneGraph::ACG::SceneGraph::BaseNode::HideNode, manipulatorNode(), manipulatorNode_, materialNode_, rootNode_, separatorNode_, ACG::SceneGraph::ACG::SceneGraph::BaseNode::set_status(), ACG::SceneGraph::QtTranslationManipulatorNode::setIdentifier(), stencilRefNode(), and stencilRefNode_.
Referenced by BaseObjectData(), BSplineCurveObject::BSplineCurveObject(), BSplineSurfaceObject::BSplineSurfaceObject(), cleanup(), SphereObject::cleanup(), PlaneObject::cleanup(), MeshObject< MeshT >::cleanup(), LightObject::cleanup(), BSplineSurfaceObject::cleanup(), BSplineCurveObject::cleanup(), LightObject::LightObject(), MeshObject< MeshT >::MeshObject(), PlaneObject::PlaneObject(), and SphereObject::SphereObject().
| QtTranslationManipulatorNode * BaseObjectData::manipulatorNode | ( | ) |
get the ManipulatorNode node of this object (Use this node to add custom Nodes to the Object which should be transformed with the manipulator of the Object)
Definition at line 262 of file BaseObjectData.cc.
References manipulatorNode_.
Referenced by init(), MeshObject< MeshT >::init(), and MouseAndKeyPlugin::slotKeyEvent().
| bool BaseObjectData::pickingEnabled | ( | ) | [virtual] |
Check if picking is enabled for this Node This function will return true unless the derived class overwrites this function.
Reimplemented in BSplineCurveObject, BSplineSurfaceObject, LightObject, MeshObject< MeshT >, PlaneObject, and SphereObject.
Definition at line 317 of file BaseObjectData.cc.
| BaseNode * BaseObjectData::primaryNode | ( | ) | [virtual] |
get the primary node of this object (Use this node to change drawModes)
Reimplemented in MeshObject< MeshT >.
Definition at line 258 of file BaseObjectData.cc.
References separatorNode_.
| bool BaseObjectData::removeAdditionalNode | ( | NodeT *& | _node, | |
| QString | _pluginName, | |||
| QString | _nodeName, | |||
| int | _id = 0 | |||
| ) | [inline] |
remove an additional node from the object
If additional nodes are stored for this object, such a node can be removed using this function. If this node has children, they will be removed from the scenegraph as well (and their memory is freed).
| _node | Needed for type specification | |
| _pluginName | Name of the current plugin | |
| _nodeName | Name of the Node | |
| _id | extra index, if there are multiple nodes with this name ( defaults to 0) |
Definition at line 100 of file BaseObjectDataT.cc.
References additionalNodes_.
| void BaseObjectData::setFromFileName | ( | QString | _filename | ) |
Set the object name from a filename. The function will set the name of the object to the filename. At the same time the path is set to the one given in the parameter
| _filename | path to the file. |
Definition at line 157 of file BaseObjectData.cc.
References path_, and setName().
Referenced by MeshObject< MeshT >::loadMesh().
| ACG::SceneGraph::ShaderNode * BaseObjectData::shaderNode | ( | ) | [virtual] |
Return pointer to the shader node If you want to support shaders, you have to add a shader node into your scenegraph structure above your object to be rendered. If you do not have a shader, just ignore this function and it will return a 0 pointer.
Reimplemented in BSplineSurfaceObject, and MeshObject< MeshT >.
Definition at line 266 of file BaseObjectData.cc.
| void BaseObjectData::update | ( | ) | [virtual] |
This function is called to update the object.
If the object changes, the core will call this function. Normally this will update the corresponding scenegraph nodes or trigger other data handling which has to be done when the object changes.
Definition at line 324 of file BaseObjectData.cc.
Referenced by MeshObject< MeshT >::init(), and MeshObject< MeshT >::loadMesh().
std::vector< std::pair <BaseNode*,QString> > BaseObjectData::additionalNodes_ [private] |
This pointer may be used to store additional Nodes belonging to this Object The String should be used by the plugin to identify its Nodes
Definition at line 365 of file BaseObjectData.hh.
Referenced by addAdditionalNode(), cleanup(), getAdditionalNode(), hasAdditionalNode(), and removeAdditionalNode().
1.6.3