Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 19, 2016, 11:27:40 PM (9 years ago)
Author:
landauf
Message:

merged shaders back to trunk (pps project from HS 2012)

Location:
code/trunk
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/graphics/Billboard.cc

    r11071 r11080  
    171171        }
    172172    }
     173   
     174    void Billboard::setRenderQueueGroup(unsigned char groupID)
     175    {
     176        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
     177        if( bSet != nullptr )
     178        {
     179            bSet->setRenderQueueGroup(groupID);
     180        }
     181    }
     182   
     183    void Billboard::disableFrustumCulling()
     184    {
     185        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
     186        if( bSet != nullptr )
     187        {
     188            bSet->setBounds(Ogre::AxisAlignedBox(Ogre::AxisAlignedBox::EXTENT_INFINITE),0);
     189        }
     190    }
    173191}
  • code/trunk/src/orxonox/graphics/Billboard.h

    r11071 r11080  
    8181           
    8282            void setDefaultDimensions(float width, float height);
     83           
     84            void setRenderQueueGroup(unsigned char groupID);
     85           
     86            void disableFrustumCulling();
    8387
    8488
  • code/trunk/src/orxonox/graphics/CMakeLists.txt

    r8729 r11080  
    1313  Backlight.cc
    1414  Camera.cc
     15  LensFlare.cc
    1516  Light.cc
    1617END_BUILD_UNIT
  • code/trunk/src/orxonox/graphics/Model.cc

    r11071 r11080  
    3737#include "core/XMLPort.h"
    3838#include "Scene.h"
     39#include "RenderQueueListener.h"
    3940#include "graphics/MeshLodInformation.h"
    4041#include "Level.h"
     
    4546
    4647    Model::Model(Context* context) :
    47         StaticEntity(context), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15f)
     48        StaticEntity(context), bCastShadows_(true), renderQueueGroup_(RENDER_QUEUE_MAIN), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15f)
    4849    {
    4950        RegisterObject(Model);
     
    7273
    7374        XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
     75        XMLPortParam(Model, "renderQueueGroup", setRenderQueueGroup, getRenderQueueGroup, xmlelement, mode);
     76        XMLPortParam(Model, "material", setMaterial, getMaterial, xmlelement, mode);
    7477        XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
    7578    }
     79   
     80    /**
     81    @brief
     82        This function turns a string from XML Port into a usable ID for the rendering system
     83        It defaults to the main queue if the group isn't recognized.
     84       
     85    @param renderQueueGroup
     86        This is a string representing the render queue group. Accepted values:
     87        'main', 'stencil glow', 'stencil object'
     88    */
     89    const unsigned int Model::getRenderQueueGroupID(const std::string& renderQueueGroup) const
     90    {
     91        if(renderQueueGroup.compare("stencil glow")==0)
     92        {
     93            return RENDER_QUEUE_STENCIL_GLOW;
     94        }
     95        if(renderQueueGroup.compare("stencil object")==0)
     96        {
     97            return RENDER_QUEUE_STENCIL_OBJECTS;
     98        }
     99        return RENDER_QUEUE_MAIN;
     100    }
    76101
    77102    void Model::registerVariables()
    78103    {
    79104        registerVariable(this->meshSrc_,    VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMesh));
     105        registerVariable(this->renderQueueGroup_,    VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedRenderQueueGroup));
     106        registerVariable(this->materialName_,    VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMaterial));
    80107        registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedShadows));
    81108    }
     
    104131                this->attachOgreObject(this->mesh_.getEntity());
    105132                this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
     133                this->mesh_.getEntity()->setRenderQueueGroup(this->renderQueueGroup_);
    106134                this->mesh_.setVisible(this->isVisible());
    107135
     
    110138            }
    111139        }
     140    }
     141
     142    void Model::changedRenderQueueGroup()
     143    {
     144        if (GameMode::showsGraphics())
     145        {
     146            if (this->mesh_.getEntity())
     147            {
     148                this->mesh_.getEntity()->setRenderQueueGroup(this->renderQueueGroup_);
     149            }
     150        }
     151    }
     152
     153    void Model::changedMaterial()
     154    {
     155        this->mesh_.setMaterial(this->materialName_);
    112156    }
    113157
  • code/trunk/src/orxonox/graphics/Model.h

    r11071 r11080  
    2727 */
    2828
     29/**
     30  @file Model.h
     31  @brief Definition of Model Class
     32*/
     33
    2934#ifndef _Model_H__
    3035#define _Model_H__
     
    3439#include <string>
    3540#include "tools/Mesh.h"
     41#include "RenderQueueListener.h"
    3642#include "worldentities/StaticEntity.h"
    3743
     
    4046    class _OrxonoxExport Model : public StaticEntity
    4147    {
     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        */
    4255        public:
    4356            Model(Context* context);
     
    5871                { return this->meshSrc_; }
    5972
     73            inline void setRenderQueueGroup(const std::string& renderQueueGroup)
     74                { this->renderQueueGroup_ = getRenderQueueGroupID(renderQueueGroup); this->changedRenderQueueGroup(); }
     75            inline const int getRenderQueueGroup() const
     76                { return this->renderQueueGroup_; }
     77
    6078            inline void setCastShadows(bool bCastShadows)
    6179                { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
     
    6381                { return this->bCastShadows_; }
    6482
     83            inline void setMaterial(const std::string& materialname)
     84                { this->materialName_ = materialname; this->changedMaterial(); }
     85            inline const std::string& getMaterial() const
     86                { return this->materialName_; }
     87
    6588        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
    66100            void registerVariables();
    67101            void changedMesh();
     102            void changedRenderQueueGroup();
     103            void changedMaterial();
    68104            void changedShadows();
    69105
     
    77113            float getBiggestScale(Vector3 scale3d);
    78114
    79             std::string meshSrc_;
    80             Mesh mesh_;
    81             bool bCastShadows_;
     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
    82120
    83121            //LoD
    84             bool bGlobalEnableLod_;
    85             float lodLevel_;
    86             bool bLodEnabled_;
    87             unsigned int numLodLevels_;
    88             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
    89127
    90128    };
Note: See TracChangeset for help on using the changeset viewer.