Home
Forum
Documentation
C++
|
Lua
Issue Tracker
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Loader_mdl_hl1.h
1
/*
2
Cafu Engine, http://www.cafu.de/
3
Copyright (c) Carsten Fuchs and other contributors.
4
This project is licensed under the terms of the MIT license.
5
*/
6
7
#ifndef CAFU_HL1_MDL_FILE_FORMAT_HPP_INCLUDED
8
#define CAFU_HL1_MDL_FILE_FORMAT_HPP_INCLUDED
9
10
#if defined(_WIN32)
11
// We are on the Win32 platform.
12
#if defined(__WATCOMC__)
13
// Using the OpenWatcom C/C++ compiler.
14
#pragma off(unreferenced);
15
#define WATCOM_PACKED _Packed
16
#define GCC_PACKED
17
#elif defined(_MSC_VER)
18
// Using the Microsoft Visual C++ compiler.
19
#pragma pack(push, 1)
20
#define WATCOM_PACKED
21
#define GCC_PACKED
22
#else
23
#error Using unknown compiler on the Win32 platform.
24
#endif
25
#elif __linux__
26
// We are on the Linux platform.
27
#if __GNUG__ // This is equivalent to testing (__GNUC__ && __cplusplus).
28
// Using the g++ compiler.
29
// See http://www.delorie.com/gnu/docs/gcc/cpp_toc.html for documentation about the C preprocessor.
30
#define WATCOM_PACKED
31
#define GCC_PACKED __attribute__ ((packed))
32
#else
33
#error Using unknown compiler on the Linux platform.
34
#endif
35
#else
36
#error Compiling on unknown platform.
37
#endif
38
39
40
typedef
float
Vec3T[3];
41
42
43
WATCOM_PACKED
struct
StudioHeaderT
44
{
45
int
ID;
// 4 Byte File-ID
46
int
Version;
// File-Version
47
48
char
Name[64];
// Model name as given by author(?), with file-path(?)
49
int
Length;
// File-Size
50
51
Vec3T EyePosition;
// ideal eye position
52
Vec3T Min;
// ideal movement hull size
53
Vec3T Max;
54
55
Vec3T BBMin;
// clipping bounding box
56
Vec3T BBMax;
57
58
int
Flags;
59
60
int
NumBones;
// StudioBoneT
61
int
BoneIndex;
62
63
int
NumBoneControllers;
// StudioBoneControllerT
64
int
BoneControllerIndex;
65
66
int
NumHitBoxes;
// complex bounding boxes
67
int
HitBoxIndex;
68
69
int
NumSeq;
// StudioSequenceT, animation sequence descriptions
70
int
SeqIndex;
71
72
int
NumSeqGroups;
// StudioSeqGroupT, NumSeqGroups>1 == demand loaded sequences
73
int
SeqGroupIndex;
74
75
int
NumTextures;
// StudioTextureT, raw textures
76
int
TextureIndex;
77
int
TextureDataIndex;
78
79
int
NumSkinRef;
// replaceable textures
80
int
NumSkinFamilies;
81
int
SkinIndex;
82
83
int
NumBodyParts;
// StudioBodyPartT
84
int
BodyPartIndex;
85
86
int
NumAttachments;
// queryable attachable points
87
int
AttachmentIndex;
// z.B. Haltepunkt für Waffe, Sprite o.ä.
88
89
int
SoundTable;
90
int
SoundIndex;
91
int
SoundGroups;
92
int
SoundGroupIndex;
93
94
int
NumTransitions;
// animation node to animation node transition graph
95
int
TransitionIndex;
// Zeigt auf eine NumTransitions*NumTransitions-Matrix von Bytes (chars)
96
} GCC_PACKED;
97
98
99
WATCOM_PACKED
struct
StudioBoneT
100
{
101
char
Name[32];
// bone name for symbolic links
102
int
Parent;
// parent bone
103
int
Flags;
104
int
BoneController[6];
// bone controller index, -1 == none
105
float
Value[6];
// default DoF values
106
float
Scale[6];
// scale for delta DoF values
107
} GCC_PACKED;
108
109
110
WATCOM_PACKED
struct
StudioBoneControllerT
111
{
112
int
Bone;
// -1 == none
113
int
Type;
// X, Y, Z, X rotation, Y rotation, Z rotation, M
114
float
Start;
115
float
End;
116
int
Rest;
// byte index value at rest
117
int
Index;
// 0-3 user set controller, 4 mouth
118
} GCC_PACKED;
119
120
121
WATCOM_PACKED
struct
StudioSequenceT
122
{
123
char
Label[32];
// sequence label
124
125
float
FPS;
// frames per second
126
int
Flags;
// looping/non-looping flags
127
128
int
Activity;
129
int
ActWeight;
130
131
int
NumEvents;
132
int
EventIndex;
133
134
int
NumFrames;
// number of frames per sequence
135
136
int
NumPivots;
// number of foot pivots
137
int
PivotIndex;
138
139
int
MotionType;
140
int
MotionBone;
141
Vec3T LinearMovement;
142
int
AutoMovePosIndex;
143
int
AutoMoveAngleIndex;
144
145
Vec3T BBMin;
// per sequence bounding box
146
Vec3T BBMax;
147
148
int
NumBlends;
149
int
AnimIndex;
// StudioAnimT pointer relative to start of sequence group data ([blend][bone][X, Y, Z, XR, YR, ZR] (?))
150
151
int
BlendType[2];
// X, Y, Z, XR, YR, ZR
152
float
BlendStart[2];
// starting value
153
float
BlendEnd[2];
// ending value
154
int
BlendParent;
155
156
int
SeqGroup;
// sequence group for demand loading
157
158
int
EntryNode;
// transition node at entry
159
int
ExitNode;
// transition node at exit
160
int
NodeFlags;
// transition rules
161
162
int
NextSeq;
// auto advancing sequences
163
} GCC_PACKED;
164
165
166
WATCOM_PACKED
struct
StudioSequenceGroupT
167
{
168
char
Label[32];
// textual name
169
char
Name[64];
// file name
170
char
Dummy[4];
171
int
Data;
// hack for group 0
172
} GCC_PACKED;
173
174
175
WATCOM_PACKED
struct
StudioTextureT
176
{
177
char
Name[64];
178
int
Flags;
179
int
Width;
180
int
Height;
181
int
Index;
182
} GCC_PACKED;
183
184
185
WATCOM_PACKED
struct
StudioBodyPartT
186
{
187
char
Name[64];
188
int
NumModels;
189
int
Base;
190
int
ModelIndex;
// index into models array
191
} GCC_PACKED;
192
193
194
WATCOM_PACKED
struct
StudioModelT
195
{
196
char
Name[64];
197
int
Type;
198
float
BoundingRadius;
199
200
int
NumMesh;
201
int
MeshIndex;
202
203
int
NumVerts;
// number of unique vertices
204
int
VertInfoIndex;
// vertex bone info
205
int
VertIndex;
// vertex Vec3T
206
int
NumNorms;
// number of unique surface normals
207
int
NormInfoIndex;
// normal bone info
208
int
NormIndex;
// normal Vec3T
209
210
int
NumGroups;
// deformation groups
211
int
GroupIndex;
212
} GCC_PACKED;
213
214
215
WATCOM_PACKED
struct
StudioAnimT
216
{
217
unsigned
short
Offset[6];
// relativer Offset ab "this" zu den AnimValues
218
} GCC_PACKED;
219
220
221
// The following union/struct describes a sequence of values, using RLE (run-length encoding).
222
// Let SAV be a properly set pointer to a StudioAnimValueT, as in "StudioAnimValueT* SAV=...;".
223
// Then use/interprete SAV as follows:
224
// 'SAV[0].Num.Total' is the total number of values that are being described.
225
// The first 'SAV[0].Num.Valid' of those values are actually present (see example below),
226
// the remaining ones are obtained by repeating the last valid value.
227
// Example: If SAV[0].Num.Total==8, SAV[0].Num.Valid==3, SAV[1].Value==33, SAV[2].Value==77 and SAV[3].Value==123,
228
// then the resulting sequence of values is "33, 77, 123, 123, 123, 123, 123, 123".
229
WATCOM_PACKED
union
StudioAnimValueT
230
{
231
WATCOM_PACKED
struct
232
{
233
char
Valid;
234
char
Total;
235
} Num;
236
short
Value;
237
} GCC_PACKED;
238
239
240
WATCOM_PACKED
struct
StudioMeshT
241
{
242
int
NumTris;
243
int
TriIndex;
244
int
SkinRef;
245
int
NumNorms_UNUSED;
// per mesh normals (this was used in the very old "pseudo-hemispherical" OpenGL 1.1 lighting code).
246
int
NormIndex_UNUSED;
// normal Vec3T (never seen this one being used).
247
} GCC_PACKED;
248
249
250
WATCOM_PACKED
struct
StudioAttachmentT
251
{
252
char
Name[32];
253
int
Type;
254
int
Bone;
255
Vec3T Org;
// attachment point
256
Vec3T Vectors[3];
257
} GCC_PACKED;
258
259
260
#if defined(_WIN32) && defined (_MSC_VER)
261
#pragma pack(pop)
262
#endif
263
264
#endif
StudioTextureT
Definition:
Loader_mdl_hl1.h:175
StudioSequenceT
Definition:
Loader_mdl_hl1.h:121
StudioAttachmentT
Definition:
Loader_mdl_hl1.h:250
StudioMeshT
Definition:
Loader_mdl_hl1.h:240
StudioBoneControllerT
Definition:
Loader_mdl_hl1.h:110
StudioBodyPartT
Definition:
Loader_mdl_hl1.h:185
StudioSequenceGroupT
Definition:
Loader_mdl_hl1.h:166
StudioAnimValueT
Definition:
Loader_mdl_hl1.h:229
StudioHeaderT
Definition:
Loader_mdl_hl1.h:43
StudioBoneT
Definition:
Loader_mdl_hl1.h:99
StudioModelT
Definition:
Loader_mdl_hl1.h:194
StudioAnimT
Definition:
Loader_mdl_hl1.h:215
Libs
Models
Loader_mdl_hl1.h
Generated on Wed Jun 22 2016 11:29:37 for Cafu Engine by
1.8.6
Copyright © 2002-2016 Carsten Fuchs Software.