GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-761b3a08c9
nviz.h
Go to the documentation of this file.
1 #ifndef GRASS_NVIZ_H
2 #define GRASS_NVIZ_H
3 
4 #include <grass/config.h>
5 
6 /*** Windows headers ***/
7 #if defined(OPENGL_WINDOWS)
8 #define WIN32_LEAN_AND_MEAN
9 #include <windows.h>
10 #undef WIN32_LEAN_AND_MEAN
11 #include <winnt.h>
12 #include <GL/gl.h>
13 #include <GL/glext.h>
14 
15 /*** X Window System headers ***/
16 #elif defined(OPENGL_X11)
17 #include <X11/Xlib.h>
18 #include <X11/Xutil.h>
19 #include <X11/Xatom.h> /* for XA_RGB_DEFAULT_MAP atom */
20 #define GL_GLEXT_PROTOTYPES
21 #include <GL/glx.h>
22 
23 /*** Mac headers ***/
24 #elif defined(OPENGL_AQUA)
25 #if defined(OPENGL_AGL)
26 #define Cursor QDCursor
27 #include <AGL/agl.h>
28 #undef Cursor
29 #else
30 #include <OpenGL/CGLTypes.h>
31 #include <OpenGL/CGLCurrent.h>
32 #include <OpenGL/OpenGL.h>
33 #endif
34 #include <ApplicationServices/ApplicationServices.h>
35 
36 #else /* make sure only one platform defined */
37 #error Unsupported platform, or confused platform defines...
38 #endif
39 
40 #include <grass/ogsf.h>
41 
42 #define MAP_OBJ_UNDEFINED 0
43 #define MAP_OBJ_SURF 1
44 #define MAP_OBJ_VOL 2
45 #define MAP_OBJ_VECT 3
46 #define MAP_OBJ_SITE 4
47 
48 #define DRAW_COARSE 0
49 #define DRAW_FINE 1
50 #define DRAW_BOTH 2
51 
52 /* quick draw mode */
53 #define DRAW_QUICK_SURFACE 0x01
54 #define DRAW_QUICK_VLINES 0x02
55 #define DRAW_QUICK_VPOINTS 0x04
56 #define DRAW_QUICK_VOLUME 0x08
57 
58 #define RANGE (5 * GS_UNIT_SIZE)
59 #define RANGE_OFFSET (2 * GS_UNIT_SIZE)
60 #define ZRANGE (3 * GS_UNIT_SIZE)
61 #define ZRANGE_OFFSET (1 * GS_UNIT_SIZE)
62 
63 #define DEFAULT_SURF_COLOR 0x33BBFF
64 
65 #define FORMAT_PPM 1
66 #define FORMAT_TIF 2
67 
68 /* data structures */
69 typedef struct {
70  int id;
71  float brt;
72  float r, g, b;
73  float ar, ag, ab; /* ambient rgb */
74  float x, y, z, w; /* position */
75 } light_data;
76 
77 struct fringe_data {
78  int id;
79  unsigned long color;
80  float elev;
81  int where[4];
82 };
83 
84 struct arrow_data {
85  unsigned long color;
86  float size;
87  float where[3];
88 };
89 
90 struct scalebar_data {
91  int id;
92  unsigned long color;
93  float size;
94  float where[3];
95 };
96 
97 typedef struct {
98  /* ranges */
99  float zrange, xyrange;
100 
101  /* cplanes */
103  int cur_cplane, cp_on[MAX_CPLANES];
104  float cp_trans[MAX_CPLANES][3];
105  float cp_rot[MAX_CPLANES][3];
106 
107  /* light */
109 
110  /* fringe */
112  struct fringe_data **fringe;
113 
114  /* north arrow */
116  struct arrow_data *arrow;
117 
118  /* scalebar */
121 
122  /* background color */
123  int bgcolor;
124 
125 } nv_data;
126 
128 #if defined(OPENGL_X11)
129  Display *displayId; /* display connection */
130  GLXContext contextId; /* GLX rendering context */
131  Pixmap pixmap;
132  GLXPixmap windowId;
133 #elif defined(OPENGL_AQUA)
134 #if defined(OPENGL_AGL)
135  AGLPixelFormat pixelFmtId;
136  AGLContext contextId;
137  AGLPbuffer windowId;
138 #else
139  CGLContextObj contextId;
140 #endif
141 #elif defined(OPENGL_WINDOWS)
142  HDC displayId; /* display context */
143  HGLRC contextId; /* rendering context */
144 #endif
145  int width, height;
146 };
147 
148 #include <grass/defs/nviz.h>
149 
150 #endif /* GRASS_NVIZ_H */
float g
Definition: named_colr.c:7
#define MAX_CPLANES
Definition: ogsf.h:47
#define MAX_LIGHTS
Definition: ogsf.h:46
double r
Definition: r_raster.c:39
float where[3]
Definition: nviz.h:87
unsigned long color
Definition: nviz.h:85
float size
Definition: nviz.h:86
float elev
Definition: nviz.h:80
unsigned long color
Definition: nviz.h:79
int id
Definition: nviz.h:78
int where[4]
Definition: nviz.h:81
float ab
Definition: nviz.h:73
float w
Definition: nviz.h:74
float brt
Definition: nviz.h:71
float b
Definition: nviz.h:72
int id
Definition: nviz.h:70
Definition: nviz.h:97
struct scalebar_data ** scalebar
Definition: nviz.h:120
int num_cplanes
Definition: nviz.h:102
int num_fringes
Definition: nviz.h:111
float xyrange
Definition: nviz.h:99
struct fringe_data ** fringe
Definition: nviz.h:112
struct arrow_data * arrow
Definition: nviz.h:116
int bgcolor
Definition: nviz.h:123
int draw_arrow
Definition: nviz.h:115
int num_scalebars
Definition: nviz.h:119
int height
Definition: nviz.h:145
Pixmap pixmap
Definition: nviz.h:131
GLXPixmap windowId
Definition: nviz.h:132
GLXContext contextId
Definition: nviz.h:130
Display * displayId
Definition: nviz.h:129
int width
Definition: nviz.h:145
float where[3]
Definition: nviz.h:94
int id
Definition: nviz.h:91
unsigned long color
Definition: nviz.h:92
float size
Definition: nviz.h:93
#define x