Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3071 in orxonox.OLD for orxonox/trunk/importer


Ignore:
Timestamp:
Dec 3, 2004, 9:14:21 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/importer: now reading in as floats instead of char*

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/importer/object.cc

    r3070 r3071  
    323323    printf("preparing to read in file: %s\n", fileName);   
    324324  objFileName = fileName;
    325   this->readFromObjFile (objFileName);
     325  this->readFromObjFile (fileName);
    326326  return true;
    327327}
     
    432432bool Object::readVertex (char* vertexString)
    433433{
    434   char subbuffer1[20];
    435   char subbuffer2[20];
    436   char subbuffer3[20];
    437   sscanf (vertexString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3);
     434  float subbuffer1;
     435  float subbuffer2;
     436  float subbuffer3;
     437  sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
    438438  if (verbose >= 3)
    439     printf ("reading in a vertex: %s %s %s\n", subbuffer1, subbuffer2, subbuffer3);
    440   vertices->addEntry(atof(subbuffer1)*scaleFactor, atof(subbuffer2)*scaleFactor, atof(subbuffer3)*scaleFactor);
     439    printf ("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);
     440  vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor);
    441441  return true;
    442442}
     
    485485bool Object::readVertexNormal (char* normalString)
    486486{
    487   char subbuffer1[20];
    488   char subbuffer2[20];
    489   char subbuffer3[20];
    490   sscanf (normalString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3);
     487  float subbuffer1;
     488  float subbuffer2;
     489  float subbuffer3;
     490  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
    491491  if (verbose >=3 )
    492     printf("found vertex-Normal %s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3);
    493   normals->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
     492    printf("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
     493  normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
    494494  return true;
    495495}
     
    502502bool Object::readVertexTexture (char* vTextureString)
    503503{
    504   char subbuffer1[20];
    505   char subbuffer2[20];
    506   sscanf (vTextureString, "%s %s", subbuffer1, subbuffer2);
     504  float subbuffer1;
     505  float subbuffer2;
     506  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
    507507  if (verbose >=3 )
    508     printf("found vertex-Texture %s, %s\n", subbuffer1,subbuffer2);
    509   vTexture->addEntry(atof(subbuffer1));
    510   vTexture->addEntry(atof(subbuffer2));
     508    printf("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
     509  vTexture->addEntry(subbuffer1);
     510  vTexture->addEntry(subbuffer2);
    511511  return true;
    512512}
Note: See TracChangeset for help on using the changeset viewer.