- Timestamp:
- May 16, 2011, 4:34:19 PM (14 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.