Changeset 6691 for code/branches/lod
- Timestamp:
- Apr 12, 2010, 3:48:24 PM (15 years ago)
- Location:
- code/branches/lod
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lod/src/orxonox/Level.cc
r6417 r6691 32 32 #include "core/CoreIncludes.h" 33 33 #include "core/Loader.h" 34 #include "core/ Template.h"34 #include "core/template.h" 35 35 #include "core/XMLFile.h" 36 36 #include "core/XMLPort.h" … … 73 73 XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype"); 74 74 75 XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); 76 } 75 XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); 76 XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode); 77 } 77 78 78 79 void Level::registerVariables() … … 138 139 return 0; 139 140 } 141 142 //LoD 143 void Level::addLodInfo(const MeshLodInformation* lodInformation) 144 { 145 // std::pair<std::map<std::string,MeshLodInformation*>::iterator,bool> it 146 // = new std::pair<lodInformation->getMeshName(),lodInformation>; 147 this->lodInformation_.insert(std::pair<lodInformation->getMeshName(),lodInformation>); 148 } 149 150 MeshLodInformation* Level::getLodInfo(string meshName) const 151 { 152 if(this->lodInformation_.find(meshName)!=std::map::end) 153 return this->lodInformation_.find(meshName); 154 155 return 0; 156 157 158 /* 159 unsigned int i = 0; 160 for (std::map<MeshLodInformation*>::const_iterator it = this->lodInformation_.begin(); it != this->lodInformation_.end(); ++it) 161 { 162 if (i == index) 163 return (*it); 164 ++i; 165 } 166 return 0;*/ 167 } 140 168 141 169 void Level::playerEntered(PlayerInfo* player) -
code/branches/lod/src/orxonox/Level.h
r5929 r6691 34 34 #include <list> 35 35 #include <string> 36 #include <map> 36 37 #include "core/BaseObject.h" 37 38 #include "network/synchronisable/Synchronisable.h" 39 #include "graphics/MeshLodInformation.h" 38 40 39 41 namespace orxonox … … 60 62 BaseObject* getObject(unsigned int index) const; 61 63 64 void addLodInfo(const MeshLodInformation* object); 65 MeshLodInformation* getLodInfo(unsigned int index) const; 66 62 67 void setGametypeString(const std::string& gametype); 63 68 inline const std::string& getGametypeString() const … … 66 71 void networkcallback_applyXMLFile(); 67 72 68 std::string description_; 69 std::string gametype_; 70 std::string xmlfilename_; 71 XMLFile* xmlfile_; 72 std::list<BaseObject*> objects_; 73 std::string description_; 74 std::string gametype_; 75 std::string xmlfilename_; 76 XMLFile* xmlfile_; 77 std::list<BaseObject*> objects_; 78 std::map<std::string,MeshLodInformation*> lodInformation_; 73 79 }; 74 80 } -
code/branches/lod/src/orxonox/graphics/CMakeLists.txt
r5929 r6691 4 4 FadingBillboard.cc 5 5 GlobalShader.cc 6 MeshLodInformation.cc 6 7 Model.cc 7 8 ParticleEmitter.cc -
code/branches/lod/src/orxonox/graphics/Model.cc
r5781 r6691 58 58 { 59 59 SUPER(Model, XMLPort, xmlelement, mode); 60 60 61 //LoD 62 XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode).defaultValues(5); 63 61 64 XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode); 62 65 XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true); … … 75 78 if (this->mesh_.getEntity()) 76 79 this->detachOgreObject(this->mesh_.getEntity()); 77 80 78 81 this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_); 79 82 … … 83 86 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 84 87 this->mesh_.setVisible(this->isVisible()); 88 89 //LOD 90 if(this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 91 &&this->meshSrc_!="laserbeam.mesh" 92 &&this->lodLevel_!=0) 93 { 94 float scaleFactor = this->getScale(); 95 COUT(0) << this->meshSrc_<< " lodLevel_: " << this->lodLevel_ <<" scale: "<< scaleFactor << std::endl; 96 //Für Asteroiden perfekt 97 98 #if OGRE_VERSION >= 0x010700 99 Ogre::Mesh::LodValueList distList; 100 #else 101 Ogre::Mesh::LodDistanceList distList; 102 #endif 103 104 distList.push_back(70.0f*scaleFactor); 105 distList.push_back(140.0f*scaleFactor); 106 distList.push_back(170.0f*scaleFactor); 107 distList.push_back(200.0f*scaleFactor); 108 distList.push_back(230.0f*scaleFactor); 109 distList.push_back(250.0f*scaleFactor); 110 distList.push_back(270.0f*scaleFactor); 111 distList.push_back(290.0f*scaleFactor); 112 distList.push_back(310.0f*scaleFactor); 113 distList.push_back(330.0f*scaleFactor); 114 115 float reductionValue = 0.2f; 116 117 118 //Generiert LOD-Levels 119 this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue); 120 } 85 121 } 86 122 } -
code/branches/lod/src/orxonox/graphics/Model.h
r5781 r6691 61 61 inline bool getCastShadows() const 62 62 { return this->bCastShadows_; } 63 63 64 64 private: 65 65 void changedMesh(); 66 66 void changedShadows(); 67 68 //LoD 69 inline void setLodLevel(unsigned short lodLevel) 70 { this->lodLevel_ = lodLevel; } 71 inline unsigned short getLodLevel() const 72 { return this->lodLevel_; } 67 73 68 74 std::string meshSrc_; 69 75 Mesh mesh_; 70 76 bool bCastShadows_; 77 78 //LoD 79 unsigned short lodLevel_; 71 80 }; 72 81 }
Note: See TracChangeset
for help on using the changeset viewer.