Index: code/branches/presentation3/data/levels/Level(Deathmatch).oxw
===================================================================
--- code/branches/presentation3/data/levels/Level(Deathmatch).oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/Level(Deathmatch).oxw	(revision 7036)
@@ -1,9 +1,10 @@
 <?lua
-	include("stats.oxo")
-	include("hudtemplates3.oxo")
-	include("underattackhud.oxo")
-	include("templates/spaceship_assff.oxt")
-	include("templates/spaceship_pirate.oxt")
-	include("templates/spaceship_Transporter.oxt")
+  include("stats.oxo")
+  include("hudtemplates3.oxo")
+  include("underattackhud.oxo")
+  include("templates/spaceship_assff.oxt")
+  include("templates/spaceship_pirate.oxt")
+  include("templates/spaceship_Transporter.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -60,7 +61,7 @@
   gametype=TeamDeathmatch
 >
-    <lodinformation>
-	    <MeshLodInformation mesh=Transporter.mesh lodQuality=10 />
-    </lodinformation>
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
 
 	<!-- Ausgang: Szene ===> ambientlight/skybox -->
Index: code/branches/presentation3/data/levels/Level(UnderAttack).oxw
===================================================================
--- code/branches/presentation3/data/levels/Level(UnderAttack).oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/Level(UnderAttack).oxw	(revision 7036)
@@ -1,9 +1,10 @@
 <?lua
-	include("stats.oxo")
-	include("hudtemplates3.oxo")
-	include("underattackhud.oxo")
-	include("templates/spaceship_assff.oxt")
-	include("templates/spaceship_pirate.oxt")
-	include("templates/spaceship_destroyer.oxt")
+  include("stats.oxo")
+  include("hudtemplates3.oxo")
+  include("underattackhud.oxo")
+  include("templates/spaceship_assff.oxt")
+  include("templates/spaceship_pirate.oxt")
+  include("templates/spaceship_destroyer.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -14,4 +15,7 @@
   gametype=UnderAttack
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
 
 	<!-- Ausgang: Szene ===> ambientlight/skybox -->
Index: code/branches/presentation3/data/levels/Quest_PirateAttack.oxw
===================================================================
--- code/branches/presentation3/data/levels/Quest_PirateAttack.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/Quest_PirateAttack.oxw	(revision 7036)
@@ -5,4 +5,5 @@
   include("templates/spaceship_HXY_SL.oxt")
   include("templates/spaceship_pirate.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -35,4 +36,8 @@
 gametype=TeamDeathmatch
 >
+
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
 
     <Scene
Index: code/branches/presentation3/data/levels/events.oxw
===================================================================
--- code/branches/presentation3/data/levels/events.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/events.oxw	(revision 7036)
@@ -4,4 +4,5 @@
   include("templates/spaceship_assff.oxt")
   include("templates/spaceship_H2.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -10,4 +11,8 @@
  description  = "A simple level to test the event-system (with comments)"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+
   <Scene
    ambientlight = "0.5, 0.5, 0.5"
Index: code/branches/presentation3/data/levels/mylevel.oxw
===================================================================
--- code/branches/presentation3/data/levels/mylevel.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/mylevel.oxw	(revision 7036)
@@ -6,4 +6,5 @@
   include("templates/spaceship_pirate.oxt")
   include("templates/spaceship_Transporter.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
Index: code/branches/presentation3/data/levels/pickups.oxw
===================================================================
--- code/branches/presentation3/data/levels/pickups.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/pickups.oxw	(revision 7036)
@@ -8,4 +8,5 @@
   include("templates/spaceship_pirate.oxt")
   include("templates/pickup_representation_templates.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -14,4 +15,7 @@
  description  = "Just a few tests"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
     ambientlight = "0.8, 0.8, 0.8"
Index: code/branches/presentation3/data/levels/presentation.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentation.oxw	(revision 7036)
@@ -3,4 +3,5 @@
   include("stats.oxo")
   include("templates/spaceship_assff.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -9,4 +10,7 @@
  description  = "Just a few tests"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
    ambientlight = "0.3, 0.3, 0.3"
Index: code/branches/presentation3/data/levels/presentation09.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation09.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentation09.oxw	(revision 7036)
@@ -4,4 +4,5 @@
   include("templates/spaceship_assff.oxt")
   include("templates/spaceship_H2.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -11,4 +12,7 @@
 
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
    ambientlight = "0.5, 0.5, 0.5"
Index: code/branches/presentation3/data/levels/presentation09b.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation09b.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentation09b.oxw	(revision 7036)
@@ -6,4 +6,5 @@
   include("templates/spaceship_pirate.oxt")
   include("templates/pickup_representation_templates.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -13,4 +14,7 @@
  gametype     = TeamDeathmatch
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
    ambientlight = "0.5, 0.5, 0.5"
Index: code/branches/presentation3/data/levels/presentationHS09.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentationHS09.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentationHS09.oxw	(revision 7036)
@@ -6,4 +6,5 @@
   include("templates/spaceship_pirate.oxt")
   include("templates/pickup_representation_templates.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -14,4 +15,7 @@
  hasPhysics = true
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
    ambientlight = "0.6, 0.4, 0.4"
Index: code/branches/presentation3/data/levels/presentationHS09b.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentationHS09b.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentationHS09b.oxw	(revision 7036)
@@ -2,4 +2,5 @@
   include("stats.oxo")
   include("hudtemplates3.oxo")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -19,4 +20,7 @@
  gametype     = TeamDeathmatch
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
     ambientlight = "0.8, 0.8, 0.8"
Index: code/branches/presentation3/data/levels/presentationLOD.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentationLOD.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentationLOD.oxw	(revision 7036)
@@ -2,4 +2,5 @@
   include("stats.oxo")
   include("hudtemplates3.oxo")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -13,4 +14,7 @@
  description  = "Just a few tests"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
     ambientlight = "0.8, 0.8, 0.8"
Index: code/branches/presentation3/data/levels/presentationLODdif.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentationLODdif.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentationLODdif.oxw	(revision 7036)
@@ -14,4 +14,7 @@
  description  = "Just a few tests"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
 
   <lodinformation>
Index: code/branches/presentation3/data/levels/presentation_dm.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation_dm.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentation_dm.oxw	(revision 7036)
@@ -4,4 +4,5 @@
   include("templates/spaceship_assff.oxt")
   include("templates/spaceship_H2.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -10,4 +11,7 @@
  description  = "A simple testlevel"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
    ambientlight = "0.5, 0.5, 0.5"
Index: code/branches/presentation3/data/levels/presentation_pong.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation_pong.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/presentation_pong.oxw	(revision 7036)
@@ -3,4 +3,5 @@
   include("stats.oxo")
   include("ponghud.oxo")
+  include("templates/lodinformation.oxt")
 ?>
 
Index: code/branches/presentation3/data/levels/princessaeryn.oxw
===================================================================
--- code/branches/presentation3/data/levels/princessaeryn.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/princessaeryn.oxw	(revision 7036)
@@ -3,4 +3,5 @@
   include("stats.oxo")
   include("templates/spaceship_assff.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -22,4 +23,8 @@
    width  = 50
   />
+
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
 
   <Scene
Index: code/branches/presentation3/data/levels/quest_test.oxw
===================================================================
--- code/branches/presentation3/data/levels/quest_test.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/quest_test.oxw	(revision 7036)
@@ -5,4 +5,5 @@
   include("templates/spaceship_HXY_SL.oxt")
   include("templates/spaceship_pirate.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -32,4 +33,8 @@
 	     width    = 50
     />
+
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
 
     <Scene
Index: code/branches/presentation3/data/levels/sound.oxw
===================================================================
--- code/branches/presentation3/data/levels/sound.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/sound.oxw	(revision 7036)
@@ -2,4 +2,5 @@
   include("stats.oxo")
   include("hudtemplates3.oxo")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -13,4 +14,8 @@
  description  = "Just a few tests"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+
   <Scene
     ambientlight = "0.8, 0.8, 0.8"
Index: code/branches/presentation3/data/levels/templates/lodinformation.oxt
===================================================================
--- code/branches/presentation3/data/levels/templates/lodinformation.oxt	(revision 7035)
+++ code/branches/presentation3/data/levels/templates/lodinformation.oxt	(revision 7036)
@@ -1,10 +1,12 @@
 <Template name=lodtemplate_default defaults=false>
   <Level>
-	<lodinformation>
-	  <MeshLodInformation mesh=Carrier.mesh lodQuality=1.8 />
-	  <MeshLodInformation mesh=assff.mesh lodQuality=3 />
-          <MeshLodInformation mesh=Transporter.mesh lodQuality=5 />
-          <MeshLodInformation mesh=rocket.mesh lodQuality=5 enabled=true />
-	</lodinformation>
+    <lodinformation>
+      <MeshLodInformation mesh=Carrier.mesh lodQuality=1.8 />
+      <MeshLodInformation mesh=assff.mesh lodQuality=3 />
+      <MeshLodInformation mesh=rocket.mesh lodQuality=5 enabled=true />
+      <MeshLodInformation mesh=laserbeam.mesh enabled=false />
+      <MeshLodInformation mesh=HXY.mesh enabled=true numLevels=8 />
+      <MeshLodInformation mesh=Transporter.mesh enabled=true numLevels=8 />
+    </lodinformation>
   </Level>
 </Template>
Index: code/branches/presentation3/data/levels/test_ghost.oxw
===================================================================
--- code/branches/presentation3/data/levels/test_ghost.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/test_ghost.oxw	(revision 7036)
@@ -4,4 +4,5 @@
   include("templates/spaceship_ghost.oxt")
   include("templates/spaceship_pirate.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -11,4 +12,8 @@
 
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+
   <Scene
    ambientlight = "0.5, 0.5, 0.5"
Index: code/branches/presentation3/data/levels/test_stars.oxw
===================================================================
--- code/branches/presentation3/data/levels/test_stars.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/test_stars.oxw	(revision 7036)
@@ -13,4 +13,7 @@
  description  = "Just a few tests"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
     ambientlight = "0.8, 0.8, 0.8"
Index: code/branches/presentation3/data/levels/tutorial.oxw
===================================================================
--- code/branches/presentation3/data/levels/tutorial.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/tutorial.oxw	(revision 7036)
@@ -9,4 +9,7 @@
  description  = "A simple testlevel"
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
    ambientlight = "0.5, 0.5, 0.5"
Index: code/branches/presentation3/data/levels/waypoints.oxw
===================================================================
--- code/branches/presentation3/data/levels/waypoints.oxw	(revision 7035)
+++ code/branches/presentation3/data/levels/waypoints.oxw	(revision 7036)
@@ -5,4 +5,5 @@
   include("templates/spaceship_H2.oxt")
   include("templates/spaceship_pirate.oxt")
+  include("templates/lodinformation.oxt")
 ?>
 
@@ -11,4 +12,7 @@
  description  = "Testing waypoings for AI controlled spaceships."
 >
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
   <Scene
    ambientlight = "0.5, 0.5, 0.5"
Index: code/branches/presentation3/src/orxonox/Level.cc
===================================================================
--- code/branches/presentation3/src/orxonox/Level.cc	(revision 7035)
+++ code/branches/presentation3/src/orxonox/Level.cc	(revision 7036)
@@ -145,5 +145,8 @@
     {
         std::string meshName = lodInformation->getMeshName();
-        this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
+//         this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
+        if( this->lodInformation_.find(meshName) != this->lodInformation_.end())
+          CCOUT(4) << "replacing lod information for " << meshName << endl;
+        this->lodInformation_[meshName] = lodInformation;
     }
 
Index: code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc	(revision 7035)
+++ code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc	(revision 7036)
@@ -41,5 +41,5 @@
 
     MeshLodInformation::MeshLodInformation(BaseObject* creator) 
-	: BaseObject(creator), lodLevel_(-1), bEnabled_(true)
+	: BaseObject(creator), lodLevel_(5), bEnabled_(true), numLevels_(10), reductionRate_(0.15)
     {
         RegisterObject(MeshLodInformation);
@@ -56,4 +56,6 @@
         XMLPortParam(MeshLodInformation, "lodQuality", setLodLevel, getLodLevel, xmlelement, mode);
         XMLPortParam(MeshLodInformation, "enabled", setEnabled, getEnabled, xmlelement, mode);
+        XMLPortParam(MeshLodInformation, "numLevels", setNumLevels, getNumLevels, xmlelement, mode);
+        XMLPortParam(MeshLodInformation, "reductionRate", setReductionRate, getReductionRate, xmlelement, mode);
     }
     
Index: code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h	(revision 7035)
+++ code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h	(revision 7036)
@@ -47,4 +47,6 @@
             std::string getMeshName();
             bool getEnabled(){ return this->bEnabled_; }
+            unsigned int getNumLevels(){ return this->numLevels_; }
+            float getReductionRate(){ return this->reductionRate_; }
             
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
@@ -53,9 +55,13 @@
             void setLodLevel(float lodLevel);
             void setMeshSource(std::string meshSource);
-            void setEnabled( bool enabled ){ this->bEnabled_ = true; }
+            void setEnabled( bool enabled ){ this->bEnabled_ = enabled; }
+            void setNumLevels( unsigned int num ){ this->numLevels_ = num; }
+            void setReductionRate( float rate ){ this->reductionRate_ = rate; }
             std::string getMeshSource();
             std::string meshSource_;
             float lodLevel_;
             bool bEnabled_;
+            unsigned int numLevels_;
+            float reductionRate_;
 
     };
Index: code/branches/presentation3/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Model.cc	(revision 7035)
+++ code/branches/presentation3/src/orxonox/graphics/Model.cc	(revision 7036)
@@ -42,13 +42,10 @@
     CreateFactory(Model);
 
-    Model::Model(BaseObject* creator) : StaticEntity(creator)
+    Model::Model(BaseObject* creator) : 
+        StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15)
     {
         RegisterObject(Model);
 
-        this->bCastShadows_ = true;
-
         this->registerVariables();
-        //LoD
-        this->lodLevel_=5;
     }
 
@@ -102,6 +99,5 @@
                 
                 //LOD
-                if(this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1
-                    &&this->meshSrc_!="laserbeam.mesh")
+                if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 )
                 {
                     Level* level = this->getLevel();
@@ -109,9 +105,19 @@
                     assert( level != 0 );
                     
-                    if( level->getLodInfo(this->meshSrc_)!=0 )
-                        setLodLevel(level->getLodInfo(this->meshSrc_)->getLodLevel());
-                    if( level->getLodInfo(this->meshSrc_)==0 || level->getLodInfo(this->meshSrc_)->getEnabled() )
+                    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;
@@ -139,5 +145,5 @@
                             float factor = volume/3/lodLevel_;
                             
-                            COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl;
+                            COUT(4) << "LodLevel set with factor: " << factor << endl;
 
                             distList.push_back(70.0f*factor);
@@ -151,10 +157,10 @@
                             distList.push_back(310.0f*factor);
                             distList.push_back(330.0f*factor);
-
-                            float reductionValue = 0.15f;
+                            while(distList.size()>this->numLodLevels_)
+                                distList.pop_back();
 
                             
                             //Generiert LOD-Levels
-                            this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
+                            this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_);
                         }
                         else
@@ -166,7 +172,9 @@
                                 what = "<0";
                             
-                            COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl;
+                            COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl;
                         }
                     }
+                    else
+                        COUT(4) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl;
                 }
             }
Index: code/branches/presentation3/src/orxonox/graphics/Model.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Model.h	(revision 7035)
+++ code/branches/presentation3/src/orxonox/graphics/Model.h	(revision 7036)
@@ -79,4 +79,8 @@
             //LoD
             float lodLevel_;
+            bool bLodEnabled_;
+            unsigned int numLodLevels_;
+            float lodReductionRate_;
+            
     };
 }
