Changeset 3916 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer/model.cc
- Timestamp:
- Apr 21, 2005, 3:07:36 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/model.cc
r3915 r3916 33 33 \brief Creates a 3D-Model. and assigns it a Name. 34 34 */ 35 Model::Model(const char* modelName )35 Model::Model(const char* modelName, MODEL_TYPE type) 36 36 { 37 37 PRINTF(4)("new 3D-Model is being created\n"); 38 38 this->name = NULL; 39 39 this->setName(modelName); 40 40 this->type = type; 41 41 42 42 this->finalized = false; … … 82 82 } 83 83 84 // deleting Arrays 85 this->deleteArrays(); 86 84 87 // deleting the MaterialList 85 88 PRINTF(5)("Deleting Materials.\n"); 86 87 89 tIterator<Material>* tmpIt = this->materialList->getIterator(); 88 90 Material* material = tmpIt->nextElement(); … … 101 103 void Model::finalize(void) 102 104 { 103 this->importToGL (); 105 // this creates the display List. 106 this->importToDisplayList(); 104 107 108 109 // deletes everything we allocated. 110 if (this->type == MODEL_DISPLAY_LIST) 111 this->deleteArrays(); 105 112 this->cleanup(); 106 113 … … 248 255 249 256 /** 250 \brief finalizes an Model. 251 This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process. 252 */ 253 bool Model::cleanup(void) 254 { 255 PRINTF(4)("cleaning up the 3D-Model to save Memory.\n"); 256 257 \brief deletes all the arrays 258 */ 259 bool Model::deleteArrays(void) 260 { 257 261 if (this->vertices) 258 262 delete this->vertices; … … 261 265 if (this->normals) 262 266 delete this->normals; 263 267 this->vertices = NULL; 268 this->vTexture = NULL; 269 this->normals = NULL; 270 } 271 272 /** 273 \brief finalizes an Model. 274 This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process. 275 */ 276 bool Model::cleanup(void) 277 { 278 PRINTF(4)("cleaning up the 3D-Model to save Memory.\n"); 264 279 this->cleanupGroup(this->firstGroup); 265 280 return true; … … 703 718 \brief reads and includes the Faces/Materials into the openGL state Machine 704 719 */ 705 bool Model::importToGL (void) 706 { 707 720 bool Model::importToDisplayList(void) 721 { 708 722 // finalize the Arrays 709 723 this->vertices->finalizeArray(); … … 794 808 795 809 /** 810 \brief reads and includes the Faces/Materials into the openGL state Machine 811 */ 812 bool Model::importToVertexArray(void) 813 { 814 // finalize the Arrays 815 this->vertices->finalizeArray(); 816 this->vTexture->finalizeArray(); 817 if (normals->getCount() == 0) // vertices-Array must be built for this 818 this->buildVertexNormals(); 819 this->normals->finalizeArray(); 820 821 this->currentGroup = this->firstGroup; 822 823 824 } 825 826 827 828 /** 796 829 \brief Adds a Face-element (one vertex of a face) with all its information. 797 830 \param elem The FaceElement to add to the OpenGL-environment.
Note: See TracChangeset
for help on using the changeset viewer.