Commit 575129eb authored by Jan Möbius's avatar Jan Möbius

Added function to get shadernode from baseObjectData if available

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@2994 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 55106a3d
......@@ -12,12 +12,12 @@
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
......@@ -50,11 +50,11 @@
//== TYPEDEFS =================================================================
//== CLASS DEFINITION =========================================================
BaseObjectData::BaseObjectData( SeparatorNode* _rootNode ) :
BaseObject(),
path_("."),
rootNode_(_rootNode),
rootNode_(_rootNode),
separatorNode_(0),
manipulatorNode_(0),
materialNode_(0)
......@@ -66,12 +66,12 @@ BaseObjectData::~BaseObjectData() {
if ( separatorNode_ != 0 ) {
separatorNode_->delete_subtree();
}
}
void BaseObjectData::cleanup() {
path_ = ".";
// Delete everything below the seperator node on top of the object. This will remove the complete subtree.
if ( separatorNode_ == 0 )
std::cerr << "cleanup : separatorNode_ is already 0" << std::endl;
......@@ -80,12 +80,12 @@ void BaseObjectData::cleanup() {
separatorNode_ = 0;
manipulatorNode_ = 0;
materialNode_ = 0;
additionalNodes_.clear();
}
BaseObject::cleanup();
BaseObjectData::init();
}
......@@ -93,14 +93,14 @@ void BaseObjectData::init() {
// Create seperatorNode for Object only if it does not exist.
if ( separatorNode_ == 0 )
separatorNode_ = new SeparatorNode((BaseNode*)rootNode_,"NEW Object");
else
else
std::cerr << "Separator Node already exists. this should not happen!" << std::endl;
if ( manipulatorNode_ == 0 ) {
manipulatorNode_ = new ManipulatorNode(baseNode(),"NEW ManipulatorNode");
manipulatorNode_->set_status( ACG::SceneGraph::ManipulatorNode::HideNode );
}
else
else
std::cerr << "Manipulator Node already exists. this should not happen!" << std::endl;
if ( materialNode_ == 0 )
materialNode_ = new MaterialNode(manipulatorNode(), "New Material");
......@@ -119,13 +119,13 @@ void BaseObjectData::setFromFileName(QString _filename ) {
void BaseObjectData::setName( QString _name ) {
BaseObject::setName( _name );
std::string nodename = std::string("SeparatorNode for object " + _name.toUtf8());
separatorNode_->name( nodename );
nodename = std::string("ManipulatorNode for object " + _name.toUtf8());
manipulatorNode_->name( nodename );
nodename = std::string(_name.toUtf8() + "'s Material" );
materialNode_->name( nodename );
}
......@@ -136,7 +136,7 @@ QString BaseObjectData::path(){
}
void BaseObjectData::path(QString _path ) {
path_ = _path;
path_ = _path;
}
// ===============================================================================
......@@ -144,29 +144,33 @@ void BaseObjectData::path(QString _path ) {
// ===============================================================================
void BaseObjectData::show() {
separatorNode_->set_status( ACG::SceneGraph::BaseNode::Active );
separatorNode_->set_status( ACG::SceneGraph::BaseNode::Active );
visible_ = true;
}
void BaseObjectData::hide() {
separatorNode_->set_status( ACG::SceneGraph::BaseNode::HideSubtree );
separatorNode_->set_status( ACG::SceneGraph::BaseNode::HideSubtree );
visible_ = false;
}
SeparatorNode* BaseObjectData::baseNode() {
return separatorNode_;
return separatorNode_;
}
ManipulatorNode* BaseObjectData::manipulatorNode() {
return manipulatorNode_;
return manipulatorNode_;
}
ACG::SceneGraph::ShaderNode* BaseObjectData::shaderNode() {
return 0;
}
MaterialNode* BaseObjectData::materialNode() {
return materialNode_;
return materialNode_;
}
void BaseObjectData::setBaseColor(ACG::Vec4f _color) {
materialNode_->set_base_color(_color);
materialNode_->set_base_color(_color);
}
bool BaseObjectData::manipPlaced() {
......@@ -188,11 +192,11 @@ void BaseObjectData::getBoundingBox(ACG::Vec3d& bbmin, ACG::Vec3d& bbmax){
}
// ===============================================================================
// Picking
// Picking
// ===============================================================================
bool BaseObjectData::picked( uint /* _node_idx */ ) {
return false;
return false;
}
void BaseObjectData::enablePicking( bool /*_enable*/ ) {
......@@ -219,14 +223,14 @@ bool BaseObjectData::hasAdditionalNode(QString _pluginName, QString _nodeName ,
QString index;
index.setNum(_id);
QString searchname = _pluginName+"#"+_nodeName+"#"+index;
for ( uint i =0 ; i < additionalNodes_.size() ; ++i ) {
if (additionalNodes_[i].second == searchname )
return true;
}
return false;
}
//=============================================================================
This diff is collapsed.
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