Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8558 in orxonox.OLD for branches/bsp_model/src/lib/graphics


Ignore:
Timestamp:
Jun 17, 2006, 11:46:11 AM (18 years ago)
Author:
patrick
Message:

bsp: vertex normals interpolation

Location:
branches/bsp_model/src/lib/graphics/importer/md3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc

    r8557 r8558  
    4040    this->tmpBoneFrame = new MD3BoneFrame();
    4141    this->tmpMesh = new sVec3D[2048];          //!< the temporary mesh, hopefully newer bigger than 2048 vertices
     42    this->tmpNormal = new MD3Normal[2048];     //!< the temporary normals
    4243  }
    4344
     
    124125          //interpolate vertex normals
    125126          this->drawVertexNormals(frame, this->interpolateVertexNormals(&mesh->normals[data->animationState.currentFrame],
    126                                   &mesh->normals[data->animationState.nextFrame], data->animationState.interpolationFraction));
     127                                  &mesh->normals[data->animationState.nextFrame], data->animationState.interpolationFraction, mesh));
    127128        }
    128129        else {
     
    249250   * interpolate vertex normal
    250251   */
    251   MD3Normal* MD3Model::interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac)
    252   {}
     252  MD3Normal* MD3Model::interpolateVertexNormals(MD3Normal* currNormals, MD3Normal* nextNormals, float frac, MD3Mesh* mesh)
     253  {
     254    for( int i = 0; i < mesh->header->vertexNum; i++)
     255    {
     256      this->tmpNormal[i].vertexNormal[0] = (int)((1.0f - frac) * currNormals[i].vertexNormal[0] + frac * nextNormals[i].vertexNormal[0]);
     257      this->tmpNormal[i].vertexNormal[1] = (int)((1.0f - frac) * currNormals[i].vertexNormal[1] + frac * nextNormals[i].vertexNormal[1]);
     258    }
     259
     260    return this->tmpNormal;
     261  }
    253262
    254263
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h

    r8557 r8558  
    5050
    5151    sVec3D* interpolateMeshFrame(sVec3D* currMeshFrame, sVec3D* nextMeshFrame, float frac, MD3Mesh* mesh);
    52     MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac);
     52    MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac, MD3Mesh* mesh);
    5353    float* interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac);
    5454
     
    6060
    6161    MD3BoneFrame*       tmpBoneFrame;      //!< a temporary bone frame
    62     sVec3D*             tmpMesh;           //!< a temportary mesh frame
     62    sVec3D*             tmpMesh;           //!< a temporary mesh frame
     63    MD3Normal*          tmpNormal;         //!< a temporary normals frame
    6364};
    6465
Note: See TracChangeset for help on using the changeset viewer.