- Timestamp:
- Dec 10, 2005, 12:21:31 AM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/helicopter.cc
r6002 r6005 18 18 19 19 #include "helicopter.h" 20 21 #include "objModel.h"22 #include "resource_manager.h"23 20 24 21 #include "weapons/weapon_manager.h" … … 111 108 PRINTF(4)("SPACESHIP INIT\n"); 112 109 113 this->loadModel("models/ships/helicopter_high.obj", 1.0, 0); 114 this->loadModel("models/ships/helicopter_medium.obj", 1.0, 1); 115 this->loadModel("models/ships/helicopter_low.obj", 1.0, 2); 110 this->loadModel("models/ships/helicopter_#.obj", 1.0); 116 111 117 112 EventHandler::getInstance()->grabEvents(true); … … 350 345 } 351 346 347 348 void Helicopter::draw() const 349 { 350 this->drawLODsafe(); 351 352 this->getWeaponManager()->draw(); 353 } 354 355 352 356 /** 353 357 * weapon manipulation by the player -
trunk/src/world_entities/space_ships/helicopter.h
r6002 r6005 32 32 virtual void collidesWith(WorldEntity* entity, const Vector& location); 33 33 virtual void tick(float time); 34 virtual void draw() const; 34 35 35 36 virtual void process(const Event &event); -
trunk/src/world_entities/space_ships/space_ship.cc
r6002 r6005 240 240 void SpaceShip::draw () const 241 241 { 242 glMatrixMode(GL_MODELVIEW); 243 glPushMatrix(); 244 /* translate */ 245 glTranslatef (this->getAbsCoor ().x, 246 this->getAbsCoor ().y, 247 this->getAbsCoor ().z); 248 /* rotate */ 249 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 250 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 251 this->getModel()->draw(); 252 glPopMatrix(); 242 this->drawLODsafe(); 253 243 254 244 this->getWeaponManager()->draw(); -
trunk/src/world_entities/world_entity.cc
r6004 r6005 65 65 66 66 // Delete the model (unregister it with the ResourceManager) 67 this->setModel(NULL); 67 for (unsigned int i = 0; i < this->models.size(); i++) 68 this->setModel(NULL, i); 68 69 } 69 70 … … 94 95 { 95 96 if (fileName != NULL) 96 { 97 { 98 // search for the special character # in the LoadParam 99 if (strchr(fileName, '#') != NULL) 100 { 101 PRINTF(4)("Found # in %s... searching for LOD's\n", fileName); 102 char* lodFile = new char[strlen(fileName)+1]; 103 strcpy(lodFile, fileName); 104 char* depth = strchr(lodFile, '#'); 105 for (unsigned int i = 0; i < 5; i++) 106 { 107 *depth = 48+(int)i; 108 printf("-------%s\n", lodFile); 109 if (ResourceManager::isInDataDir(lodFile)) 110 this->loadModel(lodFile, scaling, i); 111 } 112 return; 113 } 114 97 115 PRINTF(4)("fetching %s\n", fileName); 98 116 if (scaling == 1.0) … … 228 246 */ 229 247 void WorldEntity::draw() const 248 { 249 this->drawLODsafe(); 250 } 251 252 void WorldEntity::drawLODsafe() const 230 253 { 231 254 if (!this->models.empty()) -
trunk/src/world_entities/world_entity.h
r5996 r6005 51 51 52 52 virtual void tick (float time); 53 53 54 virtual void draw () const; 55 void drawLODsafe() const; 56 54 57 virtual void collidesWith (WorldEntity* entity, const Vector& location); 55 56 58 void drawBVTree(unsigned int depth, int drawMode) const; 57 59
Note: See TracChangeset
for help on using the changeset viewer.