00001 #ifndef __HEMI__MD2_H__ 00002 #define __HEMI__MD2_H__ 00003 00004 #include "hemi.h" 00005 00006 typedef struct hemi_md2_hdr 00007 { 00008 int id; 00009 int version; 00010 int tex_width; 00011 int tex_height; 00012 int frame_size; 00013 int num_skins; 00014 int num_verts; 00015 int num_coords; 00016 int num_tris; 00017 int num_glcmds; 00018 int num_frames; 00019 int offset_skins; 00020 int offset_coords; 00021 int offset_tris; 00022 int offset_frames; 00023 int offset_glcmds; 00024 int offset_eof; 00025 } hemi_md2_hdr_t; 00026 00027 typedef struct hemi_md2_skin 00028 { 00029 char name[64]; 00030 } hemi_md2_skin_t; 00031 00032 typedef struct hemi_md2_tri 00033 { 00034 hemi_ushort vert[3]; 00035 hemi_ushort coord[3]; 00036 } hemi_md2_tri_t; 00037 00038 typedef struct hemi_md2_coord 00039 { 00040 short s; 00041 short t; 00042 } hemi_md2_coord_t; 00043 00044 typedef struct hemi_md2_vert 00045 { 00046 hemi_byte v[3]; 00047 hemi_byte normal; 00048 } hemi_md2_vert_t; 00049 00050 typedef struct hemi_md2_frame 00051 { 00052 vec3 scale; 00053 vec3 translation; 00054 char name[16]; 00055 hemi_md2_vert_t* verts; 00056 } hemi_md2_frame_t; 00057 00058 typedef struct hemi_md2 00059 { 00060 hemi_md2_skin_t* skins; 00061 hemi_uint num_skins; 00062 00063 hemi_md2_coord_t* coords; 00064 hemi_uint num_coords; 00065 00066 hemi_md2_tri_t* tris; 00067 hemi_uint num_tris; 00068 00069 hemi_md2_frame_t* frames; 00070 hemi_uint num_frames; 00071 hemi_uint num_verts; 00072 00073 hemi_uint* glcmds; 00074 hemi_uint num_glcmds; 00075 } hemi_md2_t; 00076 00077 HEXTERN int hemi_load_md2(const char*, hemi_md2_t*); 00078 HEXTERN void hemi_free_md2(hemi_md2_t*); 00079 //HEXTERN int hemi_convert_md2_anim(hemi_md2_t*, hemi_vamesh_t*); 00080 //HEXTERN int hemi_convert_md2_static(hemi_md2_t*, hemi_vsmesh_t*); 00081 00082 #endif