Changeset 8904 in orxonox.OLD
- Timestamp:
- Jun 29, 2006, 1:40:35 PM (18 years ago)
- Location:
- branches/single_player_map/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/graphics/importer/bsp_file.cc
r8894 r8904 46 46 BspFile::BspFile() 47 47 {} 48 49 BspFile::~ BspFile() 50 { 51 delete [] nodes; 52 delete [] leaves; 53 delete [] planes; 54 delete [] bspModels; 55 delete [] leafFaces; 56 delete [] faces; 57 delete [] leafBrushes; 58 delete [] brushes; 59 delete [] brushSides; 60 delete [] vertice; 61 delete [] meshverts; 62 delete [] visData; 63 delete [] textures; 64 delete [] patchVertice; 65 delete [] patchIndexes; 66 // delete [] patchTrianglesPerRow; 67 delete [] lightMaps; 68 69 for(int i = 0; i < this->numPatches; ++i) delete this->VertexArrayModels[i]; 70 // delete [] VertexArrayModels; 71 72 for(int i = 0; i < this->numTextures; ++i) 73 { 74 delete this->Materials[i].mat; 75 //delete this->Materials[i].aviMat; 76 } 77 delete [] this->Materials; 78 //delete [] testSurf; 79 80 81 82 } 48 83 49 84 /** … … 294 329 this->patchVertice = new char[8*8*44*(this->numPatches+10)]; 295 330 this->patchIndexes = new char[7*8*2*4*(this->numPatches+10)]; 296 this->patchRowIndexes = new int*[7*4*this->numPatches];331 // this->patchRowIndexes = new int*[7*4*this->numPatches]; Not needed? 297 332 this->patchTrianglesPerRow = new char[7*4*this->numPatches]; 298 333 this->VertexArrayModels = new VertexArrayModel*[this->numPatches]; … … 464 499 465 500 if(File(absFileName).exists()) { 466 PRINTF( 0)("BSP FILE: gefunden . \n");501 PRINTF(4)("BSP FILE: gefunden . \n"); 467 502 this->Materials[i] = this->loadAVI(fileName); 468 503 continue; … … 553 588 } 554 589 555 PRINTF(0)("BSP FILE: Textur %s nicht gefunden . \n", &this->textures[8+72*i]);590 PRINTF(0)("BSP FILE: Texture %s not found.",&this->textures[8+ 72*i] ); 556 591 // Default Material 557 592 this->Materials[i].mat = new Material(); … … 1012 1047 Face->meshvert = patchOffset -sz; //3*(patchOffset-sz)*level1*level1; 1013 1048 Face->n_meshverts = sz; 1014 PRINTF( 4)("BSP FILE: sz: %i. \n", sz);1015 PRINTF( 4)("BSP FILE: Face->meshvert %i . \n", Face->meshvert);1049 PRINTF(0)("BSP FILE: sz: %i. \n", sz); 1050 PRINTF(0)("BSP FILE: Face->meshvert %i . \n", Face->meshvert); 1016 1051 1017 1052 //Face->n_meshverts = sz; -
branches/single_player_map/src/lib/graphics/importer/bsp_file.h
r8490 r8904 151 151 public: 152 152 BspFile(); 153 ~BspFile(); 153 154 int read(const char* name ); 154 155 void build_tree(); … … 183 184 184 185 int** patchRowIndexes; 185 VertexArrayModel** VertexArrayModels; 186 VertexArrayModel** VertexArrayModels; 186 187 int patchOffset; 187 188 -
branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc
r8894 r8904 77 77 } */ 78 78 79 void BspManager::load(const char* fileName, float scale) 79 BspManager::~BspManager() 80 { 81 if(this->bspFile) 82 delete this->bspFile; 83 } 84 85 int BspManager::load(const char* fileName, float scale) 80 86 { 81 87 // open a BSP file 88 89 82 90 this->bspFile = new BspFile(); 83 91 this->bspFile->scale = scale; 84 this->bspFile->read(ResourceManager::getFullName(fileName).c_str()); 92 if(this->bspFile->read(ResourceManager::getFullName(fileName).c_str()) == -1) 93 return -1; 85 94 this->bspFile->build_tree(); 86 95 this->root = this->bspFile->get_root(); … … 88 97 89 98 this->outputFraction = 1.0f; 99 100 return 0; 90 101 } 91 102 /* -
branches/single_player_map/src/lib/graphics/importer/bsp_manager.h
r8724 r8904 41 41 class WorldEntity; 42 42 43 44 // Obsolete 43 45 struct BspCollisionEvent 44 46 { … … 54 56 55 57 BspManager(const char* fileName, float scale = 0.4f); 56 void load(const char* fileName, float scale); 58 59 // Deconstructor 60 ~BspManager(); 61 62 57 63 58 64 // Functions 65 int load(const char* fileName, float scale); 59 66 const void draw(); 60 67 const void tick(float time); -
branches/single_player_map/src/world_entities/bsp_entity.cc
r8490 r8904 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: Claudio Botta … … 15 15 16 16 #include "bsp_entity.h" 17 #include "util/loading/resource_manager.h" 17 18 #include "util/loading/resource_manager.h" 18 19 … … 43 44 44 45 46 45 47 /** 46 48 * initializes the BspEntity … … 50 52 { 51 53 this->setClassID(CL_BSP_ENTITY, "BspEntity"); 52 53 this->bspManager = new BspManager(this); 54 this->toList(OM_ENVIRON); 55 54 this->bspManager = NULL; 56 55 /** 57 56 * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition) … … 64 63 PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str()); 65 64 66 this->bspManager->load(name.c_str(), 0.1f); 65 // Check wether file exists.... 66 if ( File(ResourceManager::getFullName(name)).exists() ){ 67 // War das Laden erfolgreich? 68 this->bspManager = new BspManager(this); 69 if(this->bspManager->load(name.c_str(), 0.1f) == -1 ) { 70 this->bspManager = NULL; 71 // Dont do anything 72 } else { 73 74 75 this->toList(OM_ENVIRON); // Success!!! 76 } 77 } else { 78 this->toList(OM_DEAD); 79 } 67 80 } 68 81 … … 76 89 { 77 90 // all the clases this Entity is directly derived from must be called in this way, to load all settings. 78 // WorldEntity::loadParam(root);91 // WorldEntity::loadParam(root); 79 92 80 93 LoadParam(root, "Name", this, BspEntity, setName) 81 94 .describe("Sets the of the BSP file."); 82 95 83 /* LoadParam(root, "Scale", this, BSpEntity, setScale)84 .describe("Sets the scale factore of the bsp level.");85 */96 /* LoadParam(root, "Scale", this, BSpEntity, setScale) 97 .describe("Sets the scale factore of the bsp level."); 98 */ 86 99 87 100 /** … … 115 128 */ 116 129 void BspEntity::collidesWith (WorldEntity* entity, const Vector& location) 117 { 118 119 } 130 {}
Note: See TracChangeset
for help on using the changeset viewer.