1 /*
2  * genmodel.h -- model structures
3  *
4  * $Id: genmodel.h 4767 2012-06-16 20:48:51Z sezero $
5  *
6  * This file must be identical in the genmodel project and in the H3
7  * project.
8  *
9  * Copyright (C) 1996-1997  Id Software, Inc.
10  * Copyright (C) 1997-1998  Raven Software Corp.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or (at
15  * your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * See the GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, write to the Free Software Foundation, Inc.,
25  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
26  */
27 
28 #ifndef __GENMODEL_H
29 #define __GENMODEL_H
30 
31 #define ALIAS_VERSION		6
32 #define ALIAS_NEWVERSION	50
33 
34 #define ALIAS_ONSEAM		0x0020
35 
36 // Little-endian "IDPO"
37 #define IDPOLYHEADER (('O'<<24)+('P'<<16)+('D'<<8)+'I')
38 #define RAPOLYHEADER (('O'<<24)+('P'<<16)+('A'<<8)+'R')
39 
40 // must match definition in spritegn.h
41 #ifndef SYNCTYPE_T
42 #define SYNCTYPE_T
43 typedef enum
44 {
45 	ST_SYNC = 0,
46 	ST_RAND
47 } synctype_t;
48 #endif
49 
50 typedef enum
51 {
52 	ALIAS_SINGLE = 0,
53 	ALIAS_GROUP
54 } aliasframetype_t;
55 
56 typedef enum
57 {
58 	ALIAS_SKIN_SINGLE = 0,
59 	ALIAS_SKIN_GROUP
60 } aliasskintype_t;
61 
62 typedef struct
63 {
64 	int			ident;
65 	int			version;
66 	vec3_t		scale;
67 	vec3_t		scale_origin;
68 	float		boundingradius;
69 	vec3_t		eyeposition;
70 	int			numskins;
71 	int			skinwidth;
72 	int			skinheight;
73 	int			numverts;
74 	int			numtris;
75 	int			numframes;
76 	synctype_t	synctype;
77 	int			flags;
78 	float		size;
79 } mdl_t;
80 
81 typedef struct
82 {
83 	int			ident;
84 	int			version;
85 	vec3_t		scale;
86 	vec3_t		scale_origin;
87 	float		boundingradius;
88 	vec3_t		eyeposition;
89 	int			numskins;
90 	int			skinwidth;
91 	int			skinheight;
92 	int			numverts;
93 	int			numtris;
94 	int			numframes;
95 	synctype_t	synctype;
96 	int			flags;
97 	float		size;
98 	int			num_st_verts;
99 } newmdl_t;
100 
101 typedef struct
102 {
103 	// TODO: could be shorts
104 	int		onseam;
105 	int		s;
106 	int		t;
107 } stvert_t;
108 
109 typedef struct dtriangle_s
110 {
111 	int	facesfront;
112 	int	vertindex[3];
113 } dtriangle_t;
114 
115 typedef struct dnewtriangle_s
116 {
117 	int	facesfront;
118 	unsigned short	vertindex[3];
119 	unsigned short	stindex[3];
120 } dnewtriangle_t;
121 
122 #define DT_FACES_FRONT	0x0010
123 
124 typedef struct
125 {
126 	byte	v[3];
127 	byte	lightnormalindex;
128 } trivertx_t;
129 
130 typedef struct
131 {
132 	trivertx_t	bboxmin;	// lightnormal isn't used
133 	trivertx_t	bboxmax;	// lightnormal isn't used
134 	char	name[16];	// frame name from grabbing
135 } daliasframe_t;
136 
137 typedef struct
138 {
139 	int		numframes;
140 	trivertx_t	bboxmin;	// lightnormal isn't used
141 	trivertx_t	bboxmax;	// lightnormal isn't used
142 } daliasgroup_t;
143 
144 typedef struct
145 {
146 	int		numskins;
147 } daliasskingroup_t;
148 
149 typedef struct
150 {
151 	float	interval;
152 } daliasinterval_t;
153 
154 typedef struct
155 {
156 	float	interval;
157 } daliasskininterval_t;
158 
159 typedef struct
160 {
161 	aliasframetype_t	type;
162 } daliasframetype_t;
163 
164 typedef struct
165 {
166 	aliasskintype_t		type;
167 } daliasskintype_t;
168 
169 #endif	/* __GENMODEL_H */
170 
171