Index: code/branches/lod/data/levels/presentationLOD.oxw
===================================================================
--- code/branches/lod/data/levels/presentationLOD.oxw	(revision 6691)
+++ code/branches/lod/data/levels/presentationLOD.oxw	(revision 6691)
@@ -0,0 +1,24 @@
+<?lua
+  include("stats.oxo")
+  include("hudtemplates3.oxo")
+?>
+
+<?lua
+  include("templates/spaceship_assff.oxt")
+  include("templates/spaceship_pirate.oxt")
+?>
+
+<Level
+ name         = "Sample"
+ description  = "Just a few tests"
+>
+  <Scene
+    ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/Starbox"
+  >
+    <Model position="0,10,0" scale=3 mesh="ast3.mesh"/>
+    <Model position="0,-10,0" scale=3 mesh="ast3.mesh"/>
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+    <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
+  </Scene>
+</Level>
Index: code/branches/lod/data/levels/presentationLODdif.oxw
===================================================================
--- code/branches/lod/data/levels/presentationLODdif.oxw	(revision 6691)
+++ code/branches/lod/data/levels/presentationLODdif.oxw	(revision 6691)
@@ -0,0 +1,35 @@
+<?lua
+  include("stats.oxo")
+  include("hudtemplates3.oxo")
+  include("lodinformation.oxt")
+?>
+
+<?lua
+  include("templates/spaceship_assff.oxt")
+  include("templates/spaceship_pirate.oxt")
+?>
+
+<Level
+ name         = "Sample"
+ description  = "Just a few tests"
+>
+  <lodinformation>
+	  <MeshLodInformation mesh=ast1.mesh lodQuality=4 />
+  </lodinformation>
+  <Scene
+    ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/Starbox"
+  >
+    <Model position="0,10,0" scale=3 mesh="ast3.mesh"/>
+	<Model position="0,-10,0" scale=3 mesh="ast3.mesh" lodLevel="1"/>
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+    <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
+	
+  </Scene>
+
+  <templates>
+	<Template link=lodtemplate_default />
+  </templates>
+</Level>
+
+ 
Index: code/branches/lod/src/orxonox/Level.cc
===================================================================
--- code/branches/lod/src/orxonox/Level.cc	(revision 6690)
+++ code/branches/lod/src/orxonox/Level.cc	(revision 6691)
@@ -32,5 +32,5 @@
 #include "core/CoreIncludes.h"
 #include "core/Loader.h"
-#include "core/Template.h"
+#include "core/template.h"
 #include "core/XMLFile.h"
 #include "core/XMLPort.h"
@@ -73,6 +73,7 @@
         XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
 
-        XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
-    }
+        XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);            
+        XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode);
+}
 
     void Level::registerVariables()
@@ -138,4 +139,31 @@
         return 0;
     }
+    
+    //LoD
+    void Level::addLodInfo(const MeshLodInformation* lodInformation)
+    {
+//		std::pair<std::map<std::string,MeshLodInformation*>::iterator,bool> it 
+//		    = new std::pair<lodInformation->getMeshName(),lodInformation>;
+        this->lodInformation_.insert(std::pair<lodInformation->getMeshName(),lodInformation>);
+    }
+
+    MeshLodInformation* Level::getLodInfo(string meshName) const
+    {
+        if(this->lodInformation_.find(meshName)!=std::map::end)
+            return this->lodInformation_.find(meshName);
+        
+        return 0;
+        
+        
+        /*
+        unsigned int i = 0;
+        for (std::map<MeshLodInformation*>::const_iterator it = this->lodInformation_.begin(); it != this->lodInformation_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;*/
+    }
 
     void Level::playerEntered(PlayerInfo* player)
Index: code/branches/lod/src/orxonox/Level.h
===================================================================
--- code/branches/lod/src/orxonox/Level.h	(revision 6690)
+++ code/branches/lod/src/orxonox/Level.h	(revision 6691)
@@ -34,6 +34,8 @@
 #include <list>
 #include <string>
+#include <map>
 #include "core/BaseObject.h"
 #include "network/synchronisable/Synchronisable.h"
+#include "graphics/MeshLodInformation.h"
 
 namespace orxonox
@@ -60,4 +62,7 @@
             BaseObject* getObject(unsigned int index) const;
 
+            void addLodInfo(const MeshLodInformation* object);
+            MeshLodInformation* getLodInfo(unsigned int index) const;
+
             void setGametypeString(const std::string& gametype);
             inline const std::string& getGametypeString() const
@@ -66,9 +71,10 @@
             void networkcallback_applyXMLFile();
 
-            std::string            description_;
-            std::string            gametype_;
-            std::string            xmlfilename_;
-            XMLFile*               xmlfile_;
-            std::list<BaseObject*> objects_;
+            std::string                    description_;
+            std::string                    gametype_;
+            std::string                    xmlfilename_;
+            XMLFile*                       xmlfile_;
+            std::list<BaseObject*>         objects_;
+            std::map<std::string,MeshLodInformation*>  lodInformation_;
     };
 }
