Changeset 5994 in orxonox.OLD for trunk/src/world_entities/world_entity.cc
- Timestamp:
- Dec 9, 2005, 10:43:31 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/world_entity.cc
r5708 r5994 58 58 WorldEntity::~WorldEntity () 59 59 { 60 // Delete the model (unregister it with the ResourceManager)61 if (likely(this->model != NULL))62 ResourceManager::getInstance()->unload(this->model);63 60 // Delete the obbTree 64 61 if( this->obbTree != NULL) 65 62 delete this->obbTree; 63 64 // Delete the model (unregister it with the ResourceManager) 65 this->setModel(NULL); 66 66 } 67 67 … … 91 91 void WorldEntity::loadModel(const char* fileName, float scaling) 92 92 { 93 if (this->model)94 ResourceManager::getInstance()->unload(this->model, RP_LEVEL);95 93 if (fileName != NULL) 96 94 { 97 95 PRINTF(4)("fetching %s\n", fileName); 98 96 if (scaling == 1.0) 99 this-> model = (Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN);97 this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN)); 100 98 else 101 this-> model = (Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling);99 this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling)); 102 100 103 101 this->buildObbTree(4); … … 106 104 this->model = NULL; 107 105 } 106 107 /** 108 * sets a specific Model for the Object. 109 * @param model The Model to set 110 * @param modelNumber the n'th model in the List to get. 111 */ 112 void WorldEntity::setModel(Model* model, unsigned int modelNumber) 113 { 114 if (this->model != NULL) 115 { 116 Resource* resource = ResourceManager::getInstance()->locateResourceByPointer(this->model); 117 if (resource != NULL) 118 ResourceManager::getInstance()->unload(resource, RP_LEVEL); 119 else 120 delete this->model; 121 } 122 this->model = model; 123 124 // if (this->model != NULL) 125 // this->buildObbTree(4); 126 } 127 108 128 109 129 /**
Note: See TracChangeset
for help on using the changeset viewer.