Commit 533710d1 authored by Jan Möbius's avatar Jan Möbius

Dennis: Added-bounding-box-node-to-object-data

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6113 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2f4cf842
...@@ -55,7 +55,8 @@ BaseObjectData::BaseObjectData(const BaseObjectData& _object) ...@@ -55,7 +55,8 @@ BaseObjectData::BaseObjectData(const BaseObjectData& _object)
rootNode_(_object.rootNode_), rootNode_(_object.rootNode_),
separatorNode_(0), separatorNode_(0),
manipulatorNode_(0), manipulatorNode_(0),
materialNode_(0) materialNode_(0),
boundingBoxNode_(0)
{ {
// We have to create our own visualization nodes as we are a new object // We have to create our own visualization nodes as we are a new object
init(); init();
...@@ -68,7 +69,8 @@ BaseObjectData::BaseObjectData( SeparatorNode* _rootNode ) : ...@@ -68,7 +69,8 @@ BaseObjectData::BaseObjectData( SeparatorNode* _rootNode ) :
rootNode_(_rootNode), rootNode_(_rootNode),
separatorNode_(0), separatorNode_(0),
manipulatorNode_(0), manipulatorNode_(0),
materialNode_(0) materialNode_(0),
boundingBoxNode_(0)
{ {
init(); init();
} }
...@@ -91,7 +93,7 @@ void BaseObjectData::cleanup() { ...@@ -91,7 +93,7 @@ void BaseObjectData::cleanup() {
separatorNode_ = 0; separatorNode_ = 0;
manipulatorNode_ = 0; manipulatorNode_ = 0;
materialNode_ = 0; materialNode_ = 0;
boundingBoxNode_ = 0;
additionalNodes_.clear(); additionalNodes_.clear();
} }
...@@ -116,8 +118,13 @@ void BaseObjectData::init() { ...@@ -116,8 +118,13 @@ void BaseObjectData::init() {
} }
else else
std::cerr << "Manipulator Node already exists. this should not happen!" << std::endl; std::cerr << "Manipulator Node already exists. this should not happen!" << std::endl;
if ( boundingBoxNode_ == 0)
{
boundingBoxNode_ = new BoundingBoxNode(manipulatorNode(), "New Bounding Box");
boundingBoxNode_->set_status( ACG::SceneGraph::BaseNode::HideNode );
}
if ( materialNode_ == 0 ) if ( materialNode_ == 0 )
materialNode_ = new MaterialNode(manipulatorNode(), "New Material"); materialNode_ = new MaterialNode(boundingBoxNode(), "New Material");
} }
...@@ -140,6 +147,9 @@ void BaseObjectData::setName( QString _name ) { ...@@ -140,6 +147,9 @@ void BaseObjectData::setName( QString _name ) {
nodename = std::string("ManipulatorNode for object " + _name.toUtf8()); nodename = std::string("ManipulatorNode for object " + _name.toUtf8());
manipulatorNode_->name( nodename ); manipulatorNode_->name( nodename );
nodename = std::string("BoundingBoxNode for object " + _name.toUtf8());
boundingBoxNode_->name( nodename );
nodename = std::string(_name.toUtf8() + "'s Material" ); nodename = std::string(_name.toUtf8() + "'s Material" );
materialNode_->name( nodename ); materialNode_->name( nodename );
} }
...@@ -197,6 +207,11 @@ MaterialNode* BaseObjectData::materialNode() { ...@@ -197,6 +207,11 @@ MaterialNode* BaseObjectData::materialNode() {
return materialNode_; return materialNode_;
} }
BoundingBoxNode* BaseObjectData::boundingBoxNode() {
return boundingBoxNode_;
}
void BaseObjectData::setBaseColor(ACG::Vec4f _color) { void BaseObjectData::setBaseColor(ACG::Vec4f _color) {
materialNode_->set_base_color(_color); materialNode_->set_base_color(_color);
} }
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include <ACG/Scenegraph/SeparatorNode.hh> #include <ACG/Scenegraph/SeparatorNode.hh>
#include <ACG/Scenegraph/ShaderNode.hh> #include <ACG/Scenegraph/ShaderNode.hh>
#include <ACG/Scenegraph/BaseNode.hh> #include <ACG/Scenegraph/BaseNode.hh>
#include <ACG/Scenegraph/BoundingBoxNode.hh>
#include <ACG/QtScenegraph/QtTranslationManipulatorNode.hh> #include <ACG/QtScenegraph/QtTranslationManipulatorNode.hh>
//== TYPEDEFS ================================================================= //== TYPEDEFS =================================================================
...@@ -71,6 +72,8 @@ typedef ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulat ...@@ -71,6 +72,8 @@ typedef ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulat
typedef ACG::SceneGraph::SeparatorNode SeparatorNode; typedef ACG::SceneGraph::SeparatorNode SeparatorNode;
/// Base Node /// Base Node
typedef ACG::SceneGraph::BaseNode BaseNode; typedef ACG::SceneGraph::BaseNode BaseNode;
/// Bounding box Node
typedef ACG::SceneGraph::BoundingBoxNode BoundingBoxNode;
//== CLASS DEFINITION ========================================================= //== CLASS DEFINITION =========================================================
...@@ -183,6 +186,9 @@ class DLLEXPORT BaseObjectData : public BaseObject ...@@ -183,6 +186,9 @@ class DLLEXPORT BaseObjectData : public BaseObject
/// get a pointer to the materialnode /// get a pointer to the materialnode
MaterialNode* materialNode(); MaterialNode* materialNode();
/// get a pointer to the bounding box node
BoundingBoxNode* boundingBoxNode();
/// Set the color of the object /// Set the color of the object
void setBaseColor(ACG::Vec4f _color); void setBaseColor(ACG::Vec4f _color);
...@@ -212,6 +218,9 @@ class DLLEXPORT BaseObjectData : public BaseObject ...@@ -212,6 +218,9 @@ class DLLEXPORT BaseObjectData : public BaseObject
/// Scenegraph Material Node for the object /// Scenegraph Material Node for the object
MaterialNode* materialNode_; MaterialNode* materialNode_;
/// Bounding box node for the object
BoundingBoxNode * boundingBoxNode_;
/** @} */ /** @} */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment