- Timestamp:
- Dec 20, 2005, 2:57:34 AM (19 years ago)
- Location:
- branches/christmas_branche/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/christmas_branche/src/world_entities/world_entity.cc
r6178 r6179 57 57 this->objectListNumber = OM_INIT; 58 58 this->objectListIterator = NULL; 59 this->supportsLOD = false;60 59 61 60 this->toList(OM_NULL); … … 119 118 this->loadModel(lodFile, scaling, i); 120 119 } 121 this->supportsLOD = true;122 120 return; 123 121 } … … 140 138 MD2Model* m = new MD2Model(fileName, ""); 141 139 m->debug(); 142 this->supportsLOD = false;143 140 //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0); 144 141 this->setModel((Model*)m, 0); … … 299 296 if (!unlikely(this->models.empty())) 300 297 { 301 if( likely(this->supportsLOD)) 302 { 303 glMatrixMode(GL_MODELVIEW); 304 glPushMatrix(); 305 306 /* translate */ 307 glTranslatef (this->getAbsCoor ().x, 308 this->getAbsCoor ().y, 309 this->getAbsCoor ().z); 310 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 311 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 298 glMatrixMode(GL_MODELVIEW); 299 glPushMatrix(); 300 301 /* translate */ 302 glTranslatef (this->getAbsCoor ().x, 303 this->getAbsCoor ().y, 304 this->getAbsCoor ().z); 305 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 306 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 312 307 313 308 314 309 // This Draws the LOD's 315 float cameraDistance = (State::getCamera()->getAbsCoor() - this->getAbsCoor()).len(); 316 if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL) 317 { 318 this->models[2]->draw(); 319 } 320 else if (cameraDistance > 10 && this->models.size() >= 2 && this->models[1] != NULL) 321 { 322 this->models[1]->draw(); 323 } 324 else if (this->models.size() >= 1 && this->models[0] != NULL) 325 { 326 this->models[0]->draw(); 327 } 328 glPopMatrix(); 329 } 330 else // no LOD 331 { 332 glMatrixMode(GL_MODELVIEW); 333 glPushMatrix(); 334 335 /* translate */ 336 glTranslatef (this->getAbsCoor ().x, 337 this->getAbsCoor ().y, 338 this->getAbsCoor ().z); 339 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 340 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 341 310 float cameraDistance = (State::getCamera()->getAbsCoor() - this->getAbsCoor()).len(); 311 if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL) 312 { 313 this->models[2]->draw(); 314 } 315 else if (cameraDistance > 10 && this->models.size() >= 2 && this->models[1] != NULL) 316 { 317 this->models[1]->draw(); 318 } 319 else if (this->models.size() >= 1 && this->models[0] != NULL) 320 { 342 321 this->models[0]->draw(); 343 344 glPopMatrix(); 345 } 346 } 347 322 } 323 glPopMatrix(); 324 } 348 325 } 349 326 -
branches/christmas_branche/src/world_entities/world_entity.h
r6177 r6179 79 79 private: 80 80 std::vector<Model*> models; //!< The model that should be loaded for this entity. 81 bool supportsLOD; //!< If this model format supports LOD (level of detail) this is true82 81 BVTree* obbTree; //!< this is the obb tree reference needed for collision detection 83 82
Note: See TracChangeset
for help on using the changeset viewer.