Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8491 for code


Ignore:
Timestamp:
May 16, 2011, 4:34:19 PM (14 years ago)
Author:
marwegma
Message:

Safety Commit

Location:
code/branches/environment2/src/orxonox/graphics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.cc

    r8435 r8491  
    3030 @file
    3131 
    32  @brief Implementation of the GlobalGodrayShader.
     32 @brief Implementation of the GlobalGodrayShader class.
    3333 */
    3434
    35 #include "GlobalShader.h"
     35#include "GlobalGodrayShader.h"
    3636
    3737#include "util/Exception.h"
     
    4343    CreateFactory(GlobalGodrayShader);
    4444   
    45     GlobalGodrayShader::GlobalGodrayShader(BaseObject* creator, WorldEntity blurObject) : BaseObject(creator)
     45    GlobalGodrayShader::GlobalGodrayShader(BaseObject* creator) : BaseObject(creator), globalShader_(creator)
    4646    {
    4747        RegisterObject(GlobalGodrayShader);
     
    5252        //            ThrowException(AbortLoading, "Can't create GlobalGodrayShader, no scene manager given.");
    5353       
    54         if (this->getScene()->getSceneManager())
    55             this- setSceneManager(this->getScene()->getSceneManager());
     54        this->skyColor_ = {0.0f, 0.0f, 0.0f, 1.0f};
     55        this->exposure_ = 1.0f;
     56        this->decay_ = 0.1f;
     57        this->density_ = 0.7f;
    5658    }
    5759   
    58     GlobalGodrayShader::~GlobalShader()
     60    GlobalGodrayShader::~GlobalGodrayShader()
    5961    {
     62        this->setVisible(false);
     63    }
     64   
     65    void GlobalGodrayShader::tick(float dt)
     66    {
     67        // To-Do
    6068    }
    6169   
     
    6472        SUPER(GlobalGodrayShader, XMLPort, xmlelement, mode);
    6573       
    66         XMLPortParamExtern(GlobalShader, Shader, &this->shader_, "compositor", setCompositorName, getCompositorName, xmlelement, mode);
     74        XMLPortParamTemplate(GlobalGodrayShader, "sunPosition", setSunPosition, getSunPosition, xmlelement, mode, const Vector3&);
     75        XMLPortParamTemplate(GlobalGodrayShader, "skyColor", setSkyColor, getSkyColor, xmlelement, mode, const Vector4&);
     76        XMLPortParamVariable(GlobalGodrayShader, exposure_, "exposure", xmlelement, mode);
     77        XMLPortParamVariable(GlobalGodrayShader, decay_, "decay", xmlelement, mode);
     78        XMLPortParamVariable(GlobalGodrayShader, density_, "density", xmlelement, mode);
     79    }
     80   
     81    void GlobalGodrayShader::setSunPosition(const Vector3& position)
     82    {
     83        this->sunPosition.x = position.x;
     84        this->sunPosition.y = position.y;
     85        this->sunPosition.z = position.z;
     86    }
     87    void GlobalGodrayShader::setSkyColor(const Vector4& color)
     88    {
     89        this->skyColor[0] = color.x;
     90        this->skyColor[1] = color.y;
     91        this->skyColor[2] = color.z;
     92        this->skyColor[3] = color.w;
     93    }
     94    const Vector3& GlobalGodrayShader::getSunPosition() const
     95    {
     96        return sunPosition;
     97    }
     98    const Vector4& GlobalGodrayShader::getSkyColor() const
     99    {
     100        Vector4 &color = new Vector4(skyColor[0], skyColor[1], skyColor[2], skyColor[3]);
     101        return color;
     102    }
     103   
     104    void GlobalShader::changedVisibility()
     105    {
     106        SUPER(GlobalShader, changedVisibility);
     107       
     108        this->globalShader_.setVisible(this->isVisible());
    67109    }
    68110}
  • code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.h

    r8435 r8491  
    5353    class _OrxonoxExport GlobalGodrayShader : public BaseObject, public Tickable
    5454    {
    55     public:
    56         GlobalGodrayShader(BaseObject* creator);
    57         virtual ~GlobalGodrayShader();
     55        public:
     56            GlobalGodrayShader(BaseObject* creator);
     57            virtual ~GlobalGodrayShader();
     58           
     59            virtual void tick(float dt);
     60           
     61            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5862       
    59         virtual void tick(float dt);
     63            virtual void changedVisibility();
     64           
     65            inline const GlobalShader& getGlobalShader() const
     66            { return this->globalShader_; }
    6067       
    61         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     68            void setSunPosition(const Vector3& position);
     69            void setSkyColor(const Vector4& color);
     70            const Vector3& getSunPosition() const;
     71            const Vector4& getSkyColor() const;
    6272       
    63         inline const GlobalShader& getGlobalShader() const
    64         { return this->globalShader_; }
    65        
    66     private:
    67        
    68         GlobalShader globalShader_;
    69         Vector3
    70        
     73        private:
     74           
     75            GlobalShader globalShader_;
     76           
     77            Vector3 sunPosition_;
     78            float skyColor_[4];
     79            float exposure_;
     80            float decay_;
     81            float density_;
    7182    };
    7283}
  • code/branches/environment2/src/orxonox/graphics/GlobalShader.cc

    r8079 r8491  
    3838    CreateFactory(GlobalShader);
    3939
    40     GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
     40    GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator),
    4141    {
    4242        RegisterObject(GlobalShader);
     
    5151
    5252        this->registerVariables();
     53       
    5354    }
    5455
Note: See TracChangeset for help on using the changeset viewer.