Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4188 in orxonox.OLD for orxonox/branches/md2_loader/src


Ignore:
Timestamp:
May 15, 2005, 10:31:15 PM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_model: implemented interpolate and some animation structures

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

    r4187 r4188  
    3434};
    3535
    36 static float *shadedots = MD2Model2::anormsDots[0];
     36static float *shadeDots = MD2Model2::anormsDots[0];
     37
     38float md2Angle = 0.0f;
     39
     40
     41sAnim MD2Model2::animationList[21] =
     42  {
     43    {   0,  39,  9 },   // STAND
     44    {  40,  45, 10 },   // RUN
     45    {  46,  53, 10 },   // ATTACK
     46    {  54,  57,  7 },   // PAIN_A
     47    {  58,  61,  7 },   // PAIN_B
     48    {  62,  65,  7 },   // PAIN_C
     49    {  66,  71,  7 },   // JUMP
     50    {  72,  83,  7 },   // FLIP
     51    {  84,  94,  7 },   // SALUTE
     52    {  95, 111, 10 },   // FALLBACK
     53    { 112, 122,  7 },   // WAVE
     54    { 123, 134,  6 },   // POINT
     55    { 135, 153, 10 },   // CROUCH_STAND
     56    { 154, 159,  7 },   // CROUCH_WALK
     57    { 160, 168, 10 },   // CROUCH_ATTACK
     58    { 196, 172,  7 },   // CROUCH_PAIN
     59    { 173, 177,  5 },   // CROUCH_DEATH
     60    { 178, 183,  7 },   // DEATH_FALLBACK
     61    { 184, 189,  7 },   // DEATH_FALLFORWARD
     62    { 190, 197,  7 },   // DEATH_FALLBACKSLOW
     63    { 198, 198,  5 },   // BOOM
     64  };
    3765
    3866
     
    591619void MD2Model2::interpolate(sVec3D* verticesList)
    592620{
     621  sVec3D* currVec;
     622  sVec3D* nextVec;
     623
     624  currVec = &this->pVertices[this->numVertices * this->animationState.currentFrame];
     625  nextVec = &this->pVertices[this->numVertices * this->animationState.currentFrame];
     626
    593627  for(int i = 0; i < this->numFrames; ++i)
    594628    {
     
    603637void MD2Model2::processLighting()
    604638{
     639  shadeDots = anormsDots[ ((int)(md2Angle*(SHADEDOT_QUANT / 360.0)))&(SHADEDOT_QUANT - 1)];
    605640}
    606641
     
    617652  glCullFace(GL_BACK);
    618653     
     654  this->processLighting();
    619655  this->interpolate(verticesList);
    620656  this->material->select();
     
    637673        {
    638674          /* for quake2 lighting */
    639           //float l = shadedots[this->pLightNormals[pCommands[2]]];
     675          float l = shadeDots[this->pLightNormals[pCommands[2]]];
    640676          //glColor3f(l * lcolor[0], l * lcolor[1], l * lcolor[2]);
    641677
    642678          glTexCoord2f( ((float *)pCommands)[0], ((float *)pCommands)[1] );
    643           //glNormal3fv(anorms[this->pLightNormals[2]]);
     679          glNormal3fv(anorms[this->pLightNormals[2]]);
    644680          glVertex3fv(verticesList[pCommands[2]]);
    645681        }
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h

    r4172 r4188  
    112112typedef char tMd2Skin[64];
    113113
     114typedef enum
     115  {
     116    STAND,
     117    RUN,
     118    ATTACK,
     119    PAIN_A,
     120    PAIN_B,
     121    PAIN_C,
     122    JUMP,
     123    FLIP,
     124    SALUTE,
     125    FALLBACK,
     126    WAVE,
     127    POINT,
     128    CROUCH_STAND,
     129    CROUCH_WALK,
     130    CROUCH_ATTACK,
     131    CROUCH_PAIN,
     132    CROUCH_DEATH,
     133    DEATH_FALLBACK,
     134    DEATH_FALLFORWARD,
     135    DEATH_FALLBACKSLOW,
     136    BOOM,
     137 
     138    MAX_ANIMATIONS
     139  } animType;
     140
    114141
    115142//! This is a MD2 Model class
     
    146173class Material;
    147174
     175
     176
    148177//! This is a MD2 Model class
    149178class MD2Model2 : public AbstractModel {
Note: See TracChangeset for help on using the changeset viewer.