[Orxonox-commit 815] r3336 - in branches/resource/src/orxonox: . tools

rgrieder at orxonox.net rgrieder at orxonox.net
Thu Jul 23 12:15:06 CEST 2009


Author: rgrieder
Date: 2009-07-23 12:15:06 +0200 (Thu, 23 Jul 2009)
New Revision: 3336

Modified:
   branches/resource/src/orxonox/GraphicsManager.cc
   branches/resource/src/orxonox/GraphicsManager.h
   branches/resource/src/orxonox/tools/ParticleInterface.cc
   branches/resource/src/orxonox/tools/ParticleInterface.h
Log:
Moved Config value detailLevelParticle from GraphicsManager to ParticleInterface.
The resulting section name problem is to be resolved later. We've got a mess of config values anyway.

Modified: branches/resource/src/orxonox/GraphicsManager.cc
===================================================================
--- branches/resource/src/orxonox/GraphicsManager.cc	2009-07-23 10:09:56 UTC (rev 3335)
+++ branches/resource/src/orxonox/GraphicsManager.cc	2009-07-23 10:15:06 UTC (rev 3336)
@@ -181,16 +181,8 @@
             .description("Corresponding orxonox debug level for ogre Normal");
         SetConfigValue(ogreLogLevelCritical_, 2)
             .description("Corresponding orxonox debug level for ogre Critical");
-        SetConfigValue(detailLevelParticle_, 2)
-            .description("O: off, 1: low, 2: normal, 3: high").callback(this, &GraphicsManager::detailLevelParticleChanged);
     }
 
-    void GraphicsManager::detailLevelParticleChanged()
-    {
-        for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it)
-            it->detailLevelChanged(this->detailLevelParticle_);
-    }
-
     void GraphicsManager::update(const Clock& time)
     {
         Ogre::FrameEvent evt;

Modified: branches/resource/src/orxonox/GraphicsManager.h
===================================================================
--- branches/resource/src/orxonox/GraphicsManager.h	2009-07-23 10:09:56 UTC (rev 3335)
+++ branches/resource/src/orxonox/GraphicsManager.h	2009-07-23 10:15:06 UTC (rev 3336)
@@ -59,10 +59,6 @@
 
         void update(const Clock& time);
 
-        void detailLevelParticleChanged();
-        inline unsigned int getDetailLevelParticle() const
-            { return this->detailLevelParticle_; }
-
         inline Ogre::Viewport* getViewport()
             { return this->viewport_; }
         inline Ogre::RenderWindow* getRenderWindow()
@@ -98,7 +94,6 @@
         OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
 
         // config values
-        unsigned int        detailLevelParticle_;      //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
         std::string         resourceFile_;             //!< resources file name
         std::string         ogreConfigFile_;           //!< ogre config file name
         std::string         ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located

Modified: branches/resource/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- branches/resource/src/orxonox/tools/ParticleInterface.cc	2009-07-23 10:09:56 UTC (rev 3335)
+++ branches/resource/src/orxonox/tools/ParticleInterface.cc	2009-07-23 10:15:06 UTC (rev 3336)
@@ -42,6 +42,7 @@
 #include "util/Convert.h"
 #include "util/Math.h"
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 #include "core/GameMode.h"
 #include "GraphicsManager.h"
 
@@ -90,6 +91,12 @@
         }
     }
 
+    void ParticleInterface::setConfigValues()
+    {
+        SetConfigValue(globalDetailLevel_, 2)
+            .description("O: off, 1: low, 2: normal, 3: high").callback(this, &ParticleInterface::detailLevelChanged);
+    }
+
     Ogre::ParticleEmitter* ParticleInterface::createNewEmitter()
     {
         if (this->particleSystem_ && this->particleSystem_->getNumEmitters() > 0)
@@ -179,12 +186,12 @@
     {
         this->detaillevel_ = level;
         if (GameMode::showsGraphics())
-            this->detailLevelChanged(GraphicsManager::getInstance().getDetailLevelParticle());
+            this->detailLevelChanged();
     }
 
-    void ParticleInterface::detailLevelChanged(unsigned int newlevel)
+    void ParticleInterface::detailLevelChanged()
     {
-        if (newlevel >= static_cast<unsigned int>(this->detaillevel_))
+        if (this->globalDetailLevel_ >= this->detaillevel_)
             this->bAllowedByLOD_ = true;
         else
             this->bAllowedByLOD_ = false;

Modified: branches/resource/src/orxonox/tools/ParticleInterface.h
===================================================================
--- branches/resource/src/orxonox/tools/ParticleInterface.h	2009-07-23 10:09:56 UTC (rev 3335)
+++ branches/resource/src/orxonox/tools/ParticleInterface.h	2009-07-23 10:15:06 UTC (rev 3336)
@@ -46,6 +46,7 @@
         public:
             ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::Value detaillevel);
             virtual ~ParticleInterface();
+            void setConfigValues();
 
             inline Ogre::ParticleSystem* getParticleSystem()
                 { return this->particleSystem_; }
@@ -76,7 +77,6 @@
             inline bool isVisible() const
                 { return this->bVisible_; }
 
-            void detailLevelChanged(unsigned int newlevel);
             void setDetailLevel(unsigned int level);
 
             inline void storeThisAsCurrentParticleInterface()
@@ -89,15 +89,19 @@
 
         private:
             void updateVisibility();
+            void detailLevelChanged();
 
             Ogre::ParticleSystem*     particleSystem_;
             Ogre::SceneManager*       scenemanager_;
             bool                      bVisible_;
             bool                      bEnabled_;
             bool                      bAllowedByLOD_;
-            unsigned int              detaillevel_;     //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
+            unsigned int              detaillevel_;       //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
             float                     speedFactor_;
 
+            // config values
+            unsigned int              globalDetailLevel_; //!< Global maximum detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
+
             static ParticleInterface* currentParticleInterface_s;
             static unsigned int       counter_s;
     };




More information about the Orxonox-commit mailing list