[Orxonox-commit 6913] r11534 - in code/branches/SOBv2_HS17/src: libraries/tools modules/superorxobros orxonox/graphics
varxth at orxonox.net
varxth at orxonox.net
Mon Nov 6 14:51:31 CET 2017
Author: varxth
Date: 2017-11-06 14:51:31 +0100 (Mon, 06 Nov 2017)
New Revision: 11534
Modified:
code/branches/SOBv2_HS17/src/libraries/tools/Mesh.cc
code/branches/SOBv2_HS17/src/libraries/tools/Mesh.h
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
code/branches/SOBv2_HS17/src/orxonox/graphics/Model.cc
code/branches/SOBv2_HS17/src/orxonox/graphics/Model.h
Log:
added setSubMaterial(...) to Model.cc and Mesh.cc
Modified: code/branches/SOBv2_HS17/src/libraries/tools/Mesh.cc
===================================================================
--- code/branches/SOBv2_HS17/src/libraries/tools/Mesh.cc 2017-11-06 13:12:57 UTC (rev 11533)
+++ code/branches/SOBv2_HS17/src/libraries/tools/Mesh.cc 2017-11-06 13:51:31 UTC (rev 11534)
@@ -78,6 +78,8 @@
}
}
+
+
void Mesh::setCastShadows(bool bCastShadows)
{
this->bCastShadows_ = bCastShadows;
@@ -99,6 +101,17 @@
this->entity_->setMaterialName(name);
}
+ // PRE: a valid Ogre::Entity* entity with a valid subentity at index
+ // POST: changed material of subentity at index to name
+ void Mesh::setSubMaterial(const std::string& name, const int index){
+ if (this->entity_ && this->entity_->getSubEntity(index))
+ {
+ this->entity_->getSubEntity(index)->setMaterialName(name);
+ }
+ else
+ orxout() << "ERROR at Index " << index << endl;
+ }
+
const std::string& Mesh::getMaterial() const
{
if (this->entity_)
Modified: code/branches/SOBv2_HS17/src/libraries/tools/Mesh.h
===================================================================
--- code/branches/SOBv2_HS17/src/libraries/tools/Mesh.h 2017-11-06 13:12:57 UTC (rev 11533)
+++ code/branches/SOBv2_HS17/src/libraries/tools/Mesh.h 2017-11-06 13:51:31 UTC (rev 11534)
@@ -49,7 +49,7 @@
void setMaterial(const std::string& name);
const std::string& getMaterial() const;
-
+ void setSubMaterial(const std::string& name, const int index);
void setVisible(bool bVisible);
bool isVisible() const;
Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc 2017-11-06 13:12:57 UTC (rev 11533)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc 2017-11-06 13:51:31 UTC (rev 11534)
@@ -120,7 +120,7 @@
if (FiguresModel != nullptr)
{
std::string name = "orxo_material_gross";
- FiguresModel->setMaterial(name);
+ FiguresModel->setSubMaterial(name, 0);
}
}
}
Modified: code/branches/SOBv2_HS17/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/SOBv2_HS17/src/orxonox/graphics/Model.cc 2017-11-06 13:12:57 UTC (rev 11533)
+++ code/branches/SOBv2_HS17/src/orxonox/graphics/Model.cc 2017-11-06 13:51:31 UTC (rev 11534)
@@ -1,3 +1,4 @@
+
/*
* ORXONOX - the hottest 3D action shooter ever to exist
* > www.orxonox.net <
@@ -156,7 +157,13 @@
this->mesh_.setMaterial(this->materialName_);
}
+ // PRE: a valid Ogre::Entity* entity with a valid subentity at index
+ // POST: changed material of subentity at index to name
+ void Model::setSubMaterial(const std::string& name, const int index){
+ this->mesh_.setSubMaterial(name, index);
+ }
+
void Model::changedShadows()
{
this->mesh_.setCastShadows(this->bCastShadows_);
Modified: code/branches/SOBv2_HS17/src/orxonox/graphics/Model.h
===================================================================
--- code/branches/SOBv2_HS17/src/orxonox/graphics/Model.h 2017-11-06 13:12:57 UTC (rev 11533)
+++ code/branches/SOBv2_HS17/src/orxonox/graphics/Model.h 2017-11-06 13:51:31 UTC (rev 11534)
@@ -85,6 +85,9 @@
inline const std::string& getMaterial() const
{ return this->materialName_; }
+ void setSubMaterial(const std::string& name, const int index);
+
+
protected:
/**
@brief
More information about the Orxonox-commit
mailing list