summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@coffee.donpellegrino.com>2009-08-17 18:01:28 (GMT)
committer Don Pellegrino <don@coffee.donpellegrino.com>2009-08-17 18:01:28 (GMT)
commita27f8789e66518fe772083cc4687a408e8e3c2f6 (patch) (unidiff)
tree479872cfa467577f06214e48acf4c67e118853bc
parente415bcfa0167c72529af8f80f25e6dfcd6ecfca0 (diff)
downloadexp005-a27f8789e66518fe772083cc4687a408e8e3c2f6.zip
exp005-a27f8789e66518fe772083cc4687a408e8e3c2f6.tar.gz
exp005-a27f8789e66518fe772083cc4687a408e8e3c2f6.tar.bz2
Removed the exp004 moniker from the objects. The objects now have
generic names based on their function in this program. They are not generally designed for reuse in other visualization programs which seems okay at the moment. I'll leave it up to OpenGL and the APIs to be general while these objects are specific to the task of interactive visualization of a map of influenza.
-rw-r--r--src/Makefile.am30
-rw-r--r--src/controller/actions/clear_selection.sqc4
-rw-r--r--src/controller/actions/process_hits.c4
-rw-r--r--src/controller/actions/sel_save.c6
-rw-r--r--src/controller/actions/sel_save.sqc4
-rw-r--r--src/controller/actions/selection_from_db.sqc4
-rw-r--r--src/controller/actions/set_ortho.c4
-rw-r--r--src/controller/actions/zoom.c4
-rw-r--r--src/controller/callbacks/display.c4
-rw-r--r--src/controller/callbacks/keyboard.c4
-rw-r--r--src/controller/callbacks/mouse.c8
-rw-r--r--src/controller/callbacks/reshape.c4
-rw-r--r--src/flumap.c (renamed from src/exp004viz.c)4
-rw-r--r--src/model/base.c417
-rw-r--r--src/model/base.h9
-rw-r--r--src/model/base.sqc (renamed from src/model/exp004base.sqc)8
-rw-r--r--src/model/exp004base.h9
-rw-r--r--src/model/geometry/density_legend_geometry.c4
-rw-r--r--src/model/geometry/map_geometry.c4
-rw-r--r--src/model/geometry/protein_geometry.c4
-rw-r--r--src/model/geometry/protein_selected_geometry.c4
-rw-r--r--src/model/state.h (renamed from src/model/exp004state.h)8
-rw-r--r--src/view/exp004geometry.h8
-rw-r--r--src/view/exp004init.h9
-rw-r--r--src/view/exp004state0.h8
-rw-r--r--src/view/exp004view.h6
-rw-r--r--src/view/geometry.c (renamed from src/view/exp004geometry.c)8
-rw-r--r--src/view/geometry.h8
-rw-r--r--src/view/init.c (renamed from src/view/exp004init.c)12
-rw-r--r--src/view/init.h9
-rw-r--r--src/view/state0.h8
-rw-r--r--src/view/view.c (renamed from src/view/exp004view.c)10
-rw-r--r--src/view/view.h6
33 files changed, 530 insertions, 113 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1ccb4f8..e2a3b72 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
1bin_PROGRAMS = exp004viz1bin_PROGRAMS = flumap
22
3exp004viz_SOURCES = \3flumap_SOURCES = \
4 controller/actions/clear_selection.c \4 controller/actions/clear_selection.c \
5 controller/actions/pan.c \5 controller/actions/pan.c \
6 controller/actions/process_hits.c \6 controller/actions/process_hits.c \
@@ -14,8 +14,8 @@ exp004viz_SOURCES = \
14 controller/callbacks/mouse_wheel.c \14 controller/callbacks/mouse_wheel.c \
15 controller/callbacks/reshape.c \15 controller/callbacks/reshape.c \
16 db/dbconnect.c \16 db/dbconnect.c \
17 exp004viz.c \17 flumap.c \
18 model/exp004base.c \18 model/base.c \
19 model/geometry/density_legend_geometry.c \19 model/geometry/density_legend_geometry.c \
20 model/geometry/map_geometry.c \20 model/geometry/map_geometry.c \
21 model/geometry/protein_geometry.c \21 model/geometry/protein_geometry.c \
@@ -26,11 +26,11 @@ exp004viz_SOURCES = \
26 util/check_error.c \26 util/check_error.c \
27 util/pick_convert.c \27 util/pick_convert.c \
28 util/sqlinfoprint.c \28 util/sqlinfoprint.c \
29 view/exp004geometry.c \29 view/geometry.c \
30 view/exp004init.c \30 view/init.c \
31 view/exp004view.c31 view/view.c
3232
33exp004viz_LDADD = ${GLUT_LIBS}33flumap_LDADD = ${GLUT_LIBS}
3434
35noinst_HEADERS = \35noinst_HEADERS = \
36 controller/actions/clear_selection.h \36 controller/actions/clear_selection.h \
@@ -47,8 +47,8 @@ noinst_HEADERS = \
47 controller/callbacks/mouse_wheel.h \47 controller/callbacks/mouse_wheel.h \
48 controller/callbacks/reshape.h \48 controller/callbacks/reshape.h \
49 db/dbconnect.h \49 db/dbconnect.h \
50 model/exp004base.h \50 model/base.h \
51 model/exp004state.h \51 model/state.h \
52 model/geometry/density_legend_geometry.h \52 model/geometry/density_legend_geometry.h \
53 model/geometry/map_geometry.h \53 model/geometry/map_geometry.h \
54 model/geometry/protein_geometry.h \54 model/geometry/protein_geometry.h \
@@ -62,10 +62,10 @@ noinst_HEADERS = \
62 util/check_error.h \62 util/check_error.h \
63 util/pick_convert.h \63 util/pick_convert.h \
64 util/sqlinfoprint.h \64 util/sqlinfoprint.h \
65 view/exp004geometry.h \65 view/geometry.h \
66 view/exp004init.h \66 view/init.h \
67 view/exp004state0.h \67 view/state0.h \
68 view/exp004view.h68 view/view.h
6969
70# The Linux non-free driver does not appear to include the70# The Linux non-free driver does not appear to include the
71# implementations of the AMD_performance_monitor functions.71# implementations of the AMD_performance_monitor functions.
@@ -86,4 +86,4 @@ CLEANFILES = \
86 controller/actions/selection_from_db.c \86 controller/actions/selection_from_db.c \
87 controller/actions/sel_save.c \87 controller/actions/sel_save.c \
88 db/dbconnect.c \88 db/dbconnect.c \
89 model/exp004base.c89 model/base.c
diff --git a/src/controller/actions/clear_selection.sqc b/src/controller/actions/clear_selection.sqc
index e527c30..c496546 100644
--- a/src/controller/actions/clear_selection.sqc
+++ b/src/controller/actions/clear_selection.sqc
@@ -1,7 +1,7 @@
1#define GL_GLEXT_PROTOTYPES1#define GL_GLEXT_PROTOTYPES
2#include "clear_selection.h"2#include "clear_selection.h"
3#include "../../model/geometry/map_geometry.h"3#include "../../model/geometry/map_geometry.h"
4#include "../../view/exp004state0.h"4#include "../../view/state0.h"
5#include <GL/glut.h>5#include <GL/glut.h>
6#include "sqlca.h"6#include "sqlca.h"
7extern struct sqlca sqlca;7extern struct sqlca sqlca;
@@ -9,7 +9,7 @@ extern struct sqlca sqlca;
9/*9/*
10 * A simple alias to make the code more readable.10 * A simple alias to make the code more readable.
11 */11 */
12#define S exp004state012#define S state0
1313
14void14void
15clear_selection (void)15clear_selection (void)
diff --git a/src/controller/actions/process_hits.c b/src/controller/actions/process_hits.c
index 4a76d1c..319ce6c 100644
--- a/src/controller/actions/process_hits.c
+++ b/src/controller/actions/process_hits.c
@@ -1,5 +1,5 @@
1#define GL_GLEXT_PROTOTYPES1#define GL_GLEXT_PROTOTYPES
2#include "../../view/exp004state0.h"2#include "../../view/state0.h"
3#include "../../model/geometry/map_geometry.h"3#include "../../model/geometry/map_geometry.h"
4#include "process_hits.h"4#include "process_hits.h"
5#include "sel_save.h"5#include "sel_save.h"
@@ -7,7 +7,7 @@
7/*7/*
8 * A simple alias to make the code more readable.8 * A simple alias to make the code more readable.
9 */9 */
10#define S exp004state010#define S state0
1111
12/*12/*
13 * The implementation of this function is based on13 * The implementation of this function is based on
diff --git a/src/controller/actions/sel_save.c b/src/controller/actions/sel_save.c
index 424f101..9690459 100644
--- a/src/controller/actions/sel_save.c
+++ b/src/controller/actions/sel_save.c
@@ -1,6 +1,6 @@
1static char sqla_program_id[292] = 1static char sqla_program_id[292] =
2{2{
3 172,0,65,69,65,78,65,73,108,65,118,119,77,82,73,90,48,49,49,49,3 172,0,65,69,65,78,65,73,79,66,73,55,78,82,73,90,48,49,49,49,
4 49,32,50,32,32,32,32,32,32,32,32,32,8,0,68,79,78,32,32,32,4 49,32,50,32,32,32,32,32,32,32,32,32,8,0,68,79,78,32,32,32,
5 32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
6 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -29,7 +29,7 @@ static const short sqlIsInputHvar = SQL_IS_INPUT_HVAR;
2929
30#line 1 "sel_save.sqc"30#line 1 "sel_save.sqc"
31#include "../../util/check_error.h"31#include "../../util/check_error.h"
32#include "../../view/exp004state0.h"32#include "../../view/state0.h"
33#include "sel_save.h"33#include "sel_save.h"
34#include "sqlca.h"34#include "sqlca.h"
35#include <string.h>35#include <string.h>
@@ -38,7 +38,7 @@ extern struct sqlca sqlca;
38/*38/*
39 * A simple alias to make the code more readable.39 * A simple alias to make the code more readable.
40 */40 */
41#define S exp004state041#define S state0
4242
43void43void
44sel_save (void)44sel_save (void)
diff --git a/src/controller/actions/sel_save.sqc b/src/controller/actions/sel_save.sqc
index 5fa614f..79fa3de 100644
--- a/src/controller/actions/sel_save.sqc
+++ b/src/controller/actions/sel_save.sqc
@@ -1,5 +1,5 @@
1#include "../../util/check_error.h"1#include "../../util/check_error.h"
2#include "../../view/exp004state0.h"2#include "../../view/state0.h"
3#include "sel_save.h"3#include "sel_save.h"
4#include "sqlca.h"4#include "sqlca.h"
5#include <string.h>5#include <string.h>
@@ -8,7 +8,7 @@ extern struct sqlca sqlca;
8/*8/*
9 * A simple alias to make the code more readable.9 * A simple alias to make the code more readable.
10 */10 */
11#define S exp004state011#define S state0
1212
13void13void
14sel_save (void)14sel_save (void)
diff --git a/src/controller/actions/selection_from_db.sqc b/src/controller/actions/selection_from_db.sqc
index 442f7c2..675bc2c 100644
--- a/src/controller/actions/selection_from_db.sqc
+++ b/src/controller/actions/selection_from_db.sqc
@@ -1,7 +1,7 @@
1#define GL_GLEXT_PROTOTYPES1#define GL_GLEXT_PROTOTYPES
2#include "selection_from_db.h"2#include "selection_from_db.h"
3#include "../../model/geometry/map_geometry.h"3#include "../../model/geometry/map_geometry.h"
4#include "../../view/exp004state0.h"4#include "../../view/state0.h"
5#include "../../util/check_error.h"5#include "../../util/check_error.h"
6#include <GL/glut.h>6#include <GL/glut.h>
7#include "sqlca.h"7#include "sqlca.h"
@@ -10,7 +10,7 @@ extern struct sqlca sqlca;
10/*10/*
11 * A simple alias to make the code more readable.11 * A simple alias to make the code more readable.
12 */12 */
13#define S exp004state013#define S state0
1414
15void15void
16selection_from_db (void)16selection_from_db (void)
diff --git a/src/controller/actions/set_ortho.c b/src/controller/actions/set_ortho.c
index 83b42f4..4309c76 100644
--- a/src/controller/actions/set_ortho.c
+++ b/src/controller/actions/set_ortho.c
@@ -1,8 +1,8 @@
1#include "set_ortho.h"1#include "set_ortho.h"
2#include "../../view/exp004state0.h"2#include "../../view/state0.h"
3#include <GL/glut.h>3#include <GL/glut.h>
44
5#define S exp004state05#define S state0
66
7void7void
8set_ortho (void)8set_ortho (void)
diff --git a/src/controller/actions/zoom.c b/src/controller/actions/zoom.c
index e33dcb8..d7f4140 100644
--- a/src/controller/actions/zoom.c
+++ b/src/controller/actions/zoom.c
@@ -1,14 +1,14 @@
1#include "zoom.h"1#include "zoom.h"
2#include "../callbacks/reshape.h"2#include "../callbacks/reshape.h"
3#include "../../util/check_error.h"3#include "../../util/check_error.h"
4#include "../../view/exp004state0.h"4#include "../../view/state0.h"
5#include <GL/glut.h>5#include <GL/glut.h>
6#include <math.h>6#include <math.h>
77
8/*8/*
9 * A simple alias to make the code more readable.9 * A simple alias to make the code more readable.
10 */10 */
11#define S exp004state011#define S state0
1212
13void13void
14zoom (int x1, int y1, int x2, int y2)14zoom (int x1, int y1, int x2, int y2)
diff --git a/src/controller/callbacks/display.c b/src/controller/callbacks/display.c
index 68211b5..b9a76a6 100644
--- a/src/controller/callbacks/display.c
+++ b/src/controller/callbacks/display.c
@@ -1,12 +1,12 @@
1#include "display.h"1#include "display.h"
2#include "../../view/exp004geometry.h"2#include "../../view/geometry.h"
3#include <GL/glut.h>3#include <GL/glut.h>
44
5void5void
6display (void)6display (void)
7{7{
8 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);8 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
9 exp004geometry (GL_RENDER);9 geometry (GL_RENDER);
10 glutSwapBuffers ();10 glutSwapBuffers ();
1111
12 return;12 return;
diff --git a/src/controller/callbacks/keyboard.c b/src/controller/callbacks/keyboard.c
index 1187bce..28bea81 100644
--- a/src/controller/callbacks/keyboard.c
+++ b/src/controller/callbacks/keyboard.c
@@ -2,10 +2,10 @@
2#include "../actions/clear_selection.h"2#include "../actions/clear_selection.h"
3#include "../actions/selection_from_db.h"3#include "../actions/selection_from_db.h"
4#include "reshape.h"4#include "reshape.h"
5#include "../../view/exp004state0.h"5#include "../../view/state0.h"
6#include <GL/glut.h>6#include <GL/glut.h>
77
8#define S exp004state08#define S state0
99
10void10void
11keyboard (unsigned char key, int x, int y)11keyboard (unsigned char key, int x, int y)
diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c
index fc48eff..16e8b8b 100644
--- a/src/controller/callbacks/mouse.c
+++ b/src/controller/callbacks/mouse.c
@@ -1,7 +1,7 @@
1#include "../../util/check_error.h"1#include "../../util/check_error.h"
2#include "../../util/pick_convert.h"2#include "../../util/pick_convert.h"
3#include "../../view/exp004geometry.h"3#include "../../view/geometry.h"
4#include "../../view/exp004state0.h"4#include "../../view/state0.h"
5#include "../actions/process_hits.h"5#include "../actions/process_hits.h"
6#include "../actions/set_ortho.h"6#include "../actions/set_ortho.h"
7#include "../actions/zoom.h"7#include "../actions/zoom.h"
@@ -14,7 +14,7 @@
14/*14/*
15 * A simple alias to make the code more readable.15 * A simple alias to make the code more readable.
16 */16 */
17#define S exp004state017#define S state0
1818
19void19void
20mouse (int button, int state, int x, int y)20mouse (int button, int state, int x, int y)
@@ -94,7 +94,7 @@ mouse (int button, int state, int x, int y)
94 * manipulate the name stack so that each primitive of interest94 * manipulate the name stack so that each primitive of interest
95 * has appropriate names assigned [Redbook]."95 * has appropriate names assigned [Redbook]."
96 */96 */
97 exp004geometry (GL_SELECT);97 geometry (GL_SELECT);
9898
99 glMatrixMode (GL_PROJECTION);99 glMatrixMode (GL_PROJECTION);
100 glPopMatrix ();100 glPopMatrix ();
diff --git a/src/controller/callbacks/reshape.c b/src/controller/callbacks/reshape.c
index da2e2bf..95e9329 100644
--- a/src/controller/callbacks/reshape.c
+++ b/src/controller/callbacks/reshape.c
@@ -1,10 +1,10 @@
1#include "../../model/geometry/density_legend_geometry.h"1#include "../../model/geometry/density_legend_geometry.h"
2#include "../../view/exp004state0.h"2#include "../../view/state0.h"
3#include "../actions/set_ortho.h"3#include "../actions/set_ortho.h"
4#include "reshape.h"4#include "reshape.h"
5#include <GL/glut.h>5#include <GL/glut.h>
66
7#define S exp004state07#define S state0
88
9void9void
10reshape (int w, int h)10reshape (int w, int h)
diff --git a/src/exp004viz.c b/src/flumap.c
index 08d5953..6da9c34 100644
--- a/src/exp004viz.c
+++ b/src/flumap.c
@@ -1,5 +1,5 @@
1#include <GL/glut.h>1#include <GL/glut.h>
2#include "view/exp004view.h"2#include "view/view.h"
33
4int4int
5main (int argc, char **argv)5main (int argc, char **argv)
@@ -7,7 +7,7 @@ main (int argc, char **argv)
7 glutInit (&argc, argv);7 glutInit (&argc, argv);
8 glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);8 glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
99
10 exp004view ();10 view ();
1111
12 glutMainLoop ();12 glutMainLoop ();
1313
diff --git a/src/model/base.c b/src/model/base.c
new file mode 100644
index 0000000..649fec3
--- a/dev/null
+++ b/src/model/base.c
@@ -0,0 +1,417 @@
1static char sqla_program_id[292] =
2{
3 172,0,65,69,65,78,65,73,86,65,78,55,78,82,73,90,48,49,49,49,
4 49,32,50,32,32,32,32,32,32,32,32,32,8,0,68,79,78,32,32,32,
5 32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
6 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
7 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
8 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
9 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
10 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
11 0,0,8,0,66,65,83,69,32,32,32,32,0,0,0,0,0,0,0,0,
12 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
13 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
14 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
15 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
16 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
17 0,0,0,0,0,0,0,0,0,0,0,0
18};
19
20#include "sqladef.h"
21
22static struct sqla_runtime_info sqla_rtinfo =
23{{'S','Q','L','A','R','T','I','N'}, sizeof(wchar_t), 0, {' ',' ',' ',' '}};
24
25
26static const short sqlIsLiteral = SQL_IS_LITERAL;
27static const short sqlIsInputHvar = SQL_IS_INPUT_HVAR;
28
29
30#line 1 "base.sqc"
31/* I seem to need this for glGenBuffers as per
32 http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */
33#define GL_GLEXT_PROTOTYPES
34
35#include "base.h"
36#include "../view/state0.h"
37#include "../util/check_error.h"
38#include <GL/glut.h>
39#include <string.h>
40#include <stdlib.h>
41#include "sqlca.h"
42extern struct sqlca sqlca;
43
44/*
45 * A simple alias to make the code more readable.
46 */
47#define S state0
48
49void
50base (void)
51{
52 /*
53 * This implementation can be improved by mapping the video memory
54 * directly rather than loading into system memory and then copying
55 * into video memory.
56 */
57
58 /*
59 * db2dclgn -d exp004 -t coordinates
60 */
61
62/*
63EXEC SQL BEGIN DECLARE SECTION;
64*/
65
66#line 31 "base.sqc"
67
68
69/*
70EXEC SQL INCLUDE 'model/coordinates.h';
71*/
72
73#line 1 "/home/don/projects/Research/Experiments/exp005/src/model/coordinates.h"
74struct
75{
76 sqlint32 coord_id;
77 struct
78 {
79 short length;
80 char data[50];
81 } gi;
82 double x;
83 double y;
84} coordinates;
85
86#line 32 "base.sqc"
87
88 sqlint32 rows;
89
90/*
91EXEC SQL END DECLARE SECTION;
92*/
93
94#line 34 "base.sqc"
95
96
97 /* Determine how many nodes have coordinates assigned to them. */
98
99/*
100EXEC SQL SELECT COUNT (*) INTO:rows FROM coordinates;
101*/
102
103{
104#line 37 "base.sqc"
105 sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
106#line 37 "base.sqc"
107 sqlaaloc(3,1,1,0L);
108 {
109 struct sqla_setdata_list sql_setdlist[1];
110#line 37 "base.sqc"
111 sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4;
112#line 37 "base.sqc"
113 sql_setdlist[0].sqldata = (void*)&rows;
114#line 37 "base.sqc"
115 sql_setdlist[0].sqlind = 0L;
116#line 37 "base.sqc"
117 sqlasetdata(3,0,1,sql_setdlist,0L,0L);
118 }
119#line 37 "base.sqc"
120 sqlacall((unsigned short)24,1,0,3,0L);
121#line 37 "base.sqc"
122 sqlastop(0L);
123}
124
125#line 37 "base.sqc"
126
127
128 /* Free any existing coordinates and allocate memory to store the
129 new values. */
130 S.rows = rows;
131
132 free (S.selection.set);
133 S.selection.set = calloc (rows, sizeof (bool));
134
135 free (S.gi_data);
136 S.gi_data = calloc (rows, sizeof (char) * 20);
137
138 free (S.base_vertices_data);
139 S.base_vertices_data = calloc (rows, sizeof (float) * 2);
140
141 free (S.base_colors_data);
142 S.base_colors_data = calloc (rows, sizeof (float) * 4);
143
144
145/*
146EXEC SQL DECLARE c2 CURSOR FOR SELECT *FROM coordinates;
147*/
148
149#line 55 "base.sqc"
150
151
152
153/*
154EXEC SQL OPEN c2;
155*/
156
157{
158#line 57 "base.sqc"
159 sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
160#line 57 "base.sqc"
161 sqlacall((unsigned short)26,2,0,0,0L);
162#line 57 "base.sqc"
163 sqlastop(0L);
164}
165
166#line 57 "base.sqc"
167
168
169 /*
170 * Initialize the bounding box of the points.
171 */
172 S.bb.min_x = 0.0;
173 S.bb.max_x = 0.0;
174 S.bb.min_y = 0.0;
175 S.bb.max_y = 0.0;
176
177
178/*
179EXEC SQL FETCH c2 INTO:coordinates;
180*/
181
182{
183#line 67 "base.sqc"
184 sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
185#line 67 "base.sqc"
186 sqlaaloc(3,4,2,0L);
187 {
188 struct sqla_setdata_list sql_setdlist[4];
189#line 67 "base.sqc"
190 sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4;
191#line 67 "base.sqc"
192 sql_setdlist[0].sqldata = (void*)&coordinates.coord_id;
193#line 67 "base.sqc"
194 sql_setdlist[0].sqlind = 0L;
195#line 67 "base.sqc"
196 sql_setdlist[1].sqltype = 448; sql_setdlist[1].sqllen = 50;
197#line 67 "base.sqc"
198 sql_setdlist[1].sqldata = (void*)&coordinates.gi;
199#line 67 "base.sqc"
200 sql_setdlist[1].sqlind = 0L;
201#line 67 "base.sqc"
202 sql_setdlist[2].sqltype = 480; sql_setdlist[2].sqllen = 8;
203#line 67 "base.sqc"
204 sql_setdlist[2].sqldata = (void*)&coordinates.x;
205#line 67 "base.sqc"
206 sql_setdlist[2].sqlind = 0L;
207#line 67 "base.sqc"
208 sql_setdlist[3].sqltype = 480; sql_setdlist[3].sqllen = 8;
209#line 67 "base.sqc"
210 sql_setdlist[3].sqldata = (void*)&coordinates.y;
211#line 67 "base.sqc"
212 sql_setdlist[3].sqlind = 0L;
213#line 67 "base.sqc"
214 sqlasetdata(3,0,4,sql_setdlist,0L,0L);
215 }
216#line 67 "base.sqc"
217 sqlacall((unsigned short)25,2,0,3,0L);
218#line 67 "base.sqc"
219 sqlastop(0L);
220}
221
222#line 67 "base.sqc"
223
224 while (sqlca.sqlcode != 100)
225 {
226 int i = coordinates.coord_id - 1;
227
228 strncpy (S.gi_data + i, coordinates.gi.data, sizeof (S.gi_data[i]));
229
230 float *v = S.base_vertices_data + (i * 2);
231 *v = coordinates.x;
232 v++;
233 *v = coordinates.y;
234
235 v = S.base_vertices_data + (i * 2);
236 if (*v < S.bb.min_x)
237 S.bb.min_x = *v;
238 if (*v > S.bb.max_x)
239 S.bb.max_x = *v;
240
241 v++;
242 if (*v < S.bb.min_y)
243 S.bb.min_y = *v;
244 if (*v > S.bb.max_y)
245 S.bb.max_y = *v;
246
247 /*
248 * Deselected by default.
249 */
250 S.selection.set[i] = false;
251
252 float *c = S.base_colors_data + (i * 4);
253 *c = DEFAULT_COLOR_R;
254 c++;
255 *c = DEFAULT_COLOR_G;
256 c++;
257 *c = DEFAULT_COLOR_B;
258 c++;
259 *c = DEFAULT_COLOR_A;
260
261
262/*
263EXEC SQL FETCH c2 INTO:coordinates;
264*/
265
266{
267#line 105 "base.sqc"
268 sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
269#line 105 "base.sqc"
270 sqlaaloc(3,4,3,0L);
271 {
272 struct sqla_setdata_list sql_setdlist[4];
273#line 105 "base.sqc"
274 sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4;
275#line 105 "base.sqc"
276 sql_setdlist[0].sqldata = (void*)&coordinates.coord_id;
277#line 105 "base.sqc"
278 sql_setdlist[0].sqlind = 0L;
279#line 105 "base.sqc"
280 sql_setdlist[1].sqltype = 448; sql_setdlist[1].sqllen = 50;
281#line 105 "base.sqc"
282 sql_setdlist[1].sqldata = (void*)&coordinates.gi;
283#line 105 "base.sqc"
284 sql_setdlist[1].sqlind = 0L;
285#line 105 "base.sqc"
286 sql_setdlist[2].sqltype = 480; sql_setdlist[2].sqllen = 8;
287#line 105 "base.sqc"
288 sql_setdlist[2].sqldata = (void*)&coordinates.x;
289#line 105 "base.sqc"
290 sql_setdlist[2].sqlind = 0L;
291#line 105 "base.sqc"
292 sql_setdlist[3].sqltype = 480; sql_setdlist[3].sqllen = 8;
293#line 105 "base.sqc"
294 sql_setdlist[3].sqldata = (void*)&coordinates.y;
295#line 105 "base.sqc"
296 sql_setdlist[3].sqlind = 0L;
297#line 105 "base.sqc"
298 sqlasetdata(3,0,4,sql_setdlist,0L,0L);
299 }
300#line 105 "base.sqc"
301 sqlacall((unsigned short)25,2,0,3,0L);
302#line 105 "base.sqc"
303 sqlastop(0L);
304}
305
306#line 105 "base.sqc"
307
308 }
309
310
311/*
312EXEC SQL CLOSE c2;
313*/
314
315{
316#line 108 "base.sqc"
317 sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
318#line 108 "base.sqc"
319 sqlacall((unsigned short)20,2,0,0,0L);
320#line 108 "base.sqc"
321 sqlastop(0L);
322}
323
324#line 108 "base.sqc"
325
326
327
328/*
329EXEC SQL COMMIT;
330*/
331
332{
333#line 110 "base.sqc"
334 sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
335#line 110 "base.sqc"
336 sqlacall((unsigned short)21,0,0,0,0L);
337#line 110 "base.sqc"
338 sqlastop(0L);
339}
340
341#line 110 "base.sqc"
342
343
344 /*
345 * Find the largest axis and use it to setup the projection. This
346 * is done to preserve the aspect ratio. The aspect ratio should be
347 * preserved since relative distance is a meaningful indicator in
348 * the map.
349 */
350
351 // Min of min x or min y.
352 if (S.bb.min_x <= S.bb.min_y)
353 S.ortho_min = S.bb.min_x;
354 else
355 S.ortho_min = S.bb.min_y;
356 S.ortho_min--;
357
358 // Max of max x or max y.
359 if (S.bb.max_x >= S.bb.max_y)
360 S.ortho_max = S.bb.max_x;
361 else
362 S.ortho_max = S.bb.max_y;
363 S.ortho_max++;
364
365 // Invert the y coordinate to match up with the LGL Java viewer.
366 float *v = S.base_vertices_data;
367 for (int i = 0; i < S.rows; i++)
368 {
369 v++;
370 *v = S.ortho_max - *v;
371 v++;
372 }
373
374 // Move the origin (0,0) to the center of the data.
375 S.ortho_min = 0.0;
376 S.ortho_max = 0.0;
377
378 v = S.base_vertices_data;
379 for (int i = 0; i < S.rows; i++)
380 {
381 *v = *v - (0.5 * (S.bb.max_x - S.bb.min_x));
382
383 if (S.ortho_min > *v)
384 S.ortho_min = *v;
385
386 if (S.ortho_max < *v)
387 S.ortho_max = *v;
388
389 v++;
390
391 *v = *v - (0.5 * (S.bb.max_y - S.bb.min_y));
392
393 if (S.ortho_min > *v)
394 S.ortho_min = *v;
395
396 if (S.ortho_max < *v)
397 S.ortho_max = *v;
398
399 v++;
400 }
401
402 glGenBuffers (2, S.buffers);
403
404 glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_VERTICES]);
405 glVertexPointer (2, GL_FLOAT, 0, 0);
406 glBufferData (GL_ARRAY_BUFFER,
407 sizeof (S.base_vertices_data), S.base_vertices_data,
408 GL_STATIC_DRAW);
409
410 glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]);
411 glColorPointer (4, GL_FLOAT, 0, 0);
412 glBufferData (GL_ARRAY_BUFFER,
413 sizeof (S.base_colors_data), S.base_colors_data,
414 GL_STATIC_DRAW);
415
416 return;
417}
diff --git a/src/model/base.h b/src/model/base.h
new file mode 100644
index 0000000..5b7bd0b
--- a/dev/null
+++ b/src/model/base.h
@@ -0,0 +1,9 @@
1#ifndef BASE_H
2#define BASE_H
3
4/*
5 * Build the base layer of the map.
6 */
7void base (void);
8
9#endif // BASE_H
diff --git a/src/model/exp004base.sqc b/src/model/base.sqc
index 4f3d06c..901ccd7 100644
--- a/src/model/exp004base.sqc
+++ b/src/model/base.sqc
@@ -2,8 +2,8 @@
2 http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */2 http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */
3#define GL_GLEXT_PROTOTYPES3#define GL_GLEXT_PROTOTYPES
44
5#include "exp004base.h"5#include "base.h"
6#include "../view/exp004state0.h"6#include "../view/state0.h"
7#include "../util/check_error.h"7#include "../util/check_error.h"
8#include <GL/glut.h>8#include <GL/glut.h>
9#include <string.h>9#include <string.h>
@@ -14,10 +14,10 @@ extern struct sqlca sqlca;
14/*14/*
15 * A simple alias to make the code more readable.15 * A simple alias to make the code more readable.
16 */16 */
17#define S exp004state017#define S state0
1818
19void19void
20exp004base (void)20base (void)
21{21{
22 /* 22 /*
23 * This implementation can be improved by mapping the video memory23 * This implementation can be improved by mapping the video memory
diff --git a/src/model/exp004base.h b/src/model/exp004base.h
deleted file mode 100644
index 4f8492d..0000000
--- a/src/model/exp004base.h
+++ b/dev/null
@@ -1,9 +0,0 @@
1#ifndef EXP004BASE_H
2#define EXP004BASE_H
3
4/*
5 * Build the base layer of the map.
6 */
7void exp004base (void);
8
9#endif // EXP004BASE_H
diff --git a/src/model/geometry/density_legend_geometry.c b/src/model/geometry/density_legend_geometry.c
index ed34b8d..c437517 100644
--- a/src/model/geometry/density_legend_geometry.c
+++ b/src/model/geometry/density_legend_geometry.c
@@ -1,9 +1,9 @@
1#include "../../controller/callbacks/reshape.h"1#include "../../controller/callbacks/reshape.h"
2#include "../../view/exp004state0.h"2#include "../../view/state0.h"
3#include "density_legend_geometry.h"3#include "density_legend_geometry.h"
4#include <GL/glut.h>4#include <GL/glut.h>
55
6#define S exp004state06#define S state0
77
8void8void
9density_legend_geometry (void)9density_legend_geometry (void)
diff --git a/src/model/geometry/map_geometry.c b/src/model/geometry/map_geometry.c
index 72bc747..8bc79a3 100644
--- a/src/model/geometry/map_geometry.c
+++ b/src/model/geometry/map_geometry.c
@@ -1,8 +1,8 @@
1#include "map_geometry.h"1#include "map_geometry.h"
2#include "../../view/exp004state0.h"2#include "../../view/state0.h"
3#include <GL/glut.h>3#include <GL/glut.h>
44
5#define S exp004state05#define S state0
66
7void7void
8map_geometry (void)8map_geometry (void)
diff --git a/src/model/geometry/protein_geometry.c b/src/model/geometry/protein_geometry.c
index 30a4350..f2b3e4f 100644
--- a/src/model/geometry/protein_geometry.c
+++ b/src/model/geometry/protein_geometry.c
@@ -1,8 +1,8 @@
1#include "protein_geometry.h"1#include "protein_geometry.h"
2#include "../../view/exp004state0.h"2#include "../../view/state0.h"
3#include <GL/glut.h>3#include <GL/glut.h>
44
5#define S exp004state05#define S state0
66
7void7void
8protein_geometry (void)8protein_geometry (void)
diff --git a/src/model/geometry/protein_selected_geometry.c b/src/model/geometry/protein_selected_geometry.c
index fb37085..abc1706 100644
--- a/src/model/geometry/protein_selected_geometry.c
+++ b/src/model/geometry/protein_selected_geometry.c
@@ -1,8 +1,8 @@
1#include "protein_selected_geometry.h"1#include "protein_selected_geometry.h"
2#include "../../view/exp004state0.h"2#include "../../view/state0.h"
3#include <GL/glut.h>3#include <GL/glut.h>
44
5#define S exp004state05#define S state0
66
7void7void
8protein_selected_geometry (void)8protein_selected_geometry (void)
diff --git a/src/model/exp004state.h b/src/model/state.h
index 1173f87..71185c8 100644
--- a/src/model/exp004state.h
+++ b/src/model/state.h
@@ -1,5 +1,5 @@
1#ifndef EXP004STATE_H1#ifndef STATE_H
2#define EXP004STATE_H2#define STATE_H
33
4#include "selection_info.h"4#include "selection_info.h"
5#include "zoom_info.h"5#include "zoom_info.h"
@@ -114,6 +114,6 @@ typedef struct
114 */114 */
115 bool legend;115 bool legend;
116116
117} EXP004STATE;117} STATE;
118118
119#endif // EXP004STATE_H119#endif // STATE_H
diff --git a/src/view/exp004geometry.h b/src/view/exp004geometry.h
deleted file mode 100644
index 582be48..0000000
--- a/src/view/exp004geometry.h
+++ b/dev/null
@@ -1,8 +0,0 @@
1#ifndef EXP004GEOMETRY_H
2#define EXP004GEOMETRY_H
3
4#include <GL/glut.h>
5
6void exp004geometry (GLenum mode);
7
8#endif // EXP004GEOMETRY_H
diff --git a/src/view/exp004init.h b/src/view/exp004init.h
deleted file mode 100644
index 5431c9f..0000000
--- a/src/view/exp004init.h
+++ b/dev/null
@@ -1,9 +0,0 @@
1#ifndef EXP004INIT_H
2#define EXP004INIT_H
3
4/*
5 * Initialize state variables to default values.
6 */
7void exp004init (void);
8
9#endif // EXP004INIT
diff --git a/src/view/exp004state0.h b/src/view/exp004state0.h
deleted file mode 100644
index 2b60ce9..0000000
--- a/src/view/exp004state0.h
+++ b/dev/null
@@ -1,8 +0,0 @@
1#ifndef EXP004STATE0_H
2#define EXP004STATE0_H
3
4#include "../model/exp004state.h"
5
6EXP004STATE exp004state0;
7
8#endif // EXP004STATE0_H
diff --git a/src/view/exp004view.h b/src/view/exp004view.h
deleted file mode 100644
index 0086f53..0000000
--- a/src/view/exp004view.h
+++ b/dev/null
@@ -1,6 +0,0 @@
1#ifndef EXP004VIEW_H
2#define EXP004VIEW_H
3
4void exp004view (void);
5
6#endif // EXP004VIEW_H
diff --git a/src/view/exp004geometry.c b/src/view/geometry.c
index 76f39bb..7a3ed36 100644
--- a/src/view/exp004geometry.c
+++ b/src/view/geometry.c
@@ -1,12 +1,12 @@
1#define GL_GLEXT_PROTOTYPES1#define GL_GLEXT_PROTOTYPES
2#include "exp004geometry.h"2#include "geometry.h"
3#include "exp004state0.h"3#include "state0.h"
4#include <GL/glut.h>4#include <GL/glut.h>
55
6#define S exp004state06#define S state0
77
8void8void
9exp004geometry (GLenum mode)9geometry (GLenum mode)
10{10{
11 glMatrixMode (GL_MODELVIEW);11 glMatrixMode (GL_MODELVIEW);
12 glLoadIdentity ();12 glLoadIdentity ();
diff --git a/src/view/geometry.h b/src/view/geometry.h
new file mode 100644
index 0000000..e4d0e48
--- a/dev/null
+++ b/src/view/geometry.h
@@ -0,0 +1,8 @@
1#ifndef GEOMETRY_H
2#define GEOMETRY_H
3
4#include <GL/glut.h>
5
6void geometry (GLenum mode);
7
8#endif // GEOMETRY_H
diff --git a/src/view/exp004init.c b/src/view/init.c
index af66623..e32a75e 100644
--- a/src/view/exp004init.c
+++ b/src/view/init.c
@@ -1,18 +1,18 @@
1#include "exp004init.h"1#include "init.h"
2#include "exp004state0.h"2#include "state0.h"
3#include "../model/geometry/density_legend_geometry.h"3#include "../model/geometry/density_legend_geometry.h"
4#include "../model/geometry/map_geometry.h"4#include "../model/geometry/map_geometry.h"
5#include "../model/geometry/protein_geometry.h"5#include "../model/geometry/protein_geometry.h"
6#include "../model/geometry/protein_selected_geometry.h"6#include "../model/geometry/protein_selected_geometry.h"
7#include "../model/selection_info_init.h"7#include "../model/selection_info_init.h"
8#include "../model/zoom_info_init.h"8#include "../model/zoom_info_init.h"
9#include "../model/exp004base.h"9#include "../model/base.h"
10#include <GL/glut.h>10#include <GL/glut.h>
1111
12#define S exp004state012#define S state0
1313
14void14void
15exp004init (void)15init (void)
16{16{
17 /*17 /*
18 * Initialize default values, zero memory and NULL pointers.18 * Initialize default values, zero memory and NULL pointers.
@@ -28,7 +28,7 @@ exp004init (void)
28 /*28 /*
29 * Load the data.29 * Load the data.
30 */30 */
31 exp004base ();31 base ();
3232
33 /*33 /*
34 * Create the geometry based on the data.34 * Create the geometry based on the data.
diff --git a/src/view/init.h b/src/view/init.h
new file mode 100644
index 0000000..eeacf19
--- a/dev/null
+++ b/src/view/init.h
@@ -0,0 +1,9 @@
1#ifndef INIT_H
2#define INIT_H
3
4/*
5 * Initialize state variables to default values.
6 */
7void init (void);
8
9#endif // INIT_H
diff --git a/src/view/state0.h b/src/view/state0.h
new file mode 100644
index 0000000..071e3ff
--- a/dev/null
+++ b/src/view/state0.h
@@ -0,0 +1,8 @@
1#ifndef STATE0_H
2#define STATE0_H
3
4#include "../model/state.h"
5
6STATE state0;
7
8#endif // STATE0_H
diff --git a/src/view/exp004view.c b/src/view/view.c
index b16597d..db3be6d 100644
--- a/src/view/exp004view.c
+++ b/src/view/view.c
@@ -4,15 +4,15 @@
4#include "../controller/callbacks/mouse_wheel.h"4#include "../controller/callbacks/mouse_wheel.h"
5#include "../controller/callbacks/reshape.h"5#include "../controller/callbacks/reshape.h"
6#include "../db/dbconnect.h"6#include "../db/dbconnect.h"
7#include "exp004init.h"7#include "init.h"
8#include "exp004state0.h"8#include "state0.h"
9#include "exp004view.h"9#include "view.h"
10#include <GL/freeglut.h>10#include <GL/freeglut.h>
11#include <GL/freeglut_ext.h>11#include <GL/freeglut_ext.h>
12#include <GL/glut.h>12#include <GL/glut.h>
1313
14void14void
15exp004view (void)15view (void)
16{16{
17 // Connect to the database.17 // Connect to the database.
18 dbconnect ();18 dbconnect ();
@@ -42,7 +42,7 @@ exp004view (void)
42 glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);42 glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
4343
44 // Initialize the model.44 // Initialize the model.
45 exp004init ();45 init ();
4646
47 // Callbacks47 // Callbacks
48 glutDisplayFunc (display);48 glutDisplayFunc (display);
diff --git a/src/view/view.h b/src/view/view.h
new file mode 100644
index 0000000..29161c7
--- a/dev/null
+++ b/src/view/view.h
@@ -0,0 +1,6 @@
1#ifndef VIEW_H
2#define VIEW_H
3
4void view (void);
5
6#endif // VIEW_H

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.