Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5774 in orxonox.OLD


Ignore:
Timestamp:
Nov 25, 2005, 1:36:31 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: stl in Model

Location:
trunk/src
Files:
3 edited

Legend:

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

    r5676 r5774  
    2424
    2525#include "vector.h"
    26 #include "list.h"
    2726
    2827using namespace std;
     
    166165  this->normals = new tArray<GLfloat>();
    167166
    168   this->materialList = new tList<ModelMaterial>;
    169 
    170167  if (this->type == MODEL_VERTEX_ARRAY)
    171168    glEnableClientState(GL_VERTEX_ARRAY | GL_NORMAL_ARRAY | GL_TEXTURE_COORD_ARRAY);
     
    196193  PRINTF(5)("Deleting Materials.\n");
    197194
    198   tIterator<ModelMaterial>* tmpIt = this->materialList->getIterator();
    199   ModelMaterial* modMat = tmpIt->firstElement();
    200195  //! @todo do we really have to delete this material??
    201   while(modMat != NULL)
     196  list<ModelMaterial*>::iterator modMat;
     197  for(modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
    202198  {
    203     if (!modMat->external)
    204       delete modMat->material;
    205     delete modMat;
    206     modMat = tmpIt->nextElement();
     199    if (!(*modMat)->external)
     200      delete (*modMat)->material;
     201    delete (*modMat);
    207202  }
    208   delete tmpIt;
    209   delete materialList;
    210203  delete this->pModelInfo;
    211204}
     
    396389  modMat->external = true;
    397390  modMat->material = material;
    398   this->materialList->add(modMat);
     391  this->materialList.push_back(modMat);
    399392  return modMat->material;
    400393}
     
    412405
    413406  // adding material to the List of materials
    414   this->materialList->add(modMat);
     407  this->materialList.push_back(modMat);
    415408  return modMat->material;
    416409}
     
    423416Material* Model::findMaterialByName(const char* materialName)
    424417{
    425   tIterator<ModelMaterial>* tmpIt = this->materialList->getIterator();
    426   ModelMaterial* modMat = tmpIt->firstElement();
    427   while(modMat != NULL)
    428     {
    429       if (!strcmp(modMat->material->getName(), materialName))
    430         {
    431           delete tmpIt;
    432           return modMat->material;
    433         }
    434       modMat = tmpIt->nextElement();
    435     }
    436   delete tmpIt;
     418  list<ModelMaterial*>::iterator modMat;
     419  for  (modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
     420    if (!strcmp((*modMat)->material->getName(), materialName))
     421      return (*modMat)->material;
    437422  return NULL;
    438423}
     
    929914  PRINTF(3)("got %i triangles, %i vertices\n", this->triangleCount, this->vertexCount);
    930915
    931  
     916
    932917  /* write MODELINFO structure */
    933918
  • trunk/src/lib/graphics/importer/model.h

    r5701 r5774  
    1212#include "glincl.h"
    1313#include "array.h"
    14 
     14#include <list>
    1515
    1616// FORWARD DECLARATION //
    1717template<class T> class tArray;
    18 template<class T> class tList;
    1918
    2019
     
    176175
    177176 private:
    178   MODEL_TYPE             type;            //!< A type for the Model
    179   bool                   finalized;       //!< Sets the Object to be finalized.
     177  MODEL_TYPE                 type;            //!< A type for the Model
     178  bool                       finalized;       //!< Sets the Object to be finalized.
    180179
    181   unsigned int           vertexCount;     //!< A modelwide Counter for vertices.
    182   unsigned int           normalCount;     //!< A modelwide Counter for the normals.
    183   unsigned int           texCoordCount;   //!< A modelwide Counter for the texCoord.
    184   unsigned int           faceCount;       //!< A modelwide Counter for the faces
    185   unsigned int           triangleCount;   //!< Number of triangles >= faceCount
    186   tArray<GLfloat>*       vertices;        //!< The Array that handles the Vertices.
    187   tArray<GLfloat>*       normals;         //!< The Array that handles the Normals.
    188   tArray<GLfloat>*       vTexture;        //!< The Array that handles the VertexTextureCoordinates.
    189   sTriangleExt*          triangles;       //!< The Array of triangles in the abstract_model.h style
     180  unsigned int               vertexCount;     //!< A modelwide Counter for vertices.
     181  unsigned int               normalCount;     //!< A modelwide Counter for the normals.
     182  unsigned int               texCoordCount;   //!< A modelwide Counter for the texCoord.
     183  unsigned int               faceCount;       //!< A modelwide Counter for the faces
     184  unsigned int               triangleCount;   //!< Number of triangles >= faceCount
     185  tArray<GLfloat>*           vertices;        //!< The Array that handles the Vertices.
     186  tArray<GLfloat>*           normals;         //!< The Array that handles the Normals.
     187  tArray<GLfloat>*           vTexture;        //!< The Array that handles the VertexTextureCoordinates.
     188  sTriangleExt*              triangles;       //!< The Array of triangles in the abstract_model.h style
    190189
    191   ModelGroup*            firstGroup;      //!< The first of all groups.
    192   ModelGroup*            currentGroup;    //!< The currentGroup. this is the one we will work with.
    193   int                    groupCount;      //!< The Count of Groups.
     190  ModelGroup*                firstGroup;      //!< The first of all groups.
     191  ModelGroup*                currentGroup;    //!< The currentGroup. this is the one we will work with.
     192  int                        groupCount;      //!< The Count of Groups.
    194193
    195   tList<ModelMaterial>*  materialList;    //!< A list for all the Materials in this Model
     194  std::list<ModelMaterial*>  materialList;    //!< A list for all the Materials in this Model
    196195};
    197196
  • trunk/src/story_entities/campaign.h

    r5773 r5774  
    33#define _CAMPAIGN_H
    44
    5 #include "stdincl.h"
    65#include "story_entity.h"
     6
    77#include <list>
    88
Note: See TracChangeset for help on using the changeset viewer.