root/trunk/contrib/vmap_extractor_v2/vmapextract/modelheaders.h

Revision 2, 5.7 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1#ifndef MODELHEADERS_H
2#define MODELHEADERS_H
3
4typedef unsigned char uint8;
5typedef char int8;
6typedef unsigned short uint16;
7typedef short int16;
8typedef unsigned int uint32;
9typedef int int32;
10
11#pragma pack(push,1)
12
13struct ModelHeader {
14        char id[4];
15        uint8 version[4];
16        uint32 nameLength;
17        uint32 nameOfs;
18        uint32 type;
19
20        uint32 nGlobalSequences;
21        uint32 ofsGlobalSequences;
22        uint32 nAnimations;
23        uint32 ofsAnimations;
24        uint32 nC;
25        uint32 ofsC;
26        uint32 nD;
27        uint32 ofsD;
28        uint32 nBones;
29        uint32 ofsBones;
30        uint32 nF;
31        uint32 ofsF;
32
33        uint32 nVertices;
34        uint32 ofsVertices;
35        uint32 nViews;
36        uint32 ofsViews;
37
38        uint32 nColors;
39        uint32 ofsColors;
40
41        uint32 nTextures;
42        uint32 ofsTextures;
43
44        uint32 nTransparency; // H
45        uint32 ofsTransparency;
46        uint32 nI;   // always unused ?
47        uint32 ofsI;
48        uint32 nTexAnims;       // J
49        uint32 ofsTexAnims;
50        uint32 nK;
51        uint32 ofsK;
52
53        uint32 nTexFlags;
54        uint32 ofsTexFlags;
55        uint32 nY;
56        uint32 ofsY;
57
58        uint32 nTexLookup;
59        uint32 ofsTexLookup;
60
61        uint32 nTexUnitLookup;          // L
62        uint32 ofsTexUnitLookup;
63        uint32 nTransparencyLookup; // M
64        uint32 ofsTransparencyLookup;
65        uint32 nTexAnimLookup;
66        uint32 ofsTexAnimLookup;
67
68        float floats[14];
69
70        uint32 nBoundingTriangles;
71        uint32 ofsBoundingTriangles;
72        uint32 nBoundingVertices;
73        uint32 ofsBoundingVertices;
74        uint32 nBoundingNormals;
75        uint32 ofsBoundingNormals;
76
77        uint32 nO;
78        uint32 ofsO;
79        uint32 nP;
80        uint32 ofsP;
81        uint32 nQ;
82        uint32 ofsQ;
83        uint32 nLights; // R
84        uint32 ofsLights;
85        uint32 nCameras; // S
86        uint32 ofsCameras;
87        uint32 nT;
88        uint32 ofsT;
89        uint32 nRibbonEmitters; // U
90        uint32 ofsRibbonEmitters;
91        uint32 nParticleEmitters; // V
92        uint32 ofsParticleEmitters;
93
94};
95
96// block B - animations
97struct ModelAnimation {
98        uint32 animID;
99        uint32 timeStart;
100        uint32 timeEnd;
101
102        float moveSpeed;
103
104        uint32 loopType;
105        uint32 flags;
106        uint32 d1;
107        uint32 d2;
108        uint32 playSpeed;  // note: this can't be play speed because it's 0 for some models
109
110        Vec3D boxA, boxB;
111        float rad;
112
113        int16 s[2];
114};
115
116
117// sub-block in block E - animation data
118struct AnimationBlock {
119        int16 type;             // interpolation type (0=none, 1=linear, 2=hermite)
120        int16 seq;              // global sequence id or -1
121        uint32 nRanges;
122        uint32 ofsRanges;
123        uint32 nTimes;
124        uint32 ofsTimes;
125        uint32 nKeys;
126        uint32 ofsKeys;
127};
128
129// block E - bones
130struct ModelBoneDef {
131        int32 animid;
132        int32 flags;
133        int16 parent; // parent bone index
134        int16 geoid;
135        // new int added to the bone definitions.  Added in WoW 2.0
136        int32 unknown;
137        AnimationBlock translation;
138        AnimationBlock rotation;
139        AnimationBlock scaling;
140        Vec3D pivot;
141};
142
143struct ModelTexAnimDef {
144        AnimationBlock trans, rot, scale;
145};
146
147struct ModelVertex {
148        Vec3D pos;
149        uint8 weights[4];
150        uint8 bones[4];
151        Vec3D normal;
152        Vec2D texcoords;
153        int unk1, unk2; // always 0,0 so this is probably unused
154};
155
156struct ModelView {
157    uint32 nIndex, ofsIndex; // Vertices in this model (index into vertices[])
158    uint32 nTris, ofsTris;       // indices
159    uint32 nProps, ofsProps; // additional vtx properties
160    uint32 nSub, ofsSub;         // materials/renderops/submeshes
161    uint32 nTex, ofsTex;         // material properties/textures
162        int32 lod;                               // LOD bias?
163};
164
165
166/// One material + render operation
167struct ModelGeoset {
168        uint16 d1;              // mesh part id?
169        uint16 d2;              // ?
170        uint16 vstart;  // first vertex
171        uint16 vcount;  // num vertices
172        uint16 istart;  // first index
173        uint16 icount;  // num indices
174        uint16 d3;              // number of bone indices
175        uint16 d4;              // offset into bone index list
176        uint16 d5;              // ?
177        uint16 d6;              // root bone?
178        Vec3D v;
179        float unknown[4];       // Added in WoW 2.0?
180};
181
182/// A texture unit (sub of material)
183struct ModelTexUnit{
184        // probably the texture units
185        // size always >=number of materials it seems
186        uint16 flags;           // Flags
187        uint16 order;           // ?
188        uint16 op;                      // Material this texture is part of (index into mat)
189        uint16 op2;                     // Always same as above?
190        int16 colorIndex;       // color or -1
191        uint16 flagsIndex;      // more flags...
192        uint16 texunit;         // Texture unit (0 or 1)
193        uint16 d4;                      // ? (seems to be always 1)
194        uint16 textureid;       // Texture id (index into global texture list)
195        uint16 texunit2;        // copy of texture unit value?
196        uint16 transid;         // transparency id (index into transparency list)
197        uint16 texanimid;       // texture animation id
198};
199
200// block X - render flags
201struct ModelRenderFlags {
202        uint16 flags;
203        uint16 blend;
204};
205
206// block G - color defs
207struct ModelColorDef {
208        AnimationBlock color;
209        AnimationBlock opacity;
210};
211
212// block H - transp defs
213struct ModelTransDef {
214        AnimationBlock trans;
215};
216
217struct ModelTextureDef {
218        uint32 type;
219        uint32 flags;
220        uint32 nameLen;
221        uint32 nameOfs;
222};
223
224struct ModelLightDef {
225        int16 type;
226        int16 bone;
227        Vec3D pos;
228        AnimationBlock ambColor;
229        AnimationBlock ambIntensity;
230        AnimationBlock color;
231        AnimationBlock intensity;
232        AnimationBlock attStart;
233        AnimationBlock attEnd;
234        AnimationBlock unk1;
235};
236
237struct ModelCameraDef {
238        int32 id;
239        float fov, farclip, nearclip;
240        AnimationBlock transPos;
241        Vec3D pos;
242        AnimationBlock transTarget;
243        Vec3D target;
244        AnimationBlock rot;
245};
246
247
248struct ModelParticleParams {
249        float mid;
250        uint32 colors[3];
251        float sizes[3];
252        int16 d[10];
253        float unk[3];
254        float scales[3];
255        float slowdown;
256        float rotation;
257        float f2[16];
258};
259
260struct ModelParticleEmitterDef {
261    int32 id;
262        int32 flags;
263        Vec3D pos;
264        int16 bone;
265        int16 texture;
266        int32 nZero1;
267        int32 ofsZero1;
268        int32 nZero2;
269        int32 ofsZero2;
270        int16 blend;
271        int16 type;
272        int16 s1;
273        int16 s2;
274        int16 cols;
275        int16 rows;
276        AnimationBlock params[10];
277        ModelParticleParams p;
278        AnimationBlock unk;
279};
280
281
282struct ModelRibbonEmitterDef {
283        int32 id;
284        int32 bone;
285        Vec3D pos;
286        int32 nTextures;
287        int32 ofsTextures;
288        int32 nUnknown;
289        int32 ofsUnknown;
290        AnimationBlock color;
291        AnimationBlock opacity;
292        AnimationBlock above;
293        AnimationBlock below;
294        float res, length, unk;
295        int16 s1, s2;
296        AnimationBlock unk1;
297        AnimationBlock unk2;
298};
299
300
301#pragma pack(pop)
302
303
304#endif
Note: See TracBrowser for help on using the browser.