Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h @ 8654

Last change on this file since 8654 was 8654, checked in by patrick, 18 years ago

bsp: md3 model:

  • traced the segfault, animation now gets initialized probperly
  • animation code exectued

still no animations tough… gogogo

File size: 2.2 KB
RevLine 
[8342]1/*!
[8343]2 * @file md3_model.h
3 *
4 * Code heavely inspired by: JAVA MD3 Model Viewer - A Java based Quake 3 model viewer
5 * Copyright (C) 1999 Erwin 'KLR8' Vervaet
6 */
[8342]7
[8343]8#ifndef _MD3_MODEL_H
9#define _MD3_MODEL_H
[8342]10
[8343]11#include <string>
[8439]12#include "interactive_model.h"
[8342]13
14
[8638]15#define FRACTION 0.34f
16
17
[8351]18namespace md3
19{
20
[8354]21
[8357]22class MD3Data;
[8551]23class MD3BoneFrame;
[8552]24class MD3Mesh;
[8553]25class MD3Tag;
[8591]26class MD3AnimationCfg;
[8637]27class MD3Animation;
[8553]28
[8552]29struct MD3Normal;
[8357]30
[8552]31
[8638]32typedef enum MD3FrameHandling {
33  NEXT = 0,          //!< swith to the next frame
34  PREVIOUS,          //!< swith to the previous frame
35  REWIND             //!< rewind the animation
36};
37
38
[8439]39class MD3Model : public InteractiveModel
[8342]40{
41
[8343]42  public:
[8353]43    MD3Model(std::string filename, float scaling);
[8343]44    ~MD3Model();
[8342]45
[8439]46    virtual void setAnimation(int animNum, int playbackMode = 0) {}
[8342]47
[8563]48    virtual void tick(float dt);
[8565]49    virtual void draw() const;
[8549]50
51
[8343]52  private:
[8579]53
54    void autoAssemblePlayerModel(std::string filename, float scaling);
55
[8565]56    void draw(MD3Data* data) const;
[8563]57    void tick(float dt, MD3Data* data);
[8550]58
[8654]59
[8565]60    void drawMesh(MD3Mesh* mesh, sVec3D* frame) const;
61    void drawVertexNormals(sVec3D* frame, MD3Normal* normals) const;
62    void drawBoneFrame(MD3BoneFrame* frame) const;
[8552]63
[8654]64
[8634]65    MD3BoneFrame* interpolateBoneFrame(MD3Data* data, MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac);
66    sVec3D* interpolateMeshFrame(MD3Data* data, sVec3D* currMeshFrame, sVec3D* nextMeshFrame, float frac, MD3Mesh* mesh, int i);
67    MD3Normal* interpolateVertexNormals(MD3Data* data, MD3Normal* curNormals, MD3Normal* nextNormals, float frac, MD3Mesh* mesh, int i);
68    float* interpolateTransformation(MD3Data* data, MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i);
[8552]69
[8654]70
71    void interpolate(MD3Data* data, MD3Animation* anim, int op, bool bInterpolate);
72
[8644]73    void visit(MD3Data* data);
[8638]74    int next(MD3Data* data, int nr);
75    int prev(MD3Data* data, int nr);
[8637]76    void doOp(MD3Data* data);
77
78
[8550]79  private:
[8354]80    MD3Data*            md3Data;           //!< reference to the md3 model data
[8549]81
82    bool                bDrawBones;        //!< draws the bone frames too
[8552]83    bool                bDrawNormals;      //!< draw the normals
[8556]84
[8597]85    MD3AnimationCfg*    config;            //!< the config file parsed
86
[8357]87};
[8354]88
[8638]89
[8351]90}
[8342]91
[8343]92#endif /* _MD3_MODEL_H */
Note: See TracBrowser for help on using the repository browser.