Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8552 in orxonox.OLD for branches/bsp_model


Ignore:
Timestamp:
Jun 17, 2006, 2:57:28 AM (19 years ago)
Author:
patrick
Message:

bsp: md3 model normal and vertex drawing functions. not working yet

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

    r8551 r8552  
    1818
    1919#include "md3_data.h"
     20#include "md3_mesh.h"
     21#include "md3_tag.h"
    2022
    2123#include "md3_animation_cfg.h"
     24
     25#include "material.h"
    2226
    2327namespace md3
     
    7377    }
    7478
     79    //draw all meshes of current frame of this model
     80    for( int i = 0;  i < data->meshNum; i++) {
     81      MD3Mesh* mesh = data->meshes[i];
    7582
     83//       gl.glBlendFunc(mesh.GLSrcBlendFunc, mesh.GLDstBlendFunc);
     84//       gl.glDepthMask(mesh.GLDepthMask);
     85
     86      if( mesh->header->textureNum > 0 && &mesh->material[0] != NULL)
     87        mesh->material[0].select();
     88
     89      // get mesh frame, do interpolation if necessary
     90      sVec3D* frame;
     91      if( data->animationState.interpolationFraction != 0.0 &&
     92          data->animationState.currentFrame != data->animationState.nextFrame) {
     93        //interpolate mesh frame between the 2 current mesh frames
     94        frame = this->interpolateMeshFrame(mesh, data->animationState.currentFrame, data->animationState.nextFrame,
     95                                           data->animationState.interpolationFraction);
     96      }
     97      else {
     98        //no interpolation needed, just draw current frame
     99        frame = &mesh->meshFrames[data->animationState.currentFrame];
     100      }
     101
     102      this->drawMesh(mesh, frame);
     103
     104      //draw vertex normals
     105      if( this->bDrawNormals) {
     106        // get vertex normals, interpolate if necessary
     107        if( data->animationState.interpolationFraction != 0.0 &&
     108            data->animationState.currentFrame != data->animationState.nextFrame) {
     109          //interpolate vertex normals
     110          this->drawVertexNormals(frame, this->interpolateVertexNormals(&mesh->normals[data->animationState.currentFrame],
     111                                  &mesh->normals[data->animationState.nextFrame], data->animationState.interpolationFraction));
     112        }
     113        else {
     114          //stick with current vertex normals
     115          this->drawVertexNormals(frame, &mesh->normals[data->animationState.currentFrame]);
     116        }
     117      }
     118    }
     119
     120    //draw all models linked to this model
     121
     122    std::map<int, MD3Data*>::iterator it = data->sortedMap.begin();
     123    while( it != data->sortedMap.end()) {
     124      MD3Data* child = it->second;
     125
     126      //build transformation array m from matrix, interpolate if necessary
     127      float* m = new float[16];
     128
     129    }
    76130
    77131  }
    78132
    79133
     134  /**
     135   * draws the mesh
     136   */
     137  void MD3Model::drawMesh(MD3Mesh* mesh, sVec3D* frame)
     138  {}
     139
     140
     141  /**
     142   *  drawo vertex normals
     143   */
     144  void MD3Model::drawVertexNormals(sVec3D* frame, MD3Normal* normals)
     145  {}
     146
     147
     148  /**
     149   *  interpolate bone frame
     150   */
    80151  MD3BoneFrame MD3Model::interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac)
    81152  {}
    82153
    83154
     155  /**
     156   * draw bone frame
     157   */
    84158  void MD3Model::drawBoneFrame(MD3BoneFrame* frame)
    85159  {}
    86160
    87161
     162  /**
     163   * interpolate mesh frame
     164   */
     165  sVec3D* MD3Model::interpolateMeshFrame(MD3Mesh* mesh, int startFrame, int nextMeshFrame, float frac)
     166  {}
     167
     168
     169  /**
     170   * interpolate vertex normal
     171   */
     172  MD3Normal* MD3Model::interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac)
     173  {}
     174
    88175
    89176}
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h

    r8551 r8552  
    1919class MD3Data;
    2020class MD3BoneFrame;
     21class MD3Mesh;
     22struct MD3Normal;
     23
    2124
    2225class MD3Model : public InteractiveModel
     
    3740    void draw(MD3Data* data);
    3841
     42    void drawMesh(MD3Mesh* mesh, sVec3D* frame);
     43    void drawVertexNormals(sVec3D* frame, MD3Normal* normals);
     44
     45
    3946    MD3BoneFrame* interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac);
    4047    void drawBoneFrame(MD3BoneFrame* frame);
     48
     49    sVec3D* interpolateMeshFrame(MD3Mesh* mesh, int startFrame, int nextMeshFrame, float frac);
     50
     51    MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac);
    4152
    4253
     
    4556
    4657    bool                bDrawBones;        //!< draws the bone frames too
     58    bool                bDrawNormals;      //!< draw the normals
    4759};
    4860
Note: See TracChangeset for help on using the changeset viewer.