nviz.h 3.1 KB

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