Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2044


Ignore:
Timestamp:
Oct 29, 2008, 11:37:19 AM (15 years ago)
Author:
landauf
Message:

added some new graphical classes

Location:
code/branches/objecthierarchy/src/orxonox
Files:
6 added
2 deleted
8 edited

Legend:

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

    r2042 r2044  
    3737
    3838  tools/BillboardSet.cc
    39   tools/Light.cc
    4039  tools/Mesh.cc
    4140  tools/ParticleInterface.cc
     
    5756  objects/worldentities/ControllableEntity.cc
    5857  objects/worldentities/Model.cc
     58  objects/worldentities/Billboard.cc
     59  objects/worldentities/BlinkingBillboard.cc
     60  objects/worldentities/Light.cc
    5961  objects/worldentities/Camera.cc
    6062  objects/worldentities/CameraPosition.cc
  • code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h

    r2042 r2044  
    9494    class Model;
    9595    class Billboard;
     96    class BlinkingBillboard;
    9697    class Light;
    97     class DirectionalLight;
    9898
    9999    class Camera;
  • code/branches/objecthierarchy/src/orxonox/objects/Scene.cc

    r2040 r2044  
    7474        {
    7575            Ogre::Light* light;
    76             light = this->sceneManager_->createLight("Light0");
     76            light = this->sceneManager_->createLight("Light-1");
    7777            light->setType(Ogre::Light::LT_DIRECTIONAL);
    7878            light->setDiffuseColour(ColourValue(1.0, 0.9, 0.6, 1.0));
    7979            light->setSpecularColour(ColourValue(1.0, 0.9, 0.6, 1.0));
    80             light->setDirection(1, -0.2, 0.2);
     80            light->setDirection(1, -0.3, 0.3);
    8181        }
    8282        // test test test
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/Backlight.h

    r2027 r2044  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "WorldEntity.h"
     34#include "PositionableEntity.h"
    3535#include "tools/BillboardSet.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport Backlight : public WorldEntity
     39    class _OrxonoxExport Backlight : public PositionableEntity
    4040    {
    4141        public:
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/Model.h

    r2040 r2044  
    4747            virtual void changedVisibility();
    4848
     49            inline const Mesh& getMesh() const
     50                { return this->mesh_; }
     51
    4952            inline void setMeshSource(const std::string& meshname)
    5053                { this->meshSrc_ = meshname; this->changedMesh(); }
    5154            inline const std::string& getMeshSource() const
    5255                { return this->meshSrc_; }
    53             inline const Mesh& getMesh() const
    54                 { return this->mesh_; }
    5556
    5657            inline void setCastShadows(bool bCastShadows)
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.h

    r2027 r2044  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "WorldEntity.h"
     34#include "PositionableEntity.h"
    3535#include "tools/Timer.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport ParticleSpawner : public WorldEntity
     39    class _OrxonoxExport ParticleSpawner : public PositionableEntity
    4040    {
    4141        public:
  • code/branches/objecthierarchy/src/orxonox/tools/BillboardSet.cc

    r2023 r2044  
    3232#include <sstream>
    3333#include <cassert>
     34
    3435#include <OgreSceneManager.h>
     36#include <OgreBillboard.h>
    3537
    36 #include "util/Math.h"
     38#include "util/Convert.h"
     39#include "util/String.h"
    3740
    3841namespace orxonox
     
    4548    }
    4649
     50    BillboardSet::~BillboardSet()
     51    {
     52        this->destroyBillboardSet();
     53    }
     54
    4755    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, int count)
    4856    {
    49         assert(scenemanager);
    50 
    51         std::ostringstream name;
    52         name << (BillboardSet::billboardSetCounter_s++);
    53         this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count);
    54         this->billboardSet_->createBillboard(Vector3::ZERO);
    55         this->billboardSet_->setMaterialName(file);
    56 
    57         this->scenemanager_ = scenemanager;
     57        this->setBillboardSet(scenemanager, file, Vector3::ZERO, count);
    5858    }
    5959
    6060    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, int count)
    6161    {
    62         assert(scenemanager);
    63 
    64         std::ostringstream name;
    65         name << (BillboardSet::billboardSetCounter_s++);
    66         this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count);
    67         this->billboardSet_->createBillboard(Vector3::ZERO, colour);
    68         this->billboardSet_->setMaterialName(file);
    69 
    70         this->scenemanager_ = scenemanager;
     62        this->setBillboardSet(scenemanager, file, colour, Vector3::ZERO, count);
    7163    }
    7264
     
    7466    {
    7567        assert(scenemanager);
     68        this->destroyBillboardSet();
    7669
    77         std::ostringstream name;
    78         name << (BillboardSet::billboardSetCounter_s++);
    79         this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count);
    80         this->billboardSet_->createBillboard(position);
    81         this->billboardSet_->setMaterialName(file);
     70        try
     71        {
     72            this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
     73            this->billboardSet_->createBillboard(position);
     74            this->billboardSet_->setMaterialName(file);
     75        }
     76        catch (...)
     77        {
     78            COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
     79        }
    8280
    8381        this->scenemanager_ = scenemanager;
     
    8785    {
    8886        assert(scenemanager);
     87        this->destroyBillboardSet();
    8988
    90         std::ostringstream name;
    91         name << (BillboardSet::billboardSetCounter_s++);
    92         this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count);
    93         this->billboardSet_->createBillboard(position, colour);
    94         this->billboardSet_->setMaterialName(file);
     89        try
     90        {
     91            this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
     92            this->billboardSet_->createBillboard(position, colour);
     93            this->billboardSet_->setMaterialName(file);
     94        }
     95        catch (...)
     96        {
     97            COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
     98        }
    9599
    96100        this->scenemanager_ = scenemanager;
    97101    }
    98102
    99     BillboardSet::~BillboardSet()
     103    void BillboardSet::destroyBillboardSet()
    100104    {
    101105        if (this->billboardSet_ && this->scenemanager_)
    102106            this->scenemanager_->destroyBillboardSet(this->billboardSet_);
    103107    }
     108
     109    const std::string& BillboardSet::getName() const
     110    {
     111        if (this->billboardSet_)
     112            return this->billboardSet_->getName();
     113        else
     114            return BLANKSTRING;
     115    }
     116
     117    void BillboardSet::setVisible(bool visible)
     118    {
     119        if (this->billboardSet_)
     120            this->billboardSet_->setVisible(visible);
     121    }
     122
     123    bool BillboardSet::getVisible() const
     124    {
     125        if (this->billboardSet_)
     126            return this->billboardSet_->getVisible();
     127        else
     128            return false;
     129    }
     130
     131    void BillboardSet::setColour(const ColourValue& colour)
     132    {
     133        if (this->billboardSet_)
     134        {
     135            for (int i = 0; i < this->billboardSet_->getNumBillboards(); ++i)
     136                this->billboardSet_->getBillboard(i)->setColour(colour);
     137        }
     138    }
     139
     140    const ColourValue& BillboardSet::getColour() const
     141    {
     142        if (this->billboardSet_ && this->billboardSet_->getNumBillboards() > 0)
     143        {
     144            return this->billboardSet_->getBillboard(0)->getColour();
     145        }
     146        else
     147            return ColourValue::White;
     148    }
     149
     150    void BillboardSet::setMaterial(const std::string& material)
     151    {
     152        if (this->billboardSet_)
     153            this->billboardSet_->setMaterialName(material);
     154    }
     155
     156    const std::string& BillboardSet::getMaterial() const
     157    {
     158        if (this->billboardSet_)
     159            return this->billboardSet_->getMaterialName();
     160        else
     161            return BLANKSTRING;
     162    }
    104163}
  • code/branches/objecthierarchy/src/orxonox/tools/BillboardSet.h

    r2019 r2044  
    4444            BillboardSet();
    4545            ~BillboardSet();
     46
    4647            void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, int count = 1);
    4748            void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, int count = 1);
     
    5253                { return this->billboardSet_; }
    5354
    54             inline const std::string& getName() const
    55                 { return this->billboardSet_->getName(); }
     55            const std::string& getName() const;
    5656
    57             inline void setVisible(bool visible)
    58                 { this->billboardSet_->setVisible(visible); }
    59             inline bool getVisible() const
    60                 { return this->billboardSet_->getVisible(); }
     57            void setVisible(bool visible);
     58            bool getVisible() const;
     59
     60            void setColour(const ColourValue& colour);
     61            const ColourValue& getColour() const;
     62
     63            void setMaterial(const std::string& material);
     64            const std::string& getMaterial() const;
    6165
    6266        private:
     67            void destroyBillboardSet();
     68
    6369            static unsigned int billboardSetCounter_s;
    6470            Ogre::BillboardSet* billboardSet_;
Note: See TracChangeset for help on using the changeset viewer.