Changeset 3913 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer
- Timestamp:
- Apr 21, 2005, 1:38:34 AM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/model.cc
r3912 r3913 27 27 using namespace std; 28 28 29 ////////////////// 30 // DE-CONSTRUCT // 31 ////////////////// 29 32 /** 30 33 \brief Creates a 3D-Model. and assigns it a Name. … … 313 316 // MESH // 314 317 ////////// 318 /** 319 \brief adds a new Material to the Material List 320 \param material the Material to add 321 \returns the added material 322 323 !! beware the Material will be deleted when the Model gets deleted 324 */ 325 Material* Model::addMaterial(Material* material) 326 { 327 this->materialList->add(material); 328 return material; 329 } 330 331 /** 332 \brief adds a new Material to the Material List 333 \param material the name of the Material to add 334 \returns the added material 335 */ 336 Material* Model::addMaterial(const char* materialName) 337 { 338 339 Material* newMat = new Material(); 340 newMat->setName(materialName); 341 342 // adding material to the List of materials 343 this->materialList->add(newMat); 344 return newMat; 345 } 346 347 Material* Model::findMaterialByName(const char* materialName) 348 { 349 tIterator<Material>* tmpIt = this->materialList->getIterator(); 350 Material* material = tmpIt->nextElement(); 351 while(material) 352 { 353 if (!strcmp(material->getName(), materialName)) 354 { 355 delete tmpIt; 356 return material; 357 } 358 material = tmpIt->nextElement(); 359 } 360 delete tmpIt; 361 return NULL; 362 } 363 315 364 /** 316 365 \brief parses a group String … … 534 583 \param matString the Material that will be set. 535 584 */ 536 bool Model:: addUseMtl(const char* matString)585 bool Model::setMaterial(const char* matString) 537 586 { 538 587 if (this->currentGroup->faceCount > 0) … … 550 599 \param mtl the Material that will be set. 551 600 */ 552 bool Model:: addUseMtl(Material* mtl)601 bool Model::setMaterial(Material* mtl) 553 602 { 554 603 if (this->currentGroup->faceCount > 0) … … 572 621 */ 573 622 bool Model::buildVertexNormals () 574 { 575 623 { 576 624 PRINTF(4)("Normals are being calculated.\n"); 577 625 -
orxonox/trunk/src/lib/graphics/importer/model.h
r3911 r3913 101 101 Material* material; //!< Initial pointer to the Material. This can hold many materials, because Material can be added with Material::addMaterial(..) 102 102 103 Material* findMaterialByName(const char* materialName); 104 103 105 void cubeModel(void); 104 106 … … 115 117 int getGroupCount() const; 116 118 119 Material* addMaterial(Material* material); 120 Material* addMaterial(const char* materialName); 121 117 122 bool addGroup(const char* groupString); 118 123 bool addVertex(const char* vertexString); … … 124 129 bool addVertexTexture(const char* vTextureString); 125 130 bool addVertexTexture(float u, float v); 126 bool addUseMtl(const char* mtlString);127 bool addUseMtl(Material* mtl);131 bool setMaterial(const char* mtlString); 132 bool setMaterial(Material* mtl); 128 133 void finalize(void); 129 134 }; -
orxonox/trunk/src/lib/graphics/importer/objModel.cc
r3911 r3913 153 153 else if (!strncmp(buffer, "usemtl ", 7)) 154 154 { 155 this-> addUseMtl (buffer+7);155 this->setMaterial (buffer+7); 156 156 } 157 157 … … 222 222 { 223 223 tmpMat = tmpMat->addMaterial(buffer+7); 224 // PRINTF(2)("%s, %p\n", tmpMat->getName(), tmpMat);225 224 } 226 225 // setting a illumMode
Note: See TracChangeset
for help on using the changeset viewer.