Index: /code/trunk/src/libraries/core/ConfigValueIncludes.h
===================================================================
--- /code/trunk/src/libraries/core/ConfigValueIncludes.h	(revision 7165)
+++ /code/trunk/src/libraries/core/ConfigValueIncludes.h	(revision 7166)
@@ -96,4 +96,19 @@
     orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, this->getIdentifier()->getName(), entryName, defaultValue)
 
+/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
+    If the container for the value doesn't yet exist, a new one is created.
+    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
+@param variable
+    Variable name as C++ identifier.
+@param sectionName
+    Name of the section in the ini file (e.g. [MySection])
+@param entryName
+    Name of the entry in the ini file (e.g. [MySection] myValue)
+@param defaultValue
+    Value to be used if it cannot be read from the ini file
+*/
+#define SetConfigValueExternal(variable, sectionName, entryName, defaultValue) \
+    orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, sectionName, entryName, defaultValue)
+
 
 namespace orxonox
Index: /code/trunk/src/libraries/tools/ParticleInterface.cc
===================================================================
--- /code/trunk/src/libraries/tools/ParticleInterface.cc	(revision 7165)
+++ /code/trunk/src/libraries/tools/ParticleInterface.cc	(revision 7166)
@@ -95,6 +95,7 @@
     void ParticleInterface::setConfigValues()
     {
-        SetConfigValue(globalDetailLevel_, 2)
-            .description("O: off, 1: low, 2: normal, 3: high").callback(this, &ParticleInterface::detailLevelChanged);
+        SetConfigValueExternal(globalDetailLevel_, "GraphicsSettings", "particlesDetailLevel", 2)
+            .description("O: off, 1: low, 2: normal, 3: high")
+            .callback(this, &ParticleInterface::detailLevelChanged);
     }
 
Index: /code/trunk/src/orxonox/graphics/Model.cc
===================================================================
--- /code/trunk/src/orxonox/graphics/Model.cc	(revision 7165)
+++ /code/trunk/src/orxonox/graphics/Model.cc	(revision 7166)
@@ -32,4 +32,5 @@
 
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 #include "core/GameMode.h"
 #include "core/XMLPort.h"
@@ -47,4 +48,5 @@
         RegisterObject(Model);
 
+        this->setConfigValues();
         this->registerVariables();
     }
@@ -54,4 +56,10 @@
         if (this->isInitialized() && this->mesh_.getEntity())
             this->detachOgreObject(this->mesh_.getEntity());
+    }
+
+    void Model::setConfigValues()
+    {
+        SetConfigValueExternal(bGlobalEnableLod_, "GraphicsSettings", "enableModelLoD", true)
+            .description("Enable level of detail for models");
     }
 
@@ -97,99 +105,105 @@
                 this->mesh_.setVisible(this->isVisible());
 
