Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4138 in orxonox.OLD for orxonox/branches/md2_loader/src/lib


Ignore:
Timestamp:
May 10, 2005, 10:15:57 AM (19 years ago)
Author:
patrick
Message:

orxonox/branches/md2_loader: modified the MD2Model class so it is able to draw the model, very bad style, just debugging the code. Some worse hacks in world class

Location:
orxonox/branches/md2_loader/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc

    r4126 r4138  
    4949}
    5050
     51/**
     52  \brief draw function
     53 
     54  these function will take NO argument in the final version, just for testing
     55*/
     56void MD2Model::draw(t3DModel *pModel)
     57{
     58        if( pModel->objectList->getSize() <= 0) return;
     59
     60        t3DObject *pObject = pModel->objectList->firstElement();
     61        glBegin(GL_TRIANGLES);
     62                for(int j = 0; j < pObject->numOfFaces; j++)
     63                {
     64                        for(int whichVertex = 0; whichVertex < 3; whichVertex++)
     65                        {
     66                                int index = pObject->pFaces[j].vertIndex[whichVertex];
     67                                int index2 = pObject->pFaces[j].coordIndex[whichVertex];
     68                                /* we invert the normals since the md2 file format uses different style */
     69                                glNormal3f(-pObject->pNormals[ index ].x, -pObject->pNormals[ index ].y, -pObject->pNormals[ index ].z);
     70                                if(pObject->pTexVerts)
     71                                {
     72                                        glTexCoord2f(pObject->pTexVerts[ index2 ].x, pObject->pTexVerts[ index2 ].y);
     73                                }
     74                                glVertex3f(pObject->pVerts[ index ].x, pObject->pVerts[ index ].y, pObject->pVerts[ index ].z);
     75                        }
     76                }
     77        glEnd();
     78}
    5179
    5280/********************************************************************************
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h

    r4079 r4138  
    118118  void drawFrame(int frame);
    119119 
     120  void draw(t3DModel *pModel);
     121 
    120122  void setAnim(int type);
    121123  void scaleModel(float s);
Note: See TracChangeset for help on using the changeset viewer.