GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
gsd_wire.c
Go to the documentation of this file.
1 /*!
2  \file lib/ogsf/gsd_wire.c
3 
4  \brief OGSF library -
5 
6  GRASS OpenGL gsurf OGSF Library
7 
8  (C) 1999-2008 by the GRASS Development Team
9 
10  This program is free software under the
11  GNU General Public License (>=v2).
12  Read the file COPYING that comes with GRASS
13  for details.
14 
15  \author Bill Brown USACERL (January 1993)
16  \author Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)
17  */
18 
19 #include <grass/gis.h>
20 #include <grass/ogsf.h>
21 
22 #include "gsget.h"
23 #include "rowcol.h"
24 
25 #define DO_ARROWS
26 
27 /************************************************************************/
28 /* Notes on exageration:
29  vertical exageration is of two forms:
30  1) global exageration (from geoview struct)
31  2) vertical exageration for each surface - not implemented
32  */
33 
34 /************************************************************************/
35 /* may need to add more parameters to tell it which window or off_screen
36  * pixmap to draw into. nah - just have one current (OpenGL limitation)
37  */
38 
39 /*!
40  \brief Draw surface wire
41 
42  \param surf surface (geosurf)
43 
44  \return
45  */
47 {
48  int desc, ret;
49 
50  G_debug(3, "gsd_wire_surf(): id=%d", surf->gsurf_id);
51 
52  desc = ATT_TOPO;
53 
54  switch (gs_get_att_src(surf, desc)) {
55  case NOTSET_ATT:
56  ret = (-1);
57 
58  break;
59 
60  case MAP_ATT:
61  if (surf->draw_mode & DM_GRID_WIRE)
62  ret = (gsd_wire_surf_map(surf)); /* draw mesh */
63  else
64  ret = (gsd_coarse_surf_map(surf)); /* draw coarse surf */
65 
66 #ifdef DO_ARROWS
67  /*
68  gsd_wire_arrows(surf);
69  */
70 #endif
71 
72  break;
73 
74  case CONST_ATT:
75  ret = (gsd_wire_surf_const(surf, surf->att[desc].constant));
76  break;
77 
78  case FUNC_ATT:
79  ret = (gsd_wire_surf_func(surf, surf->att[desc].user_func));
80 
81  break;
82 
83  default:
84  ret = (-1);
85 
86  break;
87  }
88 
89  return (ret);
90 }
91 
92 /*!
93  \brief ADD
94 
95  \param surf surface (geosurf)
96 
97  \return
98  */
100 {
101  int check_mask, check_color;
102  typbuff *buff, *cobuff;
103  int xmod, ymod, row, col, cnt, xcnt, ycnt, x1off;
104  long offset, y1off;
105  float pt[4], xres, yres, ymax, zexag;
106  int col_src, curcolor;
107  gsurf_att *coloratt;
108 
109  G_debug(3, "gsd_wire_surf_map");
110 
111  buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
112  cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
113 
114  gs_update_curmask(surf);
115  check_mask = surf->curmask ? 1 : 0;
116 
117  /*
118  checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
119  combine it/them with any current mask, put in typbuff:
120  if(surf->att[ATT_TOPO].constant)
121  */
122 
123  xmod = surf->x_modw;
124  ymod = surf->y_modw;
125  xres = xmod * surf->xres;
126  yres = ymod * surf->yres;
127  ymax = (surf->rows - 1) * surf->yres;
128  xcnt = 1 + (surf->cols - 1) / xmod;
129  ycnt = 1 + (surf->rows - 1) / ymod;
130 
131  gsd_pushmatrix();
132  gsd_do_scale(1);
133  gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
134 
135  zexag = surf->z_exag;
136 
138 
139  /* will need to check for color source of FUNC_ATT & NOTSET_ATT,
140  or else use more general and inefficient gets */
141 
142  check_color = (surf->wire_color == WC_COLOR_ATT);
143 
144  if (check_color) {
145  coloratt = &(surf->att[ATT_COLOR]);
146  col_src = surf->att[ATT_COLOR].att_src;
147 
148  if (col_src != MAP_ATT) {
149  if (col_src == CONST_ATT) {
150  gsd_color_func((int)surf->att[ATT_COLOR].constant);
151  }
152  else {
153  gsd_color_func(surf->wire_color);
154  }
155 
156  check_color = 0;
157  }
158  }
159  else {
160  gsd_color_func(surf->wire_color);
161  }
162 
163  /* would also be good to check if colormap == surfmap, to increase speed */
164  for (row = 0; row < ycnt; row++) {
165  pt[Y] = ymax - row * yres;
166  y1off = row * ymod * surf->cols;
167 
168  gsd_bgnline();
169  cnt = 0;
170 
171  for (col = 0; col < xcnt; col++) {
172  pt[X] = col * xres;
173  x1off = col * xmod;
174  offset = x1off + y1off;
175 
176  if (check_mask) {
177  if (BM_get(surf->curmask, col * xmod, row * ymod)) {
178  gsd_endline();
179  gsd_bgnline();
180  cnt = 0;
181  continue;
182  }
183  }
184 
185  GET_MAPATT(buff, offset, pt[Z]);
186 
187  if (check_color) {
188  curcolor = gs_mapcolor(cobuff, coloratt, offset);
189  gsd_color_func(curcolor);
190  /* could use this & skip the GET if colordata == elevdata
191  gsd_color_func(gs_fastmapcolor(cobuff, coloratt, offset,
192  (int)pt[Z]));
193  */
194  }
195 
196  pt[Z] = pt[Z] * zexag;
197 
198  gsd_vert_func(pt);
199 
200  if (cnt == 255) {
201  gsd_endline();
202  gsd_bgnline();
203  cnt = 0;
204  gsd_vert_func(pt);
205  }
206 
207  cnt++;
208  }
209 
210  gsd_endline();
211  }
212 
213  for (col = 0; col < xcnt; col++) {
214  pt[X] = col * xres;
215  x1off = col * xmod;
216 
217  gsd_bgnline();
218  cnt = 0;
219 
220  for (row = 0; row < ycnt; row++) {
221  pt[Y] = ymax - row * yres;
222  y1off = row * ymod * surf->cols;
223  offset = x1off + y1off;
224 
225  if (check_mask) {
226  if (BM_get(surf->curmask, col * xmod, row * ymod)) {
227  gsd_endline();
228  gsd_bgnline();
229  cnt = 0;
230  continue;
231  }
232  }
233 
234  GET_MAPATT(buff, offset, pt[Z]);
235 
236  if (check_color) {
237  curcolor = gs_mapcolor(cobuff, coloratt, offset);
238  gsd_color_func(curcolor);
239  /* could use this & skip the GET if colordata == elevdata
240  gsd_color_func(gs_fastmapcolor(coloratt, offset,
241  (int)pt[Z]));
242  */
243  }
244 
245  pt[Z] = pt[Z] * zexag;
246 
247  gsd_vert_func(pt);
248 
249  if (cnt == 255) {
250  gsd_endline();
251  gsd_bgnline();
252  cnt = 0;
253  gsd_vert_func(pt);
254  }
255 
256  cnt++;
257  }
258 
259  gsd_endline();
260  }
261 
262  gsd_popmatrix();
264 
265  return (1);
266 }
267 
268 /*!
269  \brief ADD
270 
271  \param surf surface (geosurf)
272  \param k
273 
274  \return
275  */
276 int gsd_wire_surf_const(geosurf *surf, float k)
277 {
278  int do_diff, check_mask, check_color;
279  int xmod, ymod, row, col, cnt, xcnt, ycnt, x1off;
280  long offset, y1off;
281  float pt[4], xres, yres, ymax, zexag;
282  int col_src;
283  gsurf_att *coloratt;
284  typbuff *cobuff;
285 
286  G_debug(3, "gsd_wire_surf_const");
287 
288  cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
289 
290  gs_update_curmask(surf);
291  check_mask = surf->curmask ? 1 : 0;
292 
293  do_diff = (NULL != gsdiff_get_SDref());
294 
295  xmod = surf->x_modw;
296  ymod = surf->y_modw;
297  xres = xmod * surf->xres;
298  yres = ymod * surf->yres;
299 
300  xcnt = 1 + (surf->cols - 1) / xmod;
301  ycnt = 1 + (surf->rows - 1) / ymod;
302  ymax = (surf->rows - 1) * surf->yres;
303 
304  gsd_pushmatrix();
305  gsd_do_scale(1);
306  gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
307 
308  zexag = surf->z_exag;
309 
311 
312  /* will need to check for color source of FUNC_ATT & NOTSET_ATT,
313  or else use more general and inefficient gets */
314 
315  check_color = (surf->wire_color == WC_COLOR_ATT);
316 
317  if (check_color) {
318  coloratt = &(surf->att[ATT_COLOR]);
319  col_src = surf->att[ATT_COLOR].att_src;
320 
321  if (col_src != MAP_ATT) {
322  if (col_src == CONST_ATT) {
323  gsd_color_func((int)surf->att[ATT_COLOR].constant);
324  }
325  else {
326  gsd_color_func(surf->wire_color);
327  }
328 
329  check_color = 0;
330  }
331  }
332  else {
333  gsd_color_func(surf->wire_color);
334  }
335 
336  pt[Z] = k * zexag;
337 
338  for (row = 0; row < ycnt; row++) {
339  pt[Y] = ymax - row * yres;
340  y1off = row * ymod * surf->cols;
341 
342  gsd_bgnline();
343  cnt = 0;
344 
345  for (col = 0; col < xcnt; col++) {
346  pt[X] = col * xres;
347  x1off = col * xmod;
348  offset = x1off + y1off;
349 
350  if (check_mask) {
351  if (BM_get(surf->curmask, col * xmod, row * ymod)) {
352  gsd_endline();
353  gsd_bgnline();
354  cnt = 0;
355  continue;
356  }
357  }
358 
359  if (check_color) {
360  gsd_color_func(gs_mapcolor(cobuff, coloratt, offset));
361  }
362 
363  if (do_diff) {
364  pt[Z] = gsdiff_do_SD(k * zexag, offset);
365  }
366 
367  gsd_vert_func(pt);
368 
369  if (cnt == 255) {
370  gsd_endline();
371  gsd_bgnline();
372  cnt = 0;
373  gsd_vert_func(pt);
374  }
375 
376  cnt++;
377  }
378 
379  gsd_endline();
380  }
381 
382  for (col = 0; col < xcnt; col++) {
383  pt[X] = col * xres;
384  x1off = col * xmod;
385 
386  gsd_bgnline();
387  cnt = 0;
388 
389  for (row = 0; row < ycnt; row++) {
390  pt[Y] = ymax - row * yres;
391  y1off = row * ymod * surf->cols;
392  offset = x1off + y1off;
393 
394  if (check_mask) {
395  if (BM_get(surf->curmask, col * xmod, row * ymod)) {
396  gsd_endline();
397  gsd_bgnline();
398  cnt = 0;
399  continue;
400  }
401  }
402 
403  if (check_color) {
404  gsd_color_func(gs_mapcolor(cobuff, coloratt, offset));
405  }
406 
407  if (do_diff) {
408  pt[Z] = gsdiff_do_SD(k * zexag, offset);
409  }
410 
411  gsd_vert_func(pt);
412 
413  if (cnt == 255) {
414  gsd_endline();
415  gsd_bgnline();
416  cnt = 0;
417  gsd_vert_func(pt);
418  }
419 
420  cnt++;
421  }
422 
423  gsd_endline();
424  }
425 
426  gsd_popmatrix();
428 
429  return (1);
430 }
431 
432 /*!
433  \brief ADD
434 
435  Not yet implemented.
436 
437  \param gs surface (geosurf) [unused]
438  \param user_func user defined function [unused]
439 
440  \return 1
441  */
442 int gsd_wire_surf_func(geosurf *gs UNUSED, int (*user_func)(void) UNUSED)
443 {
444  return (1);
445 }
446 
447 /*!
448  \brief ADD
449 
450  Need to do Zexag scale of normal for arrow direction, drawing
451  routine unexags z for arrow
452 
453  \param surf surface (geosurf)
454 
455  \return
456  */
458 {
459  typbuff *buff, *cobuff;
460  int check_mask, check_color;
461  int xmod, ymod, row, col, xcnt, ycnt;
462  long offset, y1off;
463  float tx, ty, tz, sz;
464  float n[3], pt[4], xres, yres, ymax, zexag;
465  int col_src, curcolor;
466  gsurf_att *coloratt;
467 
468  G_debug(3, "gsd_norm_arrows");
469 
470  /* avoid scaling by zero */
471  GS_get_scale(&tx, &ty, &tz, 1);
472 
473  if (tz == 0.0) {
474  return (0);
475  }
476 
477  sz = GS_global_exag();
478 
479  gs_update_curmask(surf);
480  check_mask = surf->curmask ? 1 : 0;
481 
482  /*
483  checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
484  combine it/them with any current mask, put in surf->curmask:
485  */
486 
487  check_color = 1;
488  curcolor = 0;
489  coloratt = &(surf->att[ATT_COLOR]);
490  col_src = surf->att[ATT_COLOR].att_src;
491 
492  if (col_src != MAP_ATT) {
493  if (col_src == CONST_ATT) {
494  curcolor = (int)surf->att[ATT_COLOR].constant;
495  }
496  else {
497  curcolor = surf->wire_color;
498  }
499 
500  check_color = 0;
501  }
502 
503  buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
504  cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
505 
506  xmod = surf->x_modw;
507  ymod = surf->y_modw;
508  xres = xmod * surf->xres;
509  yres = ymod * surf->yres;
510  ymax = (surf->rows - 1) * surf->yres;
511  xcnt = 1 + (surf->cols - 1) / xmod;
512  ycnt = 1 + (surf->rows - 1) / ymod;
513 
514  gsd_pushmatrix();
515  gsd_do_scale(1);
516  gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
517 
518  zexag = surf->z_exag;
519  /* CURRENTLY ALWAYS 1.0 */
520 
522 
523  for (row = 0; row < ycnt; row++) {
524  pt[Y] = ymax - row * yres;
525  y1off = row * ymod * surf->cols;
526 
527  for (col = 0; col < xcnt; col++) {
528  pt[X] = col * xres;
529  offset = col * xmod + y1off;
530 
531  if (check_mask) {
532  if (BM_get(surf->curmask, col * xmod, row * ymod)) {
533  continue;
534  }
535  }
536 
537  FNORM(surf->norms[offset], n);
538  GET_MAPATT(buff, offset, pt[Z]);
539  pt[Z] *= zexag;
540 
541  if (check_color) {
542  curcolor = gs_mapcolor(cobuff, coloratt, offset);
543  }
544 
545  gsd_arrow(pt, curcolor, xres * 2, n, sz, surf);
546  } /* ea col */
547  } /* ea row */
548 
549  gsd_popmatrix();
551 
552  return (1);
553 }
554 
555 /*!
556  \brief Draw coarse surface
557 
558  New (TEST) wire routine that draws low res surface
559  Based on new Trinagle Fan routine
560  Resolution is a function of current surface resolution
561  times wire resolution
562 
563  \todo normals have to be recalculated before proper low
564  res surface can be drawn
565 
566  In window optimization has been removed
567 
568  \param surf surface (geosurf)
569 
570  \return
571  */
573 {
574  int /* check_mask, */ check_color, check_transp;
575  int check_material, check_emis, check_shin;
576  typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
577  int xmod, ymod;
578  int row, col, xcnt, ycnt;
579  long y1off, y2off, y3off;
580  long offset2[10];
581  float pt2[10][2];
582  int ii;
583  float x1, x2, x3, y1, y2, y3, tx, ty, tz, ttr;
584  float n[3], pt[4], xres, yres, ymax, zexag;
585  int em_src, sh_src, trans_src, col_src, curcolor;
586  gsurf_att *ematt, *shatt, *tratt, *coloratt;
587 
588  int datacol1, datacol2, datacol3;
589 
590  /* int datarow1, datarow2, datarow3; */
591 
592  float kem, ksh, pkem, pksh;
593  unsigned int ktrans;
594 
595  int step_val = 2 * surf->x_modw; /* should always be factor of 2 for fan */
596  int start_val = surf->x_modw;
597 
598  /* ensure normals are correct */
599  gs_calc_normals(surf);
600 
601  /* avoid scaling by zero */
602  GS_get_scale(&tx, &ty, &tz, 1);
603 
604  if (tz == 0.0) {
605  return (gsd_surf_const(surf, 0.0));
606  }
607  /* else if (surf->z_exag == 0.0)
608  {
609  return(gsd_surf_const(surf, surf->z_min));
610  }
611  NOT YET IMPLEMENTED */
612 
613  buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
614  cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
615 
616  gs_update_curmask(surf);
617  /* check_mask = surf->curmask ? 1 : 0; */
618 
619  /*
620  checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
621  combine it/them with any current mask, put in surf->curmask:
622  */
623  xmod = surf->x_mod;
624  ymod = surf->y_mod;
625  xres = xmod * surf->xres;
626  yres = ymod * surf->yres;
627  ymax = (surf->rows - 1) * surf->yres;
628 
629  xcnt = VCOLS(surf);
630  ycnt = VROWS(surf);
631 
632  gsd_pushmatrix();
633  gsd_do_scale(1);
634  gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
635  zexag = surf->z_exag;
636 
638 
639  /* CURRENTLY ALWAYS 1.0 */
640 #ifdef CALC_AREA
641  sz = GS_global_exag();
642 #endif
643 
644  /* TODO: get rid of (define) these magic numbers scaling the attribute vals
645  */
646  check_transp = 0;
647  tratt = &(surf->att[ATT_TRANSP]);
648  ktrans = (255U << 24);
649  trans_src = surf->att[ATT_TRANSP].att_src;
650 
651  if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) {
652  ktrans = (255 - (int)surf->att[ATT_TRANSP].constant) << 24;
653  gsd_blend(1);
654  gsd_zwritemask(0x0);
655  }
656  else if (MAP_ATT == trans_src) {
657  trbuff = gs_get_att_typbuff(surf, ATT_TRANSP, 0);
658  check_transp = trbuff ? 1 : 0;
659  gsd_blend(1);
660  gsd_zwritemask(0x0);
661  }
662 
663  check_emis = 0;
664  ematt = &(surf->att[ATT_EMIT]);
665  kem = 0.0;
666  pkem = 1.0;
667  em_src = surf->att[ATT_EMIT].att_src;
668 
669  if (CONST_ATT == em_src) {
670  kem = surf->att[ATT_EMIT].constant / 255.;
671  }
672  else if (MAP_ATT == em_src) {
673  embuff = gs_get_att_typbuff(surf, ATT_EMIT, 0);
674  check_emis = embuff ? 1 : 0;
675  }
676 
677  check_shin = 0;
678  shatt = &(surf->att[ATT_SHINE]);
679  ksh = 0.0;
680  pksh = 1.0;
681  sh_src = surf->att[ATT_SHINE].att_src;
682 
683  if (CONST_ATT == sh_src) {
684  ksh = surf->att[ATT_SHINE].constant / 255.;
685  gsd_set_material(1, 0, ksh, kem, 0x0);
686  }
687  else if (MAP_ATT == sh_src) {
688  shbuff = gs_get_att_typbuff(surf, ATT_SHINE, 0);
689  check_shin = shbuff ? 1 : 0;
690  }
691 
692  /* will need to check for color source of FUNC_ATT & NOTSET_ATT,
693  or else use more general and inefficient gets */
694  check_color = 1;
695  curcolor = 0;
696  coloratt = &(surf->att[ATT_COLOR]);
697  col_src = surf->att[ATT_COLOR].att_src;
698 
699  if (col_src != MAP_ATT) {
700  if (col_src == CONST_ATT) {
701  curcolor = (int)surf->att[ATT_COLOR].constant;
702  }
703  else {
704  curcolor = surf->wire_color;
705  }
706 
707  check_color = 0;
708  }
709 
710  check_material = (check_shin || check_emis || (kem && check_color));
711 
712  /* would also be good to check if colormap == surfmap, to increase speed */
713  /* will also need to set check_transp, check_shine, etc & fix material */
714  for (row = start_val; row <= ycnt - start_val; row += step_val) {
715 
716  /*
717  datarow1 = row * ymod;
718  datarow2 = (row - (step_val / 2)) * ymod;
719  datarow3 = (row + (step_val / 2)) * ymod;
720  */
721 
722  y1 = ymax - row * yres;
723  y2 = ymax - (row - (step_val / 2)) * yres;
724  y3 = ymax - (row + (step_val / 2)) * yres;
725 
726  y1off = row * ymod * surf->cols;
727  y2off = (row - (step_val / 2)) * ymod * surf->cols;
728  y3off = (row + (step_val / 2)) * ymod * surf->cols;
729 
730  for (col = start_val; col <= xcnt - start_val; col += step_val) {
731 
732  datacol1 = col * xmod;
733  datacol2 = (col - (step_val / 2)) * xmod;
734  datacol3 = (col + (step_val / 2)) * xmod;
735 
736  x1 = col * xres;
737  x2 = (col - (step_val / 2)) * xres;
738  x3 = (col + (step_val / 2)) * xres;
739 
740  /* Do not need BM_get because GET_MAPATT calls
741  * same and returns zero if masked
742  */
743  offset2[0] = y1off + datacol1; /* fan center */
744  pt2[0][X] = x1;
745  pt2[0][Y] = y1; /* fan center */
746  pt[X] = pt2[0][X];
747  pt[Y] = pt2[0][Y];
748  if (!GET_MAPATT(buff, offset2[0], pt[Z]))
749  continue; /* masked */
750  pt[Z] *= zexag;
751 
752  offset2[1] = y2off + datacol2;
753  offset2[2] = y2off + datacol1;
754  offset2[3] = y2off + datacol3;
755  offset2[4] = y1off + datacol3;
756  offset2[5] = y3off + datacol3;
757  offset2[6] = y3off + datacol1;
758  offset2[7] = y3off + datacol2;
759  offset2[8] = y1off + datacol2;
760  offset2[9] = y2off + datacol2; /* repeat 1st corner to close */
761 
762  pt2[1][X] = x2;
763  pt2[1][Y] = y2;
764  pt2[2][X] = x1;
765  pt2[2][Y] = y2;
766  pt2[3][X] = x3;
767  pt2[3][Y] = y2;
768  pt2[4][X] = x3;
769  pt2[4][Y] = y1;
770  pt2[5][X] = x3;
771  pt2[5][Y] = y3;
772  pt2[6][X] = x1;
773  pt2[6][Y] = y3;
774  pt2[7][X] = x2;
775  pt2[7][Y] = y3;
776  pt2[8][X] = x2;
777  pt2[8][Y] = y1;
778  pt2[9][X] = x2;
779  pt2[9][Y] = y2; /* repeat 1st corner to close */
780 
781  /* Run through triangle fan */
782  gsd_bgntfan();
783  for (ii = 0; ii < 10; ii++) {
784 
785  if (ii > 0) {
786  pt[X] = pt2[ii][X];
787  pt[Y] = pt2[ii][Y];
788  if (!GET_MAPATT(buff, offset2[ii], pt[Z]))
789  continue;
790  pt[Z] *= zexag;
791  }
792 
793  FNORM(surf->norms[offset2[ii]], n);
794 
795  if (check_color)
796  curcolor = gs_mapcolor(cobuff, coloratt, offset2[ii]);
797 
798  if (check_transp) {
799  GET_MAPATT(trbuff, offset2[ii], ttr);
800  ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
801  ktrans = (char)(255U - ktrans) << 24;
802  }
803 
804  if (check_material) {
805  if (check_emis) {
806  GET_MAPATT(embuff, offset2[ii], kem);
807  kem = SCALE_ATT(ematt, kem, 0., 1.);
808  }
809 
810  if (check_shin) {
811  GET_MAPATT(shbuff, offset2[ii], ksh);
812  ksh = SCALE_ATT(shatt, ksh, 0., 1.);
813  }
814 
815  if (pksh != ksh || pkem != kem || (kem && check_color)) {
816  pksh = ksh;
817  pkem = kem;
818  gsd_set_material(check_shin, check_emis, ksh, kem,
819  curcolor);
820  }
821  }
822 
823  gsd_litvert_func(n, ktrans | curcolor, pt);
824 
825  } /* close ii loop */
826  gsd_endtfan();
827 
828  } /* end col */
829 
830  } /* end row */
831 
832  gsd_popmatrix();
833  /*
834  gsd_colormode(CM_DIFFUSE);
835  */
836  gsd_blend(0);
837  gsd_zwritemask(0xffffffff);
838 
839  return (0);
840 }
#define NULL
Definition: ccmath.h:32
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
Definition: bitmap.c:217
int G_debug(int, const char *,...) __attribute__((format(printf
void gsd_endtfan(void)
ADD.
Definition: gsd_prim.c:347
void gsd_pushmatrix(void)
Push the current matrix stack.
Definition: gsd_prim.c:511
void gsd_do_scale(int)
Set current scale.
Definition: gsd_views.c:355
int gs_get_att_src(geosurf *, int)
Get attribute source.
Definition: gs.c:656
int gs_calc_normals(geosurf *)
Calculate normals.
Definition: gs_norms.c:124
int gs_mapcolor(typbuff *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
Definition: gs.c:968
int gs_update_curmask(geosurf *)
Update current maps.
Definition: gs_bm.c:231
void gsd_color_func(unsigned int)
Set current color.
Definition: gsd_prim.c:698
void gsd_translate(float, float, float)
Multiply the current matrix by a translation matrix.
Definition: gsd_prim.c:539
void gsd_popmatrix(void)
Pop the current matrix stack.
Definition: gsd_prim.c:501
void gsd_zwritemask(unsigned long)
Write out z-mask.
Definition: gsd_prim.c:241
void gsd_endline(void)
End line.
Definition: gsd_prim.c:407
int gsd_surf_const(geosurf *, float)
Using tmesh - not confident with qstrips portability.
Definition: gsd_surf.c:729
void gsd_colormode(int)
Set color mode.
Definition: gsd_prim.c:98
geosurf * gsdiff_get_SDref(void)
ADD.
Definition: gsdiff.c:77
void GS_get_scale(float *, float *, float *, int)
Get axis scale.
Definition: gs2.c:3236
void gsd_bgntfan(void)
ADD.
Definition: gsd_prim.c:337
void gsd_set_material(int, int, float, float, int)
Set material.
Definition: gsd_prim.c:803
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
Definition: gs.c:681
void gsd_bgnline(void)
Begin line.
Definition: gsd_prim.c:397
float gsdiff_do_SD(float, int)
ADD.
Definition: gsdiff.c:94
void gsd_blend(int)
Specify pixel arithmetic.
Definition: gsd_prim.c:994
void gsd_vert_func(float *)
ADD.
Definition: gsd_prim.c:686
int gsd_arrow(float *, unsigned long, float, float *, float, geosurf *)
ADD.
Definition: gsd_objs.c:898
void gsd_litvert_func(float *, unsigned long, float *)
Set the current normal vector & specify vertex.
Definition: gsd_prim.c:657
float GS_global_exag(void)
Get global z-exag value.
Definition: gs2.c:1997
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition: gis.h:47
int gsd_wire_surf_func(geosurf *gs UNUSED, int(*user_func)(void) UNUSED)
ADD.
Definition: gsd_wire.c:442
int gsd_wire_arrows(geosurf *surf)
ADD.
Definition: gsd_wire.c:457
int gsd_wire_surf(geosurf *surf)
Draw surface wire.
Definition: gsd_wire.c:46
int gsd_coarse_surf_map(geosurf *surf)
Draw coarse surface.
Definition: gsd_wire.c:572
int gsd_wire_surf_const(geosurf *surf, float k)
ADD.
Definition: gsd_wire.c:276
int gsd_wire_surf_map(geosurf *surf)
ADD.
Definition: gsd_wire.c:99
#define FNORM(i, nv)
Definition: gsget.h:51
#define SCALE_ATT(att, val, low, high)
Definition: gsget.h:24
#define GET_MAPATT(buff, offset, att)
Definition: gsget.h:29
#define NOTSET_ATT
Definition: ogsf.h:84
#define DM_GRID_WIRE
Definition: ogsf.h:66
#define CM_DIFFUSE
Definition: ogsf.h:151
#define X
Definition: ogsf.h:140
#define ATT_TOPO
Definition: ogsf.h:75
#define ATT_COLOR
Definition: ogsf.h:76
#define ATT_EMIT
Definition: ogsf.h:80
#define Z
Definition: ogsf.h:142
#define ATT_SHINE
Definition: ogsf.h:79
#define Y
Definition: ogsf.h:141
#define MAP_ATT
Definition: ogsf.h:85
#define WC_COLOR_ATT
Definition: ogsf.h:69
#define CM_COLOR
Definition: ogsf.h:148
#define FUNC_ATT
Definition: ogsf.h:87
#define CONST_ATT
Definition: ogsf.h:86
#define ATT_TRANSP
Definition: ogsf.h:78
#define VCOLS(gs)
Definition: rowcol.h:14
#define VROWS(gs)
Definition: rowcol.h:13
Definition: ogsf.h:256
float x_trans
Definition: ogsf.h:266
int rows
Definition: ogsf.h:258
double yres
Definition: ogsf.h:264
int cols
Definition: ogsf.h:258
long wire_color
Definition: ogsf.h:262
gsurf_att att[MAX_ATTS]
Definition: ogsf.h:259
unsigned long * norms
Definition: ogsf.h:273
int gsurf_id
Definition: ogsf.h:257
int y_mod
Definition: ogsf.h:270
int x_modw
Definition: ogsf.h:270
int y_modw
Definition: ogsf.h:270
double xres
Definition: ogsf.h:264
struct BM * curmask
Definition: ogsf.h:274
int x_mod
Definition: ogsf.h:270
float z_exag
Definition: ogsf.h:265
float z_trans
Definition: ogsf.h:266
IFLAG draw_mode
Definition: ogsf.h:260
float y_trans
Definition: ogsf.h:266
float constant
Definition: ogsf.h:250
IFLAG att_src
Definition: ogsf.h:246
int(* user_func)(void)
Definition: ogsf.h:249
Definition: ogsf.h:208