Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3914 in orxonox.OLD


Ignore:
Timestamp:
Apr 21, 2005, 1:46:31 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: materialList is now a property of model not material, makes more sense

Location:
orxonox/trunk/src/lib/graphics/importer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/importer/material.cc

    r3894 r3914  
    3737{
    3838   PRINTF(4)("initializing new Material.\n");
    39   this->nextMat = NULL;
    4039  this->name = NULL;
    4140  this->setIllum(3);
     
    6867  if (this->diffuseTexture)
    6968    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 mtlName
    94    \param mtlName the Name of the Material to search for
    95    \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;
    11369}
    11470
  • orxonox/trunk/src/lib/graphics/importer/material.h

    r3894 r3914  
    2727 public:
    2828  Material (const char* mtlName = NULL);
    29   Material* addMaterial(const char* mtlName);
    3029  ~Material ();
    3130
    32   Material* search(const char* mtlName);
    3331  bool select (void);
    3432
     
    7472  bool specularTextureSet;//!< Chekcs if the specular texture is Set.
    7573
    76   Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
    77 
    78 
    7974};
    8075#endif
  • orxonox/trunk/src/lib/graphics/importer/model.cc

    r3913 r3914  
    345345}
    346346
     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*/
    347352Material* Model::findMaterialByName(const char* materialName)
    348353{
     
    589594  this->initFace (this->currentGroup->currentFace);
    590595 
    591   this->currentGroup->currentFace->material = material->search(matString);
     596  this->currentGroup->currentFace->material = this->findMaterialByName(matString);
    592597
    593598  if (this->currentGroup->faceCount == 0)
  • orxonox/trunk/src/lib/graphics/importer/objModel.cc

    r3913 r3914  
    221221      if (!strncmp(buffer, "newmtl ", 7))
    222222        {
    223           tmpMat = tmpMat->addMaterial(buffer+7);
     223          tmpMat = this->addMaterial(buffer+7);//tmpMat->addMaterial(buffer+7);
    224224        }
    225225      // setting a illumMode
Note: See TracChangeset for help on using the changeset viewer.