[Orxonox-commit 3821] r8497 - code/branches/environment2/src/orxonox/graphics

marwegma at orxonox.net marwegma at orxonox.net
Tue May 17 00:44:33 CEST 2011


Author: marwegma
Date: 2011-05-17 00:44:32 +0200 (Tue, 17 May 2011)
New Revision: 8497

Modified:
   code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.cc
   code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.h
   code/branches/environment2/src/orxonox/graphics/GlobalShader.cc
Log:
Godrays: Implementing in progress.

Modified: code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.cc
===================================================================
--- code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.cc	2011-05-16 19:01:09 UTC (rev 8496)
+++ code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.cc	2011-05-16 22:44:32 UTC (rev 8497)
@@ -51,10 +51,12 @@
         //        if (!this->getScene()->getSceneManager())
         //            ThrowException(AbortLoading, "Can't create GlobalGodrayShader, no scene manager given.");
         
-        this->skyColor_ = {0.0f, 0.0f, 0.0f, 1.0f};
+        this->skyColor_ = ColourValue::Black;
         this->exposure_ = 1.0f;
         this->decay_ = 0.1f;
         this->density_ = 0.7f;
+        
+        //// Init ////
     }
     
     GlobalGodrayShader::~GlobalGodrayShader()
@@ -72,38 +74,32 @@
         SUPER(GlobalGodrayShader, XMLPort, xmlelement, mode);
         
         XMLPortParamTemplate(GlobalGodrayShader, "sunPosition", setSunPosition, getSunPosition, xmlelement, mode, const Vector3&);
-        XMLPortParamTemplate(GlobalGodrayShader, "skyColor", setSkyColor, getSkyColor, xmlelement, mode, const Vector4&);
-        XMLPortParamVariable(GlobalGodrayShader, exposure_, "exposure", xmlelement, mode);
-        XMLPortParamVariable(GlobalGodrayShader, decay_, "decay", xmlelement, mode);
-        XMLPortParamVariable(GlobalGodrayShader, density_, "density", xmlelement, mode);
+        XMLPortParamTemplate(GlobalGodrayShader, "skyColor", setSkyColor, getSkyColor, xmlelement, mode, const ColourValue&);
+        XMLPortParamVariable(GlobalGodrayShader, "exposure", exposure_, xmlelement, mode);
+        XMLPortParamVariable(GlobalGodrayShader, "decay", decay_, xmlelement, mode);
+        XMLPortParamVariable(GlobalGodrayShader, "density", density_, xmlelement, mode);
     }
     
     void GlobalGodrayShader::setSunPosition(const Vector3& position)
     {
-        this->sunPosition.x = position.x;
-        this->sunPosition.y = position.y;
-        this->sunPosition.z = position.z;
+        this->sunPosition_ = position;
     }
-    void GlobalGodrayShader::setSkyColor(const Vector4& color)
+    void GlobalGodrayShader::setSkyColor(const ColourValue& color)
     {
-        this->skyColor[0] = color.x;
-        this->skyColor[1] = color.y;
-        this->skyColor[2] = color.z;
-        this->skyColor[3] = color.w;
+        this->skyColor_ = color;
     }
     const Vector3& GlobalGodrayShader::getSunPosition() const
     {
-        return sunPosition;
+        return this->sunPosition_;
     }
-    const Vector4& GlobalGodrayShader::getSkyColor() const
+    const ColourValue& GlobalGodrayShader::getSkyColor() const
     {
-        Vector4 &color = new Vector4(skyColor[0], skyColor[1], skyColor[2], skyColor[3]);
-        return color;
+        return this->skyColor_;
     }
     
-    void GlobalShader::changedVisibility()
+    void GlobalGodrayShader::changedVisibility()
     {
-        SUPER(GlobalShader, changedVisibility);
+        SUPER(GlobalGodrayShader, changedVisibility);
         
         this->globalShader_.setVisible(this->isVisible());
     }

Modified: code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.h
===================================================================
--- code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.h	2011-05-16 19:01:09 UTC (rev 8496)
+++ code/branches/environment2/src/orxonox/graphics/GlobalGodrayShader.h	2011-05-16 22:44:32 UTC (rev 8497)
@@ -30,7 +30,7 @@
 /**
  @file
  
- @brief Header of the GlobalGodrayShader.
+ @brief Header of the GlobalGodrayShader class.
 */
 
 
@@ -41,6 +41,7 @@
 
 #include "tools/interfaces/Tickable.h"
 #include "core/BaseObject.h"
+#include "util/Math.h"
 #include "GlobalShader.h"
 
 
@@ -66,16 +67,16 @@
             { return this->globalShader_; }
         
             void setSunPosition(const Vector3& position);
-            void setSkyColor(const Vector4& color);
+            void setSkyColor(const ColourValue& color);
             const Vector3& getSunPosition() const;
-            const Vector4& getSkyColor() const;
+            const ColourValue& getSkyColor() const;
         
         private:
             
             GlobalShader globalShader_;
             
             Vector3 sunPosition_;
-            float skyColor_[4];
+            ColourValue skyColor_;
             float exposure_;
             float decay_;
             float density_;

Modified: code/branches/environment2/src/orxonox/graphics/GlobalShader.cc
===================================================================
--- code/branches/environment2/src/orxonox/graphics/GlobalShader.cc	2011-05-16 19:01:09 UTC (rev 8496)
+++ code/branches/environment2/src/orxonox/graphics/GlobalShader.cc	2011-05-16 22:44:32 UTC (rev 8497)
@@ -37,7 +37,7 @@
 {
     CreateFactory(GlobalShader);
 
-    GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), 
+    GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
     {
         RegisterObject(GlobalShader);
 




More information about the Orxonox-commit mailing list