[Orxonox-commit 2070] r6786 - in code/branches/lod: data/levels/templates src/orxonox src/orxonox/graphics

kolibri7 at orxonox.net kolibri7 at orxonox.net
Mon Apr 26 16:05:45 CEST 2010


Author: kolibri7
Date: 2010-04-26 16:05:45 +0200 (Mon, 26 Apr 2010)
New Revision: 6786

Added:
   code/branches/lod/data/levels/templates/lodinformation.oxt
Modified:
   code/branches/lod/src/orxonox/Level.cc
   code/branches/lod/src/orxonox/Level.h
   code/branches/lod/src/orxonox/graphics/MeshLodInformation.cc
   code/branches/lod/src/orxonox/graphics/MeshLodInformation.h
   code/branches/lod/src/orxonox/graphics/Model.cc
Log:


Added: code/branches/lod/data/levels/templates/lodinformation.oxt
===================================================================
--- code/branches/lod/data/levels/templates/lodinformation.oxt	                        (rev 0)
+++ code/branches/lod/data/levels/templates/lodinformation.oxt	2010-04-26 14:05:45 UTC (rev 6786)
@@ -0,0 +1,7 @@
+<Template name=lodtemplate_default>
+  <Level>
+	<lodinformation>
+	  <MeshLodInformation mesh=ast1.mesh lodQuality=1 />
+	</lodinformation>
+  </Level>
+</Template>
\ No newline at end of file

Modified: code/branches/lod/src/orxonox/Level.cc
===================================================================
--- code/branches/lod/src/orxonox/Level.cc	2010-04-26 14:04:03 UTC (rev 6785)
+++ code/branches/lod/src/orxonox/Level.cc	2010-04-26 14:05:45 UTC (rev 6786)
@@ -140,17 +140,19 @@
     }
     
     //LoD
-    void Level::addLodInfo(const MeshLodInformation* lodInformation)
+    void Level::addLodInfo(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>);
+		std::string meshName = lodInformation->getMeshName();
+        this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
+		//this->lodInformation_[std::make_pair<meshName,lodInformation>);
     }
 
-    MeshLodInformation* Level::getLodInfo(string meshName) const
+    const MeshLodInformation* Level::getLodInfo(std::string meshName) const
     {
-        if(this->lodInformation_.find(meshName)!=std::map::end)
-            return this->lodInformation_.find(meshName);
+        if(this->lodInformation_.find(meshName)!=this->lodInformation_.end())
+            return this->lodInformation_.find(meshName)->second;
         
         return 0;
         

Modified: code/branches/lod/src/orxonox/Level.h
===================================================================
--- code/branches/lod/src/orxonox/Level.h	2010-04-26 14:04:03 UTC (rev 6785)
+++ code/branches/lod/src/orxonox/Level.h	2010-04-26 14:05:45 UTC (rev 6786)
@@ -61,8 +61,9 @@
             void addObject(BaseObject* object);
             BaseObject* getObject(unsigned int index) const;
 
-            void addLodInfo(const MeshLodInformation* object);
-            MeshLodInformation* getLodInfo(unsigned int index) const;
+            void addLodInfo(MeshLodInformation* object);
+            const MeshLodInformation* getLodInfo(std::string meshName) const;
+//            MeshLodInformation* getLodInfo(unsigned int index) const;
 
             void setGametypeString(const std::string& gametype);
             inline const std::string& getGametypeString() const

Modified: code/branches/lod/src/orxonox/graphics/MeshLodInformation.cc
===================================================================
--- code/branches/lod/src/orxonox/graphics/MeshLodInformation.cc	2010-04-26 14:04:03 UTC (rev 6785)
+++ code/branches/lod/src/orxonox/graphics/MeshLodInformation.cc	2010-04-26 14:05:45 UTC (rev 6786)
@@ -39,7 +39,8 @@
 {
     CreateFactory(MeshLodInformation);
 
-    MeshLodInformation::MeshLodInformation(BaseObject* creator) : StaticEntity(creator)
+    MeshLodInformation::MeshLodInformation(BaseObject* creator) 
+	: BaseObject(creator), lodLevel_(-1)
     {
         RegisterObject(MeshLodInformation);
     }
@@ -55,12 +56,26 @@
         XMLPortParam(MeshLodInformation, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
     }
     
-    std::string getMeshName()
+    std::string MeshLodInformation::getMeshName()
     {
-        if(mesh!=null)
-            return mesh;
-        return "";
+		return MeshLodInformation::getMeshSource();
     }
-
+	
+	void MeshLodInformation::setLodLevel(unsigned int lodLevel)
+	{
+		lodLevel_=lodLevel;
+	}
+	int MeshLodInformation::getLodLevel()
+	{
+		return lodLevel_;
+	}
+	void MeshLodInformation::setMeshSource(std::string meshSource)
+	{
+		meshSource_ = meshSource;
+	}
+	std::string MeshLodInformation::getMeshSource()
+	{
+		return meshSource_;
+	}
  
-}
+}
\ No newline at end of file

Modified: code/branches/lod/src/orxonox/graphics/MeshLodInformation.h
===================================================================
--- code/branches/lod/src/orxonox/graphics/MeshLodInformation.h	2010-04-26 14:04:03 UTC (rev 6785)
+++ code/branches/lod/src/orxonox/graphics/MeshLodInformation.h	2010-04-26 14:05:45 UTC (rev 6786)
@@ -39,6 +39,14 @@
 {
     class _OrxonoxExport MeshLodInformation : public BaseObject
     {
+		private:
+			void setLodLevel(unsigned int lodLevel);
+			int getLodLevel();
+			void setMeshSource(std::string meshSource);
+			std::string getMeshSource();
+			std::string meshSource_;
+			int lodLevel_;
+		
         public:
             MeshLodInformation(BaseObject* creator);
             virtual ~MeshLodInformation();

Modified: code/branches/lod/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/lod/src/orxonox/graphics/Model.cc	2010-04-26 14:04:03 UTC (rev 6785)
+++ code/branches/lod/src/orxonox/graphics/Model.cc	2010-04-26 14:05:45 UTC (rev 6786)
@@ -101,19 +101,21 @@
                     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 factor = scaleFactor*scaleFactor*scaleFactor*scaleFactor;
 
-                    float reductionValue = 0.2f;
+                    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.5f;
+
                     
                     //Generiert LOD-Levels
                     this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);




More information about the Orxonox-commit mailing list