summaryrefslogtreecommitdiffstats
Unidiff
-rw-r--r--Makefile.am10
-rw-r--r--r/connect.R16
-rw-r--r--src/controller/exp004mouse.c51
-rw-r--r--src/controller/exp004processhits.c16
-rw-r--r--src/controller/exp004reshape.c26
-rw-r--r--src/controller/keyboard.c2
-rw-r--r--src/controller/selection_from_db.sqc9
-rw-r--r--src/controller/selsave.sqc4
-rw-r--r--src/controller/set_ortho.c11
-rw-r--r--src/controller/vis_sel_set.h3
-rw-r--r--src/model/coordinates.h3
-rw-r--r--src/model/exp004base.sqc30
-rw-r--r--src/model/exp004state.h30
-rw-r--r--src/model/selection_info.h11
-rw-r--r--src/model/selection_info_init.c2
-rw-r--r--src/model/selection_info_init.h2
-rw-r--r--src/model/selection_purposes.h22
-rw-r--r--src/model/zoom_info.h5
-rw-r--r--src/model/zoom_info_init.c2
-rw-r--r--src/model/zoom_info_init.h2
-rw-r--r--src/util/pick_convert.c7
-rw-r--r--src/util/sqlinfoprint.c2
-rw-r--r--src/util/sqlinfoprint.h7
-rw-r--r--src/view/exp004geometry.c6
-rw-r--r--src/view/exp004view.c7
25 files changed, 140 insertions, 146 deletions
diff --git a/src/controller/exp004mouse.c b/src/controller/exp004mouse.c
index fb753d6..9a556ae 100644
--- a/src/controller/exp004mouse.c
+++ b/src/controller/exp004mouse.c
@@ -37,13 +37,13 @@ exp004mouse (int button, int state, int x, int y)
37 GLdouble model[16];37 GLdouble model[16];
38 glGetDoublev (GL_MODELVIEW_MATRIX, model);38 glGetDoublev (GL_MODELVIEW_MATRIX, model);
39 GLdouble projection[16];39 GLdouble projection[16];
40 glGetDoublev (GL_PROJECTION_MATRIX, projection); 40 glGetDoublev (GL_PROJECTION_MATRIX, projection);
41 GLint viewport[4];41 GLint viewport[4];
42 glGetIntegerv (GL_VIEWPORT, viewport);42 glGetIntegerv (GL_VIEWPORT, viewport);
4343
44 check_error (__FILE__, __LINE__);44 check_error (__FILE__, __LINE__);
4545
46 GLdouble start_position[3]; 46 GLdouble start_position[3];
47 gluUnProject (S.selection.x,47 gluUnProject (S.selection.x,
48 viewport[3] - S.selection.y,48 viewport[3] - S.selection.y,
49 0,49 0,
@@ -51,8 +51,7 @@ exp004mouse (int button, int state, int x, int y)
51 projection,51 projection,
52 viewport,52 viewport,
53 &start_position[0],53 &start_position[0],
54 &start_position[1],54 &start_position[1], &start_position[2]);
55 &start_position[2]);
5655
57 check_error (__FILE__, __LINE__);56 check_error (__FILE__, __LINE__);
5857
@@ -63,12 +62,10 @@ exp004mouse (int button, int state, int x, int y)
63 model,62 model,
64 projection,63 projection,
65 viewport,64 viewport,
66 &end_position[0],65 &end_position[0], &end_position[1], &end_position[2]);
67 &end_position[1],66
68 &end_position[2]); 67 check_error (__FILE__, __LINE__);
6968
70 check_error (__FILE__, __LINE__);
71
72 S.zoom.active = true;69 S.zoom.active = true;
73 S.zoom.coords[0] = fmin (start_position[0], end_position[0]);70 S.zoom.coords[0] = fmin (start_position[0], end_position[0]);
74 S.zoom.coords[1] = fmax (start_position[0], end_position[0]);71 S.zoom.coords[1] = fmax (start_position[0], end_position[0]);
@@ -76,7 +73,7 @@ exp004mouse (int button, int state, int x, int y)
76 S.zoom.coords[3] = fmax (start_position[1], end_position[1]);73 S.zoom.coords[3] = fmax (start_position[1], end_position[1]);
7774
78 exp004reshape (S.viewport.w, S.viewport.h);75 exp004reshape (S.viewport.w, S.viewport.h);
79 76
80 glutPostRedisplay ();77 glutPostRedisplay ();
81 }78 }
8279
@@ -85,27 +82,27 @@ exp004mouse (int button, int state, int x, int y)
85 */82 */
86 if (S.selection.active && S.selection.purpose == SET)83 if (S.selection.active && S.selection.purpose == SET)
87 {84 {
88 85
89 /*86 /*
90 * "Specify the array to be used for the returned hit records87 * "Specify the array to be used for the returned hit records
91 * with glSelectBuffer () [Redbook]."88 * with glSelectBuffer () [Redbook]."
92 */89 */
93 GLuint select_buf[ROWS];90 GLuint select_buf[ROWS];
94 glSelectBuffer (ROWS, select_buf);91 glSelectBuffer (ROWS, select_buf);
95 92
96 /*93 /*
97 * "Enter selection mode by specifying GL_SELECT with94 * "Enter selection mode by specifying GL_SELECT with
98 * glRenderMode () [Redbook]."95 * glRenderMode () [Redbook]."
99 */96 */
100 glRenderMode (GL_SELECT);97 glRenderMode (GL_SELECT);
101 98
102 /*99 /*
103 * "Initialize the name stack using glInitNames () and glPush100 * "Initialize the name stack using glInitNames () and glPush
104 * Names () [Redbook]."101 * Names () [Redbook]."
105 */102 */
106 glInitNames ();103 glInitNames ();
107 glPushName (0);104 glPushName (0);
108 105
109 /*106 /*
110 * "Define the viewing volume you want to use for selection.107 * "Define the viewing volume you want to use for selection.
111 * Usually this is different from the viewing volume you108 * Usually this is different from the viewing volume you
@@ -116,10 +113,10 @@ exp004mouse (int button, int state, int x, int y)
116 glMatrixMode (GL_PROJECTION);113 glMatrixMode (GL_PROJECTION);
117 glPushMatrix ();114 glPushMatrix ();
118 glLoadIdentity ();115 glLoadIdentity ();
119 116
120 GLint viewport[4];117 GLint viewport[4];
121 glGetIntegerv (GL_VIEWPORT, viewport);118 glGetIntegerv (GL_VIEWPORT, viewport);
122 119
123 double c_x = 0.0;120 double c_x = 0.0;
124 double c_y = 0.0;121 double c_y = 0.0;
125 double w = 0.0;122 double w = 0.0;
@@ -127,37 +124,33 @@ exp004mouse (int button, int state, int x, int y)
127 pick_convert (S.selection.x, S.selection.y, x, y,124 pick_convert (S.selection.x, S.selection.y, x, y,
128 &c_x, &c_y, &w, &h);125 &c_x, &c_y, &w, &h);
129126
130 gluPickMatrix (c_x,127 gluPickMatrix (c_x, (GLdouble) viewport[3] - c_y, w, h, viewport);
131 (GLdouble)viewport[3] - c_y,
132 w,
133 h,
134 viewport);
135128
136 set_ortho ();129 set_ortho ();
137 130
138 /*131 /*
139 * "Alternately issue primitive drawing commands and commands to132 * "Alternately issue primitive drawing commands and commands to
140 * manipulate the name stack so that each primitive of interest133 * manipulate the name stack so that each primitive of interest
141 * has appropriate names assigned [Redbook]."134 * has appropriate names assigned [Redbook]."
142 */135 */
143 exp004geometry (GL_SELECT);136 exp004geometry (GL_SELECT);
144 137
145 glMatrixMode (GL_PROJECTION); 138 glMatrixMode (GL_PROJECTION);
146 glPopMatrix ();139 glPopMatrix ();
147 glutSwapBuffers ();140 glutSwapBuffers ();
148 141
149 /*142 /*
150 * "Exit selection mode and process the returned selection data143 * "Exit selection mode and process the returned selection data
151 * (the hit records) [Redbook]."144 * (the hit records) [Redbook]."
152 */145 */
153 GLint hits = glRenderMode (GL_RENDER);146 GLint hits = glRenderMode (GL_RENDER);
154 check_error (__FILE__, __LINE__);147 check_error (__FILE__, __LINE__);
155 148
156 /* "process hits from selection mode rendering [Angel,2008]." */149 /* "process hits from selection mode rendering [Angel,2008]." */
157 exp004processhits (hits, select_buf);150 exp004processhits (hits, select_buf);
158 151
159 /* "normal render [Angel,2008]." */ 152 /* "normal render [Angel,2008]." */
160 glutPostRedisplay (); 153 glutPostRedisplay ();
161 }154 }
162155
163 }156 }

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.