Index: /code/branches/lod/src/orxonox/graphics/Model.cc
===================================================================
--- /code/branches/lod/src/orxonox/graphics/Model.cc	(revision 6842)
+++ /code/branches/lod/src/orxonox/graphics/Model.cc	(revision 6843)
@@ -29,6 +29,4 @@
 #include "Model.h"
 
-// What's this? With the directory in front the filename, my compiler can't find the file...
-//#include <OGRE/OgreEntity.h>
 #include <OgreEntity.h>
 
@@ -76,4 +74,14 @@
     }
 
+    float Model::getBiggestScale(Vector3 scale3d)
+    {
+        float scaleFactor = scale3d.x;
+        if(scale3d.y>scaleFactor)
+            scaleFactor = scale3d.y;
+        if(scale3d.z>scaleFactor)
+            scaleFactor = scale3d.z;
+        return scaleFactor;
+    }
+    
     void Model::changedMesh()
     {
@@ -93,13 +101,14 @@
                 //LOD
                 if(this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1
-                    &&this->meshSrc_!="laserbeam.mesh"
-                    &&this->lodLevel_!=0)
+                    &&this->meshSrc_!="laserbeam.mesh")
                 {
-                    Vector3 scale3d = this->getScale3D();
-                    float scaleFactor = scale3d.x;
-                    if(scale3d.y>scaleFactor)
-                        scaleFactor = scale3d.y;
-                    if(scale3d.z>scaleFactor)
-                        scaleFactor = scale3d.z;
+                    float scaleFactor = getBiggestScale(this->getScale3D());
+                    BaseObject* creatorPtr = this->getCreator();
+                    while(creatorPtr!=0)
+                    {
+                        // TODO Cannot cast to WorldEntity
+                        scaleFactor *= getBiggestScale(((WorldEntity) creatorPtr)->getScale3D());
+                        creatorPtr = this->getCreator();
+                    }
                     
                     Level* level_ = this->getLevel();
@@ -109,6 +118,5 @@
                         setLodLevel(lodInfo->getLodLevel());
                     
-                    COUT(0) << this->meshSrc_<< " lodLevel_: " << this->lodLevel_ <<" scale: "<< scaleFactor << std::endl;
-                    //Fuer Asteroiden perfekt
+                    COUT(0) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and scale: "<< scaleFactor << ":" << std::endl;
 
 #if OGRE_VERSION >= 0x010700
@@ -118,23 +126,31 @@
 #endif
 
-                    float factor = scaleFactor;
-                    COUT(0)<<"scaleFactor:"<<scaleFactor<<std::endl;
+                    if(lodLevel_>0)
+                    {
+                        float factor = scaleFactor*5/lodLevel_;
+                        
+                        COUT(0)<<"LodLevel set with factor: "<<factor<<std::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);
+                        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);
 
-                    float reductionValue = 0.2f;
+                        float reductionValue = 0.2f;
 
-                    
-                    //Generiert LOD-Levels
-                    this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
+                        
+                        //Generiert LOD-Levels
+                        this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
+                    }
+                    else
+                    {
+                        COUT(0)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was < 0."<<std::endl;
+                    }
                 }
             }
Index: /code/branches/lod/src/orxonox/graphics/Model.h
===================================================================
--- /code/branches/lod/src/orxonox/graphics/Model.h	(revision 6842)
+++ /code/branches/lod/src/orxonox/graphics/Model.h	(revision 6843)
@@ -61,21 +61,22 @@
             inline bool getCastShadows() const
                 { return this->bCastShadows_; }
-				
+                
         private:
             void changedMesh();
             void changedShadows();
-			
-			//LoD
-			inline void setLodLevel(unsigned short lodLevel)
-				{ this->lodLevel_ =  lodLevel; }
-			inline unsigned short getLodLevel() const
-				{ return this->lodLevel_; }
+            
+            //LoD
+            inline void setLodLevel(unsigned short lodLevel)
+                { this->lodLevel_ =  lodLevel; }
+            inline unsigned short getLodLevel() const
+                { return this->lodLevel_; }
+            float Model::getBiggestScale(Vector3 scale3d);
 
             std::string meshSrc_;
             Mesh mesh_;
             bool bCastShadows_;
-			
-			//LoD
-			unsigned short lodLevel_;
+            
+            //LoD
+            unsigned short lodLevel_;
     };
 }
