- Timestamp:
- Jun 9, 2010, 9:32:58 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/orxonox/graphics/Model.cc
r7111 r7127 42 42 CreateFactory(Model); 43 43 44 Model::Model(BaseObject* creator) : 44 Model::Model(BaseObject* creator) : 45 45 StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15) 46 46 { … … 59 59 { 60 60 SUPER(Model, XMLPort, xmlelement, mode); 61 61 62 62 XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode); 63 63 64 64 XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode); 65 65 XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true); … … 81 81 return scaleFactor; 82 82 } 83 83 84 84 void Model::changedMesh() 85 85 { … … 88 88 if (this->mesh_.getEntity()) 89 89 this->detachOgreObject(this->mesh_.getEntity()); 90 90 91 91 this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_); 92 92 … … 96 96 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 97 97 this->mesh_.setVisible(this->isVisible()); 98 99 98 99 100 100 //LOD 101 101 if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 ) 102 102 { 103 103 Level* level = this->getLevel(); 104 104 105 105 assert( level != 0 ); 106 106 107 107 MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_); 108 108 if( lodInfo ) … … 122 122 float volume = this->mesh_.getEntity()->getBoundingBox().volume(); 123 123 // float scaleFactor = 1; 124 124 125 125 // BaseObject* creatorPtr = this; 126 // 126 // 127 127 // while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr)) 128 128 // { … … 131 131 // } 132 132 // COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl; 133 133 134 134 COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl; 135 135 … … 144 144 // float factor = scaleFactor*5/lodLevel_; 145 145 float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_; 146 146 147 147 COUT(4) << "LodLevel set with factor: " << factor << endl; 148 148 … … 160 160 distList.pop_back(); 161 161 162 162 163 163 //Generiert LOD-Levels 164 164 this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_); … … 171 171 else 172 172 what = "<0"; 173 173 174 174 COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl; 175 175 }
Note: See TracChangeset
for help on using the changeset viewer.