1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef __MISSIONGRID_H__
13 #define __MISSIONGRID_H__
14 
15 #include "globalincs/pstypes.h"
16 #include "physics/physics.h"
17 
18 #define	MAX_GRIDLINE_POINTS	201
19 #define	L_MAX_LINES				128
20 
21 typedef struct grid {
22 	int		nrows, ncols;
23 	vec3d	center;
24 	matrix	gmatrix;
25 	physics_info	physics;
26 	float	square_size;
27 	float	planeD;		//	D component of plane equation (A, B, C are uvec in gmatrix)
28 	vec3d	gpoints1[MAX_GRIDLINE_POINTS];  // 1 -4 are edge gridpoints for small grid.
29 	vec3d	gpoints2[MAX_GRIDLINE_POINTS];
30 	vec3d	gpoints3[MAX_GRIDLINE_POINTS];
31 	vec3d	gpoints4[MAX_GRIDLINE_POINTS];
32 	vec3d	gpoints5[MAX_GRIDLINE_POINTS];  // 5-8 are edge gridpoints for large grid.
33 	vec3d	gpoints6[MAX_GRIDLINE_POINTS];
34 	vec3d	gpoints7[MAX_GRIDLINE_POINTS];
35 	vec3d	gpoints8[MAX_GRIDLINE_POINTS];
36 } grid;
37 
38 typedef struct tline {
39 	int	istart, iend, color;
40 } tline;
41 
42 extern grid Global_grid;
43 extern grid	*The_grid;
44 extern int	double_fine_gridlines;
45 
46 void grid_read_camera_controls( control_info * ci, float frametime );
47 void maybe_create_new_grid(grid *gridp, vec3d *pos, matrix *orient, int force = 0);
48 grid *create_grid(grid *gridp, vec3d *forward, vec3d *right, vec3d *center, int nrows, int ncols, float square_size);
49 grid *create_default_grid(void);
50 void render_grid(grid *gridp);
51 void modify_grid(grid *gridp);
52 void rpd_line(vec3d *v0, vec3d *v1);
53 void grid_render_elevation_line(vec3d *pos, grid* gridp);
54 
55 #endif
56