Debian Codegraph @

lib/polymodel_external.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * 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, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/lib/polymodel_external.h $
21 * $Revision: 7 $
22 * $Date: 10/02/01 8:56a $
23 * $Author: Matt $
24 *
25 * Polymodel defines, flags and structs (anything that could be exported to a DLL)
26 *
27 * $Log: /DescentIII/Main/lib/polymodel_external.h $
28 *
29 * 7 10/02/01 8:56a Matt
30 * Increased MAX_POLY_MODELS from 1000 to 1200
31 *
32 * 6 7/08/99 5:47p Jason
33 * changes for new bumpmapping system in 1.1 update patch
34 *
35 * 5 6/08/99 1:00p Jason
36 * changes for bumpmapping
37 *
38 * 4 4/20/99 1:02p 3dsmax
39 * fixed polymodel loimt
40 *
41 * 3 4/08/99 11:45a Jason
42 * greatly sped up the time it takes to get model anges/positions by
43 * precalculation
44 *
45 * 2 1/21/99 11:15p Jeff
46 * pulled out some structs and defines from header files and moved them
47 * into seperate header files so that multiplayer dlls don't require major
48 * game headers, just those new headers. Side effect is a shorter build
49 * time. Also cleaned up some header file #includes that weren't needed.
50 * This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
51 * manage.h and multi.h
52 *
53 * $NoKeywords: $
54 */
55
56 #ifndef POLYMODEL_EXTERNAL_H_
57 #define POLYMODEL_EXTERNAL_H_
58
59 #include <cstdint>
60
61 #include "grdefs.h"
62 #include "manage_external.h"
63 #include "robotfirestruct.h"
64 #include "vecmat_external.h"
65
66 #define MAX_POLY_MODELS 1200
67
68 #define MAX_MODEL_TEXTURES 35
69 #define MAX_POLYGON_VECS 2500
70 #define MAX_DETAIL_LEVELS 3
71 #define MAX_PROP_LEN 256
72 #define MAX_NAME_LEN 32
73
74 #define MAX_GROUND_PLANES_PER_MODEL 10
75 #define MAX_GUNS_PER_MODEL 64
76 #define MAX_SUBOBJECTS 30
77 #define MAX_POINTS_PER_SUBOBJECT 300
78
79 // Subobject flags
80 #define SOF_ROTATE 0x01 // This subobject is a rotator
81 #define SOF_TURRET 0x02 // This subobject is a turret that tracks
82 #define SOF_SHELL 0x04 // This subobject is a door housing
83 #define SOF_FRONTFACE 0x08 // This subobject contains the front face for the door
84 #define SOF_MONITOR1 0x010 // This subobject contains it's first monitor
85 #define SOF_MONITOR2 0x020 // This subobject contains it's second monitor
86 #define SOF_MONITOR3 0x040 // This subobject contains it's third monitor
87 #define SOF_MONITOR4 0x080 // This subobject contains it's fourth monitor
88 #define SOF_MONITOR5 0x0100
89 #define SOF_MONITOR6 0x0200
90 #define SOF_MONITOR7 0x0400
91 #define SOF_MONITOR8 0x0800
92 #define SOF_FACING 0x01000 // This subobject always faces you
93 #define SOF_VIEWER 0x02000 // This subobject is marked as a 'viewer'.
94 #define SOF_LAYER 0x04000 // This subobject is marked as part of possible secondary model rendering.
95 #define SOF_WB 0x08000 // This subobject is part of a weapon battery
96 #define SOF_GLOW 0x0200000 // This subobject glows
97 #define SOF_CUSTOM 0x0400000 // This subobject has textures/colors that are customizable
98 #define SOF_THRUSTER 0x0800000 // This is a thruster subobject
99 #define SOF_JITTER 0x01000000 // This object jitters by itself
100 #define SOF_HEADLIGHT 0x02000000 // This suboject is a headlight
101
102 // gun bank
103 struct w_bank {
104 int parent;
105 vector pnt;
106 vector norm;
107 };
108
109 // attach bank
110 struct a_bank {
111 int parent;
112 vector pnt;
113 vector norm;
114 vector uvec;
115 bool f_uvec;
116 };
117
118 struct lightmap_object_face {
119 uint8_t num_verts;
120 uint16_t lmi_handle;
121 vector rvec, uvec;
122 float *u2, *v2;
123 };
124
125 struct lightmap_object {
126 uint8_t num_models;
127
128 int16_t num_faces[MAX_SUBOBJECTS];
129 lightmap_object_face *lightmap_faces[MAX_SUBOBJECTS];
130 uint8_t used;
131
132 };
133
134 struct polyface {
135 int8_t nverts;
136 int16_t *vertnums;
137 float *u;
138 float *v;
139
140 // float *u2,*v2; // For lightmaps only
141
142 ddgr_color color;
143 int16_t texnum;
144
145 vector normal;
146 };
147
148 // glow info
149 struct glowinfo {
150 float glow_r, glow_g, glow_b, glow_size, glow_length;
151 vector center, normal;
152 };
153
154 // bsp information
155 struct bsp_info {
156 char name[PAGENAME_LEN]; // name of the subsystem. Probably displayed on HUD
157 int movement_type; //-1 if no movement, otherwise rotational or positional movement -- subobjects only
158 int movement_axis; // which axis this subobject moves or rotates on.
159 int tree_offset; // offset of tree data (children included) into the model_data
160 int data_offset; // offset of data into the model_data
161 vector offset; // 3d offset from parent object
162 vector norm; // norm for sep plane
163 float d; // norm d for sep plane
164 vector pnt; // point for sep plane
165 vector geometric_center; // geometric center of this subobject. In the same Frame Of
166 // Reference as all other vertices in this submodel. (Relative to pivot point)
167 float rad; // radius for each submodel
168
169 vector *verts; // vertices for the submodel (NEWSTYLE)
170 vector *vertnorms;
171 float *alpha;
172 polyface *faces; // faces for the submodel (NEWSTYLE)
173 vector *face_min;
174 vector *face_max;
175
176 int16_t *vertnum_memory;
177 float *u_memory;
178 float *v_memory;
179
180 int nverts;
181 int num_faces; // amount of faces (NEWSTYLE);
182
183 int8_t children[MAX_SUBOBJECTS]; // children of this submodel
184 int parent; // what is parent for each submodel
185 uint8_t num_children;
186
187 vector min;
188 vector max;
189 int blown_off; // If set, this subobject is blown off. Stuffed by model_set_instance
190
191 angvec angs;
192 matrix mod_matrix; // The angles from parent. Stuffed by model_set_instance
193 vector mod_pos; // The modified position of this object. Used for positional interpolation
194
195 vector *keyframe_axis; // the axis of rotation for each keyframe
196 int *keyframe_angles; // The destination angles for each key frame
197 vector *keyframe_pos;
198 matrix *keyframe_matrix; // the combined rotation matrices up to frame n
199 uint16_t *tick_pos_remap; // For looking up keyframes fast
200 uint16_t *tick_ang_remap; // For looking up keyframes fast
201 int *rot_start_time;
202 int *pos_start_time;
203
204 int num_key_angles;
205 int num_key_pos;
206
207 int flags; // see SOF_FLAGS above
208
209 int rot_track_min, rot_track_max;
210 int pos_track_min, pos_track_max;
211
212 float rps; // if SOF_ROTATE or SOF_TURRET is set, this is the rotations per second
213 float fov; // Half the normalized angle that this turret is allowed to turn (amount in each direction)
214 float think_interval; // How quickly a turret updates which way it should move
215
216 float normalized_angle;
217
218 glowinfo *glow_info;
219 };
220
221 #define PMF_LIGHTMAP_RES 1
222 #define PMF_TIMED 2 // Uses new timed animation
223 #define PMF_ALPHA 4 // Has alpha per vertex qualities
224 #define PMF_FACING 8 // Has a submodel that is always facing
225 #define PMF_NOT_RESIDENT 16 // This polymodel is not in memory
226 #define PMF_SIZE_COMPUTED 32 // This polymodel's size is computed
227
228 // used to describe a polygon model
229 struct poly_model {
230 uint16_t used;
231
232 int flags; // PMF_flags, see above
233 uint8_t new_style; // if 1, then this polymodel is in the new outrage format (oof)
234 int id; // what the polygon model number is. (Index in Poly_models)
235 int version;
236 char name[PAGENAME_LEN];
237
238 int n_models;
239 int model_data_size;
240 uint8_t *model_data;
241
242 vector mins, maxs; // min,max for whole model
243 vector view_pos; // viewing position. Default to {0,0,0}.
244
245 float wall_size;
246 vector wall_size_offset;
247
248 float anim_size;
249 vector anim_size_offset;
250
251 float rad;
252 int n_textures;
253 int16_t textures[MAX_MODEL_TEXTURES]; // a list of bitmap indices
254
255 bsp_info *submodel; // an array of size n_models of submodel info.
256 int num_key_angles;
257 int num_key_pos;
258 int max_keys; // the greater number of num_key_pos or num_key_angles
259
260 int frame_min, frame_max; // For TIMED polymodels, the min/max frames
261
262 int n_guns;
263 w_bank *gun_slots; // array of gun banks
264
265 int n_ground;
266 w_bank *ground_slots; // array of ground planes
267
268 int n_attach;
269 a_bank *attach_slots;
270
271 int num_wbs;
272 poly_wb_info *poly_wb; // array of weapon batteries
273
274 int *render_order; // internal use
275
276 };
277
278 // Which kind of lighting model for this polymodel
279 enum polymodel_light_type {
280 POLYMODEL_LIGHTING_STATIC,
281 POLYMODEL_LIGHTING_GOURAUD,
282 POLYMODEL_LIGHTING_LIGHTMAP,
283 };
284
285 // polymodel effects stuff
286 // Effect flags:
287 #define PEF_ALPHA 1
288 #define PEF_DEFORM 2
289 #define PEF_COLOR 4
290 #define PEF_MED_RES 8
291 #define PEF_LO_RES 16
292 #define PEF_FOG 32
293 #define PEF_CUSTOM_COLOR 64
294 #define PEF_CUSTOM_TEXTURE 128
295 #define PEF_FOGGED_MODEL 256
296 #define PEF_SPECULAR_MODEL 512
297 #define PEF_SPECULAR_FACES 1024
298 #define PEF_GLOW_SCALAR 2048
299 #define PEF_THRUSTER_SCALAR 4096
300 #define PEF_DRAW_HEADLIGHTS 8192
301 #define PEF_NO_GLOWS (8192 << 1)
302 #define PEF_CUSTOM_GLOW (8192 << 2)
303 #define PEF_BUMPMAPPED (8192 << 3)
304
305 struct polymodel_effect {
306 int type;
307 float alpha;
308 float deform_range;
309 float r, g, b;
310 float fog_r, fog_g, fog_b;
311 int custom_texture;
312 int custom_color;
313
314 float spec_r, spec_g, spec_b;
315 vector spec_light_pos;
316 float spec_scalar;
317
318 vector bump_light_pos;
319 float bump_scalar;
320
321 float fog_depth;
322 float fog_eye_distance;
323 float fog_distance;
324 vector fog_plane, fog_portal_vert;
325 int fog_plane_check;
326
327 float glow_length_scalar;
328 float glow_size_scalar;
329
330 float glow_r, glow_g, glow_b;
331
332 };
333
334 #endif