File: v3dhf.h

package info (click to toggle)
searchandrescue 0.8.2-10
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,656 kB
  • ctags: 6,111
  • sloc: ansic: 89,072; cpp: 7,691; sh: 90; makefile: 80
file content (80 lines) | stat: -rw-r--r-- 2,052 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
			   V3D HeightField IO
 */

#ifndef V3DHF_H
#define V3DHF_H

#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


/*
 *	HF options structure:
 */
typedef struct {

#define V3D_HF_OPT_FLAG_WINDING		(1 << 0)
#define V3D_HF_OPT_FLAG_SET_NORMAL	(1 << 1)
#define V3D_HF_OPT_FLAG_SET_TEXCOORD	(1 << 2)
#define V3D_HF_OPT_FLAG_TEX_OFFSET	(1 << 3)
#define V3D_HF_OPT_FLAG_TEX_SIZE	(1 << 4)
	/* Indicates which members are set. */
	unsigned int flags;

#define V3D_HF_WIND_CW	0
#define V3D_HF_WIND_CCW	1
	/* V3D_HF_WIND_CW or V3D_HF_WIND_CCW. */
	int winding;

#define V3D_HF_SET_NORMAL_NEVER		0
#define V3D_HF_SET_NORMAL_AVERAGED	1
#define V3D_HF_SET_NORMAL_STREATCHED	2	/* For smoother shading. */
	/* One of V3D_HF_SET_NORMAL_*. */
	int set_normal;

#define V3D_HF_SET_TEXCOORD_NEVER	0
#define V3D_HF_SET_TEXCOORD_ALWAYS	1
	/* One of V3D_HF_SET_TEXCOORD_*. */
	int set_texcoord;

	/* Texture offset in meters, from upper left corner. */
	double tex_offset_x, tex_offset_y;

	/* Texture size in meters. */
	double tex_width, tex_height;

} v3d_hf_options_struct;


extern int V3DHFLoadFromFile(
	const char *path,	/* Heightfield image file. */
	double x_len, double y_len, double z_len,	/* Size in meters. */
	int *width_rtn, int *height_rtn,	/* Num grids (pixels). */
	double *x_spacing_rtn,	/* Each grid (pixel) is this many meters. */
	double *y_spacing_rtn,
	double **data_rtn,      /* Dynamically allocated z points, each of
				 * type double (can be NULL).
				 */
	void *gl_list,		/* GL list (can be NULL). */
	v3d_hf_options_struct *hfopt
);

extern double V3DHFGetHeightFromWorldPosition(
	double x, double y,     /* The world position. */
	double hf_x, double hf_y, double hf_z,  /* HF's world position. */
	double hf_heading,      /* HF's heading in radians. */
	double hf_len_x, double hf_len_y, double hf_len_z,
	int hf_widthp, int hf_heightp,  /* Size of heightfield in points. */
	double *hf_data           /* Heightfield's data. */
);


#ifdef __cplusplus
}  
#endif /* __cplusplus */

#endif	/* V3DHF_H */