Changeset 6691 for code/branches/lod/src/orxonox/graphics
- Timestamp:
- Apr 12, 2010, 3:48:24 PM (15 years ago)
- Location:
- code/branches/lod/src/orxonox/graphics
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.