Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4073 in orxonox.OLD for orxonox/branches/md2_loader/src/lib


Ignore:
Timestamp:
May 6, 2005, 1:08:50 AM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_importer: now created all the structures needed to load a md2 file. there are some types that have already been defined in other files of orxonox. i will use the original md2 structures. there is time for cleanup and resolve possible conflicts later: as soon as md2 works

File:
1 edited

Legend:

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

    r4072 r4073  
    55        We are deeply thankfull for all the wunderfull things id software made for us gamers!
    66
     7        The md2 file format is structured in a very simple way: it contains animations which are made out of
     8        frames (so called keyframes). Each frame is a complete draweable model in a specific position.
     9        A frame is a collection of vertex and its compagnions (normals, texture coordinates).
     10       
     11        A typical model has about 200 frames, the maximum frame count is fixed by MD2_MAX_FRAMES to currently
     12        512 frames. The maximal vetices count is set to 2048 verteces, not enough?
     13        You just have to change the MD2_MAX_* values if it doesn't fit your purposes...
    714*/
    815
     
    2128#define MD2_MAX_FRAMESIZE               (MD2_MAX_VERTICES * 4 + 128)
    2229
    23 //! This holds the header information that is read in at the beginning of the file
     30//! This stores the speed of the animation between each key frame - currently conflicting with the animation framework
     31#define kAnimationSpeed                 5.0f
     32
     33//! This holds the header information that is read in at the beginning of the file: id software definition
    2434struct tMd2Header
    2535{
    26    int magic;                                   //!< This is used to identify the file
     36   int ident;                                   //!< This is used to identify the file
    2737   int version;                                 //!< The version number of the file (Must be 8)
     38   
    2839   int skinWidth;                               //!< The skin width in pixels
    2940   int skinHeight;                              //!< The skin height in pixels
    3041   int frameSize;                               //!< The size in bytes the frames are
     42   
    3143   int numSkins;                                //!< The number of skins associated with the model
    3244   int numVertices;                             //!< The number of vertices (constant for each frame)
     
    3547   int numGlCommands;                   //!< The number of gl commands
    3648   int numFrames;                               //!< The number of animation frames
     49   
    3750   int offsetSkins;                             //!< The offset in the file for the skin data
    3851   int offsetTexCoords;                 //!< The offset in the file for the texture data
     
    7184};
    7285
    73 // This stores the animation scale, translation and name information for a frame, plus verts
     86//! This stores the animation scale, translation and name information for a frame, plus verts
    7487struct tMd2AliasFrame
    7588{
     
    8093};
    8194
    82 // This stores the frames vertices after they have been transformed
     95//! This stores the frames vertices after they have been transformed
    8396struct tMd2Frame
    8497{
     
    87100};
    88101
    89 // This stores a skin name
     102//! This stores a skin name
    90103typedef char tMd2Skin[64];
    91104
    92105
    93 //! A class for representating a MD2Model
    94 class MD2Model : public AbstractModel {
     106//! A class for representating a MD2Model it handles also all of the loading code
     107class MD2Model : public AbstractModel
     108{
    95109
    96  public:
     110public:
    97111  MD2Model();
    98112  virtual ~MD2Model();
     113 
     114  bool importMD2(t3DModel *pModel, char *strFileName, char *strTexture);
     115
     116private:
     117  void readMD2Data();
     118  void parseAnimations(t3DModel *pModel);
     119  void convertDataStructures(t3DModel *pModel);
     120  void computeNormals(t3DModel *pModel);
     121  void cleanUp();
     122 
     123  FILE *m_FilePointer; 
     124  tMd2Header m_Header;                                  //!< The header data
     125  tMd2Skin *m_pSkins;                                           //!< The skin data
     126  tMd2TexCoord *m_pTexCoords;                           //!< The texture coordinates
     127  tMd2Face *m_pTriangles;                                       //!< Face index information
     128  tMd2Frame *m_pFrames;                                 //!< The frames of animation (vertices)
     129};
    99130
    100131
    101 };
    102 
    103132#endif /* _MD2MODEL_H */
Note: See TracChangeset for help on using the changeset viewer.