Changeset 4283 in orxonox.OLD for orxonox/branches/physics/src/world_entities/world_entity.cc
- Timestamp:
- May 24, 2005, 10:32:34 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/world_entities/world_entity.cc
r4178 r4283 23 23 #include "vector.h" 24 24 25 //#include "stdincl.h"26 //#include "collision.h"27 28 25 using namespace std; 29 26 30 27 /** 31 \brief standard constructor32 */ 33 WorldEntity::WorldEntity ()28 \brief Loads the WordEntity-specific Part of any derived Class 29 */ 30 WorldEntity::WorldEntity(const TiXmlElement* root) 34 31 { 35 32 this->setClassName ("WorldEntity"); 33 this->model = NULL; 34 35 if (root) 36 this->loadParams(root); 37 36 38 this->bDraw = true; 37 this->model = NULL; 38 // collisioncluster = NULL; 39 } 40 41 /** 42 \brief Loads the WordEntity-specific Part of any derived Class 43 */ 44 WorldEntity::WorldEntity(TiXmlElement* root) 45 { 46 // Name Setup 47 char* temp; 48 const char* string; 49 string = grabParameter( root, "name"); 50 if( string == NULL) 51 { 52 PRINTF(2)("WorldEntity is missing a proper 'name'\n"); 53 string = "Unknown"; 54 temp = new char[strlen(string + 2)]; 55 strcpy( temp, string); 56 this->setName( temp); 57 } 58 else 59 { 60 temp = new char[strlen(string + 2)]; 61 strcpy( temp, string); 62 this->setName( temp); 63 } 39 } 40 41 void WorldEntity::loadParams(const TiXmlElement* root) 42 { 43 // name setup 44 LoadParam<WorldEntity>(root, "name", this, &WorldEntity::setName) 45 .describe("the name of the Object at hand"); 46 64 47 // Model Loading 65 this->model = NULL; 66 string = grabParameter( root, "model"); 67 if( string != NULL) 68 this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN); 69 else 70 { 71 PRINTF(2)("WorldEntity is missing a proper 'model'\n"); 72 this->model = NULL; 73 } 74 if( this->model == NULL) 75 { 76 PRINTF(2)("WorldEntity model '%s' could not be loaded\n", string); 77 } 78 this->bDraw = true; 48 LoadParam<WorldEntity>(root, "model", this, &WorldEntity::loadModel) 49 .describe("the fileName of the model, that should be loaded onto this world-entity. (must be relative to the data-dir)") ; 79 50 } 80 51 … … 87 58 if (this->model) 88 59 ResourceManager::getInstance()->unload(this->model); 60 } 61 62 /** 63 \brief loads a Model onto a WorldEntity 64 \param fileName the name of the model to load 65 */ 66 void WorldEntity::loadModel(const char* fileName) 67 { 68 if (this->model) 69 ResourceManager::getInstance()->unload(this->model, RP_LEVEL); 70 this->model = (Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN); 89 71 } 90 72
Note: See TracChangeset
for help on using the changeset viewer.