Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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        }
Note: See TracChangeset for help on using the changeset viewer.