Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4802 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Jul 6, 2005, 4:28:52 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: ok, the normals are included now and just work fine. there is no more work on the triangle creation process to be done. Now comes spatial data partitioning. but i will take a brake before this :)

Location:
orxonox/trunk/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/importer/abstract_model.h

    r4794 r4802  
    7777{
    7878  unsigned int   indexToVertices[3];   //!< index to the verteces of the triangle
     79  unsigned int   indexToNormals[3];    //!< index to the normals of the triangle
    7980  unsigned int   indexToTexCoor[3];    //!< index to the texture coordinates
    8081} sTriangleExt;
  • orxonox/trunk/src/lib/graphics/importer/model.cc

    r4801 r4802  
    237237
    238238  const GLfloat* pVertices = NULL;
     239  const GLfloat* pNorm = NULL;
    239240
    240241  glBegin(GL_TRIANGLES);
    241242  for( int i = 0; i < this->triangleCount; ++i)
    242243  {
     244    //printf("int i = %i\n", i);
     245    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[0]];
    243246    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[0]];
     247    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
    244248    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
    245249
     250    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[1]];
    246251    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[1]];
     252    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
    247253    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
    248254
     255    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[2]];
    249256    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[2]];
     257    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
    250258    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
    251259
     
    916924        {
    917925          this->triangles[index].indexToVertices[j] = (unsigned int)tmpElem->vertexNumber * 3;
     926          this->triangles[index].indexToNormals[j] = (unsigned int)tmpElem->normalNumber * 3;
    918927          this->triangles[index].indexToTexCoor[j] = (unsigned int)tmpElem->texCoordNumber * 3;
    919928          tmpElem = tmpElem->next;
     
    925934
    926935        this->triangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
     936        this->triangles[index].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
    927937        this->triangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
    928938
    929939        this->triangles[index + 1].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
     940        this->triangles[index + 1].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
    930941        this->triangles[index + 1].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
    931942        tmpElem = tmpElem->next;
    932943
    933944        this->triangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
     945        this->triangles[index].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
    934946        this->triangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
    935947        tmpElem = tmpElem->next;
    936948
    937949        this->triangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
     950        this->triangles[index].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
    938951        this->triangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
    939952
    940953        this->triangles[index + 1].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
     954        this->triangles[index + 1].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
    941955        this->triangles[index + 1].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
    942956        tmpElem = tmpElem->next;
    943957
    944958        this->triangles[index + 1].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
     959        this->triangles[index + 1].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
    945960        this->triangles[index + 1].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
    946961
Note: See TracChangeset for help on using the changeset viewer.