]> icculus.org git repositories - divverent/darkplaces.git/blob - model_iqm.h
IQM base pose cleanups
[divverent/darkplaces.git] / model_iqm.h
1 #ifndef __MODEL_IQM_H__
2 #define __MODEL_IQM_H__
3
4 typedef struct iqmheader_s
5 {
6         char id[16];
7         unsigned int version;
8         unsigned int filesize;
9         unsigned int flags;
10         unsigned int num_text, ofs_text;
11         unsigned int num_meshes, ofs_meshes;
12         unsigned int num_vertexarrays, num_vertexes, ofs_vertexarrays;
13         unsigned int num_triangles, ofs_triangles, ofs_neighbors;
14         unsigned int num_joints, ofs_joints;
15         unsigned int num_poses, ofs_poses;
16         unsigned int num_anims, ofs_anims;
17         unsigned int num_frames, num_framechannels, ofs_frames, ofs_bounds;
18         unsigned int num_comment, ofs_comment;
19         unsigned int num_extensions, ofs_extensions;
20
21 iqmheader_t;
22
23 typedef struct iqmmesh_s
24 {
25         unsigned int name;
26         unsigned int material;
27         unsigned int first_vertex, num_vertexes;
28         unsigned int first_triangle, num_triangles;
29 }
30 iqmmesh_t;
31
32 #define IQM_POSITION        0
33 #define IQM_TEXCOORD        1
34 #define IQM_NORMAL          2
35 #define IQM_TANGENT         3
36 #define IQM_BLENDINDEXES    4
37 #define IQM_BLENDWEIGHTS    5
38 #define IQM_COLOR               6
39 #define IQM_CUSTOM          0x10
40
41 #define IQM_BYTE    0
42 #define IQM_UBYTE   1
43 #define IQM_SHORT   2
44 #define IQM_USHORT  3
45 #define IQM_INT     4
46 #define IQM_UINT    5
47 #define IQM_HALF    6
48 #define IQM_FLOAT   7
49 #define IQM_DOUBLE  8
50
51 typedef struct iqmtriangle_s
52 {
53         unsigned int vertex[3];
54 }
55 iqmtriangle_t;
56
57 typedef struct iqmjoint_s
58 {
59         unsigned int name;
60         signed int parent;
61         float origin[3], rotation[3];
62 }
63 iqmjoint_t;
64
65 typedef struct iqmpose_s
66 {
67         signed int parent;
68         unsigned int channelmask;
69         float channeloffset[6], channelscale[6];
70 }
71 iqmpose_t;
72
73 typedef struct iqmanim_s
74 {
75         unsigned int name;
76         unsigned int first_frame, num_frames;
77         unsigned int framerate;
78         unsigned int flags;
79 }
80 iqmanim_t;
81
82 typedef struct iqmvertexarray_s
83 {
84         unsigned int type;
85         unsigned int flags;
86         unsigned int format;
87         unsigned int size;
88         unsigned int offset;
89 }
90 iqmvertexarray_t;
91
92 typedef struct iqmextension_s
93 {
94     unsigned int name;
95     unsigned int num_data, ofs_data;
96     unsigned int ofs_extensions; // pointer to next extension
97 }
98 iqmextension_t;
99
100 typedef struct iqmbounds_s
101 {
102         float mins[3], maxs[3];
103         float xyradius, radius;
104 }
105 iqmbounds_t;
106     
107 #endif
108