File: sardrawdefs.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 (90 lines) | stat: -rw-r--r-- 2,597 bytes parent folder | download | duplicates (6)
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
81
82
83
84
85
86
87
88
89
90
/*
	Definations for sardraw*.c Modules

	All sardraw*.c modules should #include this.
 */

#ifndef SARDRAWDEFS_H
#define SARDRAWDEFS_H

#define LOG(x)		(((x) > 0.0f) ? log(x) : 0.0f)
#define POW(x,y)	(((x) > 0.0f) ? pow(x,y) : 0.0f)
#define SQRT(x)		(((x) > 0.0f) ? sqrt(x) : 0.0f)

#define MAX(a,b)	(((a) > (b)) ? (a) : (b))
#define MIN(a,b)	(((a) < (b)) ? (a) : (b))
#define CLIP(a,l,h)	(MIN(MAX((a),(l)),(h)))
#define STRLEN(s)	(((s) != NULL) ? ((int)strlen(s)) : 0)

#define RADTODEG(r)	((r) * 180.0 / PI)
#define DEGTORAD(d)	((d) * PI / 180.0)


/* Get camera orientation back from GL (can be True or False)?
 * Note: This supposedly slows GL down dramatically if True
 */
#define GET_CAM_DIR	False

/* Turns on GL_DEPTH_TEST and sets the DepthFunc */
#define SAR_DRAW_DEPTH_TEST_ON	{			\
 state_gl_struct *state = &display->state_gl;		\
 StateGLEnable(state, GL_DEPTH_TEST);			\
 StateGLDepthFunc(state, GL_LEQUAL);			\
}
/* Turns off GL_DEPTH_TEST and sets the DepthFunc */
#define SAR_DRAW_DEPTH_TEST_OFF	{			\
 state_gl_struct *state = &display->state_gl;		\
 StateGLDisable(state, GL_DEPTH_TEST);			\
 StateGLDepthFunc(state, GL_ALWAYS);			\
}

/* Turns on GL_TEXTURE_1D and sets the TexEnv */
#define SAR_DRAW_TEXTURE_1D_ON	{			\
 state_gl_struct *state = &display->state_gl;		\
 StateGLEnable(state, GL_TEXTURE_1D);			\
 StateGLTexEnvI(					\
  state,						\
  GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE	\
 );							\
}
/* Turns off GL_TEXTURE_1D */
#define SAR_DRAW_TEXTURE_1D_OFF	{			\
 StateGLDisable(&display->state_gl, GL_TEXTURE_1D);	\
}

/* Turns on GL_TEXTURE_2D and sets the TexEnv */
#define SAR_DRAW_TEXTURE_2D_ON	{			\
 state_gl_struct *state = &display->state_gl;		\
 StateGLEnable(state, GL_TEXTURE_2D);			\
 StateGLTexEnvI(					\
  state,						\
  GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE	\
 );							\
}
/* Turns off GL_TEXTURE_2D */
#define SAR_DRAW_TEXTURE_2D_OFF	{			\
 StateGLDisable(&display->state_gl, GL_TEXTURE_2D);	\
}

/* Force disables certain GL states which might have been enabled
 * during a call to SARVisualModelCallList()
 */
#define SAR_DRAW_POST_CALLLIST_RESET_STATES	{	\
 state_gl_struct *state = &display->state_gl;		\
 StateGLEnableF(state, GL_ALPHA_TEST, GL_TRUE);		\
 StateGLDisableF(state, GL_BLEND, GL_TRUE);		\
 StateGLPointSize(state, 1.0f);				\
}


/* Sets the color mask to force FLIR color tinting */
#define SAR_DRAW_FLIR_COLOR_MASK_SET	{		\
 glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE);	\
}
#define SAR_DRAW_COLOR_MASK_UNSET	{		\
 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);	\
}



#endif	/* SARDRAWDEFS_H */