Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9401 for code/branches/shaders


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

Orxonox::Mesh: Added functions setMaterial() and getMaterial() to easily attach a material/shader to a Mesh via the provided functions in Ogre::Entity and Ogre::SubEntity

Location:
code/branches/shaders/src/libraries/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/shaders/src/libraries/tools/Mesh.cc

    r8858 r9401  
    3333#include <string>
    3434#include <OgreEntity.h>
     35#include <OgreSubEntity.h>
    3536#include <OgreSceneManager.h>
    3637
     
    9394    }
    9495
     96    void Mesh::setMaterial(const std::string& name)
     97    {
     98        if (this->entity_)
     99            this->entity_->setMaterialName(name);
     100    }
     101
     102    const std::string& Mesh::getMaterial() const
     103    {
     104        if (this->entity_)
     105        {
     106            if(this->entity_->getSubEntity(0))
     107                return this->entity_->getSubEntity(0)->getMaterialName(); //return the Material of the first SubEntity, should be enough for now
     108            else
     109                return BLANKSTRING;
     110        }
     111        else
     112            return BLANKSTRING;
     113    }
     114
    95115    void Mesh::setVisible(bool bVisible)
    96116    {
  • code/branches/shaders/src/libraries/tools/Mesh.h

    r5781 r9401  
    4848            const std::string& getName() const;
    4949
     50            void setMaterial(const std::string& name);
     51            const std::string& getMaterial() const;
     52
    5053            void setVisible(bool bVisible);
    5154            bool isVisible() const;
Note: See TracChangeset for help on using the changeset viewer.