Changeset 6691 for code/branches/lod/src/orxonox/graphics/Model.cc
- Timestamp:
- Apr 12, 2010, 3:48:24 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.