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/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, 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
29ALIAS MODELS
30
31Alias models are position independent, so the cache manager can move them.
32==============================================================================
33*/
34
35#include "modelgen.h"
36
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
71typedef struct md2stvert_s
72{
73 short s;
74 short t;
76
77typedef struct md2triangle_s
78{
79 short index_xyz[3];
80 short index_st[3];
82
83typedef 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
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
99typedef struct md2_s
100{
101 int ident;
103
106 int framesize; // byte size of each frame
107
110 int num_st; // greater than num_xyz for seams
112 int num_glcmds; // dwords in strip/fan command list
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
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
132typedef struct md3vertex_s
133{
134 short origin[3];
135 unsigned char pitch;
136 unsigned char yaw;
137}
139
140// one per frame
141typedef struct md3frameinfo_s
142{
143 float mins[3];
144 float maxs[3];
145 float origin[3];
146 float radius;
148}
150
151// one per tag per frame
152typedef struct md3tag_s
153{
155 float origin[3];
156 float rotationmatrix[9];
157}
159
160// one per shader per mesh
161typedef struct md3shader_s
162{
164 // engine field (yes this empty int does exist in the file)
166}
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
176typedef struct md3mesh_s
177{
178 char identifier[4]; // "IDP3"
180 int flags;
190}
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)
197typedef struct md3modelheader_s
198{
199 char identifier[4]; // "IDP3"
200 int version; // 15
202 int flags;
211}
213
214typedef struct aliastag_s
215{
217 float matrixgl[12];
218}
220
221typedef struct aliasbone_s
222{
224 int flags;
225 int parent; // -1 for no parent
226}
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
238extern float mod_md3_sin[320];
239
240extern struct cvar_s r_skeletal_debugbone;
241extern struct cvar_s r_skeletal_debugbonecomponent;
242extern struct cvar_s r_skeletal_debugbonevalue;
243extern struct cvar_s r_skeletal_debugtranslatex;
244extern struct cvar_s r_skeletal_debugtranslatey;
245extern struct cvar_s r_skeletal_debugtranslatez;
246
247struct model_s;
248struct frameblend_s;
249struct skeleton_s;
250
252void 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
vector mins
vector maxs
vector origin
string model
float scale
const GLchar * name
Definition glquake.h:601
void * Mod_Skeletal_AnimateVertices_AllocBuffers(size_t nbytes)
Definition model_alias.c:53
struct cvar_s r_skeletal_debugtranslatex
Definition model_alias.c:36
struct cvar_s r_skeletal_debugbonecomponent
Definition model_alias.c:34
struct cvar_s r_skeletal_debugbonevalue
Definition model_alias.c:35
#define MD3NAME
struct cvar_s r_skeletal_debugtranslatey
Definition model_alias.c:37
float mod_md3_sin[320]
Definition model_alias.c:42
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)
struct cvar_s r_skeletal_debugtranslatez
Definition model_alias.c:38
#define MD3FRAMENAME
struct cvar_s r_skeletal_debugbone
Definition model_alias.c:33
vec_t vec3_t[3]
Definition qtypes.h:71
#define RESTRICT
Definition qtypes.h:27
vec3_t scale
Definition model_alias.h:41
vec3_t scale_origin
Definition model_alias.h:42
float boundingradius
Definition model_alias.h:43
vec3_t eyeposition
Definition model_alias.h:44
int num_st
int framesize
int skinheight
int ofs_skins
int ident
int ofs_frames
int ofs_glcmds
int num_frames
int num_glcmds
int num_tris
int num_skins
int ofs_st
int ofs_tris
int ofs_end
int skinwidth
int version
int num_xyz
int lump_elements
int num_shaders
int num_triangles
int lump_shaders
int num_vertices
int lump_framevertices
int lump_texcoords
unsigned char pitch
unsigned char yaw