Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 21, 2005, 12:27:19 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: importer: no more fstream c-style code only

File:
1 edited

Legend:

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

    r3905 r3909  
    2727
    2828/**
    29    \brief Creates a 3D-Model.
    30 
    31    This only initializes a 3D-Model, but does not cleanup the Faces.
    32 */
    33 Model::Model(void)
    34 {
    35   this->initialize();
    36 }
    37 
    38 /**
    3929   \brief Creates a 3D-Model. and assigns it a Name.
    4030*/
    41 Model::Model(char* modelName)
    42 {
    43   this->initialize();
     31Model::Model(const char* modelName)
     32{
     33  PRINTF(4)("new 3D-Model is being created\n");
     34  this->name = NULL;
    4435  this->setName(modelName);
     36
     37
     38  this->finalized = false;
     39  // setting the start group;
     40  this->firstGroup = new Group;
     41  this->currentGroup = this->firstGroup;
     42  this->groupCount = 0;
     43 
     44  this->initGroup (this->currentGroup);
     45  this->scaleFactor = 1;
     46  this->material = new Material();
     47
     48  this->vertices = new Array();
     49  this->vTexture = new Array();
     50  this->normals = new Array();
     51
    4552}
    4653
     
    169176
    170177/**
    171     \brief initializes the Model.
    172 
    173     This Function initializes all the needed arrays, Lists and clientStates.
    174     It also defines default values.
    175 */
    176 bool Model::initialize (void)
    177 {
    178   PRINTF(4)("new 3D-Model is being created\n");
    179 
    180   this->name = NULL;
    181   this->finalized = false;
    182   // setting the start group;
    183   this->firstGroup = new Group;
    184   this->currentGroup = this->firstGroup;
    185   this->groupCount = 0;
    186  
    187   this->initGroup (this->currentGroup);
    188   this->scaleFactor = 1;
    189   this->material = new Material();
    190 
    191   this->vertices = new Array();
    192   this->vTexture = new Array();
    193   this->normals = new Array();
    194 
    195   return true;
    196 }
    197 
    198 /**
    199178   \brief sets a name to the Model
    200179   \param name The name to set to this Model
     
    204183  if (this->name)
    205184    delete this->name;
    206   this->name = new char[strlen(name)+1];
    207   strcpy(this->name, name);
     185  if (name)
     186    {
     187      this->name = new char[strlen(name)+1];
     188      strcpy(this->name, name);
     189    }
     190  else
     191    this->name = NULL;
    208192}
    209193/**
     
    348332   If a vertex line is found this function will inject it into the vertex-Array
    349333*/
    350 bool Model::addVertex (char* vertexString)
     334bool Model::addVertex (const char* vertexString)
    351335{
    352336  float subbuffer1;
     
    379363   If a face line is found this function will add it to the glList.
    380364*/
    381 bool Model::addFace (char* faceString)
     365bool Model::addFace (const char* faceString)
    382366{
    383367  if (this->currentGroup->faceCount >0)
     
    477461   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
    478462*/
    479 bool Model::addVertexNormal (char* normalString)
     463bool Model::addVertexNormal (const char* normalString)
    480464{
    481465  float subbuffer1;
     
    509493   this function will inject it into the vertexTexture-Array
    510494*/
    511 bool Model::addVertexTexture (char* vTextureString)
     495bool Model::addVertexTexture (const char* vTextureString)
    512496{
    513497  float subbuffer1;
     
    540524bool Model::addUseMtl (const char* matString)
    541525{
    542   /*
    543   if (!this->mtlFileName)
    544     {
    545       PRINTF(4)("Not using new defined material, because no mtlFile found yet\n");
    546       return false;
    547     }
    548   */     
    549526  if (this->currentGroup->faceCount > 0)
    550527    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new Face;
Note: See TracChangeset for help on using the changeset viewer.