Changeset 3914 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 21, 2005, 1:46:31 AM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/material.cc
r3894 r3914 37 37 { 38 38 PRINTF(4)("initializing new Material.\n"); 39 this->nextMat = NULL;40 39 this->name = NULL; 41 40 this->setIllum(3); … … 68 67 if (this->diffuseTexture) 69 68 ResourceManager::getInstance()->unload(this->diffuseTexture); 70 if (this->nextMat)71 delete this->nextMat;72 }73 74 /**75 \brief adds a new Material to the List.76 this Function will append a new Material to the end of a Material List.77 \param mtlName The name of the Material to be added.78 */79 Material* Material::addMaterial(const char* mtlName)80 {81 PRINTF(4)("adding Material %s.\n", mtlName);82 Material* tmpMat = this;83 while (tmpMat->nextMat != NULL)84 {85 tmpMat = tmpMat->nextMat;86 }87 tmpMat->nextMat = new Material(mtlName);88 return tmpMat->nextMat;89 90 }91 92 /**93 \brief Search for a Material called mtlName94 \param mtlName the Name of the Material to search for95 \returns Material named mtlName if it is found. NULL otherwise.96 */97 Material* Material::search(const char* mtlName)98 {99 PRINTF(5)("Searching for material %s", mtlName);100 Material* searcher = this;101 while (searcher != NULL)102 {103 PRINT(5)(".");104 if (!strcmp (searcher->getName(), mtlName))105 {106 PRINT(5)("found.\n");107 return searcher;108 }109 searcher = searcher->nextMat;110 }111 PRINT(2)("material %s not found\n", mtlName);112 return NULL;113 69 } 114 70 -
orxonox/trunk/src/lib/graphics/importer/material.h
r3894 r3914 27 27 public: 28 28 Material (const char* mtlName = NULL); 29 Material* addMaterial(const char* mtlName);30 29 ~Material (); 31 30 32 Material* search(const char* mtlName);33 31 bool select (void); 34 32 … … 74 72 bool specularTextureSet;//!< Chekcs if the specular texture is Set. 75 73 76 Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.77 78 79 74 }; 80 75 #endif -
orxonox/trunk/src/lib/graphics/importer/model.cc
r3913 r3914 345 345 } 346 346 347 /** 348 \brief finds a Material by its name and returns it 349 \param materialName the Name of the material to search for. 350 \returns the Material if found, NULL otherwise 351 */ 347 352 Material* Model::findMaterialByName(const char* materialName) 348 353 { … … 589 594 this->initFace (this->currentGroup->currentFace); 590 595 591 this->currentGroup->currentFace->material = material->search(matString);596 this->currentGroup->currentFace->material = this->findMaterialByName(matString); 592 597 593 598 if (this->currentGroup->faceCount == 0) -
orxonox/trunk/src/lib/graphics/importer/objModel.cc
r3913 r3914 221 221 if (!strncmp(buffer, "newmtl ", 7)) 222 222 { 223 tmpMat = t mpMat->addMaterial(buffer+7);223 tmpMat = this->addMaterial(buffer+7);//tmpMat->addMaterial(buffer+7); 224 224 } 225 225 // setting a illumMode
Note: See TracChangeset
for help on using the changeset viewer.