summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@drexel.edu>2009-06-18 21:13:44 (GMT)
committer Don Pellegrino <don@drexel.edu>2009-06-18 21:13:44 (GMT)
commitae6ce70b96395c1a73c5b1e2be498a18628c44e1 (patch) (unidiff)
treebf1e2981993412efcf23ac2ac213a0f19d36b8cc
parent4914750f48517cd076600d7e209a8da391a3be59 (diff)
downloadexp005-ae6ce70b96395c1a73c5b1e2be498a18628c44e1.zip
exp005-ae6ce70b96395c1a73c5b1e2be498a18628c44e1.tar.gz
exp005-ae6ce70b96395c1a73c5b1e2be498a18628c44e1.tar.bz2
Implemented zooming.
-rw-r--r--src/model/exp004base.sqc11
-rw-r--r--src/model/exp004state.h35
-rw-r--r--src/view/exp004init.c5
-rw-r--r--src/view/exp004view.c4
4 files changed, 18 insertions, 37 deletions
diff --git a/src/model/exp004base.sqc b/src/model/exp004base.sqc
index cbf2291..2742138 100644
--- a/src/model/exp004base.sqc
+++ b/src/model/exp004base.sqc
@@ -4,11 +4,12 @@
44
5#include "exp004base.h"5#include "exp004base.h"
6#include "../view/exp004state0.h"6#include "../view/exp004state0.h"
7#include "../util/check_error.h"
7#include <GL/glut.h>8#include <GL/glut.h>
8#include <stdio.h>9#include <stdio.h>
9#include <string.h>10#include <string.h>
1011#include "sqlca.h"
11EXEC SQL INCLUDE sqlca;12extern struct sqlca sqlca;
1213
13/*14/*
14 * A simple alias to make the code more readable.15 * A simple alias to make the code more readable.
@@ -18,8 +19,6 @@ EXEC SQL INCLUDE sqlca;
18void19void
19exp004base (void)20exp004base (void)
20{21{
21 EXEC SQL CONNECT TO exp004;
22
23 /* 22 /*
24 * This implementation can be improved by mapping the video memory23 * This implementation can be improved by mapping the video memory
25 * directly rather than loading into system memory and then copying24 * directly rather than loading into system memory and then copying
@@ -49,7 +48,7 @@ exp004base (void)
49 EXEC SQL FETCH c2 INTO :coordinates;48 EXEC SQL FETCH c2 INTO :coordinates;
50 while (sqlca.sqlcode != 100)49 while (sqlca.sqlcode != 100)
51 {50 {
52 int i = coordinates.coord_id;51 int i = coordinates.coord_id - 1;
5352
54 strncpy(S.gi_data[i], 53 strncpy(S.gi_data[i],
55 coordinates.gi.data, 54 coordinates.gi.data,
@@ -70,7 +69,7 @@ exp004base (void)
70 /*69 /*
71 * Deselected by default.70 * Deselected by default.
72 */71 */
73 S.selection[i] = false;72 S.selection.set[i] = false;
7473
75 S.base_colors_data[i][0] = DEFAULT_COLOR_R;74 S.base_colors_data[i][0] = DEFAULT_COLOR_R;
76 S.base_colors_data[i][1] = DEFAULT_COLOR_G;75 S.base_colors_data[i][1] = DEFAULT_COLOR_G;
diff --git a/src/model/exp004state.h b/src/model/exp004state.h
index e3106ec..11e9ebd 100644
--- a/src/model/exp004state.h
+++ b/src/model/exp004state.h
@@ -1,7 +1,8 @@
1#ifndef EXP004STATE_H1#ifndef EXP004STATE_H
2#define EXP004STATE_H2#define EXP004STATE_H
33
4#include <stdbool.h>4#include "selection_info.h"
5#include "zoom_info.h"
56
6/*7/*
7 * Buffer object identifiers.8 * Buffer object identifiers.
@@ -9,11 +10,6 @@
9#define BASE_VERTICES 010#define BASE_VERTICES 0
10#define BASE_COLORS 111#define BASE_COLORS 1
1112
12/*
13 * Vertices in the graph.
14 */
15#define ROWS 83905
16
17#define DEFAULT_COLOR_R 0.513#define DEFAULT_COLOR_R 0.5
18#define DEFAULT_COLOR_G 0.514#define DEFAULT_COLOR_G 0.5
19#define DEFAULT_COLOR_B 0.515#define DEFAULT_COLOR_B 0.5
@@ -88,31 +84,10 @@ typedef struct
88 */84 */
89 float base_colors_data[ROWS][4];85 float base_colors_data[ROWS][4];
9086
91 /*87 SELECTION_INFO selection;
92 * Selection list.
93 */
94 bool selection[ROWS];
95
96 /*
97 * Indicate if the user is currently defining a selection.
98 */
99 bool selecting;
100
101 /*
102 * X coordinate of mouse when selection mode initiated.
103 */
104 int select_x;
105
106 /*
107 * Y coordinate of mouse when selection mode initiated.
108 */
109 int select_y;
110
111 /*
112 * Indicate if a selection should be used for a new set or a zoom region.
113 */
114 bool zoom;
11588
89 ZOOM_INFO zoom;
90
116} EXP004STATE;91} EXP004STATE;
11792
118#endif // EXP004STATE_H93#endif // EXP004STATE_H
diff --git a/src/view/exp004init.c b/src/view/exp004init.c
index fa4b2b0..97bd779 100644
--- a/src/view/exp004init.c
+++ b/src/view/exp004init.c
@@ -1,12 +1,15 @@
1#include "exp004init.h"1#include "exp004init.h"
2#include "exp004state0.h"2#include "exp004state0.h"
3#include "../model/selection_info_init.h"
4#include "../model/zoom_info_init.h"
35
4#define S exp004state06#define S exp004state0
57
6void8void
7exp004init (void)9exp004init (void)
8{10{
9 S.zoom = false;11 selection_info_init (&S.selection);
12 zoom_info_init (&S.zoom);
1013
11 return;14 return;
12}15}
diff --git a/src/view/exp004view.c b/src/view/exp004view.c
index aa6e966..cc27a93 100644
--- a/src/view/exp004view.c
+++ b/src/view/exp004view.c
@@ -2,6 +2,7 @@
2#include "../controller/exp004mouse.h"2#include "../controller/exp004mouse.h"
3#include "../controller/exp004reshape.h"3#include "../controller/exp004reshape.h"
4#include "../controller/keyboard.h"4#include "../controller/keyboard.h"
5#include "../db/dbconnect.h"
5#include "../model/exp004base.h"6#include "../model/exp004base.h"
6#include "exp004init.h"7#include "exp004init.h"
7#include "exp004view.h"8#include "exp004view.h"
@@ -10,6 +11,9 @@
10void11void
11exp004view (void)12exp004view (void)
12{13{
14 // Connect to the database.
15 dbconnect ();
16
13 // GLUT Initialization17 // GLUT Initialization
14 glutInitWindowSize (500, 500);18 glutInitWindowSize (500, 500);
15 glutInitWindowPosition (100, 100);19 glutInitWindowPosition (100, 100);

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.