DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
model_alias.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 1996-1997 Id Software, Inc.
3
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13
See the GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19
*/
20
21
#ifndef MODEL_ALIAS_H
22
#define MODEL_ALIAS_H
23
24
#include <stddef.h>
25
#include "
qtypes.h
"
26
/*
27
==============================================================================
28
29
ALIAS MODELS
30
31
Alias models are position independent, so the cache manager can move them.
32
==============================================================================
33
*/
34
35
#include "
modelgen.h
"
36
37
typedef
struct
daliashdr_s
38
{
39
int
ident
;
40
int
version
;
41
vec3_t
scale
;
42
vec3_t
scale_origin
;
43
float
boundingradius
;
44
vec3_t
eyeposition
;
45
int
numskins
;
46
int
skinwidth
;
47
int
skinheight
;
48
int
numverts
;
49
int
numtris
;
50
int
numframes
;
51
int
synctype
;
52
int
flags
;
53
float
size
;
54
}
55
daliashdr_t
;
56
57
/*
58
========================================================================
59
60
.MD2 triangle model file format
61
62
========================================================================
63
*/
64
65
// LadyHavoc: grabbed this from the Q2 utility source,
66
// renamed a things to avoid conflicts
67
68
#define MD2ALIAS_VERSION 8
69
#define MD2_SKINNAME 64
70
71
typedef
struct
md2stvert_s
72
{
73
short
s
;
74
short
t
;
75
}
md2stvert_t
;
76
77
typedef
struct
md2triangle_s
78
{
79
short
index_xyz[3];
80
short
index_st[3];
81
}
md2triangle_t
;
82
83
typedef
struct
md2frame_s
84
{
85
float
scale
[3];
// multiply byte verts by this
86
float
translate[3];
// then add this
87
char
name
[16];
// frame name from grabbing
88
}
md2frame_t
;
89
90
// the glcmd format:
91
// a positive integer starts a tristrip command, followed by that many
92
// vertex structures.
93
// a negative integer starts a trifan command, followed by -x vertexes
94
// a zero indicates the end of the command list.
95
// a vertex consists of a floating point s, a floating point t,
96
// and an integer vertex index.
97
98
99
typedef
struct
md2_s
100
{
101
int
ident
;
102
int
version
;
103
104
int
skinwidth
;
105
int
skinheight
;
106
int
framesize
;
// byte size of each frame
107
108
int
num_skins
;
109
int
num_xyz
;
110
int
num_st
;
// greater than num_xyz for seams
111
int
num_tris
;
112
int
num_glcmds
;
// dwords in strip/fan command list
113
int
num_frames
;
114
115
int
ofs_skins
;
// each skin is a MAX_SKINNAME string
116
int
ofs_st
;
// byte offset from start for stverts
117
int
ofs_tris
;
// offset for dtriangles
118
int
ofs_frames
;
// offset for first frame
119
int
ofs_glcmds
;
120
int
ofs_end
;
// end of file
121
}
md2_t
;
122
123
// all md3 ints, floats, and shorts, are little endian, and thus need to be
124
// passed through LittleLong/LittleFloat/LittleShort to avoid breaking on
125
// bigendian machines
126
#define MD3VERSION 15
127
#define MD3NAME 64
128
#define MD3FRAMENAME 16
129
130
// the origin is at 1/64th scale
131
// the pitch and yaw are encoded as 8 bits each
132
typedef
struct
md3vertex_s
133
{
134
short
origin
[3];
135
unsigned
char
pitch
;
136
unsigned
char
yaw
;
137
}
138
md3vertex_t
;
139
140
// one per frame
141
typedef
struct
md3frameinfo_s
142
{
143
float
mins
[3];
144
float
maxs
[3];
145
float
origin
[3];
146
float
radius
;
147
char
name
[
MD3FRAMENAME
];
148
}
149
md3frameinfo_t
;
150
151
// one per tag per frame
152
typedef
struct
md3tag_s
153
{
154
char
name
[
MD3NAME
];
155
float
origin
[3];
156
float
rotationmatrix[9];
157
}
158
md3tag_t
;
159
160
// one per shader per mesh
161
typedef
struct
md3shader_s
162
{
163
char
name
[
MD3NAME
];
164
// engine field (yes this empty int does exist in the file)
165
int
shadernum
;
166
}
167
md3shader_t
;
168
169
// one per mesh per model
170
//
171
// note that the lump_ offsets in this struct are relative to the beginning
172
// of the mesh struct
173
//
174
// to find the next mesh in the file, you must go to lump_end, which puts you
175
// at the beginning of the next mesh
176
typedef
struct
md3mesh_s
177
{
178
char
identifier[4];
// "IDP3"
179
char
name
[
MD3NAME
];
180
int
flags
;
181
int
num_frames
;
182
int
num_shaders
;
183
int
num_vertices
;
184
int
num_triangles
;
185
int
lump_elements
;
186
int
lump_shaders
;
187
int
lump_texcoords
;
188
int
lump_framevertices
;
189
int
lump_end
;
190
}
191
md3mesh_t
;
192
193
// this struct is at the beginning of the md3 file
194
//
195
// note that the lump_ offsets in this struct are relative to the beginning
196
// of the header struct (which is the beginning of the file)
197
typedef
struct
md3modelheader_s
198
{
199
char
identifier[4];
// "IDP3"
200
int
version
;
// 15
201
char
name
[
MD3NAME
];
202
int
flags
;
203
int
num_frames
;
204
int
num_tags
;
205
int
num_meshes
;
206
int
num_skins
;
207
int
lump_frameinfo
;
208
int
lump_tags
;
209
int
lump_meshes
;
210
int
lump_end
;
211
}
212
md3modelheader_t
;
213
214
typedef
struct
aliastag_s
215
{
216
char
name
[
MD3NAME
];
217
float
matrixgl[12];
218
}
219
aliastag_t
;
220
221
typedef
struct
aliasbone_s
222
{
223
char
name
[
MD3NAME
];
224
int
flags
;
225
int
parent
;
// -1 for no parent
226
}
227
aliasbone_t
;
228
229
#include "
model_zymotic.h
"
230
231
#include "
model_dpmodel.h
"
232
233
#include "
model_psk.h
"
234
235
#include "
model_iqm.h
"
236
237
// for decoding md3 model latlong vertex normals
238
extern
float
mod_md3_sin
[320];
239
240
extern
struct
cvar_s
r_skeletal_debugbone
;
241
extern
struct
cvar_s
r_skeletal_debugbonecomponent
;
242
extern
struct
cvar_s
r_skeletal_debugbonevalue
;
243
extern
struct
cvar_s
r_skeletal_debugtranslatex
;
244
extern
struct
cvar_s
r_skeletal_debugtranslatey
;
245
extern
struct
cvar_s
r_skeletal_debugtranslatez
;
246
247
struct
model_s;
248
struct
frameblend_s;
249
struct
skeleton_s;
250
251
void
*
Mod_Skeletal_AnimateVertices_AllocBuffers
(
size_t
nbytes);
252
void
Mod_Skeletal_BuildTransforms
(
const
struct
model_s *
RESTRICT
model
,
const
struct
frameblend_s *
RESTRICT
frameblend,
const
struct
skeleton_s *skeleton,
float
*
RESTRICT
bonepose,
float
*
RESTRICT
boneposerelative);
253
254
#endif
255
mins
vector mins
Definition
csprogsdefs.qc:117
maxs
vector maxs
Definition
csprogsdefs.qc:117
origin
vector origin
Definition
csprogsdefs.qc:105
model
string model
Definition
csprogsdefs.qc:112
scale
float scale
Definition
dpextensions.qc:282
name
const GLchar * name
Definition
glquake.h:601
Mod_Skeletal_AnimateVertices_AllocBuffers
void * Mod_Skeletal_AnimateVertices_AllocBuffers(size_t nbytes)
Definition
model_alias.c:53
r_skeletal_debugtranslatex
struct cvar_s r_skeletal_debugtranslatex
Definition
model_alias.c:36
r_skeletal_debugbonecomponent
struct cvar_s r_skeletal_debugbonecomponent
Definition
model_alias.c:34
r_skeletal_debugbonevalue
struct cvar_s r_skeletal_debugbonevalue
Definition
model_alias.c:35
MD3NAME
#define MD3NAME
Definition
model_alias.h:127
r_skeletal_debugtranslatey
struct cvar_s r_skeletal_debugtranslatey
Definition
model_alias.c:37
mod_md3_sin
float mod_md3_sin[320]
Definition
model_alias.c:42
Mod_Skeletal_BuildTransforms
void Mod_Skeletal_BuildTransforms(const struct model_s *RESTRICT model, const struct frameblend_s *RESTRICT frameblend, const struct skeleton_s *skeleton, float *RESTRICT bonepose, float *RESTRICT boneposerelative)
r_skeletal_debugtranslatez
struct cvar_s r_skeletal_debugtranslatez
Definition
model_alias.c:38
MD3FRAMENAME
#define MD3FRAMENAME
Definition
model_alias.h:128
r_skeletal_debugbone
struct cvar_s r_skeletal_debugbone
Definition
model_alias.c:33
model_dpmodel.h
model_iqm.h
model_psk.h
model_zymotic.h
modelgen.h
qtypes.h
vec3_t
vec_t vec3_t[3]
Definition
qtypes.h:71
RESTRICT
#define RESTRICT
Definition
qtypes.h:27
aliasbone_t
Definition
model_alias.h:222
aliasbone_t::parent
int parent
Definition
model_alias.h:225
aliasbone_t::flags
int flags
Definition
model_alias.h:224
aliastag_t
Definition
model_alias.h:215
daliashdr_t
Definition
model_alias.h:38
daliashdr_t::numtris
int numtris
Definition
model_alias.h:49
daliashdr_t::scale
vec3_t scale
Definition
model_alias.h:41
daliashdr_t::scale_origin
vec3_t scale_origin
Definition
model_alias.h:42
daliashdr_t::skinheight
int skinheight
Definition
model_alias.h:47
daliashdr_t::ident
int ident
Definition
model_alias.h:39
daliashdr_t::numskins
int numskins
Definition
model_alias.h:45
daliashdr_t::size
float size
Definition
model_alias.h:53
daliashdr_t::flags
int flags
Definition
model_alias.h:52
daliashdr_t::version
int version
Definition
model_alias.h:40
daliashdr_t::skinwidth
int skinwidth
Definition
model_alias.h:46
daliashdr_t::synctype
int synctype
Definition
model_alias.h:51
daliashdr_t::boundingradius
float boundingradius
Definition
model_alias.h:43
daliashdr_t::eyeposition
vec3_t eyeposition
Definition
model_alias.h:44
daliashdr_t::numframes
int numframes
Definition
model_alias.h:50
daliashdr_t::numverts
int numverts
Definition
model_alias.h:48
md2_t
Definition
model_alias.h:100
md2_t::num_st
int num_st
Definition
model_alias.h:110
md2_t::framesize
int framesize
Definition
model_alias.h:106
md2_t::skinheight
int skinheight
Definition
model_alias.h:105
md2_t::ofs_skins
int ofs_skins
Definition
model_alias.h:115
md2_t::ident
int ident
Definition
model_alias.h:101
md2_t::ofs_frames
int ofs_frames
Definition
model_alias.h:118
md2_t::ofs_glcmds
int ofs_glcmds
Definition
model_alias.h:119
md2_t::num_frames
int num_frames
Definition
model_alias.h:113
md2_t::num_glcmds
int num_glcmds
Definition
model_alias.h:112
md2_t::num_tris
int num_tris
Definition
model_alias.h:111
md2_t::num_skins
int num_skins
Definition
model_alias.h:108
md2_t::ofs_st
int ofs_st
Definition
model_alias.h:116
md2_t::ofs_tris
int ofs_tris
Definition
model_alias.h:117
md2_t::ofs_end
int ofs_end
Definition
model_alias.h:120
md2_t::skinwidth
int skinwidth
Definition
model_alias.h:104
md2_t::version
int version
Definition
model_alias.h:102
md2_t::num_xyz
int num_xyz
Definition
model_alias.h:109
md2frame_t
Definition
model_alias.h:84
md2stvert_t
Definition
model_alias.h:72
md2stvert_t::t
short t
Definition
model_alias.h:74
md2stvert_t::s
short s
Definition
model_alias.h:73
md2triangle_t
Definition
model_alias.h:78
md3frameinfo_t
Definition
model_alias.h:142
md3frameinfo_t::radius
float radius
Definition
model_alias.h:146
md3mesh_t
Definition
model_alias.h:177
md3mesh_t::lump_elements
int lump_elements
Definition
model_alias.h:185
md3mesh_t::num_shaders
int num_shaders
Definition
model_alias.h:182
md3mesh_t::flags
int flags
Definition
model_alias.h:180
md3mesh_t::num_triangles
int num_triangles
Definition
model_alias.h:184
md3mesh_t::lump_end
int lump_end
Definition
model_alias.h:189
md3mesh_t::lump_shaders
int lump_shaders
Definition
model_alias.h:186
md3mesh_t::num_vertices
int num_vertices
Definition
model_alias.h:183
md3mesh_t::lump_framevertices
int lump_framevertices
Definition
model_alias.h:188
md3mesh_t::num_frames
int num_frames
Definition
model_alias.h:181
md3mesh_t::lump_texcoords
int lump_texcoords
Definition
model_alias.h:187
md3modelheader_t
Definition
model_alias.h:198
md3modelheader_t::lump_frameinfo
int lump_frameinfo
Definition
model_alias.h:207
md3modelheader_t::num_skins
int num_skins
Definition
model_alias.h:206
md3modelheader_t::lump_tags
int lump_tags
Definition
model_alias.h:208
md3modelheader_t::version
int version
Definition
model_alias.h:200
md3modelheader_t::lump_end
int lump_end
Definition
model_alias.h:210
md3modelheader_t::num_frames
int num_frames
Definition
model_alias.h:203
md3modelheader_t::num_tags
int num_tags
Definition
model_alias.h:204
md3modelheader_t::lump_meshes
int lump_meshes
Definition
model_alias.h:209
md3modelheader_t::num_meshes
int num_meshes
Definition
model_alias.h:205
md3modelheader_t::flags
int flags
Definition
model_alias.h:202
md3shader_t
Definition
model_alias.h:162
md3shader_t::shadernum
int shadernum
Definition
model_alias.h:165
md3tag_t
Definition
model_alias.h:153
md3vertex_t
Definition
model_alias.h:133
md3vertex_t::pitch
unsigned char pitch
Definition
model_alias.h:135
md3vertex_t::yaw
unsigned char yaw
Definition
model_alias.h:136
model_alias.h
Generated on Mon Mar 10 2025 16:50:16 for DarkPlaces by
1.12.0