Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 18, 2005, 2:15:59 AM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_model: smoother rendering because of face culling: no flickering anymore

File:
1 edited

Legend:

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

    r4213 r4214  
    513513  this->scaleFactor = 0.1f;
    514514
    515   this->setAnim(0);
     515  this->setAnim(STAND);
    516516}
    517517
     
    603603
    604604
    605 void MD2Model2::tick(float time)
    606 {
    607   this->animationState.localTime += time;
    608 }
    609 
    610 void MD2Model2::draw()
    611 {
    612   if( likely(this->animationState.localTime > 0.0))
    613     this->animate();
    614 
    615   glPushMatrix();
    616   /* rotate because id software uses another orientation then the openGL default */
    617   /* \todo: rotate the axis already when loading... easy :) */
    618   glRotatef(-90.0, 1.0, 0.0, 0.0);
    619   glRotatef(-90.0, 0.0, 0.0, 1.0);
    620 
    621   this->renderFrame();
    622 
    623   glPopMatrix();
    624 }
    625 
    626 
    627605/**
    628606   \brief initializes an array of vert with the current frame scaled vertices
     
    667645  this->animationState.fps = animationList[type].fps;
    668646  this->animationState.type = type;
    669  
    670647}
    671648
     
    699676}
    700677
     678void MD2Model2::tick(float time)
     679{
     680  this->animationState.localTime += time;
     681}
     682
     683
     684void MD2Model2::draw()
     685{
     686  if( likely(this->animationState.localTime > 0.0))
     687    this->animate();
     688
     689  glPushMatrix();
     690  /* rotate because id software uses another orientation then the openGL default */
     691  /* \todo: rotate the axis already when loading... easy :) */
     692  glRotatef(-90.0, 1.0, 0.0, 0.0);
     693  glRotatef(-90.0, 0.0, 0.0, 1.0);
     694
     695  this->renderFrame();
     696
     697  glPopMatrix();
     698}
     699
    701700
    702701void MD2Model2::renderFrame()
     
    706705
    707706  /* some face culling stuff */
    708   //glPushAttrib(GL_POLYGON_BIT);
    709   //glFrontFace(GL_CW);
    710   //glEnable(GL_CULL_FACE);
    711   //glCullFace(GL_BACK);
     707  glPushAttrib(GL_POLYGON_BIT);
     708  glFrontFace(GL_CW);
     709  glEnable(GL_CULL_FACE);
     710  glCullFace(GL_BACK);
    712711     
    713712  this->processLighting();
     
    732731        {
    733732          /* for quake2 lighting */
    734           float l = shadeDots[this->pLightNormals[pCommands[2]]];
     733          //float l = shadeDots[this->pLightNormals[pCommands[2]]];
    735734          //glColor3f(l * lcolor[0], l * lcolor[1], l * lcolor[2]);
    736735
     
    741740      glEnd();
    742741    }
    743   //glDisable(GL_CULL_FACE);
    744   //glPopAttrib();
    745 }
    746 
     742  glDisable(GL_CULL_FACE);
     743  glPopAttrib();
     744}
     745
Note: See TracChangeset for help on using the changeset viewer.