Index: code/branches/lod/src/orxonox/graphics/CMakeLists.txt
===================================================================
--- code/branches/lod/src/orxonox/graphics/CMakeLists.txt	(revision 6690)
+++ code/branches/lod/src/orxonox/graphics/CMakeLists.txt	(revision 6691)
@@ -4,4 +4,5 @@
   FadingBillboard.cc
   GlobalShader.cc
+  MeshLodInformation.cc
   Model.cc
   ParticleEmitter.cc
Index: code/branches/lod/src/orxonox/graphics/MeshLodInformation.cc
===================================================================
--- code/branches/lod/src/orxonox/graphics/MeshLodInformation.cc	(revision 6691)
+++ code/branches/lod/src/orxonox/graphics/MeshLodInformation.cc	(revision 6691)
@@ -0,0 +1,66 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Jan Bernegger
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "MeshLodInformation.h"
+
+#include <OgreEntity.h>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+    CreateFactory(MeshLodInformation);
+
+    MeshLodInformation::MeshLodInformation(BaseObject* creator) : StaticEntity(creator)
+    {
+        RegisterObject(MeshLodInformation);
+    }
+
+    MeshLodInformation::~MeshLodInformation()
+    {    }
+
+    void MeshLodInformation::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(MeshLodInformation, XMLPort, xmlelement, mode);
+
+        XMLPortParam(MeshLodInformation, "lodQuality", setLodLevel, getLodLevel, xmlelement, mode).defaultValues(5);
+        XMLPortParam(MeshLodInformation, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
+    }
+    
+    std::string getMeshName()
+    {
+        if(mesh!=null)
+            return mesh;
+        return "";
+    }
+
+ 
+}
Index: code/branches/lod/src/orxonox/graphics/MeshLodInformation.h
===================================================================
--- code/branches/lod/src/orxonox/graphics/MeshLodInformation.h	(revision 6691)
+++ code/branches/lod/src/orxonox/graphics/MeshLodInformation.h	(revision 6691)
@@ -0,0 +1,52 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Jan Bernegger
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _MeshLodInformation_H__
+#define _MeshLodInformation_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "tools/Mesh.h"
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport MeshLodInformation : public BaseObject
+    {
+        public:
+            MeshLodInformation(BaseObject* creator);
+            virtual ~MeshLodInformation();
+            
+            std::string getMeshName();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+    };
+}
+
+#endif /* _MeshLodInformation_H__ */
Index: code/branches/lod/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/lod/src/orxonox/graphics/Model.cc	(revision 6690)
+++ code/branches/lod/src/orxonox/graphics/Model.cc	(revision 6691)
@@ -58,5 +58,8 @@
     {
         SUPER(Model, XMLPort, xmlelement, mode);
-
+		
+		//LoD
+        XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode).defaultValues(5);
+		
         XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
         XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
@@ -75,5 +78,5 @@
             if (this->mesh_.getEntity())
                 this->detachOgreObject(this->mesh_.getEntity());
-
+            
             this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
 
@@ -83,4 +86,37 @@
                 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
                 this->mesh_.setVisible(this->isVisible());
+                
+                //LOD
+                if(this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1
+                    &&this->meshSrc_!="laserbeam.mesh"
+                    &&this->lodLevel_!=0)
+                {
+                    float scaleFactor = this->getScale();
+                    COUT(0) << this->meshSrc_<< " lodLevel_: " << this->lodLevel_ <<" scale: "<< scaleFactor << std::endl;
+                    //Für Asteroiden perfekt
+
+#if OGRE_VERSION >= 0x010700
+                    Ogre::Mesh::LodValueList distList;
+#else
+                    Ogre::Mesh::LodDistanceList distList;
+#endif
+
+                    distList.push_back(70.0f*scaleFactor);
+                    distList.push_back(140.0f*scaleFactor);
+                    distList.push_back(170.0f*scaleFactor);
+                    distList.push_back(200.0f*scaleFactor);
+                    distList.push_back(230.0f*scaleFactor);
+                    distList.push_back(250.0f*scaleFactor);
+                    distList.push_back(270.0f*scaleFactor);
+                    distList.push_back(290.0f*scaleFactor);
+                    distList.push_back(310.0f*scaleFactor);
+                    distList.push_back(330.0f*scaleFactor);
+
+                    float reductionValue = 0.2f;
+
+                    
+                    //Generiert LOD-Levels
+                    this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
+                }
             }
         }
Index: code/branches/lod/src/orxonox/graphics/Model.h
===================================================================
--- code/branches/lod/src/orxonox/graphics/Model.h	(revision 6690)
+++ code/branches/lod/src/orxonox/graphics/Model.h	(revision 6691)
@@ -61,12 +61,21 @@
             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_; }
 
             std::string meshSrc_;
             Mesh mesh_;
             bool bCastShadows_;
+			
+			//LoD
+			unsigned short lodLevel_;
     };
 }
