GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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 
26 #define DO_ARROWS
27 
28 /************************************************************************/
29 /* Notes on exageration:
30  vertical exageration is of two forms:
31  1) global exageration (from geoview struct)
32  2) vertical exageration for each surface - not implemented
33  */
34 
35 /************************************************************************/
36 /* may need to add more parameters to tell it which window or off_screen
37  * pixmap to draw into. nah - just have one current (OpenGL limitation)
38  */
39 
40 /*!
41  \brief Draw surface wire
42 
43  \param surf surface (geosurf)
44 
45  \return
46  */
48 {
49  int desc, ret;
50 
51  G_debug(3, "gsd_wire_surf(): id=%d", surf->gsurf_id);
52 
53  desc = ATT_TOPO;
54 
55  switch (gs_get_att_src(surf, desc)) {
56  case NOTSET_ATT:
57  ret = (-1);
58 
59  break;
60 
61  case MAP_ATT:
62  if (surf->draw_mode & DM_GRID_WIRE)
63  ret = (gsd_wire_surf_map(surf)); /* draw mesh */
64  else
65  ret = (gsd_coarse_surf_map(surf)); /* draw coarse surf */
66 
67 #ifdef DO_ARROWS
68  /*
69  gsd_wire_arrows(surf);
70  */
71 #endif
72 
73  break;
74 
75  case CONST_ATT:
76  ret = (gsd_wire_surf_const(surf, surf->att[desc].constant));
77  break;
78 
79  case FUNC_ATT:
80  ret = (gsd_wire_surf_func(surf, surf->att[desc].user_func));
81 
82  break;
83 
84  default:
85  ret = (-1);
86 
87  break;
88  }
89 
90  return (ret);
91 }
92 
93 /*!
94  \brief ADD
95 
96  \param surf surface (geosurf)
97 
98  \return
99  */
101 {
102  int check_mask, check_color;
103  typbuff *buff, *cobuff;
104  int xmod, ymod, row, col, cnt, xcnt, ycnt, x1off;
105  long offset, y1off;
106  float pt[4], xres, yres, ymax, zexag;
107  int col_src, curcolor;
108  gsurf_att *coloratt;
109 
110  G_debug(3, "gsd_wire_surf_map");
111 
112  buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
113  cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
114 
115  gs_update_curmask(surf);
116  check_mask = surf->curmask ? 1 : 0;
117 
118  /*
119  checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
120  combine it/them with any current mask, put in typbuff:
121  if(surf->att[ATT_TOPO].constant)
122  */
123 
124  xmod = surf->x_modw;
125  ymod = surf->y_modw;
126  xres = xmod * surf->xres;
127  yres = ymod * surf->yres;
128  ymax = (surf->rows - 1) * surf->yres;
129  xcnt = 1 + (surf->cols - 1) / xmod;
130  ycnt = 1 + (surf->rows - 1) / ymod;
131 
132  gsd_pushmatrix();
133  gsd_do_scale(1);
134  gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
135 
136  zexag = surf->z_exag;
137 
139 
140  /* will need to check for color source of FUNC_ATT & NOTSET_ATT,
141  or else use more general and inefficient gets */
142 
143  check_color = (surf->wire_color == WC_COLOR_ATT);
144 
145  if (check_color) {
146  coloratt = &(surf->att[ATT_COLOR]);
147  col_src = surf->att[ATT_COLOR].att_src;
148 
149  if (col_src != MAP_ATT) {
150  if (col_src == CONST_ATT) {
151  gsd_color_func((int)surf->att[ATT_COLOR].constant);
152  }
153  else {
154  gsd_color_func(surf->wire_color);
155  }
156 
157  check_color = 0;
158  }
159  }
160  else {
161  gsd_color_func(surf->wire_color);
162  }
163 
164  /* would also be good to check if colormap == surfmap, to increase speed */
165  for (row = 0; row < ycnt; row++) {
166  pt[Y] = ymax - row * yres;
167  y1off = row * ymod * surf->cols;
168 
169  gsd_bgnline();
170  cnt = 0;
171 
172  for (col = 0; col < xcnt; col++) {
173  pt[X] = col * xres;
174  x1off = col * xmod;
175  offset = x1off + y1off;
176 
177  if (check_mask) {
178  if (BM_get(surf->curmask, col * xmod, row * ymod)) {
179  gsd_endline();
180  gsd_bgnline();
181  cnt = 0;
182  continue;
183  }
184  }
185 
186  GET_MAPATT(buff, offset, pt[Z]);
187 
188  if (check_color) {
189  curcolor = gs_mapcolor(cobuff, coloratt, offset);
190  gsd_color_func(curcolor);
191  /* could use this & skip the GET if colordata == elevdata
192  gsd_color_func(gs_fastmapcolor(cobuff, coloratt, offset,
193  (int)pt[Z]));
194  */
195  }
196 
197  pt[Z] = pt[Z] * zexag;
198 
199  gsd_vert_func(pt);
200 
201  if (cnt == 255) {
202  gsd_endline();
203  gsd_bgnline();
204  cnt = 0;
205  gsd_vert_func(pt);
206  }
207 
208  cnt++;
209  }
210 
211  gsd_endline();
212  }
213 
214  for (col = 0; col < xcnt; col++) {
215  pt[X] = col * xres;
216  x1off = col * xmod;
217 
218  gsd_bgnline();
219  cnt = 0;
220 
221  for (row = 0; row < ycnt; row++) {
222  pt[Y] = ymax - row * yres;
223  y1off = row * ymod * surf->cols;
224  offset = x1off + y1off;
225 
226  if (check_mask) {
227  if (BM_get(surf->curmask, col * xmod, row * ymod)) {
228  gsd_endline();
229  gsd_bgnline();
230  cnt = 0;
231  continue;
232  }
233  }
234 
235  GET_MAPATT(buff, offset, pt[Z]);
236 
237  if (check_color) {
238  curcolor = gs_mapcolor(cobuff, coloratt, offset);
239  gsd_color_func(curcolor);
240  /* could use this & skip the GET if colordata == elevdata
241  gsd_color_func(gs_fastmapcolor(coloratt, offset, (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)
438  \param user_func user defined function
439 
440  \return 1
441  */
442 int gsd_wire_surf_func(geosurf * gs, int (*user_func) ())
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 
589  int datarow1, datacol1, datarow2, datacol2, datarow3, datacol3;
590 
591  float kem, ksh, pkem, pksh;
592  unsigned int ktrans;
593 
594  int step_val = 2 * surf->x_modw; /* should always be factor of 2 for fan */
595  int start_val = surf->x_modw;
596 
597  /* ensure normals are correct */
598  gs_calc_normals(surf);
599 
600  /* avoid scaling by zero */
601  GS_get_scale(&tx, &ty, &tz, 1);
602 
603  if (tz == 0.0) {
604  return (gsd_surf_const(surf, 0.0));
605  }
606  /* else if (surf->z_exag == 0.0)
607  {
608  return(gsd_surf_const(surf, surf->z_min));
609  }
610  NOT YET IMPLEMENTED */
611 
612  buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
613  cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
614 
615  gs_update_curmask(surf);
616  check_mask = surf->curmask ? 1 : 0;
617 
618  /*
619  checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
620  combine it/them with any current mask, put in surf->curmask:
621  */
622  xmod = surf->x_mod;
623  ymod = surf->y_mod;
624  xres = xmod * surf->xres;
625  yres = ymod * surf->yres;
626  ymax = (surf->rows - 1) * surf->yres;
627 
628  xcnt = VCOLS(surf);
629  ycnt = VROWS(surf);
630 
631  gsd_pushmatrix();
632  gsd_do_scale(1);
633  gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
634  zexag = surf->z_exag;
635 
637 
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  check_transp = 0;
646  tratt = &(surf->att[ATT_TRANSP]);
647  ktrans = (255 << 24);
648  trans_src = surf->att[ATT_TRANSP].att_src;
649 
650  if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) {
651  ktrans = (255 - (int)surf->att[ATT_TRANSP].constant) << 24;
652  gsd_blend(1);
653  gsd_zwritemask(0x0);
654  }
655  else if (MAP_ATT == trans_src) {
656  trbuff = gs_get_att_typbuff(surf, ATT_TRANSP, 0);
657  check_transp = trbuff ? 1 : 0;
658  gsd_blend(1);
659  gsd_zwritemask(0x0);
660  }
661 
662  check_emis = 0;
663  ematt = &(surf->att[ATT_EMIT]);
664  kem = 0.0;
665  pkem = 1.0;
666  em_src = surf->att[ATT_EMIT].att_src;
667 
668  if (CONST_ATT == em_src) {
669  kem = surf->att[ATT_EMIT].constant / 255.;
670  }
671  else if (MAP_ATT == em_src) {
672  embuff = gs_get_att_typbuff(surf, ATT_EMIT, 0);
673  check_emis = embuff ? 1 : 0;
674  }
675 
676  check_shin = 0;
677  shatt = &(surf->att[ATT_SHINE]);
678  ksh = 0.0;
679  pksh = 1.0;
680  sh_src = surf->att[ATT_SHINE].att_src;
681 
682  if (CONST_ATT == sh_src) {
683  ksh = surf->att[ATT_SHINE].constant / 255.;
684  gsd_set_material(1, 0, ksh, kem, 0x0);
685  }
686  else if (MAP_ATT == sh_src) {
687  shbuff = gs_get_att_typbuff(surf, ATT_SHINE, 0);
688  check_shin = shbuff ? 1 : 0;
689  }
690 
691  /* will need to check for color source of FUNC_ATT & NOTSET_ATT,
692  or else use more general and inefficient gets */
693  check_color = 1;
694  curcolor = 0;
695  coloratt = &(surf->att[ATT_COLOR]);
696  col_src = surf->att[ATT_COLOR].att_src;
697 
698  if (col_src != MAP_ATT) {
699  if (col_src == CONST_ATT) {
700  curcolor = (int)surf->att[ATT_COLOR].constant;
701  }
702  else {
703  curcolor = surf->wire_color;
704  }
705 
706  check_color = 0;
707  }
708 
709  check_material = (check_shin || check_emis || (kem && check_color));
710 
711  /* would also be good to check if colormap == surfmap, to increase speed */
712  /* will also need to set check_transp, check_shine, etc & fix material */
713  for (row = start_val; row <= ycnt - start_val; row += step_val) {
714 
715  datarow1 = row * ymod;
716  datarow2 = (row - (step_val / 2)) * ymod;
717  datarow3 = (row + (step_val / 2)) * ymod;
718 
719 
720  y1 = ymax - row * yres;
721  y2 = ymax - (row - (step_val / 2)) * yres;
722  y3 = ymax - (row + (step_val / 2)) * yres;
723 
724  y1off = row * ymod * surf->cols;
725  y2off = (row - (step_val / 2)) * ymod * surf->cols;
726  y3off = (row + (step_val / 2)) * ymod * surf->cols;
727 
728  for (col = start_val; col <= xcnt - start_val; col += step_val) {
729 
730  datacol1 = col * xmod;
731  datacol2 = (col - (step_val / 2)) * xmod;
732  datacol3 = (col + (step_val / 2)) * xmod;
733 
734  x1 = col * xres;
735  x2 = (col - (step_val / 2)) * xres;
736  x3 = (col + (step_val / 2)) * xres;
737 
738 
739  /* Do not need BM_get because GET_MAPATT calls
740  * same and returns zero if masked
741  */
742  offset2[0] = y1off + datacol1; /* fan center */
743  pt2[0][X] = x1;
744  pt2[0][Y] = y1; /* fan center */
745  pt[X] = pt2[0][X];
746  pt[Y] = pt2[0][Y];
747  if (!GET_MAPATT(buff, offset2[0], pt[Z]))
748  continue; /* masked */
749  pt[Z] *= zexag;
750 
751  offset2[1] = y2off + datacol2;
752  offset2[2] = y2off + datacol1;
753  offset2[3] = y2off + datacol3;
754  offset2[4] = y1off + datacol3;
755  offset2[5] = y3off + datacol3;
756  offset2[6] = y3off + datacol1;
757  offset2[7] = y3off + datacol2;
758  offset2[8] = y1off + datacol2;
759  offset2[9] = y2off + datacol2; /* repeat 1st corner to close */
760 
761  pt2[1][X] = x2;
762  pt2[1][Y] = y2;
763  pt2[2][X] = x1;
764  pt2[2][Y] = y2;
765  pt2[3][X] = x3;
766  pt2[3][Y] = y2;
767  pt2[4][X] = x3;
768  pt2[4][Y] = y1;
769  pt2[5][X] = x3;
770  pt2[5][Y] = y3;
771  pt2[6][X] = x1;
772  pt2[6][Y] = y3;
773  pt2[7][X] = x2;
774  pt2[7][Y] = y3;
775  pt2[8][X] = x2;
776  pt2[8][Y] = y1;
777  pt2[9][X] = x2;
778  pt2[9][Y] = y2; /* repeat 1st corner to close */
779 
780  /* Run through triangle fan */
781  gsd_bgntfan();
782  for (ii = 0; ii < 10; ii++) {
783 
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)(255 - ktrans) << 24;
802  }
803 
804 
805  if (check_material) {
806  if (check_emis) {
807  GET_MAPATT(embuff, offset2[ii], kem);
808  kem = SCALE_ATT(ematt, kem, 0., 1.);
809  }
810 
811  if (check_shin) {
812  GET_MAPATT(shbuff, offset2[ii], ksh);
813  ksh = SCALE_ATT(shatt, ksh, 0., 1.);
814  }
815 
816  if (pksh != ksh || pkem != kem || (kem && check_color)) {
817  pksh = ksh;
818  pkem = kem;
819  gsd_set_material(check_shin, check_emis,
820  ksh, kem, curcolor);
821  }
822  }
823 
824 
825  gsd_litvert_func(n, ktrans | curcolor, pt);
826 
827 
828  } /* close ii loop */
829  gsd_endtfan();
830 
831  } /* end col */
832 
833  } /* end row */
834 
835  gsd_popmatrix();
836  /*
837  gsd_colormode(CM_DIFFUSE);
838  */
839  gsd_blend(0);
840  gsd_zwritemask(0xffffffff);
841 
842  return (0);
843 }
int gs_mapcolor(typbuff *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
Definition: gs.c:969
void gsd_endtfan(void)
ADD.
Definition: gsd_prim.c:346
#define CM_DIFFUSE
Definition: ogsf.h:148
long wire_color
Definition: ogsf.h:263
void gsd_blend(int)
Specify pixel arithmetic.
Definition: gsd_prim.c:996
#define ATT_SHINE
Definition: ogsf.h:77
int gsd_wire_surf(geosurf *surf)
Draw surface wire.
Definition: gsd_wire.c:47
int gsd_arrow(float *, unsigned long, float, float *, float, geosurf *)
ADD.
Definition: gsd_objs.c:923
unsigned long * norms
Definition: ogsf.h:274
#define NOTSET_ATT
Definition: ogsf.h:82
#define VROWS(gs)
Definition: rowcol.h:13
int rows
Definition: ogsf.h:260
void gsd_popmatrix(void)
Pop the current matrix stack.
Definition: gsd_prim.c:500
#define VCOLS(gs)
Definition: rowcol.h:14
#define ATT_TOPO
Definition: ogsf.h:73
int gs_get_att_src(geosurf *, int)
Get attribute source.
Definition: gs.c:656
#define FUNC_ATT
Definition: ogsf.h:85
#define NULL
Definition: ccmath.h:32
IFLAG att_src
Definition: ogsf.h:247
float z_exag
Definition: ogsf.h:266
int cols
Definition: ogsf.h:260
void gsd_colormode(int)
Set color mode.
Definition: gsd_prim.c:97
IFLAG draw_mode
Definition: ogsf.h:262
#define DM_GRID_WIRE
Definition: ogsf.h:64
double yres
Definition: ogsf.h:265
int gsd_wire_surf_const(geosurf *surf, float k)
ADD.
Definition: gsd_wire.c:276
int x_mod
Definition: ogsf.h:271
float gsdiff_do_SD(float, int)
ADD.
Definition: gsdiff.c:94
float x_trans
Definition: ogsf.h:267
int gsd_wire_arrows(geosurf *surf)
ADD.
Definition: gsd_wire.c:457
#define CM_COLOR
Definition: ogsf.h:145
void gsd_color_func(unsigned int)
Set current color.
Definition: gsd_prim.c:701
int gs_update_curmask(geosurf *)
Update current maps.
Definition: gs_bm.c:232
void gsd_endline(void)
End line.
Definition: gsd_prim.c:406
#define MAP_ATT
Definition: ogsf.h:83
void gsd_translate(float, float, float)
Multiply the current matrix by a translation matrix.
Definition: gsd_prim.c:538
int y_mod
Definition: ogsf.h:271
int gsd_wire_surf_func(geosurf *gs, int(*user_func)())
ADD.
Definition: gsd_wire.c:442
int gsd_coarse_surf_map(geosurf *surf)
Draw coarse surface.
Definition: gsd_wire.c:572
#define ATT_COLOR
Definition: ogsf.h:74
void gsd_bgntfan(void)
ADD.
Definition: gsd_prim.c:336
int BM_get(struct BM *, int, int)
Gets &#39;val&#39; from the bitmap.
Definition: bitmap.c:223
struct BM * curmask
Definition: ogsf.h:275
int(* user_func)()
Definition: ogsf.h:250
#define Z
Definition: ogsf.h:139
float GS_global_exag(void)
Get global z-exag value.
Definition: gs2.c:1999
gsurf_att att[MAX_ATTS]
Definition: ogsf.h:261
int y_modw
Definition: ogsf.h:271
void gsd_zwritemask(unsigned long)
Write out z-mask.
Definition: gsd_prim.c:240
float y_trans
Definition: ogsf.h:267
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
Definition: gs.c:681
#define Y
Definition: ogsf.h:138
#define ATT_TRANSP
Definition: ogsf.h:76
int gsurf_id
Definition: ogsf.h:259
#define WC_COLOR_ATT
Definition: ogsf.h:67
void gsd_litvert_func(float *, unsigned long, float *)
Set the current normal vector & specify vertex.
Definition: gsd_prim.c:660
Definition: ogsf.h:204
geosurf * gsdiff_get_SDref(void)
ADD.
Definition: gsdiff.c:77
void gsd_pushmatrix(void)
Push the current matrix stack.
Definition: gsd_prim.c:510
#define X
Definition: ogsf.h:137
#define FNORM(i, nv)
Definition: gsget.h:50
void GS_get_scale(float *, float *, float *, int)
Get axis scale.
Definition: gs2.c:3240
#define SCALE_ATT(att, val, low, high)
Definition: gsget.h:22
#define ATT_EMIT
Definition: ogsf.h:78
int x_modw
Definition: ogsf.h:271
void gsd_set_material(int, int, float, float, int)
Set material.
Definition: gsd_prim.c:806
float z_trans
Definition: ogsf.h:267
double xres
Definition: ogsf.h:265
#define CONST_ATT
Definition: ogsf.h:84
void gsd_do_scale(int)
Set current scale.
Definition: gsd_views.c:355
int G_debug(int, const char *,...) __attribute__((format(printf
Definition: ogsf.h:257
float constant
Definition: ogsf.h:251
void gsd_bgnline(void)
Begin line.
Definition: gsd_prim.c:396
int gsd_surf_const(geosurf *, float)
Using tmesh - not confident with qstrips portability.
Definition: gsd_surf.c:729
int gs_calc_normals(geosurf *)
Calculate normals.
Definition: gs_norms.c:124
int gsd_wire_surf_map(geosurf *surf)
ADD.
Definition: gsd_wire.c:100
#define GET_MAPATT(buff, offset, att)
Definition: gsget.h:27
void gsd_vert_func(float *)
ADD.
Definition: gsd_prim.c:689