author | Don Pellegrino <don@drexel.edu> | 2009-06-29 17:17:36 (GMT) |
---|---|---|
committer | Don Pellegrino <don@drexel.edu> | 2009-06-29 17:17:36 (GMT) |
commit | e4d02addde594ced73be73a127f006317c37c9e3 (patch) (unidiff) | |
tree | d5e051c885016e25296e0cc2c38f98c136244d98 | |
parent | c107ae238c1dd98e8723ef96d6a56788f7aebfa0 (diff) | |
download | exp005-e4d02addde594ced73be73a127f006317c37c9e3.zip exp005-e4d02addde594ced73be73a127f006317c37c9e3.tar.gz exp005-e4d02addde594ced73be73a127f006317c37c9e3.tar.bz2 |
Removed exp004base.c since it is an output from the DB2 precompiler from exp004base.sqc.
-rw-r--r-- | src/model/exp004base.c | 359 |
1 files changed, 0 insertions, 359 deletions
diff --git a/src/model/exp004base.c b/src/model/exp004base.c deleted file mode 100644 index fb07b2c..0000000 --- a/src/model/exp004base.c +++ b/dev/null | |||
@@ -1,359 +0,0 @@ | |||
1 | static char sqla_program_id[292] = | ||
2 | { | ||
3 | 172,0,65,69,65,77,65,73,77,65,105,103,79,83,71,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,69,88,80,48,48,52,66,65,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 | |||
22 | static struct sqla_runtime_info sqla_rtinfo = | ||
23 | {{'S','Q','L','A','R','T','I','N'}, sizeof(wchar_t), 0, {' ',' ',' ',' '}}; | ||
24 | |||
25 | |||
26 | static const short sqlIsLiteral = SQL_IS_LITERAL; | ||
27 | static const short sqlIsInputHvar = SQL_IS_INPUT_HVAR; | ||
28 | |||
29 | |||
30 | #line 1 "exp004base.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 "exp004base.h" | ||
36 | #include "../view/exp004state0.h" | ||
37 | #include "../util/check_error.h" | ||
38 | #include <GL/glut.h> | ||
39 | #include <stdio.h> | ||
40 | #include <string.h> | ||
41 | #include "sqlca.h" | ||
42 | extern struct sqlca sqlca; | ||
43 | |||
44 | /* | ||
45 | * A simple alias to make the code more readable. | ||
46 | */ | ||
47 | #define S exp004state0 | ||
48 | |||
49 | void | ||
50 | exp004base (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 | /* | ||
63 | EXEC SQL BEGIN DECLARE SECTION; | ||
64 | */ | ||
65 | |||
66 | #line 31 "exp004base.sqc" | ||
67 | |||
68 | |||
69 | /* | ||
70 | EXEC SQL INCLUDE 'model/coordinates.h'; | ||
71 | */ | ||
72 | |||
73 | #line 1 "/home/don/projects/Research/Experiments/exp005/src/model/coordinates.h" | ||
74 | struct | ||
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 | |||
87 | #line 32 "exp004base.sqc" | ||
88 | |||
89 | |||
90 | /* | ||
91 | EXEC SQL END DECLARE SECTION; | ||
92 | */ | ||
93 | |||
94 | #line 33 "exp004base.sqc" | ||
95 | |||
96 | |||
97 | |||
98 | /* | ||
99 | EXEC SQL DECLARE c2 CURSOR FOR | ||
100 | SELECT * FROM coordinates; | ||
101 | */ | ||
102 | |||
103 | #line 36 "exp004base.sqc" | ||
104 | |||
105 | |||
106 | |||
107 | /* | ||
108 | EXEC SQL OPEN c2; | ||
109 | */ | ||
110 | |||
111 | { | ||
112 | #line 38 "exp004base.sqc" | ||
113 | sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); | ||
114 | #line 38 "exp004base.sqc" | ||
115 | sqlacall((unsigned short)26,1,0,0,0L); | ||
116 | #line 38 "exp004base.sqc" | ||
117 | sqlastop(0L); | ||
118 | } | ||
119 | |||
120 | #line 38 "exp004base.sqc" | ||
121 | |||
122 | |||
123 | /* | ||
124 | * Initialize the bounding box of the points. | ||
125 | */ | ||
126 | S.bb.min_x = 0.0; | ||
127 | S.bb.max_x = 0.0; | ||
128 | S.bb.min_y = 0.0; | ||
129 | S.bb.max_y = 0.0; | ||
130 | |||
131 | |||
132 | /* | ||
133 | EXEC SQL FETCH c2 INTO :coordinates; | ||
134 | */ | ||
135 | |||
136 | { | ||
137 | #line 48 "exp004base.sqc" | ||
138 | sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); | ||
139 | #line 48 "exp004base.sqc" | ||
140 | sqlaaloc(3,4,1,0L); | ||
141 | { | ||
142 | struct sqla_setdata_list sql_setdlist[4]; | ||
143 | #line 48 "exp004base.sqc" | ||
144 | sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4; | ||
145 | #line 48 "exp004base.sqc" | ||
146 | sql_setdlist[0].sqldata = (void*)&coordinates.coord_id; | ||
147 | #line 48 "exp004base.sqc" | ||
148 | sql_setdlist[0].sqlind = 0L; | ||
149 | #line 48 "exp004base.sqc" | ||
150 | sql_setdlist[1].sqltype = 448; sql_setdlist[1].sqllen = 50; | ||
151 | #line 48 "exp004base.sqc" | ||
152 | sql_setdlist[1].sqldata = (void*)&coordinates.gi; | ||
153 | #line 48 "exp004base.sqc" | ||
154 | sql_setdlist[1].sqlind = 0L; | ||
155 | #line 48 "exp004base.sqc" | ||
156 | sql_setdlist[2].sqltype = 480; sql_setdlist[2].sqllen = 8; | ||
157 | #line 48 "exp004base.sqc" | ||
158 | sql_setdlist[2].sqldata = (void*)&coordinates.x; | ||
159 | #line 48 "exp004base.sqc" | ||
160 | sql_setdlist[2].sqlind = 0L; | ||
161 | #line 48 "exp004base.sqc" | ||
162 | sql_setdlist[3].sqltype = 480; sql_setdlist[3].sqllen = 8; | ||
163 | #line 48 "exp004base.sqc" | ||
164 | sql_setdlist[3].sqldata = (void*)&coordinates.y; | ||
165 | #line 48 "exp004base.sqc" | ||
166 | sql_setdlist[3].sqlind = 0L; | ||
167 | #line 48 "exp004base.sqc" | ||
168 | sqlasetdata(3,0,4,sql_setdlist,0L,0L); | ||
169 | } | ||
170 | #line 48 "exp004base.sqc" | ||
171 | sqlacall((unsigned short)25,1,0,3,0L); | ||
172 | #line 48 "exp004base.sqc" | ||
173 | sqlastop(0L); | ||
174 | } | ||
175 | |||
176 | #line 48 "exp004base.sqc" | ||
177 | |||
178 | while (sqlca.sqlcode != 100) | ||
179 | { | ||
180 | int i = coordinates.coord_id - 1; | ||
181 | |||
182 | strncpy(S.gi_data[i], | ||
183 | coordinates.gi.data, | ||
184 | sizeof (S.gi_data[i])); | ||
185 | |||
186 | S.base_vertices_data[i][0] = coordinates.x; | ||
187 | S.base_vertices_data[i][1] = coordinates.y; | ||
188 | |||
189 | if (S.base_vertices_data[i][0] < S.bb.min_x) | ||
190 | S.bb.min_x = S.base_vertices_data[i][0]; | ||
191 | if (S.base_vertices_data[i][0] > S.bb.max_x) | ||
192 | S.bb.max_x = S.base_vertices_data[i][0]; | ||
193 | if (S.base_vertices_data[i][1] < S.bb.min_y) | ||
194 | S.bb.min_y = S.base_vertices_data[i][1]; | ||
195 | if (S.base_vertices_data[i][1] > S.bb.max_y) | ||
196 | S.bb.max_y = S.base_vertices_data[i][1]; | ||
197 | |||
198 | /* | ||
199 | * Deselected by default. | ||
200 | */ | ||
201 | S.selection.set[i] = false; | ||
202 | |||
203 | S.base_colors_data[i][0] = DEFAULT_COLOR_R; | ||
204 | S.base_colors_data[i][1] = DEFAULT_COLOR_G; | ||
205 | S.base_colors_data[i][2] = DEFAULT_COLOR_B; | ||
206 | S.base_colors_data[i][3] = DEFAULT_COLOR_A; | ||
207 | |||
208 | |||
209 | /* | ||
210 | EXEC SQL FETCH c2 INTO :coordinates; | ||
211 | */ | ||
212 | |||
213 | { | ||
214 | #line 79 "exp004base.sqc" | ||
215 | sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); | ||
216 | #line 79 "exp004base.sqc" | ||
217 | sqlaaloc(3,4,2,0L); | ||
218 | { | ||
219 | struct sqla_setdata_list sql_setdlist[4]; | ||
220 | #line 79 "exp004base.sqc" | ||
221 | sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4; | ||
222 | #line 79 "exp004base.sqc" | ||
223 | sql_setdlist[0].sqldata = (void*)&coordinates.coord_id; | ||
224 | #line 79 "exp004base.sqc" | ||
225 | sql_setdlist[0].sqlind = 0L; | ||
226 | #line 79 "exp004base.sqc" | ||
227 | sql_setdlist[1].sqltype = 448; sql_setdlist[1].sqllen = 50; | ||
228 | #line 79 "exp004base.sqc" | ||
229 | sql_setdlist[1].sqldata = (void*)&coordinates.gi; | ||
230 | #line 79 "exp004base.sqc" | ||
231 | sql_setdlist[1].sqlind = 0L; | ||
232 | #line 79 "exp004base.sqc" | ||
233 | sql_setdlist[2].sqltype = 480; sql_setdlist[2].sqllen = 8; | ||
234 | #line 79 "exp004base.sqc" | ||
235 | sql_setdlist[2].sqldata = (void*)&coordinates.x; | ||
236 | #line 79 "exp004base.sqc" | ||
237 | sql_setdlist[2].sqlind = 0L; | ||
238 | #line 79 "exp004base.sqc" | ||
239 | sql_setdlist[3].sqltype = 480; sql_setdlist[3].sqllen = 8; | ||
240 | #line 79 "exp004base.sqc" | ||
241 | sql_setdlist[3].sqldata = (void*)&coordinates.y; | ||
242 | #line 79 "exp004base.sqc" | ||
243 | sql_setdlist[3].sqlind = 0L; | ||
244 | #line 79 "exp004base.sqc" | ||
245 | sqlasetdata(3,0,4,sql_setdlist,0L,0L); | ||
246 | } | ||
247 | #line 79 "exp004base.sqc" | ||
248 | sqlacall((unsigned short)25,1,0,3,0L); | ||
249 | #line 79 "exp004base.sqc" | ||
250 | sqlastop(0L); | ||
251 | } | ||
252 | |||
253 | #line 79 "exp004base.sqc" | ||
254 | |||
255 | } | ||
256 | |||
257 | |||
258 | /* | ||
259 | EXEC SQL CLOSE c2; | ||
260 | */ | ||
261 | |||
262 | { | ||
263 | #line 82 "exp004base.sqc" | ||
264 | sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); | ||
265 | #line 82 "exp004base.sqc" | ||
266 | sqlacall((unsigned short)20,1,0,0,0L); | ||
267 | #line 82 "exp004base.sqc" | ||
268 | sqlastop(0L); | ||
269 | } | ||
270 | |||
271 | #line 82 "exp004base.sqc" | ||
272 | |||
273 | |||
274 | |||
275 | /* | ||
276 | EXEC SQL COMMIT; | ||
277 | */ | ||
278 | |||
279 | { | ||
280 | #line 84 "exp004base.sqc" | ||
281 | sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); | ||
282 | #line 84 "exp004base.sqc" | ||
283 | sqlacall((unsigned short)21,0,0,0,0L); | ||
284 | #line 84 "exp004base.sqc" | ||
285 | sqlastop(0L); | ||
286 | } | ||
287 | |||
288 | #line 84 "exp004base.sqc" | ||
289 | |||
290 | |||
291 | /* | ||
292 | * Find the largest axis and use it to setup the projection. This | ||
293 | * is done to preserve the aspect ratio. The aspect ratio should be | ||
294 | * preserved since relative distance is a meaningful indicator in | ||
295 | * the map. | ||
296 | */ | ||
297 | |||
298 | // Min of min x or min y. | ||
299 | if (S.bb.min_x <= S.bb.min_y) | ||
300 | S.ortho_min = S.bb.min_x; | ||
301 | else | ||
302 | S.ortho_min = S.bb.min_y; | ||
303 | S.ortho_min--; | ||
304 | |||
305 | // Max of max x or max y. | ||
306 | if (S.bb.max_x >= S.bb.max_y) | ||
307 | S.ortho_max = S.bb.max_x; | ||
308 | else | ||
309 | S.ortho_max = S.bb.max_y; | ||
310 | S.ortho_max++; | ||
311 | |||
312 | // Invert the y coordinate to match up with the LGL Java viewer. | ||
313 | for (int i = 0; i < ROWS; i++) | ||
314 | S.base_vertices_data[i][1] = | ||
315 | S.ortho_max - S.base_vertices_data[i][1]; | ||
316 | |||
317 | // Move the origin (0,0) to the center of the data. | ||
318 | S.ortho_min = 0.0; | ||
319 | S.ortho_max = 0.0; | ||
320 | |||
321 | for (int i = 0; i < ROWS; i++) | ||
322 | { | ||
323 | S.base_vertices_data[i][0] = | ||
324 | S.base_vertices_data[i][0] - | ||
325 | (0.5 * (S.bb.max_x - S.bb.min_x)); | ||
326 | |||
327 | if (S.ortho_min > S.base_vertices_data[i][0]) | ||
328 | S.ortho_min = S.base_vertices_data[i][0]; | ||
329 | |||
330 | if (S.ortho_max < S.base_vertices_data[i][0]) | ||
331 | S.ortho_max = S.base_vertices_data[i][0]; | ||
332 | |||
333 | S.base_vertices_data[i][1] = | ||
334 | S.base_vertices_data[i][1] - | ||
335 | (0.5 * (S.bb.max_y - S.bb.min_y)); | ||
336 | |||
337 | if (S.ortho_min > S.base_vertices_data[i][1]) | ||
338 | S.ortho_min = S.base_vertices_data[i][1]; | ||
339 | |||
340 | if (S.ortho_max < S.base_vertices_data[i][1]) | ||
341 | S.ortho_max = S.base_vertices_data[i][1]; | ||
342 | } | ||
343 | |||
344 | glGenBuffers (2, S.buffers); | ||
345 | |||
346 | glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_VERTICES]); | ||
347 | glVertexPointer (2, GL_FLOAT, 0, 0); | ||
348 | glBufferData (GL_ARRAY_BUFFER, | ||
349 | sizeof (S.base_vertices_data), S.base_vertices_data, | ||
350 | GL_STATIC_DRAW); | ||
351 | |||
352 | glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]); | ||
353 | glColorPointer (4, GL_FLOAT, 0, 0); | ||
354 | glBufferData (GL_ARRAY_BUFFER, | ||
355 | sizeof (S.base_colors_data), S.base_colors_data, | ||
356 | GL_STATIC_DRAW); | ||
357 | |||
358 | return; | ||
359 | } | ||