-rw-r--r-- | src/controller/clear_selection.h | 6 | ||||
-rw-r--r-- | src/controller/clear_selection.sqc | 45 | ||||
-rw-r--r-- | src/controller/keyboard.c | 28 | ||||
-rw-r--r-- | src/controller/keyboard.h | 6 | ||||
-rw-r--r-- | src/controller/selection_from_db.h | 9 | ||||
-rw-r--r-- | src/controller/selection_from_db.sqc | 21 | ||||
-rw-r--r-- | src/controller/selection_to_db.h | 9 | ||||
-rw-r--r-- | src/controller/selection_to_db.sqc | 38 | ||||
-rw-r--r-- | src/model/exp004base.sqc | 144 | ||||
-rw-r--r-- | src/util/pick_convert.c | 50 | ||||
-rw-r--r-- | src/util/pick_convert.h | 29 |
11 files changed, 385 insertions, 0 deletions
diff --git a/src/controller/clear_selection.sqc b/src/controller/clear_selection.sqc new file mode 100644 index 0000000..cf04681 --- a/dev/null +++ b/src/controller/clear_selection.sqc | |||
@@ -0,0 +1,45 @@ | |||
1 | /* I seem to need this for glGenBuffers as per | ||
2 | http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */ | ||
3 | #define GL_GLEXT_PROTOTYPES | ||
4 | |||
5 | #include "clear_selection.h" | ||
6 | #include "../view/exp004state0.h" | ||
7 | #include <GL/glut.h> | ||
8 | |||
9 | EXEC SQL INCLUDE sqlca; | ||
10 | |||
11 | /* | ||
12 | * A simple alias to make the code more readable. | ||
13 | */ | ||
14 | #define S exp004state0 | ||
15 | |||
16 | void | ||
17 | clear_selection (void) | ||
18 | { | ||
19 | /* | ||
20 | * WHERE gi IS NOT NULL is added to prevent the PRECOMPILE command | ||
21 | * from throwing a warning about modifying an entire table. Since | ||
22 | * gi is defined as NOT NULL this will clear the entire table. | ||
23 | */ | ||
24 | EXEC SQL DELETE FROM vis_selection WHERE gi IS NOT NULL; | ||
25 | |||
26 | EXEC SQL COMMIT; | ||
27 | |||
28 | for (unsigned int i = 0; i < ROWS; i++) | ||
29 | { | ||
30 | S.selection[i] = false; | ||
31 | S.base_colors_data[i][0] = DEFAULT_COLOR_R; | ||
32 | S.base_colors_data[i][1] = DEFAULT_COLOR_G; | ||
33 | S.base_colors_data[i][2] = DEFAULT_COLOR_B; | ||
34 | } | ||
35 | |||
36 | glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]); | ||
37 | glColorPointer (3, GL_FLOAT, 0, 0); | ||
38 | glBufferData (GL_ARRAY_BUFFER, | ||
39 | sizeof (S.base_colors_data), S.base_colors_data, | ||
40 | GL_STATIC_DRAW); | ||
41 | |||
42 | glutPostRedisplay (); | ||
43 | |||
44 | return; | ||
45 | } | ||