nviz.h 3.0 KB

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