Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9402


Ignore:
Timestamp:
Oct 16, 2012, 3:32:20 PM (12 years ago)
Author:
davidsa
Message:

Orxonox::Model: added XMLPort 'material' to easily attach a material/shader to a Model

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

Legend:

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

    r8858 r9402  
    7171
    7272        XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
     73        XMLPortParam(Model, "material", setMaterial, getMaterial, xmlelement, mode);
    7374        XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
    7475    }
     
    109110            }
    110111        }
     112    }
     113
     114    void Model::changedMaterial()
     115    {
     116        this->mesh_.setMaterial(this->materialName_);
    111117    }
    112118
  • code/branches/shaders/src/orxonox/graphics/Model.h

    r7166 r9402  
    6363                { return this->bCastShadows_; }
    6464
     65            inline void setMaterial(const std::string& materialname)
     66                { this->materialName_ = materialname; this->changedMaterial(); }
     67            inline const std::string& getMaterial() const
     68                { return this->materialName_; }
     69
    6570        protected:
    6671            void registerVariables();
    6772            void changedMesh();
     73            void changedMaterial();
    6874            void changedShadows();
    6975
     
    8086            Mesh mesh_;
    8187            bool bCastShadows_;
     88            std::string materialName_;
    8289
    8390            //LoD
Note: See TracChangeset for help on using the changeset viewer.