Changeset 3909 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer/model.cc
- Timestamp:
- Apr 21, 2005, 12:27:19 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/model.cc
r3905 r3909 27 27 28 28 /** 29 \brief Creates a 3D-Model.30 31 This only initializes a 3D-Model, but does not cleanup the Faces.32 */33 Model::Model(void)34 {35 this->initialize();36 }37 38 /**39 29 \brief Creates a 3D-Model. and assigns it a Name. 40 30 */ 41 Model::Model(char* modelName) 42 { 43 this->initialize(); 31 Model::Model(const char* modelName) 32 { 33 PRINTF(4)("new 3D-Model is being created\n"); 34 this->name = NULL; 44 35 this->setName(modelName); 36 37 38 this->finalized = false; 39 // setting the start group; 40 this->firstGroup = new Group; 41 this->currentGroup = this->firstGroup; 42 this->groupCount = 0; 43 44 this->initGroup (this->currentGroup); 45 this->scaleFactor = 1; 46 this->material = new Material(); 47 48 this->vertices = new Array(); 49 this->vTexture = new Array(); 50 this->normals = new Array(); 51 45 52 } 46 53 … … 169 176 170 177 /** 171 \brief initializes the Model.172 173 This Function initializes all the needed arrays, Lists and clientStates.174 It also defines default values.175 */176 bool Model::initialize (void)177 {178 PRINTF(4)("new 3D-Model is being created\n");179 180 this->name = NULL;181 this->finalized = false;182 // setting the start group;183 this->firstGroup = new Group;184 this->currentGroup = this->firstGroup;185 this->groupCount = 0;186 187 this->initGroup (this->currentGroup);188 this->scaleFactor = 1;189 this->material = new Material();190 191 this->vertices = new Array();192 this->vTexture = new Array();193 this->normals = new Array();194 195 return true;196 }197 198 /**199 178 \brief sets a name to the Model 200 179 \param name The name to set to this Model … … 204 183 if (this->name) 205 184 delete this->name; 206 this->name = new char[strlen(name)+1]; 207 strcpy(this->name, name); 185 if (name) 186 { 187 this->name = new char[strlen(name)+1]; 188 strcpy(this->name, name); 189 } 190 else 191 this->name = NULL; 208 192 } 209 193 /** … … 348 332 If a vertex line is found this function will inject it into the vertex-Array 349 333 */ 350 bool Model::addVertex (c har* vertexString)334 bool Model::addVertex (const char* vertexString) 351 335 { 352 336 float subbuffer1; … … 379 363 If a face line is found this function will add it to the glList. 380 364 */ 381 bool Model::addFace (c har* faceString)365 bool Model::addFace (const char* faceString) 382 366 { 383 367 if (this->currentGroup->faceCount >0) … … 477 461 If a vertexNormal line is found this function will inject it into the vertexNormal-Array 478 462 */ 479 bool Model::addVertexNormal (c har* normalString)463 bool Model::addVertexNormal (const char* normalString) 480 464 { 481 465 float subbuffer1; … … 509 493 this function will inject it into the vertexTexture-Array 510 494 */ 511 bool Model::addVertexTexture (c har* vTextureString)495 bool Model::addVertexTexture (const char* vTextureString) 512 496 { 513 497 float subbuffer1; … … 540 524 bool Model::addUseMtl (const char* matString) 541 525 { 542 /*543 if (!this->mtlFileName)544 {545 PRINTF(4)("Not using new defined material, because no mtlFile found yet\n");546 return false;547 }548 */549 526 if (this->currentGroup->faceCount > 0) 550 527 this->currentGroup->currentFace = this->currentGroup->currentFace->next = new Face;
Note: See TracChangeset
for help on using the changeset viewer.