[Orxonox-commit 4753] r9422 - code/branches/shaders/src/orxonox/graphics
davidsa at orxonox.net
davidsa at orxonox.net
Mon Oct 29 17:00:19 CET 2012
Author: davidsa
Date: 2012-10-29 17:00:19 +0100 (Mon, 29 Oct 2012)
New Revision: 9422
Modified:
code/branches/shaders/src/orxonox/graphics/Model.cc
code/branches/shaders/src/orxonox/graphics/Model.h
Log:
Added some documentation to orxonox::Model and refined the XML Port for renderQueueGroup
Modified: code/branches/shaders/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/shaders/src/orxonox/graphics/Model.cc 2012-10-29 15:22:11 UTC (rev 9421)
+++ code/branches/shaders/src/orxonox/graphics/Model.cc 2012-10-29 16:00:19 UTC (rev 9422)
@@ -35,6 +35,7 @@
#include "core/GameMode.h"
#include "core/XMLPort.h"
#include "Scene.h"
+#include "RenderQueueListener.h"
#include "graphics/MeshLodInformation.h"
#include "Level.h"
@@ -74,6 +75,28 @@
XMLPortParam(Model, "material", setMaterial, getMaterial, xmlelement, mode);
XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
}
+
+ /**
+ @brief
+ This function turns a string from XML Port into a usable ID for the rendering system
+ It defaults to the main queue if the group isn't recognized.
+
+ @param renderQueueGroup
+ This is a string representing the render queue group. Accepted values:
+ 'main', 'stencil glow', 'stencil object'
+ */
+ const unsigned int Model::getRenderQueueGroupID(const std::string& renderQueueGroup) const
+ {
+ if(renderQueueGroup.compare("stencil glow")==0)
+ {
+ return RENDER_QUEUE_STENCIL_GLOW;
+ }
+ if(renderQueueGroup.compare("stencil object")==0)
+ {
+ return RENDER_QUEUE_STENCIL_OBJECTS;
+ }
+ return RENDER_QUEUE_MAIN;
+ }
void Model::registerVariables()
{
@@ -106,6 +129,7 @@
{
this->attachOgreObject(this->mesh_.getEntity());
this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+ this->mesh_.getEntity()->setRenderQueueGroup(this->renderQueueGroup_);
this->mesh_.setVisible(this->isVisible());
if (this->bGlobalEnableLod_)
Modified: code/branches/shaders/src/orxonox/graphics/Model.h
===================================================================
--- code/branches/shaders/src/orxonox/graphics/Model.h 2012-10-29 15:22:11 UTC (rev 9421)
+++ code/branches/shaders/src/orxonox/graphics/Model.h 2012-10-29 16:00:19 UTC (rev 9422)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file Model.h
+ @brief Definition of Model Class
+*/
+
#ifndef _Model_H__
#define _Model_H__
@@ -40,6 +45,13 @@
{
class _OrxonoxExport Model : public StaticEntity
{
+ /**
+ @brief
+ The class Model stores a Mesh and some additional properties, so you can easily render any Model and apply different effects to it.
+
+ You can assign any Material to any Mesh to completely change the way it looks, to further add versatility you can also assign the Model
+ to a render queue group, to enable proper rendering of fancy effect like glowing edges around objects with alpha blending.
+ */
public:
Model(BaseObject* creator);
virtual ~Model();
@@ -58,9 +70,8 @@
inline const std::string& getMeshSource() const
{ return this->meshSrc_; }
- //TODO: let this function accept strings instead of ints for the XML Port, so we don't have to rely on static int values which may change in future Ogre revisions
- inline void setRenderQueueGroup(const int renderQueueGroup)
- { this->renderQueueGroup_ = renderQueueGroup; this->changedRenderQueueGroup(); }
+ inline void setRenderQueueGroup(const std::string& renderQueueGroup)
+ { this->renderQueueGroup_ = getRenderQueueGroupID(renderQueueGroup); this->changedRenderQueueGroup(); }
inline const int getRenderQueueGroup() const
{ return this->renderQueueGroup_; }
@@ -75,6 +86,17 @@
{ return this->materialName_; }
protected:
+ /**
+ @brief
+ This function turns a string from XML Port into a usable ID for the rendering system
+ It defaults to the main queue if the group isn't recognized.
+
+ @param renderQueueGroup
+ This is a string representing the render queue group. Accepted values:
+ main, stencil glow, stencil object
+ */
+ const unsigned int getRenderQueueGroupID(const std::string& renderQueueGroup) const;
+
void registerVariables();
void changedMesh();
void changedRenderQueueGroup();
@@ -90,18 +112,18 @@
{ return this->lodLevel_; }
float getBiggestScale(Vector3 scale3d);
- std::string meshSrc_;
- Mesh mesh_;
- bool bCastShadows_;
- int renderQueueGroup_;
- std::string materialName_;
+ std::string meshSrc_; //!< This string stores the path where the mesh is stored
+ Mesh mesh_; //!< This is the mesh object linked to this Object, it stores the data from the mesh file in a usable format for the Ogre engine
+ bool bCastShadows_; //!< This value determines whether a Model is casting a shadow or not, turn it off to save performance, when not needed
+ unsigned int renderQueueGroup_; //!< This variable stores which render queue group this object is assigned to
+ std::string materialName_; //!< This string stores the name of the material to be applied to the mesh/model
//LoD
- bool bGlobalEnableLod_;
- float lodLevel_;
- bool bLodEnabled_;
- unsigned int numLodLevels_;
- float lodReductionRate_;
+ bool bGlobalEnableLod_; //!< Has LoD been turned on in the graphics configuration?
+ float lodLevel_; //!< Standard LoD Level
+ bool bLodEnabled_; //!< Is LoD to be used on this model?
+ unsigned int numLodLevels_; //!< How many LoD does this model feature
+ float lodReductionRate_; //!< How fast should be switched to lower LoDs
};
}
More information about the Orxonox-commit
mailing list