Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6033 in orxonox.OLD for trunk/src/lib/graphics/importer/model.cc


Ignore:
Timestamp:
Dec 10, 2005, 11:31:12 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: model now also implements a Draw function, based on what it knows and patrick did

File:
1 edited

Legend:

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

    r6022 r6033  
    1717
    1818#include "model.h"
     19
     20#include "glincl.h"
    1921
    2022using namespace std;
     
    4547  // delete what has to be deleted here
    4648}
     49
     50
     51
     52void Model::draw() const
     53{
     54  const GLfloat* pVertices = NULL;
     55  const GLfloat* pNorm = NULL;
     56 
     57  glBegin(GL_TRIANGLES);
     58  for( int i = 0; i < this->pModelInfo.numTriangles; ++i)
     59    {
     60      //printf("int i = %i\n", i);
     61      pNorm = &this->pModelInfo.pNormals[this->pModelInfo.pTriangles[i].indexToNormals[0]];
     62      pVertices = &this->pModelInfo.pVertices[this->pModelInfo.pTriangles[i].indexToVertices[0]];
     63      glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
     64      glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
     65     
     66      pNorm = &this->pModelInfo.pNormals[this->pModelInfo.pTriangles[i].indexToNormals[1]];
     67      pVertices = &this->pModelInfo.pVertices[this->pModelInfo.pTriangles[i].indexToVertices[1]];
     68      glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
     69      glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
     70     
     71      pNorm = &this->pModelInfo.pNormals[this->pModelInfo.pTriangles[i].indexToNormals[2]];
     72      pVertices = &this->pModelInfo.pVertices[this->pModelInfo.pTriangles[i].indexToVertices[2]];
     73      glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
     74      glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
     75     
     76    }
     77  glEnd();
     78}
Note: See TracChangeset for help on using the changeset viewer.