Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Safety Commit

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.