GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gvld.c
Go to the documentation of this file.
1 
19 #include <math.h>
20 
21 #include <grass/gis.h>
22 #include <grass/gstypes.h>
23 
24 #include "mc33_table.h"
25 
26 /* usefull macros */
27 #define READ() gvl_read_char(pos[i]++, gvl->isosurf[i]->data)
28 
37 int gvld_vol(geovol *gvl)
38 {
39  G_debug(5, "gvld_vol(): id=%d", gvl->gvol_id);
40 
41  /* SLICES */
42  /* calculate slices data, if slices changed */
43  if (0 > gvl_slices_calc(gvl))
44  return (-1);
45  /* draw slices */
46  if (0 > gvld_slices(gvl))
47  return (-1);
48 
49  /* ISOSURFACES */
50  /* calculate isosurfaces data, if isosurfaces changed */
51  if (0 > gvl_isosurf_calc(gvl))
52  return (-1);
53  /* draw isosurfaces */
54  if (0 > gvld_isosurf(gvl))
55  return (-1);
56 
57  return (1);
58 }
59 
68 int gvld_wire_vol(geovol * gvl)
69 {
70  G_debug(5, "gvld_vol(): id=%d", gvl->gvol_id);
71 
72  gvld_wind3_box(gvl);
73 
74  if (0 > gvld_wire_slices(gvl))
75  return (-1);
76 
77  if (0 > gvld_wire_isosurf(gvl))
78  return (-1);
79 
80  return (1);
81 }
82 
91 int gvld_isosurf(geovol * gvl)
92 {
93  float tx, ty, tz;
94  int cols, rows, depths;
95  int x, y, z, i, iv;
96  float xc, yc, zc;
97  float xres, yres, zres;
98  unsigned r, g, b;
99 
100  int j, p, num, c_ndx, crnt_ev;
101  float n[3], pt[4];
102 
103  int n_i = gvl->n_isosurfs;
104 
105  int *check_color, *check_transp, *check_material, *check_emis,
106  *check_shin;
107  float *kem, *ksh, pkem, pksh;
108  unsigned int *ktrans, *curcolor;
109  int pktransp = 0;
110 
111  int *pos, *nz, *e_dl, tmp_pos, edge_pos[13];
112 
113  GLdouble modelMatrix[16], projMatrix[16];
114  GLint viewport[4];
115  GLint window[4];
116 
117  geovol_isosurf *isosurf;
118 
119  /* Allocate memory for arrays */
120 
121  check_color = G_malloc(n_i * sizeof(int));
122  check_transp = G_malloc(n_i * sizeof(int));
123  check_material = G_malloc(n_i * sizeof(int));
124  check_emis = G_malloc(n_i * sizeof(int));
125  check_shin = G_malloc(n_i * sizeof(int));
126 
127  kem = G_malloc(n_i * sizeof(float));
128  ksh = G_malloc(n_i * sizeof(float));
129 
130  ktrans = G_malloc(n_i * sizeof(unsigned int));
131  curcolor = G_malloc(n_i * sizeof(unsigned int));
132 
133  pos = G_malloc(n_i * sizeof(int));
134  nz = G_malloc(n_i * sizeof(int));
135  e_dl = G_malloc(n_i * sizeof(int));
136 
137  G_debug(5, "gvld_isosurf():");
138  for (i = 0; i < gvl->n_isosurfs; i++) {
139  G_debug(5, " start : gvl: %s isosurf : %d\n",
140  gvl_file_get_name(gvl->hfile), i);
141  }
142 
143  /* shade */
144  gsd_shademodel(gvl->isosurf_draw_mode & DM_GOURAUD);
145 
146  /* scaling */
147  GS_get_scale(&tx, &ty, &tz, 1);
148 
149  /* set number of cols, rows, dephs */
150  cols = gvl->cols / gvl->isosurf_x_mod;
151  rows = gvl->rows / gvl->isosurf_y_mod;
152  depths = gvl->depths / gvl->isosurf_z_mod;
153 
154  /* set x,y,z resolution */
155  xres =
156  /*((float) gvl->cols) / ((float) cols) */ gvl->isosurf_x_mod *
157  gvl->xres;
158  yres =
159  /*((float) gvl->rows) / ((float) rows) */ gvl->isosurf_y_mod *
160  gvl->yres;
161  zres =
162  /*((float) gvl->depths) / ((float) depths) */ gvl->isosurf_z_mod *
163  gvl->zres;
164 
165  /* get viewport */
166  gsd_getwindow(window, viewport, modelMatrix, projMatrix);
167 
168  /* adjust window */
169  window[0] += (int)(yres * 2);
170  window[1] -= (int)(yres * 2);
171  window[2] -= (int)(xres * 2);
172  window[3] += (int)(xres * 2);
173 
174  gsd_colormode(CM_DIFFUSE);
175  gsd_pushmatrix();
176  gsd_do_scale(1);
177  gsd_translate(gvl->x_trans, gvl->y_trans, gvl->z_trans);
178 
179  pkem = 1.0;
180  pksh = 1.0;
181 
182  /* set default attribute values for isosurfaces */
183  for (i = 0; i < gvl->n_isosurfs; i++) {
184  isosurf = gvl->isosurf[i];
185 
186  /* init isosurf one cube edge datalength */
187  e_dl[i] = 4;
188 
189  /* transparency */
190  check_transp[i] = 0;
191  ktrans[i] = (255 << 24);
192  if (CONST_ATT == isosurf->att[ATT_TRANSP].att_src &&
193  isosurf->att[ATT_TRANSP].constant != 0.0) {
194  ktrans[i] = (255 - (int)isosurf->att[ATT_TRANSP].constant) << 24;
195  }
196  else if (MAP_ATT == isosurf->att[ATT_TRANSP].att_src) {
197  check_transp[i] = 1;
198  e_dl[i]++;
199  }
200 
201  /* emis */
202  check_emis[i] = 0;
203  kem[i] = 0.0;
204  if (CONST_ATT == isosurf->att[ATT_EMIT].att_src) {
205  kem[i] = isosurf->att[ATT_EMIT].constant / 255.;
206  }
207  else if (MAP_ATT == isosurf->att[ATT_EMIT].att_src) {
208  check_emis[i] = 1;
209  e_dl[i]++;
210  }
211 
212  /* shin */
213  check_shin[i] = 0;
214  ksh[i] = 0.0;
215  if (CONST_ATT == isosurf->att[ATT_SHINE].att_src) {
216  ksh[i] = isosurf->att[ATT_SHINE].constant / 255.;
217  }
218  else if (MAP_ATT == isosurf->att[ATT_SHINE].att_src) {
219  check_shin[i] = 1;
220  e_dl[i]++;
221  }
222 
223  /* color */
224  check_color[i] = 0;
225  curcolor[i] = 0.0;
226  if (CONST_ATT == isosurf->att[ATT_COLOR].att_src) {
227  curcolor[i] = (int)isosurf->att[ATT_COLOR].constant;
228  }
229  else if (MAP_ATT == isosurf->att[ATT_COLOR].att_src) {
230  check_color[i] = 1;
231  e_dl[i] += 3;
232  }
233 
234  /* check material */
235  check_material[i] = (check_shin[i] || check_emis[i] ||
236  (kem[i] && check_color[i]));
237 
238  /* set position in data */
239  pos[i] = 0;
240  nz[i] = 0;
241  }
242 
243  G_debug(5, " intialize OK");
244 
245  for (z = 0; z < depths - 1; z++) {
246  zc = z * zres;
247 
248  if (GS_check_cancel()) {
249  for (i = 0; i < gvl->n_isosurfs; i++) {
250  G_debug(5, " break : isosurf : %d datalength : %d B\n",
251  i, pos[i]);
252  }
253 
254  gsd_set_material(1, 1, 0., 0., 0x0);
255  gsd_popmatrix();
256  gsd_blend(0);
257  gsd_zwritemask(0xffffffff);
258 
259  return (-1);
260  }
261 
262  for (y = 0; y < rows - 1; y++) {
263  yc = ((rows - 1) * yres) - (y * yres);
264 
265  for (x = 0; x < cols - 1; x++) {
266  xc = x * xres;
267 
268  for (i = 0; i < gvl->n_isosurfs; i++) {
269 
270  /* read cube index */
271  if (nz[i] != 0) {
272  nz[i]--;
273  continue;
274  }
275  else {
276  c_ndx = READ();
277  if (c_ndx == 0) {
278  nz[i] = READ() - 1;
279  continue;
280  }
281  else {
282  c_ndx = (c_ndx - 1) * 256 + READ();
283  }
284  }
285 
286  /* save position */
287  tmp_pos = pos[i];
288 
289  /* set position for each cube edge data */
290  iv = 0;
291  for (j = 0; j < cell_table[c_ndx].nedges; j++) {
292  if (cell_table[c_ndx].edges[j] == 12)
293  iv = 1;
294 
295  edge_pos[cell_table[c_ndx].edges[j]] =
296  pos[i] + j * e_dl[i];
297  }
298 
299  /* enable/disable blending and depth buffer writing */
300  if (check_transp[i] || (ktrans[i] >> 24) < 255) {
301  if (!pktransp) {
302  gsd_blend(1);
303  gsd_zwritemask(0);
304  }
305  }
306  else if (pktransp) {
307  gsd_blend(0);
308  gsd_zwritemask(0xffffffff);
309  pktransp = 0;
310  }
311 
312  /* draw cube polygons */
313  for (p = 0, num = 0; num < cell_table[c_ndx].npolys;
314  num++) {
315  gsd_bgnpolygon();
316 
317  for (j = 0; j < 3; j++) {
318  crnt_ev = cell_table[c_ndx].polys[p];
319  /* set position in data to current edge data */
320  pos[i] = edge_pos[crnt_ev];
321 
322  /* triagle vertex */
323  if (crnt_ev == 12) {
324  pt[X] = xc + (READ() / 255. * xres);
325  pt[Y] = yc + (-(READ() / 255. * yres));
326  pt[Z] = zc + (READ() / 255. * zres);
327  }
328  else {
329  pt[edge_vert_pos[crnt_ev][0]] = READ() / 255.;
330  pt[edge_vert_pos[crnt_ev][1]] =
331  edge_vert_pos[crnt_ev][2];
332  pt[edge_vert_pos[crnt_ev][3]] =
333  edge_vert_pos[crnt_ev][4];
334 
335  pt[X] = xc + (pt[X] * xres);
336  pt[Y] = yc + (-(pt[Y] * yres));
337  pt[Z] = zc + (pt[Z] * zres);
338  }
339 
340  n[X] = (READ() / 127. - 1.) / xres;
341  n[Y] = (-(READ() / 127. - 1.)) / yres;
342  n[Z] = (READ() / 127. - 1.) / zres;
343 
344  if (gvl->isosurf[i]->inout_mode) {
345  n[X] *= -1;
346  n[Y] *= -1;
347  n[Z] *= -1;
348  }
349 
350  if (check_color[i]) {
351  r = READ();
352  g = READ();
353  b = READ();
354  curcolor[i] =
355  (r & 0xff) | ((g & 0xff) << 8) |
356  ((b & 0xff) << 16);
357  }
358 
359  if (check_transp[i])
360  ktrans[i] = READ() << 24;;
361 
362  if (check_shin[i])
363  ksh[i] = ((float)READ()) / 255.;
364 
365  if (check_emis[i])
366  kem[i] = ((float)READ()) / 255.;
367 
368  if (pksh != ksh[i] || pkem != kem[i] ||
369  (kem[i] && check_color[i])) {
370  pksh = ksh[i];
371  pkem = kem[i];
372  gsd_set_material(1, 1, ksh[i], kem[i],
373  curcolor[i]);
374  }
375 
376  gsd_litvert_func(n, ktrans[i] | curcolor[i], pt);
377  p++;
378  }
379 
380  gsd_endpolygon();
381  }
382 
383  /* set position to next cube */
384  pos[i] =
385  tmp_pos + cell_table[c_ndx].nedges * e_dl[i] +
386  (iv ? 2 : 0);
387  }
388 
389  }
390 
391  }
392 
393  }
394 
395  for (i = 0; i < gvl->n_isosurfs; i++) {
396  G_debug(5, " end : isosurf : %d datalength : %d B\n", i, pos[i]);
397  }
398 
399  gsd_set_material(1, 1, 0., 0., 0x0);
400  gsd_popmatrix();
401  gsd_blend(0);
402  gsd_zwritemask(0xffffffff);
403 
404  return (0);
405 }
406 
414 int gvld_wire_isosurf(geovol * gvl)
415 {
416  return (0);
417 }
418 
419 /************************************************************************/
420 /* SLICES */
421 
422 /************************************************************************/
423 
424 #define DISTANCE_2(x1, y1, x2, y2) sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
425 
433 int gvld_slices(geovol * gvl)
434 {
435  float tx, ty, tz;
436  int i;
437 
438  GLdouble modelMatrix[16], projMatrix[16];
439  GLint viewport[4];
440  GLint window[4];
441 
442  G_debug(5, "gvld_slices");
443 
444  /* shade */
445  gsd_shademodel(gvl->slice_draw_mode & DM_GOURAUD);
446 
447  /* scaling */
448  GS_get_scale(&tx, &ty, &tz, 1);
449 
450  /* get viewport */
451  gsd_getwindow(window, viewport, modelMatrix, projMatrix);
452 
453  gsd_colormode(CM_COLOR);
454  gsd_pushmatrix();
455  gsd_do_scale(1);
456  gsd_translate(gvl->x_trans, gvl->y_trans, gvl->z_trans);
457 
458  for (i = 0; i < gvl->n_slices; i++) {
459  gsd_blend(0);
460  gsd_zwritemask(0xffffffff);
461 
462  if (gvl->slice[i]->transp == 0)
463  gvld_slice(gvl, i);
464  }
465 
466  for (i = 0; i < gvl->n_slices; i++) {
467  gsd_blend(1);
468  gsd_zwritemask(0x0);
469 
470  if (gvl->slice[i]->transp > 0)
471  gvld_slice(gvl, i);
472  }
473 
474  gsd_set_material(1, 1, 0., 0., 0x0);
475  gsd_popmatrix();
476  gsd_blend(0);
477  gsd_zwritemask(0xffffffff);
478 
479  return (0);
480 }
481 
490 int gvld_slice(geovol * gvl, int ndx)
491 {
492  geovol_slice *slice;
493 
494  int color, offset, transp;
495  float n[3], pt[4];
496  float x, nextx, y, nexty, z, stepx, stepy, stepz;
497  int cols, rows, c, r;
498  float f_cols, f_rows, distxy, distz, modx, mody, modz, modxy;
499  int ptX, ptY, ptZ;
500  double resx, resy, resz;
501 
502  /* current slice */
503  slice = gvl->slice[ndx];
504 
505  /* distance between slice def. pts */
506  distxy = DISTANCE_2(slice->x2, slice->y2, slice->x1, slice->y1);
507  distz = fabsf(slice->z2 - slice->z1);
508 
509  /* distance between slice def pts is zero - zero slice */
510  if (distxy == 0. || distz == 0.) {
511  return (1);
512  }
513 
514  /* set slice mod, resolution and set correct coords */
515  if (slice->dir == X) {
516  modx = gvl->slice_y_mod;
517  mody = gvl->slice_z_mod;
518  modz = gvl->slice_x_mod;
519  resx = gvl->yres;
520  resy = gvl->zres;
521  resz = gvl->xres;
522  ptX = Y;
523  ptY = Z;
524  ptZ = X;
525  }
526  else if (slice->dir == Y) {
527  modx = gvl->slice_x_mod;
528  mody = gvl->slice_z_mod;
529  modz = gvl->slice_y_mod;
530  resx = gvl->xres;
531  resy = gvl->zres;
532  resz = gvl->yres;
533  ptX = X;
534  ptY = Z;
535  ptZ = Y;
536  }
537  else {
538  modx = gvl->slice_x_mod;
539  mody = gvl->slice_y_mod;
540  modz = gvl->slice_z_mod;
541  resx = gvl->xres;
542  resy = gvl->yres;
543  resz = gvl->zres;
544  ptX = X;
545  ptY = Y;
546  ptZ = Z;
547  }
548 
549  /* x,y mod */
550  modxy =
551  DISTANCE_2((slice->x2 - slice->x1) / distxy * modx,
552  (slice->y2 - slice->y1) / distxy * mody, 0., 0.);
553 
554  /* cols/rows of slice */
555  f_cols = distxy / modxy;
556  cols = f_cols > (int)f_cols ? (int)f_cols + 1 : (int)f_cols;
557 
558  f_rows = distz / modz;
559  rows = f_rows > (int)f_rows ? (int)f_rows + 1 : (int)f_rows;
560 
561  /* step in x,y for each row of slice */
562  stepx = (slice->x2 - slice->x1) / f_cols;
563  stepy = (slice->y2 - slice->y1) / f_cols;
564  stepz = (slice->z2 - slice->z1) / f_rows;
565 
566  /* set x,y intially to first slice pt */
567  x = (slice->x1);
568  y = (slice->y1);
569 
570  /* set next draw pt */
571  if (f_cols < 1.) {
572  nextx = x + stepx * f_cols;
573  nexty = y + stepy * f_cols;
574  }
575  else {
576  nextx = x + stepx;
577  nexty = y + stepy;
578  }
579 
580  /* set transparency */
581  if (slice->transp > 0) {
582  transp = (255 - slice->transp) << 24;
583  }
584  else {
585  transp = 0x0;
586  }
587 
588  /* loop in slice cols */
589  for (c = 0; c < cols; c++) {
590 
591  /* set z to slice z1 pt */
592  z = slice->z1;
593 
594  /* begin draw one row - triangle strip */
595  gsd_bgntmesh();
596 
597  /* loop in slice rows */
598  for (r = 0; r < rows + 1; r++) {
599  /* offset to data - 1. column */
600  offset = (c + 1) * (rows + 1) * 3 + r * 3;
601 
602  /* get color from slice data */
603  color = (slice->data[offset] & 0xff) |
604  ((slice->data[offset + 1] & 0xff) << 8) |
605  ((slice->data[offset + 2] & 0xff) << 16);
606 
607  /* triagle vertices */
608  pt[ptX] = nextx * resx;
609  pt[ptY] = nexty * resy;
610  pt[ptZ] = z * resz;
611 
612  pt[Y] = (gvl->rows - 1) * gvl->yres - pt[Y];
613  gsd_litvert_func(n, (unsigned int)transp | color, pt);
614 
615  /* offset to data - 2. column */
616  offset = c * (rows + 1) * 3 + r * 3;
617 
618  /* get color from slice data */
619  color = (slice->data[offset] & 0xff) |
620  ((slice->data[offset + 1] & 0xff) << 8) |
621  ((slice->data[offset + 2] & 0xff) << 16);
622 
623  /* set triangle vertices */
624  pt[ptX] = x * resx;
625  pt[ptY] = y * resy;
626  pt[ptZ] = z * resz;
627 
628  pt[Y] = (gvl->rows - 1) * gvl->yres - pt[Y];
629  gsd_litvert_func(n, (unsigned int)transp | color, pt);
630 
631  if (r + 1 > f_rows) {
632  z += stepz * (f_rows - (float)r);
633  }
634  else {
635  z += stepz;
636  }
637  }
638 
639  gsd_endtmesh();
640 
641  /* step */
642  if (c + 2 > f_cols) {
643  x += stepx;
644  nextx += stepx * (f_cols - (float)(c + 1));
645  y += stepy;
646  nexty += stepy * (f_cols - (float)(c + 1));
647  }
648  else {
649  x += stepx;
650  nextx += stepx;
651  y += stepy;
652  nexty += stepy;
653  }
654  }
655 
656  gsd_blend(0);
657  gsd_zwritemask(0xffffffff);
658 
659  return (1);
660 }
661 
669 int gvld_wire_slices(geovol * gvl)
670 {
671  float pt[3];
672  int i;
673  int ptX, ptY, ptZ;
674  double resx, resy, resz;
675 
676  geovol_slice *slice;
677 
678  G_debug(5, "gvld_wire_slices");
679 
680  gsd_pushmatrix();
681 
682  /* shading */
683  gsd_shademodel(DM_FLAT);
684  /* set color mode */
685  gsd_colormode(CM_COLOR);
686  /* do scale and set volume position */
687  gsd_do_scale(1);
688  gsd_translate(gvl->x_trans, gvl->y_trans, gvl->z_trans);
689 
690  /* set color and line width */
691  gsd_color_func(0x0);
692  gsd_linewidth(1);
693 
694  /* loop in slices */
695  for (i = 0; i < gvl->n_slices; i++) {
696  slice = gvl->slice[i];
697 
698  /* intialize correct coords */
699  if (slice->dir == X) {
700  resx = gvl->yres;
701  resy = gvl->zres;
702  resz = gvl->xres;
703  ptX = Y;
704  ptY = Z;
705  ptZ = X;
706  }
707  else if (slice->dir == Y) {
708  resx = gvl->xres;
709  resy = gvl->zres;
710  resz = gvl->yres;
711  ptX = X;
712  ptY = Z;
713  ptZ = Y;
714  }
715  else {
716  resx = gvl->xres;
717  resy = gvl->yres;
718  resz = gvl->zres;
719  ptX = X;
720  ptY = Y;
721  ptZ = Z;
722  }
723 
724  gsd_bgnline();
725 
726  /* first slice edge */
727  pt[ptX] = slice->x1 * resx;
728  pt[ptY] = slice->y1 * resy;
729  pt[ptZ] = slice->z1 * resz;;
730  pt[Y] = (gvl->rows - 1) * gvl->yres - pt[Y];
731  gsd_vert_func(pt);
732 
733  pt[ptX] = slice->x1 * resx;
734  pt[ptY] = slice->y1 * resy;
735  pt[ptZ] = slice->z2 * resz;;
736  pt[Y] = (gvl->rows - 1) * gvl->yres - pt[Y];
737  gsd_vert_func(pt);
738 
739  pt[ptX] = slice->x2 * resx;
740  pt[ptY] = slice->y2 * resy;
741  pt[ptZ] = slice->z2 * resz;;
742  pt[Y] = (gvl->rows - 1) * gvl->yres - pt[Y];
743  gsd_vert_func(pt);
744 
745  pt[ptX] = slice->x2 * resx;
746  pt[ptY] = slice->y2 * resy;
747  pt[ptZ] = slice->z1 * resz;;
748  pt[Y] = (gvl->rows - 1) * gvl->yres - pt[Y];
749  gsd_vert_func(pt);
750 
751  pt[ptX] = slice->x1 * resx;
752  pt[ptY] = slice->y1 * resy;
753  pt[ptZ] = slice->z1 * resz;;
754  pt[Y] = (gvl->rows - 1) * gvl->yres - pt[Y];
755  gsd_vert_func(pt);
756 
757  gsd_endline();
758  }
759 
760  gsd_set_material(1, 1, 0., 0., 0x0);
761  gsd_popmatrix();
762 
763  return (0);
764 }
765 
773 int gvld_wind3_box(geovol * gvl)
774 {
775  float pt[3];
776 
777  G_debug(5, "gvld_wind3_box(): id=%d", gvl->gvol_id);
778 
779  gsd_pushmatrix();
780 
781  /* shading */
782  gsd_shademodel(DM_FLAT);
783  /* set color mode */
784  gsd_colormode(CM_COLOR);
785  /* do scale and set volume position */
786  gsd_do_scale(1);
787  gsd_translate(gvl->x_trans, gvl->y_trans, gvl->z_trans);
788 
789  /* set color and line width */
790  gsd_color_func(0x0);
791  gsd_linewidth(1);
792 
793  /* draw box */
794 
795  /* front edges */
796  gsd_bgnline();
797  pt[X] = 0;
798  pt[Y] = 0;
799  pt[Z] = 0;
800  gsd_vert_func(pt);
801  pt[X] = (gvl->cols - 1) * gvl->xres;
802  pt[Y] = 0;
803  pt[Z] = 0;
804  gsd_vert_func(pt);
805  pt[X] = (gvl->cols - 1) * gvl->xres;
806  pt[Y] = (gvl->rows - 1) * gvl->yres;
807  pt[Z] = 0;
808  gsd_vert_func(pt);
809  pt[X] = 0;
810  pt[Y] = (gvl->rows - 1) * gvl->yres;
811  pt[Z] = 0;
812  gsd_vert_func(pt);
813  pt[X] = 0;
814  pt[Y] = 0;
815  pt[Z] = 0;
816  gsd_vert_func(pt);
817  gsd_endline();
818 
819  /* back edges */
820  gsd_bgnline();
821  pt[X] = 0;
822  pt[Y] = 0;
823  pt[Z] = (gvl->depths - 1) * gvl->zres;
824  gsd_vert_func(pt);
825  pt[X] = (gvl->cols - 1) * gvl->xres;
826  pt[Y] = 0;
827  pt[Z] = (gvl->depths - 1) * gvl->zres;
828  gsd_vert_func(pt);
829  pt[X] = (gvl->cols - 1) * gvl->xres;
830  pt[Y] = (gvl->rows - 1) * gvl->yres;
831  pt[Z] = (gvl->depths - 1) * gvl->zres;
832  gsd_vert_func(pt);
833  pt[X] = 0;
834  pt[Y] = (gvl->rows - 1) * gvl->yres;
835  pt[Z] = (gvl->depths - 1) * gvl->zres;
836  gsd_vert_func(pt);
837  pt[X] = 0;
838  pt[Y] = 0;
839  pt[Z] = (gvl->depths - 1) * gvl->zres;
840  gsd_vert_func(pt);
841  gsd_endline();
842 
843  /* others edges */
844  gsd_bgnline();
845  pt[X] = 0;
846  pt[Y] = 0;
847  pt[Z] = 0;
848  gsd_vert_func(pt);
849  pt[X] = 0;
850  pt[Y] = 0;
851  pt[Z] = (gvl->depths - 1) * gvl->zres;
852  gsd_vert_func(pt);
853  gsd_endline();
854 
855  gsd_bgnline();
856  pt[X] = (gvl->cols - 1) * gvl->xres;
857  pt[Y] = 0;
858  pt[Z] = 0;
859  gsd_vert_func(pt);
860  pt[X] = (gvl->cols - 1) * gvl->xres;
861  pt[Y] = 0;
862  pt[Z] = (gvl->depths - 1) * gvl->zres;
863  gsd_vert_func(pt);
864  gsd_endline();
865 
866  gsd_bgnline();
867  pt[X] = 0;
868  pt[Y] = (gvl->rows - 1) * gvl->yres;
869  pt[Z] = 0;
870  gsd_vert_func(pt);
871  pt[X] = 0;
872  pt[Y] = (gvl->rows - 1) * gvl->yres;
873  pt[Z] = (gvl->depths - 1) * gvl->zres;
874  gsd_vert_func(pt);
875  gsd_endline();
876 
877  gsd_bgnline();
878  pt[X] = (gvl->cols - 1) * gvl->xres;
879  pt[Y] = (gvl->rows - 1) * gvl->yres;
880  pt[Z] = 0;
881  gsd_vert_func(pt);
882  pt[X] = (gvl->cols - 1) * gvl->xres;
883  pt[Y] = (gvl->rows - 1) * gvl->yres;
884  pt[Z] = (gvl->depths - 1) * gvl->zres;
885  gsd_vert_func(pt);
886  gsd_endline();
887 
888  gsd_popmatrix();
889 
890  return (0);
891 }
void gsd_zwritemask(unsigned long n)
Write out z-mask.
Definition: gsd_prim.c:231
#define DISTANCE_2(x1, y1, x2, y2)
Definition: gvld.c:424
float b
Definition: named_colr.c:8
void gsd_bgntmesh(void)
ADD.
Definition: gsd_prim.c:287
void gsd_do_scale(int doexag)
Set current scale.
Definition: gsd_views.c:355
float r
Definition: named_colr.c:8
void gsd_bgnpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
Definition: gsd_prim.c:362
void gsd_set_material(int set_shin, int set_emis, float sh, float em, int emcolor)
Set material.
Definition: gsd_prim.c:794
int polys[30]
Definition: viz.h:78
long num
Definition: g3dcats.c:93
#define Y(x)
Definition: display/draw.c:246
tuple pos
Definition: tools.py:1367
void gsd_colormode(int cm)
Set color mode.
Definition: gsd_prim.c:88
int GS_check_cancel(void)
Check for cancel.
Definition: GSX.c:31
#define X(y)
Definition: display/draw.c:248
char * gvl_file_get_name(int id)
Get file name for given handle.
Definition: gvl_file.c:166
void gsd_color_func(unsigned int col)
Set current color.
Definition: gsd_prim.c:689
int npolys
Definition: viz.h:77
int y
Definition: plot.c:34
void gsd_endtmesh(void)
ADD.
Definition: gsd_prim.c:297
void gsd_translate(float dx, float dy, float dz)
Multiply the current matrix by a translation matrix.
Definition: gsd_prim.c:526
int gvld_isosurf(geovol *gvl)
Draw volume isosurfaces.
Definition: gvld.c:91
void gsd_litvert_func(float *norm, unsigned long col, float *pt)
Set the current normal vector &amp; specify vertex.
Definition: gsd_prim.c:648
void gsd_shademodel(int bool)
Set shaded model.
Definition: gsd_prim.c:409
int gvl_isosurf_calc(geovol *gvol)
Fill data structure with computed isosurfaces polygons.
Definition: gvl_calc.c:584
int gvld_slice(geovol *gvl, int ndx)
Draw slice.
Definition: gvld.c:490
void gsd_pushmatrix(void)
Push the current matrix stack.
Definition: gsd_prim.c:498
int edges[12]
Definition: viz.h:76
void gsd_endline(void)
End line.
Definition: gsd_prim.c:397
int gvld_wire_slices(geovol *gvl)
Draw wire slices.
Definition: gvld.c:669
tuple color
Definition: tools.py:1703
int nedges
Definition: viz.h:75
tuple window
Definition: tools.py:543
void gsd_getwindow(int *window, int *viewport, double *modelMatrix, double *projMatrix)
Get viewport.
Definition: gsd_prim.c:541
float g
Definition: named_colr.c:8
int
Definition: g3dcolor.c:48
int gvld_wire_vol(geovol *gvl)
Draw volume in wire mode (bounding box)
Definition: gvld.c:68
void gsd_blend(int yesno)
Specify pixel arithmetic.
Definition: gsd_prim.c:974
void gsd_vert_func(float *pt)
ADD.
Definition: gsd_prim.c:677
CELL_ENTRY cell_table[256]
void gsd_endpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
Definition: gsd_prim.c:377
int gvld_slices(geovol *gvl)
Draw slices.
Definition: gvld.c:433
tuple cols
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition: gis/debug.c:51
int gvld_wind3_box(geovol *gvl)
Draw volume bounding box.
Definition: gvld.c:773
void gsd_linewidth(short n)
Set width of rasterized lines.
Definition: gsd_prim.c:257
int gvld_vol(geovol *gvl)
Draw volume set (slices and isosurfaces)
Definition: gvld.c:37
void gsd_popmatrix(void)
Pop the current matrix stack.
Definition: gsd_prim.c:488
#define READ()
Definition: gvld.c:27
void gsd_bgnline(void)
Begin line.
Definition: gsd_prim.c:387
int n
Definition: dataquad.c:291
int gvl_slices_calc(geovol *gvol)
Calculate slices for given volume set.
Definition: gvl_calc.c:1027
int gvld_wire_isosurf(geovol *gvl)
Draw volume isosurface in draw mode.
Definition: gvld.c:414
void GS_get_scale(float *sx, float *sy, float *sz, int doexag)
Get axis scale.
Definition: GS2.c:3238