Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9422


Ignore:
Timestamp:
Oct 29, 2012, 5:00:19 PM (12 years ago)
Author:
davidsa
Message:

Added some documentation to orxonox::Model and refined the XML Port for renderQueueGroup

Location:
code/branches/shaders/src/orxonox/graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/shaders/src/orxonox/graphics/Model.cc

    r9407 r9422  
    3636#include "core/XMLPort.h"
    3737#include "Scene.h"
     38#include "RenderQueueListener.h"
    3839#include "graphics/MeshLodInformation.h"
    3940#include "Level.h"
     
    7475        XMLPortParam(Model, "material", setMaterial, getMaterial, xmlelement, mode);
    7576        XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
     77    }
     78   
     79    /**
     80    @brief
     81        This function turns a string from XML Port into a usable ID for the rendering system
     82        It defaults to the main queue if the group isn't recognized.
     83       
     84    @param renderQueueGroup
     85        This is a string representing the render queue group. Accepted values:
     86        'main', 'stencil glow', 'stencil object'
     87    */
     88    const unsigned int Model::getRenderQueueGroupID(const std::string& renderQueueGroup) const
     89    {
     90        if(renderQueueGroup.compare("stencil glow")==0)
     91        {
     92            return RENDER_QUEUE_STENCIL_GLOW;
     93        }
     94        if(renderQueueGroup.compare("stencil object")==0)
     95        {
     96            return RENDER_QUEUE_STENCIL_OBJECTS;
     97        }
     98        return RENDER_QUEUE_MAIN;
    7699    }
    77100
     
    107130                this->attachOgreObject(this->mesh_.getEntity());
    108131                this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
     132                this->mesh_.getEntity()->setRenderQueueGroup(this->renderQueueGroup_);
    109133                this->mesh_.setVisible(this->isVisible());
    110134
  • code/branches/shaders/src/orxonox/graphics/Model.h

    r9407 r9422  
    2727 */
    2828
     29/**
     30  @file Model.h
     31  @brief Definition of Model Class
     32*/
     33
    2934#ifndef _Model_H__
    3035#define _Model_H__
     
    4146    class _OrxonoxExport Model : public StaticEntity
    4247    {
     48        /**
     49        @brief
     50            The class Model stores a Mesh and some additional properties, so you can easily render any Model and apply different effects to it.
     51           
     52            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
     53            to a render queue group, to enable proper rendering of fancy effect like glowing edges around objects with alpha blending.
     54        */
    4355        public:
    4456            Model(BaseObject* creator);
     
    5971                { return this->meshSrc_; }
    6072
    61             //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
    62             inline void setRenderQueueGroup(const int renderQueueGroup)
    63                 { this->renderQueueGroup_ = renderQueueGroup; this->changedRenderQueueGroup(); }
     73            inline void setRenderQueueGroup(const std::string& renderQueueGroup)
     74                { this->renderQueueGroup_ = getRenderQueueGroupID(renderQueueGroup); this->changedRenderQueueGroup(); }
    6475            inline const int getRenderQueueGroup() const
    6576                { return this->renderQueueGroup_; }
     
    7687
    7788        protected:
     89            /**
     90            @brief
     91                This function turns a string from XML Port into a usable ID for the rendering system
     92                It defaults to the main queue if the group isn't recognized.
     93               
     94            @param renderQueueGroup
     95                This is a string representing the render queue group. Accepted values:
     96                main, stencil glow, stencil object
     97            */
     98            const unsigned int getRenderQueueGroupID(const std::string& renderQueueGroup) const;
     99
    78100            void registerVariables();
    79101            void changedMesh();
     
    91113            float getBiggestScale(Vector3 scale3d);
    92114
    93             std::string meshSrc_;
    94             Mesh mesh_;
    95             bool bCastShadows_;
    96             int renderQueueGroup_;
    97             std::string materialName_;
     115            std::string meshSrc_; //!< This string stores the path where the mesh is stored
     116            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
     117            bool bCastShadows_; //!< This value determines whether a Model is casting a shadow or not, turn it off to save performance, when not needed
     118            unsigned int renderQueueGroup_; //!< This variable stores which render queue group this object is assigned to
     119            std::string materialName_; //!< This string stores the name of the material to be applied to the mesh/model
    98120
    99121            //LoD
    100             bool bGlobalEnableLod_;
    101             float lodLevel_;
    102             bool bLodEnabled_;
    103             unsigned int numLodLevels_;
    104             float lodReductionRate_;
     122            bool bGlobalEnableLod_; //!< Has LoD been turned on in the graphics configuration?
     123            float lodLevel_; //!< Standard LoD Level
     124            bool bLodEnabled_; //!< Is LoD to be used on this model?
     125            unsigned int numLodLevels_; //!< How many LoD does this model feature
     126            float lodReductionRate_; //!< How fast should be switched to lower LoDs
    105127
    106128    };
Note: See TracChangeset for help on using the changeset viewer.