Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9407


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

orxonox::RenderQueueListener: Implemented a rudimentary RenderQueueListener to enable the use of stencil buffer for elaborate alpha blending shaders without creating artifacts from overlapping faces. Also added a XML Port to assign a Model to a certain RenderQueueGroup. Needs to be improved to allow the use of strings for choosing the group instead of a static int which may change in the feature.

Location:
code/branches/shaders/src/orxonox
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/shaders/src/orxonox/CMakeLists.txt

    r9348 r9407  
    3737  CameraManager.cc
    3838  Scene.cc
     39  RenderQueueListener.cc
    3940END_BUILD_UNIT
    4041)
  • code/branches/shaders/src/orxonox/OrxonoxPrereqs.h

    r9348 r9407  
    7676    class PlayerManager;
    7777    class Radar;
     78    class RenderQueueListener;
    7879    class Scene;
    7980
  • code/branches/shaders/src/orxonox/Scene.cc

    r9348 r9407  
    4848#include "worldentities/WorldEntity.h"
    4949#include "Level.h"
     50#include "RenderQueueListener.h"
    5051
    5152namespace orxonox
     
    6667            this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
    6768            this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
     69            RenderQueueListener* renderQueueListener = new RenderQueueListener();
     70            this->sceneManager_->addRenderQueueListener(renderQueueListener);//add our own renderQueueListener
    6871
    6972            this->radar_ = new Radar();
  • code/branches/shaders/src/orxonox/graphics/Model.cc

    r9402 r9407  
    4444
    4545    Model::Model(BaseObject* creator) :
    46         StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15f)
     46        StaticEntity(creator), bCastShadows_(true), renderQueueGroup_(RENDER_QUEUE_STENCIL_OBJECTS), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15f)
    4747    {
    4848        RegisterObject(Model);
     
    7171
    7272        XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
     73        XMLPortParam(Model, "renderQueueGroup", setRenderQueueGroup, getRenderQueueGroup, xmlelement, mode);
    7374        XMLPortParam(Model, "material", setMaterial, getMaterial, xmlelement, mode);
    7475        XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
     
    7879    {
    7980        registerVariable(this->meshSrc_,    VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMesh));
     81        registerVariable(this->renderQueueGroup_,    VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedRenderQueueGroup));
     82        registerVariable(this->materialName_,    VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMaterial));
    8083        registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedShadows));
    8184    }
     
    108111                if (this->bGlobalEnableLod_)
    109112                    this->enableLod();
     113            }
     114        }
     115    }
     116
     117    void Model::changedRenderQueueGroup()
     118    {
     119        if (GameMode::showsGraphics())
     120        {
     121            if (this->mesh_.getEntity())
     122            {
     123                this->mesh_.getEntity()->setRenderQueueGroup(this->renderQueueGroup_);
    110124            }
    111125        }
  • code/branches/shaders/src/orxonox/graphics/Model.h

    r9402 r9407  
    3434#include <string>
    3535#include "tools/Mesh.h"
     36#include "RenderQueueListener.h"
    3637#include "worldentities/StaticEntity.h"
    3738
     
    5859                { return this->meshSrc_; }
    5960
     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(); }
     64            inline const int getRenderQueueGroup() const
     65                { return this->renderQueueGroup_; }
     66
    6067            inline void setCastShadows(bool bCastShadows)
    6168                { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
     
    7178            void registerVariables();
    7279            void changedMesh();
     80            void changedRenderQueueGroup();
    7381            void changedMaterial();
    7482            void changedShadows();
     
    8694            Mesh mesh_;
    8795            bool bCastShadows_;
     96            int renderQueueGroup_;
    8897            std::string materialName_;
    8998
Note: See TracChangeset for help on using the changeset viewer.