Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 20, 2005, 3:45:53 AM (19 years ago)
Author:
patrick
Message:

christmas: alternative draw funciton

Location:
branches/christmas_branche/src/lib/graphics/importer
Files:
2 edited

Legend:

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

    r6180 r6181  
    177177{
    178178  glPushMatrix();
    179   this->renderFrame();
     179//   this->renderFrame();
     180  renderFrameTriangles();
    180181  glPopMatrix();
    181182}
     
    223224  glPopAttrib();
    224225}
     226
     227
     228
     229
     230
     231void MD2Model::renderFrameTriangles() const
     232{
     233  static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
     234  int* pCommands = this->data->pGLCommands;
     235  /* some face culling stuff */
     236//   glPushAttrib(GL_POLYGON_BIT);
     237//   glFrontFace(GL_CW);
     238//   glEnable(GL_CULL_FACE);
     239//   glCullFace(GL_BACK);
     240
     241//   this->processLighting();
     242//   this->interpolate(/*verticesList*/);
     243  this->data->material->select();
     244
     245  /* draw the triangles */
     246  glBegin(GL_TRIANGLES);
     247
     248  for( int i = 0, k = 0; i < this->data->numTriangles; ++i, k += 3)
     249  {
     250    //printf("%i: (%f, %f)\n", i, (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].s, (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].t);
     251
     252    glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[0]].s,
     253                  (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[0]].t);
     254 //glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);
     255    glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[0]]);
     256
     257    glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[1]].s,
     258                  (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[1]].t);
     259
     260 //    glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);
     261    glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[1]]);
     262
     263    glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].s,
     264                  (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].t);
     265 //    glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);
     266    glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[2]]);
     267  }
     268
     269  glEnd();
     270}
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
    225282
    226283
  • branches/christmas_branche/src/lib/graphics/importer/md2Model.h

    r6180 r6181  
    214214
    215215  virtual void draw() const;
     216  void renderFrameTriangles() const;
     217
    216218
    217219  void setAnim(int type);
Note: See TracChangeset for help on using the changeset viewer.