[Orxonox-commit 6480] r11126 - code/branches/ogre1.9/src/orxonox/graphics
landauf at orxonox.net
landauf at orxonox.net
Sun Feb 21 22:21:46 CET 2016
Author: landauf
Date: 2016-02-21 22:21:46 +0100 (Sun, 21 Feb 2016)
New Revision: 11126
Modified:
code/branches/ogre1.9/src/orxonox/graphics/AnimatedModel.cc
code/branches/ogre1.9/src/orxonox/graphics/Model.h
Log:
small refactoring: make variables in Model private
Modified: code/branches/ogre1.9/src/orxonox/graphics/AnimatedModel.cc
===================================================================
--- code/branches/ogre1.9/src/orxonox/graphics/AnimatedModel.cc 2016-02-21 21:09:24 UTC (rev 11125)
+++ code/branches/ogre1.9/src/orxonox/graphics/AnimatedModel.cc 2016-02-21 21:21:46 UTC (rev 11126)
@@ -48,8 +48,8 @@
AnimatedModel::~AnimatedModel()
{
- if (this->isInitialized() && this->mesh_.getEntity())
- this->detachOgreObject(this->mesh_.getEntity());
+ if (this->isInitialized() && this->getMesh().getEntity())
+ this->detachOgreObject(this->getMesh().getEntity());
}
void AnimatedModel::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -65,17 +65,17 @@
{
if (GameMode::showsGraphics())
{
- if (this->mesh_.getEntity())
- this->detachOgreObject(this->mesh_.getEntity());
+ if (this->getMesh().getEntity())
+ this->detachOgreObject(this->getMesh().getEntity());
- this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
+ this->getMesh().setMeshSource(this->getScene()->getSceneManager(), this->getMeshSource());
- if (this->mesh_.getEntity())
+ if (this->getMesh().getEntity())
{
- this->attachOgreObject(this->mesh_.getEntity());
- this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+ this->attachOgreObject(this->getMesh().getEntity());
+ this->getMesh().getEntity()->setCastShadows(this->getCastShadows());
this->setAnimationState(this->bAnimLoop_, this->bAnimEnabled_, this->anims_);
- this->mesh_.setVisible(this->isVisible());
+ this->getMesh().setVisible(this->isVisible());
}
}
}
@@ -88,9 +88,9 @@
{
if(state!="")
{
- if(this->mesh_.getEntity()->getAnimationState(state))
+ if(this->getMesh().getEntity()->getAnimationState(state))
{
- Ogre::AnimationState* as = this->mesh_.getEntity()->getAnimationState(state);
+ Ogre::AnimationState* as = this->getMesh().getEntity()->getAnimationState(state);
as->setLoop(loop);
as->setEnabled(enabled);
this->anims_ = state;
@@ -108,11 +108,11 @@
}
void AnimatedModel::tick(float dt)
{
- if(this->mesh_.getEntity()->getAnimationState(anims_))
+ if(this->getMesh().getEntity()->getAnimationState(anims_))
{
// Test to change Material at runtime!
-// Ogre::MaterialPtr mat = this->mesh_.getEntity()->getSubEntity(0)->getMaterial();
+// Ogre::MaterialPtr mat = this->getMesh().getEntity()->getSubEntity(0)->getMaterial();
// mat->setDiffuse(0.4, 0.3, 0.1, 0.1);
// mat->setAmbient(0.3, 0.7, 0.8);
// mat->setSpecular(0.5, 0.5, 0.5, 0.1);
@@ -120,7 +120,7 @@
//
// mat->setSceneBlending(sbt);
- Ogre::AnimationState* as = this->mesh_.getEntity()->getAnimationState(anims_);
+ Ogre::AnimationState* as = this->getMesh().getEntity()->getAnimationState(anims_);
as->addTime(dt);
}
}
Modified: code/branches/ogre1.9/src/orxonox/graphics/Model.h
===================================================================
--- code/branches/ogre1.9/src/orxonox/graphics/Model.h 2016-02-21 21:09:24 UTC (rev 11125)
+++ code/branches/ogre1.9/src/orxonox/graphics/Model.h 2016-02-21 21:21:46 UTC (rev 11126)
@@ -86,6 +86,10 @@
{ return this->materialName_; }
protected:
+ inline Mesh& getMesh()
+ { return this->mesh_; }
+
+ private:
/**
@brief
This function turns a string from XML Port into a usable ID for the rendering system
More information about the Orxonox-commit
mailing list