Changeset 9832 in orxonox.OLD for branches/new_class_id/src/world_entities
- Timestamp:
- Sep 26, 2006, 3:44:38 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/world_entities/world_entity.cc
r9727 r9832 20 20 #include "shell_command.h" 21 21 22 #include "model.h" 22 #include "util/loading/new_resource_manager.h" 23 #include "resource_obj.h" 23 24 #include "md2/md2Model.h" 24 25 #include "md3/md3_model.h" … … 26 27 #include "aabb_tree_node.h" 27 28 28 #include "util/loading/resource_manager.h"29 29 #include "util/loading/load_param.h" 30 30 #include "obb_tree.h" … … 83 83 84 84 // registering default reactions: 85 /// FIXME this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /*CL_WORLD_ENTITY*/ CL_PROJECTILE);85 /// FIXME this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /*CL_WORLD_ENTITY*/ CL_PROJECTILE); 86 86 87 87 this->toList(OM_NULL); … … 162 162 std::string name = fileName; 163 163 164 if ( name.find( Resource Manager::getInstance()->getDataDir() ) == 0 )165 { 166 name.erase(Resource Manager::getInstance()->getDataDir().size());164 if ( name.find( Resources::NewResourceManager::getInstance()->mainGlobalPath().name() ) == 0 ) 165 { 166 name.erase(Resources::NewResourceManager::getInstance()->mainGlobalPath().name().size()); 167 167 } 168 168 … … 180 180 { 181 181 lodFile[offset] = 48+(int)i; 182 if (Resource Manager::isInDataDir(lodFile))182 if (Resources::NewResourceManager::getInstance()->checkFileInMainPath( lodFile)) 183 183 this->loadModel(lodFile, scaling, i); 184 184 } … … 190 190 this->scaling = 1.0; 191 191 } 192 /// LOADING AN OBJ FILE 192 193 if(fileName.find(".obj") != std::string::npos) 193 194 { 194 195 PRINTF(4)("fetching OBJ file: %s\n", fileName.c_str()); 195 BaseObject* loadedModel = ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, this->scaling); 196 if (loadedModel != NULL) 197 this->setModel(dynamic_cast<Model*>(loadedModel), modelNumber); 196 StaticModel* model = new StaticModel(); 197 *model = ResourceOBJ(fileName, this->scaling); 198 if (model->getVertexCount() > 0) 199 { 200 this->setModel(model, modelNumber); 201 if( modelNumber == 0 /* FIXME && !this->isA(CL_WEAPON) */) 202 this->buildObbTree(obbTreeDepth); 203 } 198 204 else 199 PRINTF(1)("OBJ-File %s not found.\n", fileName.c_str()); 200 201 if( modelNumber == 0 /* FIXME && !this->isA(CL_WEAPON) */) 202 this->buildObbTree(obbTreeDepth); 203 } 205 delete model; 206 } 207 /// LOADING AN MD2-model 204 208 else if(fileName.find(".md2") != std::string::npos) 205 209 { … … 212 216 this->buildObbTree(obbTreeDepth); 213 217 } 218 /// LOADING AN MD3-MODEL. 214 219 else if(fileName.find(".md3") != std::string::npos) 215 220 { … … 218 223 this->setModel(m, 0); 219 224 220 // if( m != NULL)221 // this->buildObbTree(obbTreeDepth);225 // if( m != NULL) 226 // this->buildObbTree(obbTreeDepth); 222 227 } 223 228 } … … 240 245 if (this->models[modelNumber] != NULL) 241 246 { 242 Resource* resource = ResourceManager::getInstance()->locateResourceByPointer(dynamic_cast<BaseObject*>(this->models[modelNumber])); 243 if (resource != NULL) 244 ResourceManager::getInstance()->unload(resource, RP_LEVEL); 245 else 246 { 247 PRINTF(4)("Forcing model deletion\n"); 248 delete this->models[modelNumber]; 249 } 247 delete this->models[modelNumber]; 250 248 } 251 249 … … 283 281 } 284 282 285 if( this->models[0] != NULL) { 283 if( this->models[0] != NULL) 284 { 286 285 this->aabbNode = new AABBTreeNode(); 287 286 this->aabbNode->spawnBVTree(this->models[0]); … … 367 366 void WorldEntity::subscribeReaction(CREngine::CRType type) 368 367 { 369 if( this->collisionHandles[type] != NULL) { 368 if( this->collisionHandles[type] != NULL) 369 { 370 370 PRINTF(2)("Registering for a CollisionReaction already subscribed to! Skipping\n"); 371 371 return; … … 498 498 void removeFromReflectionList() 499 499 { 500 /// TODO501 /// State::getObject500 /// TODO 501 /// State::getObject 502 502 } 503 503 … … 558 558 { 559 559 560 this->setAbsCoor(ray_2 - v);561 562 } 563 560 this->setAbsCoor(ray_2 - v); 561 562 } 563 else 564 564 { 565 565 if(ray_1.x == this->getAbsCoor().x + v.x && ray_1.y == this->getAbsCoor().y + v.y + 0.1 && ray_1.z ==this->getAbsCoor().z + v.z) … … 645 645 } 646 646 647 // if( this->aabbNode != NULL)648 // this->aabbNode->drawBV(0, DRAW_BV_POLYGON, Vector(1, 0.6, 0.2), true);647 // if( this->aabbNode != NULL) 648 // this->aabbNode->drawBV(0, DRAW_BV_POLYGON, Vector(1, 0.6, 0.2), true); 649 649 650 650 glPopMatrix();
Note: See TracChangeset
for help on using the changeset viewer.