Changeset 8491
- Timestamp:
- May 16, 2011, 4:34:19 PM (14 years ago)
- Location:
- code/branches/environment2/src/orxonox/graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.cc
r8435 r8491 30 30 @file 31 31 32 @brief Implementation of the GlobalGodrayShader .32 @brief Implementation of the GlobalGodrayShader class. 33 33 */ 34 34 35 #include "Global Shader.h"35 #include "GlobalGodrayShader.h" 36 36 37 37 #include "util/Exception.h" … … 43 43 CreateFactory(GlobalGodrayShader); 44 44 45 GlobalGodrayShader::GlobalGodrayShader(BaseObject* creator , WorldEntity blurObject) : BaseObject(creator)45 GlobalGodrayShader::GlobalGodrayShader(BaseObject* creator) : BaseObject(creator), globalShader_(creator) 46 46 { 47 47 RegisterObject(GlobalGodrayShader); … … 52 52 // ThrowException(AbortLoading, "Can't create GlobalGodrayShader, no scene manager given."); 53 53 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; 56 58 } 57 59 58 GlobalGodrayShader::~Global Shader()60 GlobalGodrayShader::~GlobalGodrayShader() 59 61 { 62 this->setVisible(false); 63 } 64 65 void GlobalGodrayShader::tick(float dt) 66 { 67 // To-Do 60 68 } 61 69 … … 64 72 SUPER(GlobalGodrayShader, XMLPort, xmlelement, mode); 65 73 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()); 67 109 } 68 110 } -
code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.h
r8435 r8491 53 53 class _OrxonoxExport GlobalGodrayShader : public BaseObject, public Tickable 54 54 { 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); 58 62 59 virtual void tick(float dt); 63 virtual void changedVisibility(); 64 65 inline const GlobalShader& getGlobalShader() const 66 { return this->globalShader_; } 60 67 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; 62 72 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_; 71 82 }; 72 83 } -
code/branches/environment2/src/orxonox/graphics/GlobalShader.cc
r8079 r8491 38 38 CreateFactory(GlobalShader); 39 39 40 GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator) 40 GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), 41 41 { 42 42 RegisterObject(GlobalShader); … … 51 51 52 52 this->registerVariables(); 53 53 54 } 54 55
Note: See TracChangeset
for help on using the changeset viewer.