Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5087 in orxonox.OLD for trunk/src/lib/graphics/importer


Ignore:
Timestamp:
Aug 20, 2005, 5:39:13 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: added some droids in the middle of the track to the left side. They die on shooting. Bensch: have some fun :D

Location:
trunk/src/lib/graphics/importer
Files:
2 edited

Legend:

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

    r5086 r5087  
    8787
    8888  this->scaleFactor = this->data->scaleFactor;
    89   this->setAnim(BOOM);
     89  this->setAnim(STAND);
    9090}
    9191
     
    134134{
    135135  if( (type < 0) || (type > MAX_ANIMATIONS) )
    136     type = 0;
     136    type = STAND;
    137137
    138138  this->animationState.startFrame = animationList[type].firstFrame;
     
    142142  this->animationState.type = type;
    143143
    144   this->animationState.interpolationState = 0.0;
    145   this->animationState.localTime = 0.0;
    146   this->animationState.lastTime = 0.0;
     144  this->animationState.interpolationState = 0.0f;
     145  this->animationState.localTime = 0.0f;
     146  this->animationState.lastTime = 0.0f;
    147147  this->animationState.currentFrame = animationList[type].firstFrame;
    148148}
     
    169169  glPushMatrix();
    170170
    171   this->renderFrameGLList();
    172 //  this->renderFrameTriangles();
     171  this->renderFrame();
    173172
    174173  glPopMatrix();
     
    179178  \brief this is an internal function to render this special frame selected by animate()
    180179*/
    181 void MD2Model::renderFrameGLList()
     180void MD2Model::renderFrame()
    182181{
    183182  static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
     
    194193  this->data->material->select();
    195194
    196   printf("=============================FRAME\n");
    197195  /* draw the triangles */
    198196  while( int i = *(pCommands++)) /* strange looking while loop for maximum performance */
     
    218216
    219217    }
    220   glDisable(GL_CULL_FACE);
    221   glPopAttrib();
    222 }
    223 
    224 
    225 /**
    226  *  renders the frame using triangles
    227  */
    228 void MD2Model::renderFrameTriangles()
    229 {
    230   static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
    231   int* pCommands = this->data->pGLCommands;
    232 
    233   /* some face culling stuff */
    234   glPushAttrib(GL_POLYGON_BIT);
    235   glFrontFace(GL_CW);
    236   glEnable(GL_CULL_FACE);
    237   glCullFace(GL_BACK);
    238 
    239   this->processLighting();
    240   this->interpolate(verticesList);
    241   this->data->material->select();
    242 
    243   /* draw the triangles */
    244   glBegin(GL_TRIANGLES);
    245 
    246   for( int i = 0, k = 0; i < this->data->numTriangles; ++i, k += 3)
    247   {
    248     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);
    249 
    250     glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[0]].s,
    251                  (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[0]].t);
    252     //glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);
    253     glVertex3fv(verticesList[this->data->pTriangles[i].indexToVertices[0]]);
    254 
    255     glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[1]].s,
    256                   (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[1]].t);
    257 
    258 //    glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);
    259     glVertex3fv(verticesList[this->data->pTriangles[i].indexToVertices[1]]);
    260 
    261     glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].s,
    262                   (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].t);
    263 //    glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);
    264     glVertex3fv(verticesList[this->data->pTriangles[i].indexToVertices[2]]);
    265   }
    266 
    267   glEnd();
    268 
    269 
    270218  glDisable(GL_CULL_FACE);
    271219  glPopAttrib();
     
    431379  fseek(pFile, this->header->offsetTexCoords, SEEK_SET);
    432380  fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile);
    433   for( int i = 0; i < this->numTexCoor; ++i)
    434   {
    435     printf("%i: (%i, %i)\n", i, this->pTexCoor[i].s, this->pTexCoor[i].t);
    436   }
     381
    437382
    438383  for(int i = 0; i < this->numFrames; ++i)
  • trunk/src/lib/graphics/importer/md2Model.h

    r5085 r5087  
    160160  void processLighting();
    161161  void interpolate(sVec3D* verticesList);
    162   void renderFrameGLList();
    163   void renderFrameTriangles();
     162  void renderFrame();
     163
    164164
    165165 public:
Note: See TracChangeset for help on using the changeset viewer.