-
-                //LOD
-                if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 )
+                if (this->bGlobalEnableLod_)
+                    this->enableLod();
+            }
+        }
+    }
+
+    void Model::changedShadows()
+    {
+        this->mesh_.setCastShadows(this->bCastShadows_);
+    }
+
+    void Model::changedVisibility()
+    {
+        SUPER(Model, changedVisibility);
+
+        this->mesh_.setVisible(this->isVisible());
+    }
+
+    void Model::enableLod()
+    {
+        //LOD
+        if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 )
+        {
+            Level* level = this->getLevel();
+
+            assert( level != 0 );
+
+            MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_);
+            if( lodInfo )
+            {
+                setLodLevel(lodInfo->getLodLevel());
+                this->bLodEnabled_ = lodInfo->getEnabled();
+                this->numLodLevels_ = lodInfo->getNumLevels();
+                this->lodReductionRate_ = lodInfo->getReductionRate();
+            }
+            if( this->numLodLevels_>10 )
+            {
+                CCOUT(2) << "More than 10 LoD levels requested. Creating only 10." << endl;
+                this->numLodLevels_ = 10;
+            }
+            if( this->bLodEnabled_ )
+            {
+                float volume = this->mesh_.getEntity()->getBoundingBox().volume();
+/*
+                float scaleFactor = 1;
+
+                BaseObject* creatorPtr = this;
+
+                while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr))
                 {
-                    Level* level = this->getLevel();
-
-                    assert( level != 0 );
-
-                    MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_);
-                    if( lodInfo )
-                    {
-                        setLodLevel(lodInfo->getLodLevel());
-                        this->bLodEnabled_ = lodInfo->getEnabled();
-                        this->numLodLevels_ = lodInfo->getNumLevels();
-                        this->lodReductionRate_ = lodInfo->getReductionRate();
-                    }
-                    if( this->numLodLevels_>10 )
-                    {
-                        CCOUT(2) << "More than 10 LoD levels requested. Creating only 10." << endl;
-                        this->numLodLevels_ = 10;
-                    }
-                    if( this->bLodEnabled_ )
-                    {
-                        float volume = this->mesh_.getEntity()->getBoundingBox().volume();
-    //                     float scaleFactor = 1;
-
-    //                     BaseObject* creatorPtr = this;
-    //
-    //                     while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr))
-    //                     {
-    //                         scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
-    //                         creatorPtr = creatorPtr->getCreator();
-    //                     }
-    //                     COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
-
-                        COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl;
+                    scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
+                    creatorPtr = creatorPtr->getCreator();
+                }
+                COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
+*/
+                COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl;
 
 #if OGRE_VERSION >= 0x010700
-                        Ogre::Mesh::LodValueList distList;
+                Ogre::Mesh::LodValueList distList;
 #else
-                        Ogre::Mesh::LodDistanceList distList;
+                Ogre::Mesh::LodDistanceList distList;
 #endif
 
-                        if( lodLevel_>0 )
-                        {
-    //                         float factor = scaleFactor*5/lodLevel_;
-                            float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_;
-
-                            COUT(4) << "LodLevel set with factor: " << factor << endl;
-
-                            distList.push_back(70.0f*factor);
-                            distList.push_back(140.0f*factor);
-                            distList.push_back(170.0f*factor);
-                            distList.push_back(200.0f*factor);
-                            distList.push_back(230.0f*factor);
-                            distList.push_back(250.0f*factor);
-                            distList.push_back(270.0f*factor);
-                            distList.push_back(290.0f*factor);
-                            distList.push_back(310.0f*factor);
-                            distList.push_back(330.0f*factor);
-                            while(distList.size()>this->numLodLevels_)
-                                distList.pop_back();
-
-
-                            //Generiert LOD-Levels
-                            this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_);
-                        }
-                        else
-                        {
-                            std::string what;
-                            if(lodLevel_>5)
-                                what = ">5";
-                            else
-                                what = "<0";
-
-                            COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl;
-                        }
-                    }
+                if( lodLevel_>0 )
+                {
+//                    float factor = scaleFactor*5/lodLevel_;
+                    float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_;
+
+                    COUT(4) << "LodLevel set with factor: " << factor << endl;
+
+                    distList.push_back(70.0f*factor);
+                    distList.push_back(140.0f*factor);
+                    distList.push_back(170.0f*factor);
+                    distList.push_back(200.0f*factor);
+                    distList.push_back(230.0f*factor);
+                    distList.push_back(250.0f*factor);
+                    distList.push_back(270.0f*factor);
+                    distList.push_back(290.0f*factor);
+                    distList.push_back(310.0f*factor);
+                    distList.push_back(330.0f*factor);
+                    while(distList.size()>this->numLodLevels_)
+                        distList.pop_back();
+
+
+                    //Generiert LOD-Levels
+                    this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_);
+                }
+                else
+                {
+                    std::string what;
+                    if(lodLevel_>5)
+                        what = ">5";
                     else
-                        COUT(4) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl;
+                        what = "<0";
+
+                    COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl;
                 }
             }
+            else
+                COUT(4) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl;
         }
     }
-
-    void Model::changedShadows()
-    {
-        this->mesh_.setCastShadows(this->bCastShadows_);
-    }
-
-    void Model::changedVisibility()
-    {
-        SUPER(Model, changedVisibility);
-
-        this->mesh_.setVisible(this->isVisible());
-    }
 }
Index: /code/trunk/src/orxonox/graphics/Model.h
===================================================================
--- /code/trunk/src/orxonox/graphics/Model.h	(revision 7165)
+++ /code/trunk/src/orxonox/graphics/Model.h	(revision 7166)
@@ -44,4 +44,6 @@
             virtual ~Model();
 
+            void setConfigValues();
+
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
@@ -67,4 +69,6 @@
 
             //LoD
+            void enableLod();
+
             inline void setLodLevel(float lodLevel)
                 { this->lodLevel_ =  lodLevel; }
@@ -78,4 +82,5 @@
 
             //LoD
+            bool bGlobalEnableLod_;
             float lodLevel_;
             bool bLodEnabled_;
