nviz.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #ifndef GRASS_NVIZ_H
  2. #define GRASS_NVIZ_H
  3. #include <grass/config.h>
  4. /*** Windows headers ***/
  5. #if defined(OPENGL_WINDOWS)
  6. # define WIN32_LEAN_AND_MEAN
  7. # include <windows.h>
  8. # undef WIN32_LEAN_AND_MEAN
  9. # include <winnt.h>
  10. /*** X Window System headers ***/
  11. #elif defined(OPENGL_X11)
  12. # include <X11/Xlib.h>
  13. # include <X11/Xutil.h>
  14. # include <X11/Xatom.h> /* for XA_RGB_DEFAULT_MAP atom */
  15. # include <GL/glx.h>
  16. /*** Mac headers ***/
  17. #elif defined(OPENGL_AQUA)
  18. # define Cursor QDCursor
  19. # include <AGL/agl.h>
  20. # undef Cursor
  21. # include <ApplicationServices/ApplicationServices.h>
  22. #else /* make sure only one platform defined */
  23. # error Unsupported platform, or confused platform defines...
  24. #endif
  25. #include <grass/ogsf.h>
  26. #define MAP_OBJ_UNDEFINED 0
  27. #define MAP_OBJ_SURF 1
  28. #define MAP_OBJ_VOL 2
  29. #define MAP_OBJ_VECT 3
  30. #define MAP_OBJ_SITE 4
  31. #define DRAW_COARSE 0
  32. #define DRAW_FINE 1
  33. #define DRAW_BOTH 2
  34. /* quick draw mode */
  35. #define DRAW_QUICK_SURFACE 0x01
  36. #define DRAW_QUICK_VLINES 0x02
  37. #define DRAW_QUICK_VPOINTS 0x04
  38. #define DRAW_QUICK_VOLUME 0x08
  39. #define RANGE (5 * GS_UNIT_SIZE)
  40. #define RANGE_OFFSET (2 * GS_UNIT_SIZE)
  41. #define ZRANGE (3 * GS_UNIT_SIZE)
  42. #define ZRANGE_OFFSET (1 * GS_UNIT_SIZE)
  43. #define DEFAULT_SURF_COLOR 0x33BBFF
  44. #define FORMAT_PPM 1
  45. #define FORMAT_TIF 2
  46. /* data structures */
  47. typedef struct
  48. {
  49. int id;
  50. float brt;
  51. float r, g, b;
  52. float ar, ag, ab; /* ambient rgb */
  53. float x, y, z, w; /* position */
  54. } light_data;
  55. struct fringe_data
  56. {
  57. int id;
  58. unsigned long color;
  59. float elev;
  60. int where[4];
  61. };
  62. struct arrow_data
  63. {
  64. unsigned long color;
  65. float size;
  66. float where[3];
  67. };
  68. struct scalebar_data
  69. {
  70. int id;
  71. unsigned long color;
  72. float size;
  73. float where[3];
  74. };
  75. typedef struct
  76. {
  77. /* ranges */
  78. float zrange, xyrange;
  79. /* cplanes */
  80. int num_cplanes;
  81. int cur_cplane, cp_on[MAX_CPLANES];
  82. float cp_trans[MAX_CPLANES][3];
  83. float cp_rot[MAX_CPLANES][3];
  84. /* light */
  85. light_data light[MAX_LIGHTS];
  86. /* fringe */
  87. int num_fringes;
  88. struct fringe_data **fringe;
  89. /* north arrow */
  90. int draw_arrow;
  91. struct arrow_data *arrow;
  92. /* scalebar */
  93. int num_scalebars;
  94. struct scalebar_data **scalebar;
  95. /* background color */
  96. int bgcolor;
  97. } nv_data;
  98. struct render_window
  99. {
  100. #if defined(OPENGL_X11)
  101. Display *displayId; /* display connection */
  102. GLXContext contextId; /* GLX rendering context */
  103. GLXPixmap windowId;
  104. Pixmap pixmap;
  105. #elif defined(OPENGL_AQUA)
  106. AGLPixelFormat pixelFmtId;
  107. AGLContext contextId;
  108. AGLPbuffer windowId;
  109. #elif defined(OPENGL_WINDOWS)
  110. HDC displayId; /* display context */
  111. HGLRC contextId; /* rendering context */
  112. HBITMAP bitmapId;
  113. #endif
  114. };
  115. #include <grass/defs/nviz.h>
  116. #endif /* GRASS_NVIZ_H */