[Orxonox-commit 6422] r11079 - code/branches/shaders_merge/src/orxonox/graphics

landauf at orxonox.net landauf at orxonox.net
Tue Jan 19 23:05:02 CET 2016


Author: landauf
Date: 2016-01-19 23:05:02 +0100 (Tue, 19 Jan 2016)
New Revision: 11079

Modified:
   code/branches/shaders_merge/src/orxonox/graphics/LensFlare.cc
   code/branches/shaders_merge/src/orxonox/graphics/LensFlare.h
Log:
bugfix: the attached objects are stored in a set, so there's no guarantee about the order of the elements. store the billboards of the lens flare in an ordered vector to ensure that the billboards are updated with the correct parameters.

Modified: code/branches/shaders_merge/src/orxonox/graphics/LensFlare.cc
===================================================================
--- code/branches/shaders_merge/src/orxonox/graphics/LensFlare.cc	2016-01-19 21:49:57 UTC (rev 11078)
+++ code/branches/shaders_merge/src/orxonox/graphics/LensFlare.cc	2016-01-19 22:05:02 UTC (rev 11079)
@@ -105,6 +105,7 @@
             lensPart->disableFrustumCulling();
             lensPart->setVisible(true);
             this->attach(lensPart);
+            this->billboards_.push_back(lensPart);
         }
     }
 
@@ -124,11 +125,8 @@
         this->occlusionBillboard_->setVisible(lightIsVisible);
 
         int i = 0;
-        for (WorldEntity* attachedObject : this->getAttachedObjects())
+        for (Billboard* billboard : this->billboards_)
         {
-            Billboard* billboard = orxonox_cast<Billboard*>(attachedObject);
-            if (billboard == this->occlusionBillboard_)
-                continue;
             const LensFlare::Lens& lens = lensConfiguration_.at(i);
             billboard->setPosition(-viewDirection * (1.0f - lens.position_));
             billboard->setVisible(lightIsVisible);
@@ -148,11 +146,8 @@
         ColourValue cur = this->colour_;
 
         int i = 0;
-        for (WorldEntity* attachedObject : this->getAttachedObjects())
+        for (Billboard* billboard : this->billboards_)
         {
-            Billboard* billboard = orxonox_cast<Billboard*>(attachedObject);
-            if (billboard == this->occlusionBillboard_)
-                continue;
             cur.a = alpha * lensConfiguration_.at(i).alpha_;
             billboard->setColour(cur);
             i++;

Modified: code/branches/shaders_merge/src/orxonox/graphics/LensFlare.h
===================================================================
--- code/branches/shaders_merge/src/orxonox/graphics/LensFlare.h	2016-01-19 21:49:57 UTC (rev 11078)
+++ code/branches/shaders_merge/src/orxonox/graphics/LensFlare.h	2016-01-19 22:05:02 UTC (rev 11079)
@@ -177,6 +177,8 @@
             
             std::vector<Lens> lensConfiguration_;//!< this stores the lensConfiguration
             Billboard* occlusionBillboard_;//!< this is a transparent billboard used solely for the Hardware Occlusion Query
+            std::vector<Billboard*> billboards_; //!< The visible billboards
+
             float scale_;//!< this factor is used to scale the billboard to the desired size
             bool fadeOnViewBorder_;//!< should the effect fade out on the border of the view?
             unsigned int fadeResolution_;//!< how many points should be sampled per axis for the screen border fade. High number => smooth fade, but uses more processing power




More information about the Orxonox-commit mailing list