- Timestamp:
- May 30, 2010, 3:46:08 PM (14 years ago)
- Location:
- code/branches/presentation3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3
- Property svn:mergeinfo changed
/code/branches/rocket2 (added) merged: 6956,6966,6969-6970
- Property svn:mergeinfo changed
-
code/branches/presentation3/src/orxonox/graphics/Model.cc
r7016 r7020 105 105 &&this->meshSrc_!="laserbeam.mesh") 106 106 { 107 float volume = this->mesh_.getEntity()->getBoundingBox().volume(); 108 float scaleFactor = 1; 109 110 BaseObject* creatorPtr = this; 111 112 while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr)) 107 Level* level = this->getLevel(); 108 109 assert( level != 0 ); 110 if( level->getLodInfo(this->meshSrc_)!=0 && level->getLodInfo(this->meshSrc_)->getEnabled() ) 113 111 { 114 scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());115 creatorPtr = creatorPtr->getCreator();116 }117 // COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;118 119 Level* level = this->getLevel();120 121 assert( level != 0 );122 if( level->getLodInfo(this->meshSrc_)!=0 )123 112 setLodLevel(level->getLodInfo(this->meshSrc_)->getLodLevel()); 124 125 COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and scale: "<< scaleFactor << ":" << std::endl; 113 114 float volume = this->mesh_.getEntity()->getBoundingBox().volume(); 115 // float scaleFactor = 1; 116 117 // BaseObject* creatorPtr = this; 118 // 119 // while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr)) 120 // { 121 // scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D()); 122 // creatorPtr = creatorPtr->getCreator(); 123 // } 124 // COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl; 125 126 COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl; 126 127 127 128 #if OGRE_VERSION >= 0x010700 128 Ogre::Mesh::LodValueList distList;129 Ogre::Mesh::LodValueList distList; 129 130 #else 130 Ogre::Mesh::LodDistanceList distList;131 Ogre::Mesh::LodDistanceList distList; 131 132 #endif 132 133 133 if( lodLevel_>0 )134 {135 // float factor = scaleFactor*5/lodLevel_;136 float factor = volume/3/lodLevel_;137 138 COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl;134 if( lodLevel_>0 ) 135 { 136 // float factor = scaleFactor*5/lodLevel_; 137 float factor = volume/3/lodLevel_; 138 139 COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl; 139 140 140 distList.push_back(70.0f*factor);141 distList.push_back(140.0f*factor);142 distList.push_back(170.0f*factor);143 distList.push_back(200.0f*factor);144 distList.push_back(230.0f*factor);145 distList.push_back(250.0f*factor);146 distList.push_back(270.0f*factor);147 distList.push_back(290.0f*factor);148 distList.push_back(310.0f*factor);149 distList.push_back(330.0f*factor);141 distList.push_back(70.0f*factor); 142 distList.push_back(140.0f*factor); 143 distList.push_back(170.0f*factor); 144 distList.push_back(200.0f*factor); 145 distList.push_back(230.0f*factor); 146 distList.push_back(250.0f*factor); 147 distList.push_back(270.0f*factor); 148 distList.push_back(290.0f*factor); 149 distList.push_back(310.0f*factor); 150 distList.push_back(330.0f*factor); 150 151 151 float reductionValue = 0.15f;152 float reductionValue = 0.15f; 152 153 153 154 //Generiert LOD-Levels 155 this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue); 156 } 157 else 158 { 159 std::string what; 160 if(lodLevel_>5) 161 what = ">5"; 154 155 //Generiert LOD-Levels 156 this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue); 157 } 162 158 else 163 what = "<0"; 164 165 COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl; 159 { 160 std::string what; 161 if(lodLevel_>5) 162 what = ">5"; 163 else 164 what = "<0"; 165 166 COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl; 167 } 166 168 } 167 169 }
Note: See TracChangeset
for help on using the changeset viewer.