Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4108 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer


Ignore:
Timestamp:
May 7, 2005, 4:49:18 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: model even saver now

File:
1 edited

Legend:

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

    r4107 r4108  
    566566      else
    567567        tmpElem->normalNumber = -1;
    568       if (unlikely(tmpElem->vertexNumber > this->vertexCount))
    569         PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->vertexNumber, this->vertexCount);
    570       if (unlikely(tmpElem->normalNumber > this->normalCount))
    571         PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->normalNumber, this->normalCount);
    572       if (unlikely(tmpElem->texCoordNumber > this->texCoordCount))
    573         PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->texCoordNumber, this->texCoordCount);
    574568
    575569      faceString += tmpLen;
     
    608602        tmpElem->normalNumber = va_arg(itemlist, int) -1;
    609603      this->currentGroup->currentFace->vertexCount++;
    610 
    611       if (unlikely(tmpElem->vertexNumber > this->vertexCount))
    612         PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->vertexNumber, this->vertexCount);
    613       if (unlikely(tmpElem->normalNumber > this->normalCount))
    614         PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->normalNumber, this->normalCount);
    615       if (unlikely(tmpElem->texCoordNumber > this->texCoordCount))
    616         PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->texCoordNumber, this->texCoordCount);
    617604    }
    618605  va_end(itemlist);
     
    716703    }
    717704
    718   for (int i=0; i<vertices->getCount()/3;i++)
     705  for (int i=0; i < vertices->getCount()/3;i++)
    719706    {
    720707      normArray[i].normalize();
    721708      PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
    722709     
    723       this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z);
     710      this->addVertexNormal(normArray[i].x, normArray[i].y, normArray[i].z);
    724711
    725712    }
     
    857844
    858845  if (elem->texCoordNumber != -1)
    859     glTexCoord2fv(this->vTexture->getArray() + elem->texCoordNumber * 2);
     846    {
     847      if (likely(elem->texCoordNumber <= this->texCoordCount))
     848        glTexCoord2fv(this->vTexture->getArray() + elem->texCoordNumber * 2);
     849      else
     850        PRINTF(2)("TextureCoordinate %d is not in the List (max: %d)\nThe Model might be incomplete\n",
     851                  elem->texCoordNumber, this->texCoordCount);
     852    }
    860853  if (elem->normalNumber != -1)
    861     glNormal3fv(this->normals->getArray() + elem->normalNumber * 3);
     854    {
     855    if (likely(elem->normalNumber <= this->normalCount))
     856      glNormal3fv(this->normals->getArray() + elem->normalNumber * 3);
     857    else
     858        PRINTF(2)("Normal %d is not in the List (max: %d)\nThe Model might be incomplete",
     859                  elem->normalNumber, this->normalCount);     
     860    }
    862861  if (elem->vertexNumber != -1)
    863     glVertex3fv(this->vertices->getArray() + elem->vertexNumber * 3);
     862    {
     863      if (likely(elem->vertexNumber <= this->vertexCount))
     864          glVertex3fv(this->vertices->getArray() + elem->vertexNumber * 3);
     865      else
     866        PRINTF(2)("Vertex %d is not in the List (max: %d)\nThe Model might be incomplete",
     867                  elem->vertexNumber, this->vertexCount);     
     868    }   
     869
    864870}
    865871
Note: See TracChangeset for help on using the changeset viewer.