1/*! \page ogsflib GRASS GIS OGSF Library
2<!-- doxygenized from "GRASS 5 Programmer's Manual"
3     by M. Neteler 2/2004
4     Updated by Martin Landa <landa.martin gmail.com> in 6/2011
5  -->
6
7by GRASS Development Team (https://grass.osgeo.org)
8
9\section ogsfintro OGSF Library for OpenGL programming
10
11<b>Overview</b>
12
13The OGSF (gsurf) library, consisting of approximately 27,000 lines of
14C code, contains some 250 public functions and about twice as many
15internal functions for run-time data storage, manipulation, querying,
16and visualization using OpenGL. The library handles all drawing and
17lighting operations, including use of user-defined clipping planes and
18drawing various style "fences" on clipping planes when drawing
19multiple surfaces, and treats datasets as objects which can be used
20for various attributes of the rendering.  It allows data sharing
21(%e.g., same data for more than one attribute of same or different
22surfaces), separate masking for each surface, multiple surfaces,
23%vector sets, or %point sets, and will also allow multiple volumes.
24The library provides all query features such as 3D "point on surface",
25keyframe animation routines, and full state saving functionality.
26Database-specific routines for interfacing with the \ref gislib are
27kept isolated for easier library reuse with other databases.  The
28gsurf library is not dependent upon any particular interface library,
29and has been used successfully with both Motif, Tcl/Tk or wxPython. It
30is used for Nviz visualization tool.
31
32The library is designed to provide a unique "handle" or identifier
33number to the calling program for each new geographic object added to
34the model.  The object could be a surface, %vector set, or %point set,
35which could each be defined by one or more database files. Once
36created, the application only needs to keep track of the "handles" to
37the objects (which are returned by the creation routines); for
38example, to draw a surface the application would make the call:
39
40\subsection ogsfNames Naming Conventions
41
42The following naming conventions for function prefixes are used:
43
44 - <b>GS_</b> - Functions which have to do with loading &amp;
45        manipulating surfaces.  Also functions for library
46        initialization, setting global variables, viewer positioning,
47        and lighting.
48
49 - <b>GSU_</b> - Utility functions for distance calculations, common
50        2D &amp; 3D unit %vector operations such as cross product or
51        %vector arithmetic.
52
53 - <b>GV_</b> - Functions which have to do with loading &amp;
54   manipulating %vector sets.
55
56 - <b>GP_</b> - Functions which have to do with loading &amp;
57   manipulating %point sets.
58
59 - <b>GVL_</b> - Functions which have to do with loading &amp;
60   manipulating 3D volumes.
61
62 - <b>GK_</b> - Functions which have to do with setting &amp;
63        manipulating keyframes for viewer position animation (fly-bys).
64
65Programmers' documentation is currently incomplete, but see the
66following for more details of the library design and capabilities in
67the appendix (PLEASE ADD EXPLANATIONS!!):
68
69 - public function prototypes
70 - public include file include/gsurf.h
71 - public include file include/keyframe.h
72 - public color packing utility macros rgbpack.h
73 - private types and defines include/gstypes.h
74 - private utilities gsget.h
75
76\section ogsfTodo Major todos
77
78- remove global variables
79- dynamically allocate items instead of static arrays
80- merge GP_ functions into GV_
81
82\section ogsfPublic Public function prototypes
83
84\subsection ogsfGs Initialization and positioning surfaces (GS)
85
86Functions which have to do with loading &amp; manipulating surfaces.
87Also functions for library initialization, setting global variables,
88viewer positioning, and lighting.
89
90- GS_alldraw_cplane_fences()
91
92- GS_alldraw_surf()
93
94- GS_alldraw_wire()
95
96- GS_check_cancel()
97
98- GS_clear()
99
100- GS_coordpair_repeats()
101
102- GS_delete_list()
103
104- GS_delete_surface()
105
106- GS_distance()
107
108- GS_done_draw()
109
110- GS_draw_all_list()
111
112- GS_draw_cplane()
113
114- GS_draw_cplane_fence()
115
116- GS_draw_flowline_at_xy()
117
118- GS_draw_fringe()
119
120- GS_draw_legend()
121
122- GS_draw_lighting_model()
123
124- GS_draw_lighting_model1()
125
126- GS_draw_line_onsurf()
127
128- GS_draw_nline_onsurf()
129
130- GS_draw_surf()
131
132- GS_draw_wire()
133
134- GS_draw_X()
135
136- GS_dv3norm()
137
138- GS_geodistance()
139
140- GS_get_aspect()
141
142- GS_get_att()
143
144- GS_get_cat_at_xy()
145
146- GS_Get_ClientData()
147
148- GS_get_dims()
149
150- GS_get_distance_alongsurf()
151
152- GS_get_drawmode()
153
154- GS_get_drawres()
155
156- GS_get_exag_guess()
157
158- GS_get_fencecolor()
159
160- GS_get_focus()
161
162- GS_get_fov()
163
164- GS_get_from()
165
166- GS_get_from_real()
167
168- GS_getlight_ambient()
169
170- GS_getlight_color()
171
172- GS_getlight_position()
173
174- GS_get_longdim()
175
176- GS_get_maskmode()
177
178- GS_get_modelposition()
179
180- GS_get_modelposition1()
181
182- GS_get_norm_at_xy()
183
184- GS_get_nozero()
185
186- GS_get_region()
187
188- GS_get_scale()
189
190- GS_get_SDscale()
191
192- GS_get_SDsurf()
193
194- GS_get_selected_point_on_surface()
195
196- GS_get_surf_list()
197
198- GS_get_to()
199
200- GS_get_to_real()
201
202- GS_get_trans()
203
204- GS_get_twist()
205
206- GS_get_val_at_xy()
207
208- GS_get_viewdir()
209
210- GS_get_wire_color()
211
212- GS_get_zextents()
213
214- GS_get_zrange()
215
216- GS_get_zrange_nz()
217
218- GS_global_exag()
219
220- GS_has_transparency()
221
222- GS_init_view()
223
224- GS_is_masked()
225
226- GS_libinit()
227
228- GS_lights_off()
229
230- GS_lights_on()
231
232- GS_load_3dview()
233
234- GS_load_att_map()
235
236- GS_look_here()
237
238- GS_moveto()
239
240- GS_moveto_real()
241
242- GS_new_light()
243
244- GS_new_surface()
245
246- GS_num_surfs()
247
248- GS_P2distance()
249
250- GS_ready_draw()
251
252- GS_save_3dview()
253
254- GS_setall_drawmode()
255
256- GS_setall_drawres()
257
258- GS_set_att_const()
259
260- GS_set_att_defaults()
261
262- GS_set_cancel()
263
264- GS_Set_ClientData()
265
266- GS_set_cplane()
267
268- GS_set_cplane_rot()
269
270- GS_set_cplane_trans()
271
272- GS_set_cxl_func()
273
274- GS_set_draw()
275
276- GS_set_drawmode()
277
278- GS_set_drawres()
279
280- GS_set_exag()
281
282- GS_set_fencecolor()
283
284- GS_set_focus()
285
286- GS_set_focus_center_map()
287
288- GS_set_focus_real()
289
290- GS_set_fov()
291
292- GS_set_global_exag()
293
294- GS_set_infocus()
295
296- GS_setlight_ambient()
297
298- GS_setlight_color()
299
300- GS_setlight_position()
301
302- GS_set_maskmode()
303
304- GS_set_Narrow()
305
306- GS_set_nofocus()
307
308- GS_set_nozero()
309
310- GS_set_SDscale()
311
312- GS_set_SDsurf()
313
314- GS_set_trans()
315
316- GS_set_twist()
317
318- GS_set_viewdir()
319
320- GS_set_viewport()
321
322- GS_set_wire_color()
323
324- GS_surf_exists()
325
326- GS_switchlight()
327
328- GS_transp_is_set()
329
330- GS_unset_att()
331
332- GS_unset_cplane()
333
334- GS_unset_SDsurf()
335
336- GS_update_curmask()
337
338- GS_update_normals()
339
340- GS_util.c()
341
342- GS_v2dir()
343
344- GS_v2norm()
345
346- GS_v3add()
347
348- GS_v3cross()
349
350- GS_v3dir()
351
352- GS_v3eq()
353
354- GS_v3mag()
355
356- GS_v3mult()
357
358- GS_v3norm()
359
360- GS_v3normalize()
361
362- GS_v3sub()
363
364- GS_write_ppm()
365
366- GS_write_tif()
367
368- GS_write_zoom()
369
370- GS_zoom_setup()
371
372\subsection ogsfGv Loading and manipulation of vector maps (GV)
373
374Functions which have to do with loading &amp; manipulating %vector
375sets.
376
377- GV_alldraw_fastvect()
378
379- GV_alldraw_vect()
380
381- GV_delete_vector()
382
383- GV_draw_fastvect()
384
385- GV_draw_vect()
386
387- GV_Get_ClientData()
388
389- GV_get_trans()
390
391- GV_get_vect_list()
392
393- GV_get_style()
394
395- GV_get_vectname()
396
397- GV_load_vector()
398
399- GV_new_vector()
400
401- GV_num_vects()
402
403- GV_select_surf()
404
405- GV_Set_ClientData()
406
407- GV_set_trans()
408
409- GV_set_style()
410
411- GV_surf_is_selected()
412
413- GV_unselect_surf()
414
415- GV_vect_exists()
416
417\subsection ogsfGp Loading and manipulation of vector point maps (GP)
418
419Functions which have to do with loading &amp; manipulating %point
420sets.
421
422- GP_alldraw_site()
423
424- GP_attmode_color()
425
426- GP_attmode_none()
427
428- GP_delete_site()
429
430- GP_draw_site()
431
432- GP_Get_ClientData()
433
434- GP_get_site_list()
435
436- GP_get_sitename()
437
438- GP_get_style()
439
440- GP_get_trans()
441
442- GP_get_zmode()
443
444- GP_load_site()
445
446- GP_new_site()
447
448- GP_num_sites()
449
450- GP_select_surf()
451
452- GP_Set_ClientData()
453
454- GP_set_style()
455
456- GP_set_style_thematic()
457
458- GP_set_trans()
459
460- GP_set_zmode()
461
462- GP_site_exists()
463
464- GP_str_to_marker()
465
466- GP_surf_is_selected()
467
468- GP_unselect_surf()
469
470\subsection ogsf ogsfGk Keyframe animation
471
472Functions which have to do with setting &amp; manipulating keyframes
473for viewer position animation (fly-bys).
474
475- GK_add_key()
476
477- GK_clear_keys()
478
479- GK_delete_key()
480
481- GK_do_framestep()
482
483- GK_move_key()
484
485- GK_print_keys()
486
487- GK_set_interpmode()
488
489- GK_set_numsteps()
490
491- GK_set_tension()
492
493- GK_show_list()
494
495- GK_show_path()
496
497- GK_show_site()
498
499- GK_showtension_start()
500
501- GK_showtension_stop()
502
503- GK_show_vect()
504
505- GK_show_vol()
506
507- GK_update_frames()
508
509- GK_update_tension()
510
511
512\subsection ogsfGvl  Loading and manipulation of volume maps (GVL)
513
514Functions which have to do with loading &amp; manipulating 3D volumes.
515
516- GVL_alldraw_vol()
517
518- GVL_alldraw_wire()
519
520- GVL_delete_vol()
521
522- GVL_draw_vol()
523
524- GVL_draw_wire()
525
526- GVL_Get_ClientData()
527
528- GVL_get_dims()
529
530- GVL_get_region()
531
532- GVL_get_trans()
533
534- GVL_get_vol_list()
535
536- GVL_get_volname()
537
538- GVL_get_window()
539
540- GVL_isosurf_add()
541
542- GVL_isosurf_del()
543
544- GVL_isosurf_get_att()
545
546- GVL_isosurf_get_drawmode()
547
548- GVL_isosurf_get_drawres()
549
550- GVL_isosurf_get_flags()
551
552- GVL_isosurf_get_maskmode()
553
554- GVL_isosurf_move_down()
555
556- GVL_isosurf_move_up()
557
558- GVL_isosurf_num_isosurfs()
559
560- GVL_isosurf_set_att_const()
561
562- GVL_isosurf_set_att_map()
563
564- GVL_isosurf_set_drawmode()
565
566- GVL_isosurf_set_drawres()
567
568- GVL_isosurf_set_flags()
569
570- GVL_isosurf_set_maskmode()
571
572- GVL_isosurf_unset_att()
573
574- GVL_libinit()
575
576- GVL_load_vol()
577
578- GVL_new_vol()
579
580- GVL_num_vols()
581
582- GVL_Set_ClientData()
583
584- GVL_set_focus_center_map()
585
586- GVL_set_trans()
587
588- GVL_slice_add()
589
590- GVL_slice_del()
591
592- GVL_slice_get_drawmode()
593
594- GVL_slice_get_drawres()
595
596- GVL_slice_get_pos()
597
598- GVL_slice_get_transp()
599
600- GVL_slice_move_down()
601
602- GVL_slice_move_up()
603
604- GVL_slice_num_slices()
605
606- GVL_slice_set_drawmode()
607
608- GVL_slice_set_drawres()
609
610- GVL_slice_set_pos()
611
612- GVL_slice_set_transp()
613
614- GVL_vol_exists()
615
616\subsection ogsfGvlIso Loading and manipulation of isosurfaces (GVL)
617
618Functions which have to do with loading &amp; manipulating
619isosurfaces.
620
621- GVL_isosurf_add()
622
623- GVL_isosurf_del()
624
625- GVL_isosurf_get_att()
626
627- GVL_isosurf_get_drawmode()
628
629- GVL_isosurf_get_drawres()
630
631- GVL_isosurf_get_flags()
632
633- GVL_isosurf_get_maskmode()
634
635- GVL_isosurf_move_down()
636
637- GVL_isosurf_move_up()
638
639- GVL_isosurf_num_isosurfs()
640
641- GVL_isosurf_set_att_const()
642
643- GVL_isosurf_set_att_map()
644
645- GVL_isosurf_set_drawmode()
646
647- GVL_isosurf_set_drawres()
648
649- GVL_isosurf_set_flags()
650
651- GVL_isosurf_set_maskmode()
652
653- GVL_isosurf_unset_att()
654
655\subsection ogsfGvlSlice  Loading and manipulation of slices (GVL)
656
657Functions which have to do with loading &amp; manipulating slices.
658
659- GVL_slice_add()
660
661- GVL_slice_del()
662
663- GVL_slice_get_drawmode()
664
665- GVL_slice_get_drawres()
666
667- GVL_slice_get_pos()
668
669- GVL_slice_get_transp()
670
671- GVL_slice_move_down()
672
673- GVL_slice_move_up()
674
675- GVL_slice_num_slices()
676
677- GVL_slice_set_drawmode()
678
679- GVL_slice_set_drawres()
680
681- GVL_slice_set_pos()
682
683- GVL_slice_set_transp()
684
685\section authors Authors
686
687 Bill Brown GMSL/University of Illinois
688
689*/
690