GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
Loading...
Searching...
No Matches
gsd_surf.c
Go to the documentation of this file.
1/*!
2 \file lib/ogsf/gsd_surf.c
3
4 \brief OGSF library - loading and manipulating surfaces
5
6 GRASS OpenGL gsurf OGSF Library
7
8 SPDX-FileCopyrightText: 1999-2008 GRASS Development Team
9 SPDX-License-Identifier: GPL-2.0-or-later
10
11 \author Bill Brown USACERL (October 1993)
12 \author Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)
13 */
14
15#include <stdlib.h>
16
17#include <grass/gis.h>
18#include <grass/glocale.h>
19#include <grass/ogsf.h>
20
21#include "gsget.h"
22#include "rowcol.h"
23
24/*
25 #define CALC_AREA
26 */
27
28/*
29 #define DO_ARROW_SOLID
30 #define DEBUG_ARROW ((row && !(row%surf->y_modw))&&(col &&
31 !(col%surf->x_modw)))
32 */
33
34/*
35 #define DO_ARROW
36 */
37
38#define DEBUG_ARROW (0)
39
40/*!
41 \brief MACROS for use in gsd_ortho_wall ONLY !!!
42 */
43#define SET_SCOLOR(sf) \
44 if (check_color[sf]) { \
45 tx = points[sf][i][X] - gsurfs[sf]->x_trans; \
46 ty = points[sf][i][Y] - gsurfs[sf]->y_trans; \
47 offset = XY2OFF(gsurfs[sf], tx, ty); \
48 colors[sf] = gs_mapcolor(cobuf[sf], coloratt[sf], offset); \
49 }
50
51static int transpoint_is_masked(geosurf *, Point3);
52static int get_point_below(Point3 **, geosurf **, int, int, int, int *);
53
54static int FCmode;
55
56/************************************************************************/
57/* Notes on exaggeration:
58 vertical exaggeration is of two forms:
59 1) global exaggeration (from geoview struct)
60 2) vertical exaggeration for each surface (UN-IMPLEMENTED)
61 */
62
63/************************************************************************/
64/* may need to add more parameters to tell it which window or off_screen
65 * pixmap to draw into.
66 */
67
68/*!
69 \brief ADD
70
71 \param surf surface (geosurf)
72
73 \return
74 \return -1 on error
75 */
77{
78 int desc, ret;
79
80 G_debug(5, "gsd_surf(): id=%d", surf->gsurf_id);
81
82 desc = ATT_TOPO;
83
84 /* won't recalculate if update not needed, but may want to check
85 to see if lights are on */
87
88 switch (gs_get_att_src(surf, desc)) {
89 case NOTSET_ATT:
90 ret = (-1);
91
92 break;
93
94 case MAP_ATT:
95 ret = (gsd_surf_map(surf)); /* changed to use test draw routine */
96
97#ifdef DO_ARROW
99
100 /* Not ready yet - need to recalc normals for proper res
101 gsd_wire_arrows(surf);
102 */
103#endif
104
105 break;
106
107 case CONST_ATT:
108 ret = (gsd_surf_const(surf, surf->att[desc].constant));
109
110 break;
111
112 case FUNC_ATT:
113 ret = (gsd_surf_func(surf, surf->att[desc].user_func));
114
115 break;
116
117 default:
118 ret = (-1);
119
120 break;
121 }
122
123 return (ret);
124}
125
126/*!
127 \brief ADD
128
129 Using tmesh - not confident with qstrips portability
130
131 \param surf surface (geosurf)
132
133 \return
134 */
136{
139 typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
140 int xmod, ymod, row, col, cnt, xcnt, ycnt;
141 long offset, y1off, y2off;
142 float x1, x2, y1, y2, tx, ty, tz, ttr;
143 float n[3], pt[4], xres, yres, ymax, zexag;
146
147 /* Viewport variables for accelerated drawing */
149 GLint viewport[4];
150 GLint window[4];
151
152#ifdef CALC_AREA
153 float sz, mag, tedge1[3], tedge2[3], crossp[3], triv[3][3];
154 double asurf = 0.0, axsurf = 0.0;
155#endif
156
157 int zeros, dr1, dr2, dr3, dr4;
159
160 float kem, ksh, pkem, pksh;
161 unsigned int ktrans;
162
163 G_debug(3, "gsd_surf_map_old");
164
165 /* avoid scaling by zero */
166 GS_get_scale(&tx, &ty, &tz, 1);
167
168 if (tz == 0.0) {
169 return (gsd_surf_const(surf, 0.0));
170 }
171 /* else if (surf->z_exag == 0.0)
172 {
173 return(gsd_surf_const(surf, surf->z_min));
174 }
175 NOT YET IMPLEMENTED */
176
177 buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
179
181 check_mask = surf->curmask ? 1 : 0;
182
183 /*
184 checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
185 combine it/them with any current mask, put in surf->curmask:
186 */
187 xmod = surf->x_mod;
188 ymod = surf->y_mod;
189 xres = xmod * surf->xres;
190 yres = ymod * surf->yres;
191 ymax = (surf->rows - 1) * surf->yres;
192
193 xcnt = VCOLS(surf);
194 ycnt = VROWS(surf);
195
196 /* Get viewport */
198 /* adjust window */
199 window[0] += (int)(yres * 2);
200 window[1] -= (int)(yres * 2);
201 window[2] -= (int)(xres * 2);
202 window[3] += (int)(xres * 2);
203
206 gsd_do_scale(1);
207 gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
208 zexag = surf->z_exag;
209
210 /* CURRENTLY ALWAYS 1.0 */
211#ifdef CALC_AREA
212 sz = GS_global_exag();
213#endif
214
215 /* TESTING */
216 /*
217 fprintf(stderr, "This machine has %d alpha bits\n",
218 getgdesc(GD_BITS_NORM_DBL_ALPHA)); fprintf(stderr, "GD_BLEND = %d \n",
219 getgdesc(GD_BLEND)); fprintf(stderr, "GD_CLIPPLANES = %d \n",
220 getgdesc(GD_CLIPPLANES));
221 */
222
223 /* TODO: get rid of (define) these magic numbers scaling the attribute vals
224 */
225 check_transp = 0;
226 tratt = &(surf->att[ATT_TRANSP]);
227 ktrans = (255U << 24);
228 trans_src = surf->att[ATT_TRANSP].att_src;
229
230 if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) {
231 ktrans = (255 - (int)surf->att[ATT_TRANSP].constant) << 24;
232 gsd_blend(1);
233 gsd_zwritemask(0x0);
234 }
235 else if (MAP_ATT == trans_src) {
237 check_transp = trbuff ? 1 : 0;
238 gsd_blend(1);
239 gsd_zwritemask(0x0);
240 }
241
242 check_emis = 0;
243 ematt = &(surf->att[ATT_EMIT]);
244 kem = 0.0;
245 pkem = 1.0;
246 em_src = surf->att[ATT_EMIT].att_src;
247
248 if (CONST_ATT == em_src) {
249 kem = surf->att[ATT_EMIT].constant / 255.;
250 }
251 else if (MAP_ATT == em_src) {
253 check_emis = embuff ? 1 : 0;
254 }
255
256 check_shin = 0;
257 shatt = &(surf->att[ATT_SHINE]);
258 ksh = 0.0;
259 pksh = 1.0;
260 sh_src = surf->att[ATT_SHINE].att_src;
261
262 if (CONST_ATT == sh_src) {
263 ksh = surf->att[ATT_SHINE].constant / 255.;
264 gsd_set_material(1, 0, ksh, kem, 0x0);
265 }
266 else if (MAP_ATT == sh_src) {
268 check_shin = shbuff ? 1 : 0;
269 }
270
271 /* will need to check for color source of FUNC_ATT & NOTSET_ATT,
272 or else use more general and inefficient gets */
273 check_color = 1;
274 coloratt = &(surf->att[ATT_COLOR]);
275 col_src = surf->att[ATT_COLOR].att_src;
276
277 if (col_src != MAP_ATT) {
278 if (col_src == CONST_ATT) {
279 curcolor = (int)surf->att[ATT_COLOR].constant;
280 }
281 else {
282 curcolor = surf->wire_color;
283 }
284
285 check_color = 0;
286 }
287
289
290 /* would also be good to check if colormap == surfmap, to increase speed */
291 /* will also need to set check_transp, check_shine, etc & fix material */
292 cnt = 0;
293
294 for (row = 0; row < ycnt; row++) {
295 if (GS_check_cancel()) {
297 gsd_blend(0);
298 gsd_zwritemask(0xffffffff);
299
300 return (-1);
301 }
302
303 datarow1 = row * ymod;
304 datarow2 = (row + 1) * ymod;
305
306 y1 = ymax - row * yres;
307 y2 = ymax - (row + 1) * yres;
308 y1off = (long)row * ymod * surf->cols;
309 y2off = (long)(row + 1) * ymod * surf->cols;
310
311 gsd_bgntmesh();
312
313 zeros = 0;
314 dr1 = dr2 = dr3 = dr4 = 1;
315
316 if (check_mask) {
317 if (BM_get(surf->curmask, 0, datarow1)) {
318 /*TL*/ ++zeros;
319 dr1 = 0;
320 }
321
322 if (BM_get(surf->curmask, 0, datarow2)) {
323 /*BL*/ ++zeros;
324 dr2 = 0;
325 }
326 }
327
328 if (dr1 && dr2) {
329 offset = y1off; /* TL */
330 FNORM(surf->norms[offset], n);
331 pt[X] = 0;
332 pt[Y] = y1;
333 GET_MAPATT(buff, offset, pt[Z]);
334 pt[Z] *= zexag;
335
336 if (check_color) {
338 }
339
340 if (check_transp) {
341 GET_MAPATT(trbuff, offset, ttr);
342 ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
343 ktrans = (char)(255U - ktrans) << 24;
344 }
345
347
348#ifdef CALC_AREA
349 GS_v3eq(triv[cnt % 3], pt);
350#endif
351
352 cnt++;
353
354 offset = y2off; /* BL */
355 FNORM(surf->norms[offset], n);
356 pt[X] = 0;
357 pt[Y] = y2;
358 GET_MAPATT(buff, offset, pt[Z]);
359 pt[Z] *= zexag;
360
361 if (check_color) {
363 }
364
365 if (check_transp) {
366 GET_MAPATT(trbuff, offset, ttr);
367 ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
368 ktrans = (char)(255U - ktrans) << 24;
369 }
370
371 if (check_material) {
372 if (check_emis) {
373 GET_MAPATT(embuff, offset, kem);
374 kem = SCALE_ATT(ematt, kem, 0., 1.);
375 }
376
377 if (check_shin) {
378 GET_MAPATT(shbuff, offset, ksh);
379 ksh = SCALE_ATT(shatt, ksh, 0., 1.);
380 }
381
382 if (pksh != ksh || pkem != kem || (kem && check_color)) {
383 /* expensive */
384 pksh = ksh;
385 pkem = kem;
387 curcolor);
388 }
389 }
390
392
393#ifdef CALC_AREA
394 GS_v3eq(triv[cnt % 3], pt);
395#endif
396
397 cnt++;
398 }
399
400 for (col = 0; col < xcnt; col++) {
401 datacol1 = col * xmod;
402 datacol2 = (col + 1) * xmod;
403
404 x1 = col * xres;
405 x2 = (col + 1) * xres;
406
407 zeros = 0;
408 dr1 = dr2 = dr3 = dr4 = 1;
409
410 if (check_mask) {
411 if (BM_get(surf->curmask, datacol1, datarow1)) {
412 /*TL*/ ++zeros;
413 dr1 = 0;
414 }
415
416 if (BM_get(surf->curmask, datacol1, datarow2)) {
417 /*BL*/ ++zeros;
418 dr2 = 0;
419 }
420
421 if (BM_get(surf->curmask, datacol2, datarow2)) {
422 /*BR*/ ++zeros;
423 dr3 = 0;
424 }
425
426 if (BM_get(surf->curmask, datacol2, datarow1)) {
427 /*TR*/ ++zeros;
428 dr4 = 0;
429 }
430
431 if ((zeros > 1) && cnt) {
432 gsd_endtmesh();
433 cnt = 0;
434 gsd_bgntmesh();
435 continue;
436 }
437 }
438
439 if (cnt > 252) {
440 /* not needed! - no limit for tmesh */
441 cnt = 0;
442 gsd_endtmesh();
443 gsd_bgntmesh();
444
445 if (dr1) {
446 offset = y1off + datacol1; /* TL */
447 FNORM(surf->norms[offset], n);
448 pt[X] = x1;
449 pt[Y] = y1;
450 GET_MAPATT(buff, offset, pt[Z]);
451 pt[Z] *= zexag;
452
454 projMatrix)) {
455 gsd_endtmesh();
456 cnt = 0;
457 gsd_bgntmesh();
458 continue;
459 }
460
461 if (check_color) {
463 }
464
465 if (check_transp) {
466 GET_MAPATT(trbuff, offset, ttr);
467 ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
468 ktrans = (char)(255U - ktrans) << 24;
469 }
470
471 if (check_material) {
472 if (check_emis) {
473 GET_MAPATT(embuff, offset, kem);
474 kem = SCALE_ATT(ematt, kem, 0., 1.);
475 }
476
477 if (check_shin) {
478 GET_MAPATT(shbuff, offset, ksh);
479 ksh = SCALE_ATT(shatt, ksh, 0., 1.);
480 }
481
482 if (pksh != ksh || pkem != kem ||
483 (kem && check_color)) {
484 pksh = ksh;
485 pkem = kem;
487 curcolor);
488 }
489 }
490
492
493#ifdef CALC_AREA
494 GS_v3eq(triv[cnt % 3], pt);
495#endif
496
497 cnt++;
498 }
499
500 if (dr2) {
501 offset = y2off + datacol1; /* BL */
502 FNORM(surf->norms[offset], n);
503 pt[X] = x1;
504 pt[Y] = y2;
505 GET_MAPATT(buff, offset, pt[Z]);
506 pt[Z] *= zexag;
507
509 projMatrix)) {
510 gsd_endtmesh();
511 cnt = 0;
512 gsd_bgntmesh();
513 continue;
514 }
515
516 if (check_color) {
518 }
519
520 if (check_transp) {
521 GET_MAPATT(trbuff, offset, ttr);
522 ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
523 ktrans = (char)(255U - ktrans) << 24;
524 }
525
526 if (check_material) {
527 if (check_emis) {
528 GET_MAPATT(embuff, offset, kem);
529 kem = SCALE_ATT(ematt, kem, 0., 1.);
530 }
531
532 if (check_shin) {
533 GET_MAPATT(shbuff, offset, ksh);
534 ksh = SCALE_ATT(shatt, ksh, 0., 1.);
535 }
536
537 if (pksh != ksh || pkem != kem ||
538 (kem && check_color)) {
539 pksh = ksh;
540 pkem = kem;
542 curcolor);
543 }
544 }
545
547
548#ifdef CALC_AREA
549 GS_v3eq(triv[cnt % 3], pt);
550#endif
551
552 cnt++;
553 }
554 }
555
556 if (dr4) {
557 offset = y1off + datacol2; /* TR */
558 FNORM(surf->norms[offset], n);
559 pt[X] = x2;
560 pt[Y] = y1;
561 GET_MAPATT(buff, offset, pt[Z]);
562 pt[Z] *= zexag;
563
565 projMatrix)) {
566 gsd_endtmesh();
567 cnt = 0;
568 gsd_bgntmesh();
569 continue;
570 }
571
572 if (check_color) {
574 }
575
576 if (check_transp) {
577 GET_MAPATT(trbuff, offset, ttr);
578 ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
579 ktrans = (char)(255U - ktrans) << 24;
580 }
581
582 if (check_material) {
583 if (check_emis) {
584 GET_MAPATT(embuff, offset, kem);
585 kem = SCALE_ATT(ematt, kem, 0., 1.);
586 }
587
588 if (check_shin) {
589 GET_MAPATT(shbuff, offset, ksh);
590 ksh = SCALE_ATT(shatt, ksh, 0., 1.);
591 }
592
593 if (pksh != ksh || pkem != kem || (kem && check_color)) {
594 pksh = ksh;
595 pkem = kem;
597 curcolor);
598 }
599 }
600
602
603#ifdef CALC_AREA
604 GS_v3eq(triv[cnt % 3], pt);
605
606 if (cnt > 1) {
607 GS_v3eq(tedge1, triv[1]);
608 GS_v3eq(tedge2, triv[2]);
609 GS_v3sub(tedge1, triv[0]);
610 GS_v3sub(tedge2, triv[1]);
613 asurf += .5 * mag;
614 tedge1[Z] *= sz;
615 tedge2[Z] *= sz;
618 axsurf += .5 * mag;
619 }
620#endif
621
622 cnt++;
623 }
624
625 if (dr3) {
626 offset = y2off + datacol2; /* BR */
627 FNORM(surf->norms[offset], n);
628 pt[X] = x2;
629 pt[Y] = y2;
630 GET_MAPATT(buff, offset, pt[Z]);
631 pt[Z] *= zexag;
632
634 projMatrix)) {
635 gsd_endtmesh();
636 cnt = 0;
637 gsd_bgntmesh();
638 continue;
639 }
640
641 if (check_color) {
643 }
644
645 if (check_transp) {
646 GET_MAPATT(trbuff, offset, ttr);
647 ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
648 ktrans = (char)(255U - ktrans) << 24;
649 }
650
651 if (check_material) {
652 if (check_emis) {
653 GET_MAPATT(embuff, offset, kem);
654 kem = SCALE_ATT(ematt, kem, 0., 1.);
655 }
656
657 if (check_shin) {
658 GET_MAPATT(shbuff, offset, ksh);
659 ksh = SCALE_ATT(shatt, ksh, 0., 1.);
660 }
661
662 if (pksh != ksh || pkem != kem || (kem && check_color)) {
663 pksh = ksh;
664 pkem = kem;
666 curcolor);
667 }
668 }
669
671
672#ifdef CALC_AREA
673 GS_v3eq(triv[cnt % 3], pt);
674
675 if (cnt > 1) {
676 GS_v3eq(tedge1, triv[1]);
677 GS_v3eq(tedge2, triv[2]);
678 GS_v3sub(tedge1, triv[0]);
679 GS_v3sub(tedge2, triv[1]);
682 asurf += .5 * mag;
683 tedge1[Z] *= sz;
684 tedge2[Z] *= sz;
687 axsurf += .5 * mag;
688 }
689#endif
690
691 cnt++;
692 }
693 } /* ea col */
694
695 gsd_endtmesh();
696 } /* ea row */
697
699 gsd_blend(0);
700 gsd_zwritemask(0xffffffff);
701
703
704#ifdef CALC_AREA
705 G_debug(5, " Surface Area: %.12lf", asurf);
706 G_debug(5, " Exaggerated Surface Area: %.12lf", axsurf);
707#endif
708
709 return (0);
710}
711
712/*!
713 \brief
714
715 Using tmesh - not confident with qstrips portability
716
717 \todo FIX: do_diff won't work right - needs normals - maybe
718 calculate on the fly
719
720 \param surf surface (geosurf)
721 \param k
722
723 \return
724 */
726{
729 int xmod, ymod, row, col, cnt, xcnt, ycnt;
730 long offset, y1off, y2off;
731 float x1, x2, y1, y2, tx, ty, tz;
732 float n[3], pt[4], xres, yres, ymax, zexag;
733 int col_src, curcolor;
735
736 /* Viewport variables */
738 GLint viewport[4];
739 GLint window[4];
740
741 int zeros, dr1, dr2, dr3, dr4;
743
744 unsigned int ktrans = 255;
745
746 G_debug(5, "gsd_surf_const(): id=%d", surf->gsurf_id);
747
748 if (GS_check_cancel()) {
749 return (-1);
750 }
751
753
755 check_mask = surf->curmask ? 1 : 0;
756
757 /*
758 checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
759 combine it/them with any current mask, put in surf->curmask:
760 */
762 xmod = surf->x_mod;
763 ymod = surf->y_mod;
764 xres = xmod * surf->xres;
765 yres = ymod * surf->yres;
766
767 xcnt = VCOLS(surf);
768 ycnt = VROWS(surf);
769 ymax = (surf->rows - 1) * surf->yres;
770
771 /* Get Viewport */
773 /* adjust window */
774 window[0] += (int)(yres * 2);
775 window[1] -= (int)(yres * 2);
776 window[2] -= (int)(xres * 2);
777 window[3] += (int)(xres * 2);
778
781
782 /* avoid scaling by zero */
783 GS_get_scale(&tx, &ty, &tz, 1);
784
785 if (tz == 0.0) {
786 k = 0.0;
787 gsd_do_scale(0);
788 }
789 else {
790 gsd_do_scale(1);
791 }
792
793 gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
794 zexag = surf->z_exag;
795
796 if (CONST_ATT == surf->att[ATT_TRANSP].att_src) {
797 gsd_blend(1);
798 ktrans = 255 - (int)surf->att[ATT_TRANSP].constant;
799 gsd_zwritemask(0x0);
800 }
801
802 ktrans = (ktrans << 24);
803
804 /* will need to check for color source of FUNC_ATT & NOTSET_ATT,
805 or else use more general and inefficient gets */
806
807 check_color = 1;
808 coloratt = &(surf->att[ATT_COLOR]);
809 col_src = surf->att[ATT_COLOR].att_src;
810
811 if (col_src != MAP_ATT) {
812 if (col_src == CONST_ATT) {
813 curcolor = (int)surf->att[ATT_COLOR].constant;
814 }
815 else {
816 curcolor = surf->wire_color;
817 }
818
819 check_color = 0;
820 }
821
822 /* CONSTANTS */
823 pt[Z] = k * zexag;
824 n[X] = n[Y] = 0.0;
825 n[Z] = 1.0;
826
827 /* just draw one polygon if no color mapped */
828 /* fast, but specular reflection will prob. be poor */
829 if (!check_color && !check_mask && !do_diff) {
831
832 pt[X] = pt[Y] = 0;
834
835 pt[X] = xcnt * xres;
837
838 pt[Y] = ycnt * yres;
840
841 pt[X] = 0;
843
846 gsd_blend(0);
847 gsd_zwritemask(0xffffffff);
848
849 return (0);
850 }
851
852 cnt = 0;
853
854 for (row = 0; row < ycnt; row++) {
855 if (GS_check_cancel()) {
857 gsd_blend(0);
858 gsd_zwritemask(0xffffffff);
859
860 return (-1);
861 }
862
863 datarow1 = row * ymod;
864 datarow2 = (row + 1) * ymod;
865
866 y1 = ymax - row * yres;
867 y2 = ymax - (row + 1) * yres;
868 y1off = (long)row * ymod * surf->cols;
869 y2off = (long)(row + 1) * ymod * surf->cols;
870
871 gsd_bgntmesh();
872
873 zeros = 0;
874 dr1 = dr2 = dr3 = dr4 = 1;
875
876 if (check_mask) {
877 if (BM_get(surf->curmask, 0, datarow1)) {
878 /*TL*/ ++zeros;
879 dr1 = 0;
880 }
881
882 if (BM_get(surf->curmask, 0, datarow2)) {
883 /*BL*/ ++zeros;
884 dr2 = 0;
885 }
886 }
887
888 if (dr1 && dr2) {
889 offset = y1off; /* TL */
890 pt[X] = 0;
891 pt[Y] = y1;
892
893 if (check_color) {
895 }
896
897 if (do_diff) {
898 pt[Z] = gsdiff_do_SD(k * zexag, offset);
899 }
900
902 cnt++;
903
904 offset = y2off; /* BL */
905 pt[X] = 0;
906 pt[Y] = y2;
907
908 if (check_color) {
910 }
911
912 if (do_diff) {
913 pt[Z] = gsdiff_do_SD(k * zexag, offset);
914 }
915
917 cnt++;
918 }
919
920 for (col = 0; col < xcnt; col++) {
921 datacol1 = col * xmod;
922 datacol2 = (col + 1) * xmod;
923
924 x1 = col * xres;
925 x2 = (col + 1) * xres;
926
927 zeros = 0;
928 dr1 = dr2 = dr3 = dr4 = 1;
929
930 if (check_mask) {
931 if (BM_get(surf->curmask, datacol1, datarow1)) {
932 /*TL*/ ++zeros;
933 dr1 = 0;
934 }
935
936 if (BM_get(surf->curmask, datacol1, datarow2)) {
937 /*BL*/ ++zeros;
938 dr2 = 0;
939 }
940
941 if (BM_get(surf->curmask, datacol2, datarow2)) {
942 /*BR*/ ++zeros;
943 dr3 = 0;
944 }
945
946 if (BM_get(surf->curmask, datacol2, datarow1)) {
947 /*TR*/ ++zeros;
948 dr4 = 0;
949 }
950
951 if ((zeros > 1) && cnt) {
952 gsd_endtmesh();
953 cnt = 0;
954 gsd_bgntmesh();
955 continue;
956 }
957 }
958
959 if (cnt > 250) {
960 cnt = 0;
961 gsd_endtmesh();
962 gsd_bgntmesh();
963
964 if (dr1) {
965 offset = y1off + datacol1; /* TL */
966 pt[X] = x1;
967 pt[Y] = y1;
968
970 projMatrix)) {
971 gsd_endtmesh();
972 cnt = 0;
973 gsd_bgntmesh();
974 continue;
975 }
976
977 if (check_color) {
979 }
980
981 if (do_diff) {
982 pt[Z] = gsdiff_do_SD(k * zexag, offset);
983 }
984
986 cnt++;
987 }
988
989 if (dr2) {
990 offset = y2off + datacol1; /* BL */
991 pt[X] = x1;
992 pt[Y] = y2;
993
995 projMatrix)) {
996 gsd_endtmesh();
997 cnt = 0;
998 gsd_bgntmesh();
999 continue;
1000 }
1001
1002 if (check_color) {
1003 curcolor = gs_mapcolor(cobuff, coloratt, offset);
1004 }
1005
1006 if (do_diff) {
1007 pt[Z] = gsdiff_do_SD(k * zexag, offset);
1008 }
1009
1011 cnt++;
1012 }
1013 }
1014
1015 if (dr4) {
1016 offset = y1off + datacol2; /* TR */
1017 pt[X] = x2;
1018 pt[Y] = y1;
1019
1020 if (gsd_checkpoint(pt, window, viewport, modelMatrix,
1021 projMatrix)) {
1022 gsd_endtmesh();
1023 cnt = 0;
1024 gsd_bgntmesh();
1025 continue;
1026 }
1027
1028 if (check_color) {
1029 curcolor = gs_mapcolor(cobuff, coloratt, offset);
1030 }
1031
1032 if (do_diff) {
1033 pt[Z] = gsdiff_do_SD(k * zexag, offset);
1034 }
1035
1037 cnt++;
1038 }
1039
1040 if (dr3) {
1041 offset = y2off + datacol2; /* BR */
1042 pt[X] = x2;
1043 pt[Y] = y2;
1044
1045 if (gsd_checkpoint(pt, window, viewport, modelMatrix,
1046 projMatrix)) {
1047 gsd_endtmesh();
1048 cnt = 0;
1049 gsd_bgntmesh();
1050 continue;
1051 }
1052
1053 if (check_color) {
1054 curcolor = gs_mapcolor(cobuff, coloratt, offset);
1055 }
1056
1057 if (do_diff) {
1058 pt[Z] = gsdiff_do_SD(k * zexag, offset);
1059 }
1060
1062 cnt++;
1063 }
1064 } /* ea col */
1065
1066 gsd_endtmesh();
1067 } /* ea row */
1068
1069 gsd_popmatrix();
1070 gsd_blend(0);
1071 gsd_zwritemask(0xffffffff);
1072
1073 return (0);
1074}
1075
1076/*!
1077 \brief Define user function
1078
1079 Not yet supported
1080
1081 \param gs surface (geosurf) [unused]
1082 \param user_func user function [unused]
1083
1084 \return 1
1085 */
1086int gsd_surf_func(geosurf *gs G_UNUSED, int (*user_func)(void) G_UNUSED)
1087{
1088
1089 return (1);
1090}
1091
1092/*!
1093 \brief ADD
1094
1095 \param npts1
1096 \param npts2
1097 \param surf1 first surface (geosurf)
1098 \param surf2 second surface (geosurf)
1099 \param points1
1100 \param points2
1101 \param norm
1102
1103 \return 1
1104 */
1106 Point3 *points1, Point3 *points2, float *norm)
1107{
1108 int i, i1, i2, nlong, offset, col_src;
1112
1114
1115 col_src = surf1->att[ATT_COLOR].att_src;
1116
1117 if (col_src != MAP_ATT) {
1118 if (col_src == CONST_ATT) {
1119 color1 = (int)surf1->att[ATT_COLOR].constant;
1120 }
1121 else {
1122 color1 = surf1->wire_color;
1123 }
1124
1125 check_color1 = 0;
1126 }
1127
1128 coloratt1 = &(surf1->att[ATT_COLOR]);
1130
1131 col_src = surf2->att[ATT_COLOR].att_src;
1132 if (col_src != MAP_ATT) {
1133 if (col_src == CONST_ATT) {
1134 color2 = (int)surf2->att[ATT_COLOR].constant;
1135 }
1136 else {
1137 color2 = surf2->wire_color;
1138 }
1139
1140 check_color2 = 0;
1141 }
1142
1143 coloratt2 = &(surf2->att[ATT_COLOR]);
1145
1148 gsd_do_scale(1);
1149
1150 gsd_bgntmesh();
1151
1152 for (nlong = (npts1 > npts2 ? npts1 : npts2), i = 0; i < nlong; i++) {
1153 i1 = i * npts1 / nlong;
1154 i2 = i * npts2 / nlong;
1155 offset = XY2OFF(surf1, points1[i1][X], points1[i1][Y]);
1156
1157 if (check_color1) {
1158 color1 = gs_mapcolor(cobuf1, coloratt1, offset);
1159 }
1160
1161 offset = XY2OFF(surf1, points2[i2][X], points2[i2][Y]);
1162
1163 if (check_color2) {
1164 color2 = gs_mapcolor(cobuf2, coloratt2, offset);
1165 }
1166
1167 /* start with long line to ensure triangle */
1168 if (npts1 > npts2) {
1169 points1[i1][X] += surf1->x_trans;
1170 points1[i1][Y] += surf1->y_trans;
1171 points1[i1][Z] += surf1->z_trans;
1173 points2[i2][X] += surf2->x_trans;
1174 points2[i2][Y] += surf2->y_trans;
1175 points2[i2][Z] += surf2->z_trans;
1177 }
1178 else {
1179 points2[i2][X] += surf2->x_trans;
1180 points2[i2][Y] += surf2->y_trans;
1181 points2[i2][Z] += surf2->z_trans;
1183 points1[i1][X] += surf1->x_trans;
1184 points1[i1][Y] += surf1->y_trans;
1185 points1[i1][Z] += surf1->z_trans;
1187 }
1188 }
1189
1190 gsd_endtmesh();
1191 gsd_popmatrix();
1192
1193 return (1);
1194}
1195
1196/*!
1197 \brief ADD
1198
1199 \param mode
1200 */
1201void gsd_setfc(int mode)
1202{
1203 FCmode = mode;
1204
1205 return;
1206}
1207
1208/*!
1209 \brief ADD
1210
1211 \return
1212 */
1213int gsd_getfc(void)
1214{
1215 return (FCmode);
1216}
1217
1218/*!
1219 \brief ADD
1220
1221 \param surf surface (geosurf)
1222 \param point
1223
1224 \return
1225 */
1226static int transpoint_is_masked(geosurf *surf, Point3 point)
1227{
1228 Point3 tp;
1229
1230 tp[X] = point[X] - surf->x_trans;
1231 tp[Y] = point[Y] - surf->y_trans;
1232
1233 return (gs_point_is_masked(surf, tp));
1234}
1235
1236/*!
1237 \brief ADD
1238
1239 \param points
1240 \param gsurf
1241 \param ptn
1242 \param cursurf
1243 \param numsurfs
1244 \param belowsurf
1245
1246 \return 0 if there is no surface below the current,
1247 \return -1 if the current surface is masked,
1248 \return 1 if the surface below the current surface is not masked
1249 (belowsurf is assigned)
1250 */
1251static int get_point_below(Point3 **points, geosurf **gsurfs, int ptn,
1252 int cursurf, int numsurfs, int *belowsurf)
1253{
1254 int n, found = -1;
1255 float nearz = 0.0, diff;
1256
1257 if (gsurfs[cursurf]->curmask) {
1258 if (transpoint_is_masked(gsurfs[cursurf], points[cursurf][ptn])) {
1259 return (-1);
1260 }
1261 }
1262
1263 for (n = 0; n < numsurfs; ++n) {
1264 diff = points[cursurf][ptn][Z] - points[n][ptn][Z];
1265
1266 if (diff > 0) {
1267 if (!nearz || diff < nearz) {
1268 if (gsurfs[n]->curmask) {
1269 if (transpoint_is_masked(gsurfs[n], points[n][ptn])) {
1270 continue;
1271 }
1272 }
1273
1274 nearz = diff;
1275 found = n;
1276 }
1277 }
1278 /* else if (diff == 0.0 && n != cursurf)
1279 {
1280 if (gsurfs[n]->curmask)
1281 {
1282 if (transpoint_is_masked(gsurfs[n], points[n][ptn]))
1283 {
1284 continue;
1285 }
1286 }
1287
1288 nearz=diff;
1289 found = n;
1290 break;
1291 }
1292 */
1293 }
1294
1295 if (found != -1) {
1296 *belowsurf = found;
1297
1298 return (1);
1299 }
1300
1301 return (0);
1302}
1303
1304/*
1305 #define CPDEBUG
1306 */
1307
1308/*!
1309 \brief ADD
1310
1311 \param np
1312 \param ns
1313 \param gsurfs
1314 \param points
1315 \param norm
1316
1317 \return
1318 */
1319int gsd_ortho_wall(int np, int ns, geosurf **gsurfs, Point3 **points,
1320 float *norm)
1321{
1322 int n, i, offset, col_src, check_color[MAX_SURFS];
1323 int color, colors[MAX_SURFS], nocolor;
1326
1327 nocolor = FCmode == FC_GREY ? 1 : 0;
1328
1329 if (!nocolor) {
1330 for (n = 0; n < ns; ++n) {
1331 check_color[n] = 1;
1332
1333 col_src = gsurfs[n]->att[ATT_COLOR].att_src;
1334
1335 if (col_src != MAP_ATT) {
1336 if (col_src == CONST_ATT) {
1337 colors[n] = (int)gsurfs[n]->att[ATT_COLOR].constant;
1338 }
1339 else {
1340 colors[n] = gsurfs[n]->wire_color;
1341 }
1342
1343 check_color[n] = 0;
1344 }
1345
1346 coloratt[n] = &(gsurfs[n]->att[ATT_COLOR]);
1348 }
1349 }
1350
1351#ifdef CPDEBUG
1352 {
1354 }
1355#endif
1356
1357 /* changed from CM_DIFFUSE - July 25, 2005
1358 * should display proper color for cut planes
1359 */
1361
1362 /* actually ought to write a GS_set_fencetransp() */
1363 if (nocolor) {
1364 color = 0x80808080;
1365 gsd_blend(1);
1366 gsd_zwritemask(0x0);
1367 }
1368
1370 gsd_do_scale(1);
1371
1372 /* using segs_intersect here with segments projected to
1373 the 2d clipping plane */
1374 {
1375 float tx, ty;
1376 int bn, bnl, ctop, cbot, ctopl, cbotl, bsret;
1377 Point3 xing;
1378
1379 if (nocolor) {
1380 ctop = cbot = ctopl = cbotl = color;
1381 }
1382
1383 for (n = 0; n < ns; ++n) {
1384 for (i = 0; i < np; i++) {
1385 if (0 <
1386 (bsret = get_point_below(points, gsurfs, i, n, ns, &bn))) {
1387 gsd_bgntmesh();
1388
1389 if (!nocolor) {
1390 SET_SCOLOR(n);
1391 SET_SCOLOR(bn);
1392
1393 if (FCmode == FC_ABOVE) {
1394 ctop = cbot = colors[n];
1395 }
1396 else if (FCmode == FC_BELOW) {
1397 ctop = cbot = colors[bn];
1398 }
1399 else {
1400 cbot = colors[bn];
1401 ctop = colors[n];
1402 }
1403 }
1404
1405 if (i) {
1406 /* need to find crossing? */
1407 if (!transpoint_is_masked(gsurfs[n],
1408 points[n][i - 1]) &&
1409 !transpoint_is_masked(gsurfs[bn],
1410 points[bn][i - 1])) {
1411 if (1 == segs_intersect(0.0, points[n][i - 1][Z],
1412 1.0, points[n][i][Z], 0.0,
1413 points[bn][i - 1][Z], 1.0,
1414 points[bn][i][Z], &tx,
1415 &ty)) {
1416 xing[Z] = ty;
1417 xing[Y] = points[n][i - 1][Y] +
1418 tx * (points[n][i][Y] -
1419 points[n][i - 1][Y]);
1420 xing[X] = points[n][i - 1][X] +
1421 tx * (points[n][i][X] -
1422 points[n][i - 1][X]);
1423 gsd_litvert_func(norm, ctop, xing);
1424 xing[Z] = points[bn][i - 1][Z] +
1425 tx * (points[bn][i][Z] -
1426 points[bn][i - 1][Z]);
1427 gsd_litvert_func(norm, cbot, xing);
1428 }
1429 }
1430 }
1431
1432 gsd_litvert_func(norm, ctop, points[n][i]);
1433 gsd_litvert_func(norm, cbot, points[bn][i]);
1434 i++;
1435
1436 bnl = -1;
1437
1438 while (i < np && 0 < (bsret = get_point_below(
1439 points, gsurfs, i, n, ns, &bn))) {
1440#ifdef CPDEBUG
1441 {
1442 int lower = 0;
1443
1444 if (GS_check_cancel()) {
1445 break;
1446 }
1447 }
1448#endif
1449
1450 if (!nocolor) {
1451 ctopl = ctop;
1452 cbotl = cbot;
1453 SET_SCOLOR(n);
1454 SET_SCOLOR(bn);
1455
1456 if (FCmode == FC_ABOVE) {
1457 ctop = cbot = colors[n];
1458 }
1459 else if (FCmode == FC_BELOW) {
1460 ctop = cbot = colors[bn];
1461 }
1462 else {
1463 cbot = colors[bn];
1464 ctop = colors[n];
1465 }
1466 }
1467
1468 /*
1469 IF UPPER crossing :
1470 (crossing is between current & new lower surf)
1471 IF XING going DOWN:
1472 - plot crossing point (color previous upper)
1473 - endtmesh/bgntmesh
1474 - plot crossing point (color current upper)
1475 - plot "equivalent" point below (color current lower)
1476 IF XING going UP:
1477 - plot crossing point (color previous upper)
1478 - plot "equivalent" point below (color previous
1479 lower)
1480 - endtmesh/bgntmesh
1481 - plot crossing point (color current upper)
1482 ELSE IF LOWER crossing:
1483 (crossing between new & previous lower surfs):
1484 - plot "equivalent" point above (color previous
1485 upper)
1486 - plot crossing below (color previous lower)
1487 - endtmesh/bgntmesh
1488 - plot "equivalent" point above (color current upper)
1489 - plot crossing below (color current lower)
1490 */
1491 if (bnl >= 0 && bnl != bn) {
1492 /* crossing */
1493 float z1, z2;
1494 int upper = 0;
1495
1496 if (!transpoint_is_masked(gsurfs[n],
1497 points[n][i - 1]) &&
1498 !transpoint_is_masked(gsurfs[bnl],
1499 points[bnl][i - 1]) &&
1500 !transpoint_is_masked(gsurfs[bn],
1501 points[bn][i - 1])) {
1502
1503 if (1 == segs_intersect(
1504 0.0, points[n][i - 1][Z], 1.0,
1505 points[n][i][Z], 0.0,
1506 points[bn][i - 1][Z], 1.0,
1507 points[bn][i][Z], &tx, &ty)) {
1508 /* crossing going up */
1509
1510 G_debug(
1511 5,
1512 "crossing going up at surf %d no. %d",
1513 n, i);
1514
1515 upper = 1;
1516 xing[Z] = ty;
1517 xing[Y] = points[n][i - 1][Y] +
1518 tx * (points[n][i][Y] -
1519 points[n][i - 1][Y]);
1520 xing[X] = points[n][i - 1][X] +
1521 tx * (points[n][i][X] -
1522 points[n][i - 1][X]);
1523 gsd_litvert_func(norm, ctopl, xing);
1524 z1 = xing[Z];
1525 xing[Z] = points[bnl][i - 1][Z] +
1526 tx * (points[bnl][i][Z] -
1527 points[bnl][i - 1][Z]);
1528 gsd_litvert_func(norm, cbotl, xing);
1529 xing[Z] = z1;
1530 gsd_endtmesh();
1531 gsd_bgntmesh();
1532 gsd_litvert_func(norm, ctop, xing);
1533 }
1534 else if (1 == segs_intersect(
1535 0.0, points[n][i - 1][Z], 1.0,
1536 points[n][i][Z], 0.0,
1537 points[bnl][i - 1][Z], 1.0,
1538 points[bnl][i][Z], &tx,
1539 &ty)) {
1540 /* crossing going down */
1541
1542 G_debug(
1543 5,
1544 "crossing going down at surf %d no. %d",
1545 n, i);
1546
1547 upper = 1;
1548 xing[Z] = ty;
1549 xing[Y] = points[n][i - 1][Y] +
1550 tx * (points[n][i][Y] -
1551 points[n][i - 1][Y]);
1552 xing[X] = points[n][i - 1][X] +
1553 tx * (points[n][i][X] -
1554 points[n][i - 1][X]);
1555 gsd_litvert_func(norm, ctopl, xing);
1556 z1 = xing[Z];
1557 xing[Z] = points[bnl][i - 1][Z] +
1558 tx * (points[bnl][i][Z] -
1559 points[bnl][i - 1][Z]);
1560 gsd_litvert_func(norm, cbotl, xing);
1561 xing[Z] = z1;
1562 gsd_endtmesh();
1563 gsd_bgntmesh();
1564 gsd_litvert_func(norm, ctop, xing);
1565 xing[Z] = points[bn][i - 1][Z] +
1566 tx * (points[bn][i][Z] -
1567 points[bn][i - 1][Z]);
1568 gsd_litvert_func(norm, cbot, xing);
1569 }
1570 }
1571
1572 if (!upper &&
1573 !transpoint_is_masked(gsurfs[bn],
1574 points[bn][i - 1]) &&
1575 !transpoint_is_masked(gsurfs[bnl],
1576 points[bnl][i - 1])) {
1577
1578 if (1 == segs_intersect(
1579 0.0, points[bn][i - 1][Z], 1.0,
1580 points[bn][i][Z], 0.0,
1581 points[bnl][i - 1][Z], 1.0,
1582 points[bnl][i][Z], &tx, &ty)) {
1583#ifdef CPDEBUG
1584 {
1585 lower = 1;
1586 }
1587#endif
1588 G_debug(5,
1589 "lower crossing at surf %d no. %d "
1590 "between surfs %d & %d",
1591 n, i, bn, bnl);
1592
1593 xing[Z] = ty;
1594 xing[Y] = points[bn][i - 1][Y] +
1595 tx * (points[bn][i][Y] -
1596 points[bn][i - 1][Y]);
1597 xing[X] = points[bn][i - 1][X] +
1598 tx * (points[bn][i][X] -
1599 points[bn][i - 1][X]);
1600 z2 = xing[Z];
1601 z1 = xing[Z] = points[n][i - 1][Z] +
1602 tx * (points[n][i][Z] -
1603 points[n][i - 1][Z]);
1604 gsd_litvert_func(norm, ctopl, xing);
1605 xing[Z] = z2;
1606 gsd_litvert_func(norm, cbotl, xing);
1607 gsd_endtmesh();
1608 gsd_bgntmesh();
1609 xing[Z] = z1;
1610 gsd_litvert_func(norm, ctop, xing);
1611 xing[Z] = z2;
1612 gsd_litvert_func(norm, cbot, xing);
1613 }
1614 }
1615
1616#ifdef CPDEBUG
1617 {
1618 if (!upper && !lower) {
1619 G_debug(5, "Crossing NOT found or masked:");
1620 G_debug(5,
1621 " current surf: %d [ %.2f %.2f "
1622 "%.2f -> %.2f %.2f %f",
1623 n, points[n][i - 1][X],
1624 points[n][i - 1][Y],
1625 points[n][i - 1][Z],
1626 points[n][i][X], points[n][i][Y],
1627 points[n][i][Z]);
1628 G_debug(5,
1629 " below surf: %d [ %.2f %.2f %.2f "
1630 "-> %.2f %.2f %f\n",
1631 bn, points[bn][i - 1][X],
1632 points[bn][i - 1][Y],
1633 points[bn][i - 1][Z],
1634 points[bn][i][X], points[bn][i][Y],
1635 points[bn][i][Z]);
1636 G_debug(5,
1637 gs " last below surf: %d [ %.2f "
1638 "%.2f %.2f -> %.2f %.2f %f\n",
1639 bnl, points[bnl][i - 1][X],
1640 points[bnl][i - 1][Y],
1641 points[bnl][i - 1][Z],
1642 points[bnl][i][X],
1643 points[bnl][i][Y],
1644 points[bnl][i][Z]);
1645 }
1646 }
1647#endif
1648 }
1649
1650 gsd_litvert_func(norm, ctop, points[n][i]);
1651 gsd_litvert_func(norm, cbot, points[bn][i]);
1652 bnl = bn;
1653 i++;
1654 }
1655
1656 if (i < np) {
1657 /* need to find crossing? */
1658 if (!transpoint_is_masked(gsurfs[n],
1659 points[n][i - 1]) &&
1660 !transpoint_is_masked(gsurfs[bn],
1661 points[bn][i - 1])) {
1662 if (1 == segs_intersect(0.0, points[n][i - 1][Z],
1663 1.0, points[n][i][Z], 0.0,
1664 points[bn][i - 1][Z], 1.0,
1665 points[bn][i][Z], &tx,
1666 &ty)) {
1667 xing[Z] = ty;
1668 xing[Y] = points[n][i - 1][Y] +
1669 tx * (points[n][i][Y] -
1670 points[n][i - 1][Y]);
1671 xing[X] = points[n][i - 1][X] +
1672 tx * (points[n][i][X] -
1673 points[n][i - 1][X]);
1674 gsd_litvert_func(norm, ctop, xing);
1675 }
1676
1677 i--;
1678 }
1679 }
1680
1681 gsd_endtmesh();
1682 }
1683 }
1684 }
1685 }
1686
1687 gsd_colormode(CM_DIFFUSE); /* set colormode back to DIFFUSE */
1688 gsd_popmatrix();
1689 gsd_blend(0);
1690 gsd_zwritemask(0xffffffff);
1691
1692 return (1);
1693}
1694
1695/*!
1696 \brief ADD
1697
1698 bgn,end should already be in world modeling coords, but have to
1699 be reverse-translated to apply to each surface
1700
1701 \param bgn,end 2d line for cutting plane
1702 \param norm indicates which way wall faces
1703
1704 \return
1705 */
1706int gsd_wall(float *bgn, float *end, float *norm)
1707{
1709 Point3 *points[MAX_SURFS], *tmp;
1710 int nsurfs, ret, npts, npts1, n, i, err = 0;
1711 float bgn1[2], end1[2];
1712
1713 if (norm[Z] > 0.0001 || norm[Z] < -.0001) {
1714 return (0); /* can't do tilted wall yet */
1715 }
1716
1717 if (FCmode == FC_OFF) {
1718 return (0);
1719 }
1720
1722
1723 for (n = 0; n < nsurfs; n++) {
1724 /* get drape points for surf */
1725 bgn1[X] = bgn[X] - gsurfs[n]->x_trans;
1726 bgn1[Y] = bgn[Y] - gsurfs[n]->y_trans;
1727 end1[X] = end[X] - gsurfs[n]->x_trans;
1728 end1[Y] = end[Y] - gsurfs[n]->y_trans;
1730
1731 if (n) {
1732 if (npts != npts1) {
1733 G_warning(_("Cut-plane points mismatch between surfaces. "
1734 "Check resolution(s)."));
1735 err = 1;
1736 nsurfs = n;
1737
1738 break;
1739 }
1740 }
1741
1742 npts = npts1;
1743
1744 if (n == nsurfs - 1) {
1745 /* last surf - don't need to copy */
1746 points[n] = tmp;
1747
1748 for (i = 0; i < npts1; i++) {
1749 /* DOING translation here! */
1750 points[n][i][X] += gsurfs[n]->x_trans;
1751 points[n][i][Y] += gsurfs[n]->y_trans;
1752 points[n][i][Z] += gsurfs[n]->z_trans;
1753 }
1754
1755 break;
1756 }
1757
1758 /* allocate space in points and copy tmp to points */
1759 points[n] =
1760 (Point3 *)G_calloc(npts1, sizeof(Point3)); /* G_fatal_error */
1761
1762 for (i = 0; i < npts1; i++) {
1763 GS_v3eq(points[n][i], tmp[i]);
1764
1765 /* DOING translation here! */
1766 points[n][i][X] += gsurfs[n]->x_trans;
1767 points[n][i][Y] += gsurfs[n]->y_trans;
1768 points[n][i][Z] += gsurfs[n]->z_trans;
1769 }
1770 } /* done for */
1771
1772 if (err) {
1773 for (n = 0; n < nsurfs; n++) {
1774 if (points[n]) {
1775 G_free(points[n]);
1776 }
1777 }
1778 return (0);
1779 }
1780
1781 ret = gsd_ortho_wall(npts, nsurfs, gsurfs, points, norm);
1782
1783 for (n = 0; n < nsurfs - 1; n++) {
1784 /* don't free last - it's constant */
1785 G_free(points[n]);
1786 }
1787
1788 return (ret);
1789}
1790
1791/*!
1792 \brief ADD
1793
1794 Need to do Zexag scale of normal for arrow direction, drawing
1795 routine unexags z for arrow
1796
1797 \param surf surface (geosurf)
1798
1799 \return
1800 */
1802{
1803 typbuff *buff;
1804 int check_mask;
1805 int xmod, ymod, row, col, cnt, xcnt, ycnt;
1806 long offset, y1off, y2off;
1807 float /* x1, */ x2, y1, y2, tx, ty, tz, sz;
1808 float n[3], pt[4], xres, yres, ymax, zexag;
1809
1810#ifdef DO_ARROW_SOLID
1811 int col_src;
1812 typbuff *cobuff;
1814 int curcolor;
1815 int check_color = 1;
1816#endif
1817 int zeros, dr1, dr2, dr3, dr4;
1819
1820 G_debug(3, "gsd_norm_arrows");
1821
1822 /* avoid scaling by zero */
1823 GS_get_scale(&tx, &ty, &tz, 1);
1824
1825 if (tz == 0.0) {
1826 return (0);
1827 }
1828
1829 sz = GS_global_exag();
1830
1831 /*
1832 checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
1833 combine it/them with any current mask, put in surf->curmask:
1834 */
1836 check_mask = surf->curmask ? 1 : 0;
1837
1838#ifdef DO_ARROW_SOLID
1839 coloratt = &(surf->att[ATT_COLOR]);
1840 col_src = surf->att[ATT_COLOR].att_src;
1841
1842 if (col_src != MAP_ATT) {
1843 if (col_src == CONST_ATT) {
1844 curcolor = (int)surf->att[ATT_COLOR].constant;
1845 }
1846 else {
1847 curcolor = surf->wire_color;
1848 }
1849 check_color = 0;
1850 }
1851
1853#endif
1854
1855 buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
1856
1857 xmod = surf->x_mod;
1858 ymod = surf->y_mod;
1859 xres = xmod * surf->xres;
1860 yres = ymod * surf->yres;
1861 ymax = (surf->rows - 1) * surf->yres;
1862
1863 xcnt = VCOLS(surf);
1864 ycnt = VROWS(surf);
1865
1867 gsd_do_scale(1);
1868 gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
1869
1870 zexag = surf->z_exag;
1871 /* CURRENTLY ALWAYS 1.0 */
1872
1873#ifdef DO_ARROW_SOLID
1875#else
1877#endif
1878
1879 cnt = 0;
1880
1881 for (row = 0; row < ycnt; row++) {
1882 if (GS_check_cancel()) {
1883 gsd_popmatrix();
1884
1885 return (-1);
1886 }
1887
1888 datarow1 = row * ymod;
1889 datarow2 = (row + 1) * ymod;
1890
1891 y1 = ymax - row * yres;
1892 y2 = ymax - (row + 1) * yres;
1893 y1off = (long)row * ymod * surf->cols;
1894 y2off = (long)(row + 1) * ymod * surf->cols;
1895
1896 zeros = 0;
1897 dr1 = dr2 = dr3 = dr4 = 1;
1898
1899 if (check_mask) {
1900 if (BM_get(surf->curmask, 0, datarow1)) {
1901 /*TL*/ ++zeros;
1902 dr1 = 0;
1903 }
1904
1905 if (BM_get(surf->curmask, 0, datarow2)) {
1906 /*BL*/ ++zeros;
1907 dr2 = 0;
1908 }
1909 }
1910
1911 if (dr1 && dr2) {
1912 offset = y1off; /* TL */
1913 FNORM(surf->norms[offset], n);
1914 pt[X] = 0;
1915 pt[Y] = y2;
1916 GET_MAPATT(buff, offset, pt[Z]);
1917 pt[Z] *= zexag;
1918
1919#ifdef DO_ARROW_SOLID
1920 if (check_color) {
1921 curcolor = gs_mapcolor(cobuff, coloratt, offset);
1922 }
1923
1924 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
1925#else
1926 if (DEBUG_ARROW) {
1927 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
1928 }
1929#endif
1930
1931 cnt++;
1932
1933 offset = y2off; /* BL */
1934 FNORM(surf->norms[offset], n);
1935 pt[X] = 0;
1936 pt[Y] = y2;
1937 GET_MAPATT(buff, offset, pt[Z]);
1938 pt[Z] *= zexag;
1939
1940#ifdef DO_ARROW_SOLID
1941 if (check_color) {
1942 curcolor = gs_mapcolor(cobuff, coloratt, offset);
1943 }
1944
1945 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
1946#else
1947 if (DEBUG_ARROW) {
1948 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
1949 }
1950#endif
1951
1952 cnt++;
1953 }
1954
1955 for (col = 0; col < xcnt; col++) {
1956 datacol1 = col * xmod;
1957 datacol2 = (col + 1) * xmod;
1958
1959 /* x1 = col * xres; */
1960 x2 = (col + 1) * xres;
1961
1962 zeros = 0;
1963 dr1 = dr2 = dr3 = dr4 = 1;
1964
1965 if (check_mask) {
1966 if (BM_get(surf->curmask, datacol1, datarow1)) {
1967 /*TL*/ ++zeros;
1968 dr1 = 0;
1969 }
1970
1971 if (BM_get(surf->curmask, datacol1, datarow2)) {
1972 /*BL*/ ++zeros;
1973 dr2 = 0;
1974 }
1975
1976 if (BM_get(surf->curmask, datacol2, datarow2)) {
1977 /*BR*/ ++zeros;
1978 dr3 = 0;
1979 }
1980
1981 if (BM_get(surf->curmask, datacol2, datarow1)) {
1982 /*TR*/ ++zeros;
1983 dr4 = 0;
1984 }
1985
1986 if ((zeros > 1) && cnt) {
1987 cnt = 0;
1988 continue;
1989 }
1990 }
1991
1992 if (dr4) {
1993 offset = y1off + datacol2; /* TR */
1994 FNORM(surf->norms[offset], n);
1995 pt[X] = x2;
1996 pt[Y] = y1;
1997 GET_MAPATT(buff, offset, pt[Z]);
1998 pt[Z] *= zexag;
1999
2000#ifdef DO_ARROW_SOLID
2001 if (check_color) {
2002 curcolor = gs_mapcolor(cobuff, coloratt, offset);
2003 }
2004
2005 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
2006#else
2007 if (DEBUG_ARROW) {
2008 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
2009 }
2010#endif
2011
2012 cnt++;
2013 }
2014
2015 if (dr3) {
2016 offset = y2off + datacol2; /* BR */
2017 FNORM(surf->norms[offset], n);
2018 pt[X] = x2;
2019 pt[Y] = y2;
2020 GET_MAPATT(buff, offset, pt[Z]);
2021 pt[Z] *= zexag;
2022
2023#ifdef DO_ARROW_SOLID
2024 if (check_color) {
2025 curcolor = gs_mapcolor(cobuff, coloratt, offset);
2026 }
2027
2028 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
2029#else
2030 if (DEBUG_ARROW) {
2031 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
2032 }
2033#endif
2034
2035 cnt++;
2036 }
2037 } /* ea col */
2038 } /* ea row */
2039 gsd_popmatrix();
2040
2041 return (1);
2042}
2043
2044/*!
2045 \brief Draw surface using triangle fan instead of strip
2046
2047 Optimized by getting rid of BM_get mask check - GET_MAPPATT does same
2048 and returns zero if masked
2049
2050 Only do in window check on Fan center(v0) to further optimize -- this runs
2051 the risk of trimming points in view !!
2052
2053 \param surf surface (geosurf)
2054
2055 \return
2056 */
2058{
2059 int /* check_mask, */ check_color, check_transp;
2061 typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
2062 int xmod, ymod;
2063 int row, col, xcnt, ycnt;
2064 long y1off, y2off, y3off;
2065 long offset2[10];
2066 float pt2[10][2];
2067 int ii;
2068 float x1, x2, x3, y1, y2, y3, tx, ty, tz, ttr;
2069 float n[3], pt[4], xres, yres, ymax, zexag;
2072
2073 /* Viewport variables for accelerated drawing */
2075 GLint viewport[4];
2076 GLint window[4];
2077
2079
2080 /* int datarow1, datarow2, datarow3; */
2081
2082 float kem, ksh, pkem, pksh;
2083 unsigned int ktrans;
2084
2085 int step_val = 2; /* should always be factor of 2 for fan */
2086 int start_val = 1; /* one half of step_val */
2087
2088 /* avoid scaling by zero */
2089 GS_get_scale(&tx, &ty, &tz, 1);
2090
2091 if (tz == 0.0) {
2092 return (gsd_surf_const(surf, 0.0));
2093 }
2094 /* else if (surf->z_exag == 0.0)
2095 {
2096 return(gsd_surf_const(surf, surf->z_min));
2097 }
2098 NOT YET IMPLEMENTED */
2099
2100 buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
2102
2104 /* check_mask = surf->curmask ? 1 : 0; */
2105
2106 /*
2107 checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
2108 combine it/them with any current mask, put in surf->curmask:
2109 */
2110 xmod = surf->x_mod;
2111 ymod = surf->y_mod;
2112 xres = xmod * surf->xres;
2113 yres = ymod * surf->yres;
2114 ymax = (surf->rows - 1) * surf->yres;
2115
2116 xcnt = VCOLS(surf);
2117 ycnt = VROWS(surf);
2118
2119 /* Get viewport */
2121
2124 gsd_do_scale(1);
2125 gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
2126 zexag = surf->z_exag;
2127
2128 /* adjust window */
2129 window[0] += (int)(yres * 4 * zexag);
2130 window[1] -= (int)(yres * 4 * zexag);
2131 window[2] -= (int)(xres * 4 * zexag);
2132 window[3] += (int)(xres * 4 * zexag);
2133
2134 /* CURRENTLY ALWAYS 1.0 */
2135#ifdef CALC_AREA
2136 sz = GS_global_exag();
2137#endif
2138
2139 /* TODO: get rid of (define) these magic numbers scaling the attribute vals
2140 */
2141 check_transp = 0;
2142 tratt = &(surf->att[ATT_TRANSP]);
2143 ktrans = (255U << 24);
2144 trans_src = surf->att[ATT_TRANSP].att_src;
2145
2146 if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) {
2147 ktrans = (255 - (int)surf->att[ATT_TRANSP].constant) << 24;
2148 gsd_blend(1);
2149 gsd_zwritemask(0x0);
2150 }
2151 else if (MAP_ATT == trans_src) {
2153 check_transp = trbuff ? 1 : 0;
2154 gsd_blend(1);
2155 gsd_zwritemask(0x0);
2156 }
2157
2158 check_emis = 0;
2159 ematt = &(surf->att[ATT_EMIT]);
2160 kem = 0.0;
2161 pkem = 1.0;
2162 em_src = surf->att[ATT_EMIT].att_src;
2163
2164 if (CONST_ATT == em_src) {
2165 kem = surf->att[ATT_EMIT].constant / 255.;
2166 }
2167 else if (MAP_ATT == em_src) {
2169 check_emis = embuff ? 1 : 0;
2170 }
2171
2172 check_shin = 0;
2173 shatt = &(surf->att[ATT_SHINE]);
2174 ksh = 0.0;
2175 pksh = 1.0;
2176 sh_src = surf->att[ATT_SHINE].att_src;
2177
2178 if (CONST_ATT == sh_src) {
2179 ksh = surf->att[ATT_SHINE].constant / 255.;
2180 gsd_set_material(1, 0, ksh, kem, 0x0);
2181 }
2182 else if (MAP_ATT == sh_src) {
2184 check_shin = shbuff ? 1 : 0;
2185 }
2186
2187 /* will need to check for color source of FUNC_ATT & NOTSET_ATT,
2188 or else use more general and inefficient gets */
2189 check_color = 1;
2190 coloratt = &(surf->att[ATT_COLOR]);
2191 col_src = surf->att[ATT_COLOR].att_src;
2192
2193 if (col_src != MAP_ATT) {
2194 if (col_src == CONST_ATT) {
2195 curcolor = (int)surf->att[ATT_COLOR].constant;
2196 }
2197 else {
2198 curcolor = surf->wire_color;
2199 }
2200
2201 check_color = 0;
2202 }
2203
2205
2206 /* would also be good to check if colormap == surfmap, to increase speed */
2207 /* will also need to set check_transp, check_shine, etc & fix material */
2208
2209 for (row = start_val; row < ycnt; row += step_val) {
2210 if (GS_check_cancel()) {
2211 gsd_popmatrix();
2212 gsd_blend(0);
2213 gsd_zwritemask(0xffffffff);
2214
2215 return (-1);
2216 }
2217
2218 /*
2219 if (row == 201 && new_fan == 0) {
2220 xmod *= 2;
2221 ymod *= 2;
2222 xres = xmod * surf->xres;
2223 yres = ymod * surf->yres;
2224 step_val *= 2;
2225 new_fan = 1;
2226 row -= 1;
2227 row /= 2;
2228 }
2229 */
2230 /*
2231 datarow1 = row * ymod;
2232 datarow2 = (row - (step_val / 2)) * ymod;
2233 datarow3 = (row + (step_val / 2)) * ymod;
2234 */
2235
2236 y1 = ymax - row * yres;
2237 y2 = ymax - (row - (step_val / 2)) * yres;
2238 y3 = ymax - (row + (step_val / 2)) * yres;
2239
2240 y1off = (long)row * ymod * surf->cols;
2241 y2off = (long)(row - (step_val / 2)) * ymod * surf->cols;
2242 y3off = (long)(row + (step_val / 2)) * ymod * surf->cols;
2243
2244 for (col = start_val; col < xcnt; col += step_val) {
2245 datacol1 = col * xmod;
2246 datacol2 = (col - (step_val / 2)) * xmod;
2247 datacol3 = (col + (step_val / 2)) * xmod;
2248
2249 x1 = col * xres;
2250 x2 = (col - (step_val / 2)) * xres;
2251 x3 = (col + (step_val / 2)) * xres;
2252
2253 /* 0 */
2254 /*
2255 if (check_mask) {
2256 if (BM_get(surf->curmask, datacol1, datarow1))
2257 continue;
2258 }
2259 */
2260
2261 /* Do not need BM_get because GET_MAPATT calls
2262 * same and returns zero if masked
2263 */
2264 offset2[0] = y1off + datacol1; /* fan center */
2265 pt2[0][X] = x1;
2266 pt2[0][Y] = y1; /* fan center */
2267 pt[X] = pt2[0][X];
2268 pt[Y] = pt2[0][Y];
2269 if (!GET_MAPATT(buff, offset2[0], pt[Z]))
2270 continue; /* masked */
2271 else {
2272 pt[Z] *= zexag;
2273 if (gsd_checkpoint(pt, window, viewport, modelMatrix,
2274 projMatrix))
2275 continue;
2276 }
2277
2278 offset2[1] = y2off + datacol2;
2279 offset2[2] = y2off + datacol1;
2280 offset2[3] = y2off + datacol3;
2281 offset2[4] = y1off + datacol3;
2282 offset2[5] = y3off + datacol3;
2283 offset2[6] = y3off + datacol1;
2284 offset2[7] = y3off + datacol2;
2285 offset2[8] = y1off + datacol2;
2286 offset2[9] = y2off + datacol2; /* repeat 1st corner to close */
2287
2288 pt2[1][X] = x2;
2289 pt2[1][Y] = y2;
2290 pt2[2][X] = x1;
2291 pt2[2][Y] = y2;
2292 pt2[3][X] = x3;
2293 pt2[3][Y] = y2;
2294 pt2[4][X] = x3;
2295 pt2[4][Y] = y1;
2296 pt2[5][X] = x3;
2297 pt2[5][Y] = y3;
2298 pt2[6][X] = x1;
2299 pt2[6][Y] = y3;
2300 pt2[7][X] = x2;
2301 pt2[7][Y] = y3;
2302 pt2[8][X] = x2;
2303 pt2[8][Y] = y1;
2304 pt2[9][X] = x2;
2305 pt2[9][Y] = y2; /* repeat 1st corner to close */
2306
2307 /* Run through triangle fan */
2308 gsd_bgntfan();
2309 for (ii = 0; ii < 10; ii++) {
2310
2311 if (ii > 0) {
2312 pt[X] = pt2[ii][X];
2313 pt[Y] = pt2[ii][Y];
2314 if (!GET_MAPATT(buff, offset2[ii], pt[Z]))
2315 continue;
2316 pt[Z] *= zexag;
2317 }
2318
2319 FNORM(surf->norms[offset2[ii]], n);
2320
2321 if (check_color)
2323
2324 if (check_transp) {
2326 ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
2327 ktrans = (char)(255U - ktrans) << 24;
2328 }
2329
2330 if (check_material) {
2331 if (check_emis) {
2333 kem = SCALE_ATT(ematt, kem, 0., 1.);
2334 }
2335
2336 if (check_shin) {
2338 ksh = SCALE_ATT(shatt, ksh, 0., 1.);
2339 }
2340
2341 if (pksh != ksh || pkem != kem || (kem && check_color)) {
2342 pksh = ksh;
2343 pkem = kem;
2345 curcolor);
2346 }
2347 }
2348
2350
2351 } /* close ii loop */
2352 gsd_endtfan();
2353 } /* end col */
2354 } /* end row */
2355
2356 gsd_popmatrix();
2357 gsd_blend(0);
2358 gsd_zwritemask(0xffffffff);
2359
2360 return (0);
2361}
#define NULL
Definition ccmath.h:32
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
Definition bitmap.c:213
void G_free(void *)
Free allocated memory.
Definition gis/alloc.c:145
#define G_calloc(m, n)
Definition defs/gis.h:137
void G_warning(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int gs_point_is_masked(geosurf *, float *)
Check if point is masked.
Definition gs.c:1310
void gsd_endtfan(void)
ADD.
Definition gsd_prim.c:343
void gsd_endtmesh(void)
ADD.
Definition gsd_prim.c:303
void gsd_pushmatrix(void)
Push the current matrix stack.
Definition gsd_prim.c:507
Point3 * gsdrape_get_allsegments(geosurf *, float *, float *, int *)
Get all segments.
Definition gsdrape.c:396
void GS_set_draw(int)
Sets which buffer to draw to.
Definition gs2.c:2458
void gsd_getwindow(int *, int *, double *, double *)
Get viewport.
Definition gsd_prim.c:550
int gs_getall_surfaces(geosurf **)
Get array of geosurf structs.
Definition gs.c:105
void gsd_do_scale(int)
Set current scale.
Definition gsd_views.c:351
void GS_v3sub(float *, float *)
Subtract vectors.
Definition gs_util.c:208
void GS_v3mag(float *, float *)
Magnitude of vector.
Definition gs_util.c:414
int gs_get_att_src(geosurf *, int)
Get attribute source.
Definition gs.c:652
void gsd_bgnpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
Definition gsd_prim.c:368
int gs_calc_normals(geosurf *)
Calculate normals.
Definition gs_norms.c:120
int segs_intersect(float, float, float, float, float, float, float, float, float *, float *)
Line intersect.
Definition gsdrape.c:1206
int gsd_checkpoint(float[4], int[4], int[4], double[16], double[16])
ADD.
Definition gsd_prim.c:581
void GS_v3eq(float *, float *)
Copy vector values.
Definition gs_util.c:174
int gs_mapcolor(typbuff *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
Definition gs.c:964
int gs_update_curmask(geosurf *)
Update current maps.
Definition gs_bm.c:224
void show_colormode(void)
Print color mode to stderr.
Definition gsd_prim.c:147
void gsd_translate(float, float, float)
Multiply the current matrix by a translation matrix.
Definition gsd_prim.c:535
void gsd_popmatrix(void)
Pop the current matrix stack.
Definition gsd_prim.c:497
void GS_v3cross(float *, float *, float *)
Get the cross product v3 = v1 cross v2.
Definition gs_util.c:399
void gsd_zwritemask(unsigned long)
Write out z-mask.
Definition gsd_prim.c:237
void gsd_colormode(int)
Set color mode.
Definition gsd_prim.c:94
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
Definition gs.c:677
void GS_get_scale(float *, float *, float *, int)
Get axis scale.
Definition gs2.c:3235
void gsd_bgntfan(void)
ADD.
Definition gsd_prim.c:333
void gsd_set_material(int, int, float, float, int)
Set material.
Definition gsd_prim.c:799
void gsd_3darrow(float *, unsigned long, float, float, float *, float)
Draw 3d north arrow.
Definition gsd_objs.c:1107
float gsdiff_do_SD(float, int)
ADD.
Definition gsdiff.c:90
void gsd_blend(int)
Specify pixel arithmetic.
Definition gsd_prim.c:990
void gsd_bgntmesh(void)
ADD.
Definition gsd_prim.c:293
int GS_check_cancel(void)
Check for cancel.
Definition gsx.c:26
int gsd_arrow(float *, unsigned long, float, float *, float, geosurf *)
Draws an arrow.
Definition gsd_objs.c:944
void gsd_endpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
Definition gsd_prim.c:383
geosurf * gsdiff_get_SDref(void)
ADD.
Definition gsdiff.c:73
void gsd_litvert_func(float *, unsigned long, float *)
Set the current normal vector & specify vertex.
Definition gsd_prim.c:653
float GS_global_exag(void)
Get global z-exag value.
Definition gs2.c:1996
#define G_UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition gis.h:43
#define _(str)
Definition glocale.h:10
int gsd_getfc(void)
ADD.
Definition gsd_surf.c:1213
int gsd_triangulated_wall(int npts1, int npts2, geosurf *surf1, geosurf *surf2, Point3 *points1, Point3 *points2, float *norm)
ADD.
Definition gsd_surf.c:1105
int gsd_ortho_wall(int np, int ns, geosurf **gsurfs, Point3 **points, float *norm)
ADD.
Definition gsd_surf.c:1319
void gsd_setfc(int mode)
ADD.
Definition gsd_surf.c:1201
#define DEBUG_ARROW
Definition gsd_surf.c:38
int gsd_norm_arrows(geosurf *surf)
ADD.
Definition gsd_surf.c:1801
int gsd_surf_func(geosurf *gs, int(*user_func)(void))
Define user function.
Definition gsd_surf.c:1086
int gsd_surf_const(geosurf *surf, float k)
Using tmesh - not confident with qstrips portability.
Definition gsd_surf.c:725
int gsd_surf_map(geosurf *surf)
Draw surface using triangle fan instead of strip.
Definition gsd_surf.c:2057
int gsd_wall(float *bgn, float *end, float *norm)
ADD.
Definition gsd_surf.c:1706
int gsd_surf(geosurf *surf)
ADD.
Definition gsd_surf.c:76
#define SET_SCOLOR(sf)
MACROS for use in gsd_ortho_wall ONLY !!!
Definition gsd_surf.c:43
int gsd_surf_map_old(geosurf *surf)
ADD.
Definition gsd_surf.c:135
#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
OGSF header file (structures)
#define NOTSET_ATT
Definition ogsf.h:85
#define CM_DIFFUSE
Definition ogsf.h:152
#define X
Definition ogsf.h:141
#define ATT_TOPO
Definition ogsf.h:76
#define ATT_COLOR
Definition ogsf.h:77
float Point3[3]
Definition ogsf.h:206
#define ATT_EMIT
Definition ogsf.h:81
#define Z
Definition ogsf.h:143
#define GSD_BOTH
Definition ogsf.h:107
#define FC_GREY
Definition ogsf.h:114
#define ATT_SHINE
Definition ogsf.h:80
#define Y
Definition ogsf.h:142
#define MAP_ATT
Definition ogsf.h:86
#define CM_COLOR
Definition ogsf.h:149
#define MAX_SURFS
Definition ogsf.h:41
#define FC_OFF
Definition ogsf.h:110
#define FUNC_ATT
Definition ogsf.h:88
#define FC_BELOW
Definition ogsf.h:112
#define FC_ABOVE
Definition ogsf.h:111
#define CONST_ATT
Definition ogsf.h:87
#define ATT_TRANSP
Definition ogsf.h:79
#define VCOLS(gs)
Definition rowcol.h:14
#define VROWS(gs)
Definition rowcol.h:13
#define XY2OFF(gs, px, py)
Definition rowcol.h:24
Definition ogsf.h:267
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)