Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.