Changeset 7216 in orxonox.OLD for branches/std/src/world_entities/world_entity.cc
- Timestamp:
- Mar 12, 2006, 8:54:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/world_entities/world_entity.cc
r7203 r7216 61 61 this->bCollide = true; 62 62 63 this->md2TextureFileName = NULL;64 65 63 this->objectListNumber = OM_INIT; 66 64 this->objectListIterator = NULL; … … 123 121 * @todo fix this, so it only has one loadModel-Function. 124 122 */ 125 void WorldEntity::loadModel(const char*fileName, float scaling, unsigned int modelNumber)123 void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber) 126 124 { 127 125 this->modelLODName = fileName; 128 126 this->scaling = scaling; 129 if ( fileName != NULL && strcmp(fileName, ""))127 if (!fileName.empty()) 130 128 { 131 129 // search for the special character # in the LoadParam 132 if (strchr(fileName, '#') != NULL) 133 { 134 PRINTF(4)("Found # in %s... searching for LOD's\n", fileName); 135 char* lodFile = new char[strlen(fileName)+1]; 136 strcpy(lodFile, fileName); 137 char* depth = strchr(lodFile, '#'); 130 if (fileName.find('#') != std::string::npos) 131 { 132 PRINTF(4)("Found # in %s... searching for LOD's\n", fileName.c_str()); 133 std::string lodFile = fileName; 134 unsigned int offset = lodFile.find('#'); 138 135 for (unsigned int i = 0; i < 3; i++) 139 136 { 140 *depth= 48+(int)i;137 lodFile[offset] = 48+(int)i; 141 138 if (ResourceManager::isInDataDir(lodFile)) 142 139 this->loadModel(lodFile, scaling, i); … … 149 146 this->scaling = 1.0; 150 147 } 151 if( strstr(fileName, ".obj"))152 { 153 PRINTF(4)("fetching OBJ file: %s\n", fileName );148 if(fileName.find(".obj") != std::string::npos) 149 { 150 PRINTF(4)("fetching OBJ file: %s\n", fileName.c_str()); 154 151 BaseObject* loadedModel = ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, this->scaling); 155 152 if (loadedModel != NULL) … … 159 156 this->buildObbTree(4); 160 157 } 161 else if( strstr(fileName, ".md2"))162 { 163 PRINTF(4)("fetching MD2 file: %s\n", fileName );158 else if(fileName.find(".md2") != std::string::npos) 159 { 160 PRINTF(4)("fetching MD2 file: %s\n", fileName.c_str()); 164 161 Model* m = new MD2Model(fileName, this->md2TextureFileName, this->scaling); 165 162 //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0);
Note: See TracChangeset
for help on using the changeset viewer.