Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4238 in orxonox.OLD for orxonox/branches/md2_loader


Ignore:
Timestamp:
May 20, 2005, 2:16:21 AM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_model: little clean up and some load speed improvements

File:
1 edited

Legend:

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

    r4237 r4238  
    574574  for(int i = 0; i < this->numFrames; ++i)
    575575    {
    576       /*
    577       faster but evt. buggy
    578576      frame = (sFrame*)(buffer + this->header->frameSize * i);
    579577      pVertex = this->pVertices + this->numVertices  * i;
    580578      pNormals = this->pLightNormals + this->numVertices * i;
    581       */
    582       frame = (sFrame *)&buffer[this->header->frameSize * i];
    583       pVertex = &this->pVertices[this->numVertices * i];
    584       pNormals = &this->pLightNormals[this->numVertices * i];
    585579
    586580      for(int j = 0; j < this->numVertices; ++j)
     
    591585          pVertex[j][2] = -1.0 * (frame->pVertices[j].v[1] * frame->scale[1]) + frame->translate[1];
    592586         
    593           //printf("pVertex %f, %f, %f\n", pVertex[j][0], pVertex[j][1], pVertex[j][2]);
    594 
    595587          pNormals[j] = frame->pVertices[j].lightNormalIndex;
    596588        }
     
    625617  nextVec = &this->pVertices[this->numVertices * this->animationState.nextFrame];
    626618
    627     for(int i = 0; i < this->numFrames; ++i)
    628       //for(int i = 0; i < this->numVertices; ++i)
    629       {
    630         /*
    631         verticesList[i][0] = this->pVertices[i + (this->numFrames * this->animationState.currentFrame)][0] * this->scaleFactor;
    632         verticesList[i][1] = this->pVertices[i + (this->numFrames * this->animationState.currentFrame)][1] * this->scaleFactor;
    633         verticesList[i][2] = this->pVertices[i + (this->numFrames * this->animationState.currentFrame)][2] * this->scaleFactor;
    634         */
    635 
    636 
    637         verticesList[i][0] = (currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0])) * this->scaleFactor;
    638         verticesList[i][1] = (currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1])) * this->scaleFactor;
    639         verticesList[i][2] = (currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2])) * this->scaleFactor;
    640       }
     619  for(int i = 0; i < this->numFrames; ++i)
     620    {
     621      verticesList[i][0] = (currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0])) * this->scaleFactor;
     622      verticesList[i][1] = (currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1])) * this->scaleFactor;
     623      verticesList[i][2] = (currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2])) * this->scaleFactor;
     624    }
    641625}
    642626
     
    738722      for(; i > 0; i--, pCommands += 3) /* down counting for loop, next 3 gl commands */
    739723        {
    740           /* for quake2 lighting */
    741           //float l = shadeDots[this->pLightNormals[pCommands[2]]];
    742           //glColor3f(l * lcolor[0], l * lcolor[1], l * lcolor[2]);
    743 
    744724          glNormal3fv(anorms[this->pLightNormals[pCommands[2]]]);
    745725          glTexCoord2f( ((float *)pCommands)[0], 1.0-((float *)pCommands)[1] );
    746           //printf("pCommands %f, %f\n", ((float *)pCommands)[0], ((float *)pCommands)[1]);
    747726          glVertex3fv(verticesList[pCommands[2]]);
    748 
    749           //printf("draw vert: %f, %f, %f\n", verticesLit[pCommands[2]][0], verticesList[pCommands[2]][1], verticesList[pCommands[2]][2] );
    750727        }
    751728      glEnd();
Note: See TracChangeset for help on using the changeset viewer.