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)
rootNode_(_object.rootNode_),
separatorNode_(0),
manipulatorNode_(0),
materialNode_(0)
materialNode_(0),
boundingBoxNode_(0)
{
// We have to create our own visualization nodes as we are a new object
init();
......@@ -68,7 +69,8 @@ BaseObjectData::BaseObjectData( SeparatorNode* _rootNode ) :
rootNode_(_rootNode),
separatorNode_(0),
manipulatorNode_(0),
materialNode_(0)
materialNode_(0),
boundingBoxNode_(0)
{
init();
}
......@@ -91,7 +93,7 @@ void BaseObjectData::cleanup() {
separatorNode_ = 0;
manipulatorNode_ = 0;
materialNode_ = 0;
boundingBoxNode_ = 0;
additionalNodes_.clear();
}
......@@ -116,8 +118,13 @@ void BaseObjectData::init() {
}
else
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 )
materialNode_ = new MaterialNode(manipulatorNode(), "New Material");
materialNode_ = new MaterialNode(boundingBoxNode(), "New Material");
}
......@@ -140,6 +147,9 @@ void BaseObjectData::setName( QString _name ) {
nodename = std::string("ManipulatorNode for object " + _name.toUtf8());
manipulatorNode_->name( nodename );
nodename = std::string("BoundingBoxNode for object " + _name.toUtf8());
boundingBoxNode_->name( nodename );
nodename = std::string(_name.toUtf8() + "'s Material" );
materialNode_->name( nodename );
}
......@@ -197,6 +207,11 @@ MaterialNode* BaseObjectData::materialNode() {
return materialNode_;
}
BoundingBoxNode* BaseObjectData::boundingBoxNode() {
return boundingBoxNode_;
}
void BaseObjectData::setBaseColor(ACG::Vec4f _color) {
materialNode_->set_base_color(_color);
}
......
......@@ -58,6 +58,7 @@
#include <ACG/Scenegraph/SeparatorNode.hh>
#include <ACG/Scenegraph/ShaderNode.hh>
#include <ACG/Scenegraph/BaseNode.hh>
#include <ACG/Scenegraph/BoundingBoxNode.hh>
#include <ACG/QtScenegraph/QtTranslationManipulatorNode.hh>
//== TYPEDEFS =================================================================
......@@ -71,6 +72,8 @@ typedef ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulat
typedef ACG::SceneGraph::SeparatorNode SeparatorNode;
/// Base Node
typedef ACG::SceneGraph::BaseNode BaseNode;
/// Bounding box Node
typedef ACG::SceneGraph::BoundingBoxNode BoundingBoxNode;
//== CLASS DEFINITION =========================================================
......@@ -183,6 +186,9 @@ class DLLEXPORT BaseObjectData : public BaseObject
/// get a pointer to the materialnode
MaterialNode* materialNode();
/// get a pointer to the bounding box node
BoundingBoxNode* boundingBoxNode();
/// Set the color of the object
void setBaseColor(ACG::Vec4f _color);
......@@ -212,6 +218,9 @@ class DLLEXPORT BaseObjectData : public BaseObject
/// Scenegraph Material Node for the object
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