Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6033 in orxonox.OLD


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

Location:
trunk/src
Files:
4 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}
  • trunk/src/lib/graphics/importer/model.h

    r6022 r6033  
    132132    virtual ~Model();
    133133
    134     virtual void draw() const {  }
     134    virtual void draw() const;
    135135
    136136    inline const modelInfo* getModelInfo() const { return &this->pModelInfo; }
  • trunk/src/lib/graphics/importer/static_model.cc

    r6031 r6033  
    220220//////////
    221221/**
    222  *  Draws the Models of all Groups.
    223    It does this by just calling the Lists that must have been created earlier.
    224 */
     222 * @brief Draws the Models of all Groups.
     223 *
     224 * It does this by just calling the Lists that must have been created earlier.
     225 */
    225226void StaticModel::draw () const
    226227{
     
    233234      tmpGroup = tmpGroup->next;
    234235    }
    235 
    236   /*
    237     const GLfloat* pVertices = NULL;
    238     const GLfloat* pNorm = NULL;
    239    
    240     glBegin(GL_TRIANGLES);
    241     for( int i = 0; i < this->triangleCount; ++i)
    242     {
    243     //printf("int i = %i\n", i);
    244     pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[0]];
    245     pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[0]];
    246     glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
    247     glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
    248 
    249     pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[1]];
    250     pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[1]];
    251     glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
    252     glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
    253 
    254     pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[2]];
    255     pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[2]];
    256     glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
    257     glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
    258 
    259     }
    260     glEnd();
    261   */
    262236}
    263237
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6005 r6033  
    111111  PRINTF(4)("SPACESHIP INIT\n");
    112112
    113   EventHandler::getInstance()->grabEvents(true);
     113  EventHandler::getInstance()->grabEvents(false);
    114114
    115115  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
Note: See TracChangeset for help on using the changeset viewer.