path:
root/
src/
controller/
actions/
clear_selection.sqc (
plain)
blob: c496546f85940dd19fbb8b04d7159471643e6957
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
|
#define GL_GLEXT_PROTOTYPES
#include "clear_selection.h"
#include "../../model/geometry/map_geometry.h"
#include "../../view/state0.h"
#include <GL/glut.h>
#include "sqlca.h"
extern struct sqlca sqlca;
/*
* A simple alias to make the code more readable.
*/
#define S state0
void
clear_selection (void)
{
/*
* WHERE gi IS NOT NULL is added to prevent the PRECOMPILE command
* from throwing a warning about modifying an entire table. Since
* gi is defined as NOT NULL this will clear the entire table.
*/
EXEC SQL DELETE FROM vis_selection WHERE gi IS NOT NULL;
EXEC SQL COMMIT;
for (unsigned int i = 0; i < S.rows; i++)
{
S.selection.set[i] = false;
float *c = S.base_colors_data + (i * 4);
*c = DEFAULT_COLOR_R;
c++;
*c = DEFAULT_COLOR_G;
c++;
*c = DEFAULT_COLOR_B;
c++;
*c = DEFAULT_COLOR_A;
}
glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]);
glColorPointer (4, GL_FLOAT, 0, 0);
glBufferData (GL_ARRAY_BUFFER,
sizeof (S.base_colors_data), S.base_colors_data,
GL_STATIC_DRAW);
/*
* Rebuild the display list for the map.
*/
map_geometry ();
glutPostRedisplay ();
return;
}
|