Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2977 in orxonox.OLD for orxonox/branches/osX/src


Ignore:
Timestamp:
Nov 24, 2004, 12:50:55 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/importer: merged back from the trunk again: command: svn merge trunk/ branches/osX -r 2887:HEAD

Location:
orxonox/branches/osX/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/osX/src/object.cc

    r2866 r2977  
    297297    }
    298298  objFileName = fileName;
    299   char Buffer[500];
     299  char Buffer[10000];
    300300  while(!OBJ_FILE->eof())
    301301    {
    302       OBJ_FILE->getline(Buffer, 500);
     302      OBJ_FILE->getline(Buffer, 10000);
    303303      if (verbose >=4)
    304304        printf ("Read input line: %s\n",Buffer);
     
    379379    {
    380380      currentGroup->vertices->finalizeArray();
    381       glVertexPointer(3, GL_FLOAT, 0, currentGroup->vertices->getArray());
     381      //      glVertexPointer(3, GL_FLOAT, 0, currentGroup->vertices->getArray());
    382382      currentGroup->normals->finalizeArray();
    383       glNormalPointer(GL_FLOAT, 0, currentGroup->normals->getArray());
     383      //      glNormalPointer(GL_FLOAT, 0, currentGroup->normals->getArray());
    384384      currentGroup->vTexture->finalizeArray();
    385385    }
     
    387387  readingVertices = false;
    388388  currentGroup->faceCount++;
    389   char subbuffer1[20];
    390   char subbuffer2[20];
    391   char subbuffer3[20];
    392   char subbuffer4[20] ="";
    393   sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
    394   if (!strcmp(subbuffer4, ""))
     389
     390  int elemCount = 0;
     391 
     392  FaceElement* firstElem = new FaceElement;
     393  FaceElement* tmpElem = firstElem;
     394
     395 
     396  while(strcmp (faceString, "\0"))
     397    {
     398      if (elemCount>0)
     399          tmpElem = tmpElem->next = new FaceElement;
     400      tmpElem->next = NULL;
     401
     402
     403      sscanf (faceString, "%s", tmpElem->value);
     404      faceString += strlen(tmpElem->value);
     405      if (strcmp (faceString, "\0"))
     406        faceString++;
     407      elemCount++;
     408
     409
     410    }
     411 
     412 
     413  if (elemCount == 3)
    395414    {
    396415      if (currentGroup->faceMode != 3)
     
    403422      currentGroup->faceMode = 3;
    404423      if (verbose >=3)
    405         printf ("found triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3);
    406       addGLElement(subbuffer1);
    407       addGLElement(subbuffer2);
    408       addGLElement(subbuffer3);
    409       return true;
    410     }
    411   else
     424        printf ("found triag.\n");
     425    }
     426 
     427  else if (elemCount == 4)
    412428    {
    413429      if (currentGroup->faceMode != 4)
     
    419435      currentGroup->faceMode = 4;
    420436      if (verbose >=3 )
    421         printf ("found quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
    422       addGLElement(subbuffer1);
    423       addGLElement(subbuffer2);
    424       addGLElement(subbuffer3);
    425       addGLElement(subbuffer4);
    426       return true;
    427     }
     437        printf ("found quad.\n");
     438    }
     439 
     440  else if (elemCount > 4)
     441    {
     442      if (currentGroup->faceMode != -1)
     443        glEnd();
     444      glBegin(GL_POLYGON);
     445      if (verbose >=3)
     446        printf ("Polygon with %i faces found.", elemCount);
     447      currentGroup->faceMode = elemCount;
     448    }
     449
     450  tmpElem = firstElem;
     451  while (tmpElem != NULL)
     452    {
     453      //      printf ("%s\n", tmpElem->value);
     454      addGLElement(tmpElem->value);
     455      tmpElem = tmpElem->next;
     456    }
     457
    428458}
    429459
     
    444474
    445475  char* texture;
    446   texture = strstr (vertex, "/");
    447   texture[0] = '\0';
    448   texture ++;
    449   if (verbose>=3)
    450     printf ("includeing texture #%i, and mapping it to group texture #%i, textureArray has %i entries.\n", atoi(texture), (atoi(texture)-1 - currentGroup->firstVertexTexture)*3, currentGroup->vTexture->getCount());
    451   glTexCoord2fv(currentGroup->vTexture->getArray()+(atoi(texture)-1 - currentGroup->firstVertexTexture)*2);
    452 
    453   char* normal;
    454   if ((normal = strstr (texture, "/")) !=NULL)
    455     {
    456       normal[0] = '\0';
    457       normal ++;
    458       //glArrayElement(atoi(vertex)-1);
    459       glNormal3fv(currentGroup->normals->getArray() +(atoi(normal)-1 - currentGroup->firstNormal)*3);
     476  if ((texture = strstr (vertex, "/")) != NULL)
     477    {
     478      texture[0] = '\0';
     479      texture ++;
     480      if (verbose>=3)
     481        printf ("includeing texture #%i, and mapping it to group texture #%i, textureArray has %i entries.\n", atoi(texture), (atoi(texture)-1 - currentGroup->firstVertexTexture)*3, currentGroup->vTexture->getCount());
     482      glTexCoord2fv(currentGroup->vTexture->getArray()+(atoi(texture)-1 - currentGroup->firstVertexTexture)*2);
     483
     484      char* normal;
     485      if ((normal = strstr (texture, "/")) !=NULL)
     486        {
     487          normal[0] = '\0';
     488          normal ++;
     489          //glArrayElement(atoi(vertex)-1);
     490          glNormal3fv(currentGroup->normals->getArray() +(atoi(normal)-1 - currentGroup->firstNormal)*3);
     491        }
    460492    }
    461493  if (verbose>=3)
  • orxonox/branches/osX/src/object.h

    r2866 r2977  
    1818extern int verbose; //!< fill be removed and added again as a verbose-class
    1919
     20
     21struct FaceElement
     22{
     23  char value[20];
     24  FaceElement* next;
     25};
    2026
    2127//! Class that handles 3D-Objects. it can also read them in and display them.
  • orxonox/branches/osX/src/player.cc

    r2816 r2977  
    2626{
    2727
    28   obj = new Object ("reaphigh.obj");
     28  obj = new Object ("reaplow.obj");
    2929  /*
    3030  objectList = glGenLists(1);
Note: See TracChangeset for help on using the changeset viewer.