1 /***********************************************************************/ 2 /* Open Visualization Data Explorer */ 3 /* (C) Copyright IBM Corp. 1989,1999 */ 4 /* ALL RIGHTS RESERVED */ 5 /* This code licensed under the */ 6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ 7 /***********************************************************************/ 8 /*********************************************************************/ 9 /* I.B.M. CONFIENTIAL */ 10 /*********************************************************************/ 11 12 #include <dxconfig.h> 13 14 15 #ifndef tdmPortXGL_h 16 #define tdmPortXGL_h 17 /*---------------------------------------------------------------------------*\ 18 $Source: /src/master/dx/src/exec/hwrender/xgl/hwPortXGL.h,v $ 19 20 Private data structures used by the XGL implementation of DX renderer. 21 22 $Log: hwPortXGL.h,v $ 23 Revision 1.3 1999/05/10 15:45:40 gda 24 Copyright message 25 26 Revision 1.3 1999/05/10 15:45:40 gda 27 Copyright message 28 29 Revision 1.2 1999/05/03 14:06:43 gda 30 moved to using dxconfig.h rather than command-line defines 31 32 Revision 1.1.1.1 1999/03/24 15:18:36 gda 33 Initial CVS Version 34 35 Revision 1.1.1.1 1999/03/19 20:59:49 gda 36 Initial CVS 37 38 Revision 10.1 1999/02/23 21:03:00 gda 39 OpenDX Baseline 40 41 Revision 9.1 1997/05/22 22:32:46 svs 42 Copy of release 3.1.4 code 43 44 * Revision 8.0 1995/10/03 22:14:40 nsc 45 * Copy of release 3.1 code 46 * 47 * Revision 7.3 1994/03/31 15:55:22 tjm 48 * added versioning 49 * 50 * Revision 7.2 94/03/23 16:34:30 tjm 51 * added model clipping 52 * 53 * Revision 7.1 94/01/18 18:59:50 svs 54 * changes since release 2.0.1 55 * 56 * Revision 6.2 94/01/14 18:07:17 ellen 57 * Added translation to context. 58 * 59 * Revision 6.1 93/11/16 10:25:55 svs 60 * ship level code, release 2.0 61 * 62 * Revision 1.5 93/09/29 14:00:08 tjm 63 * Fixed <PITTS21> wrong background color on sun. Two problems, negative colors 64 * in a field (now clamp to 0.0) and no constant colors set on mesh primitives 65 * if no normals. (now set colors) 66 * 67 * 68 * Revision 1.4 93/09/28 09:40:16 tjm 69 * fixed <DMCZAP71> colors are now clamped so that the maximum value for 70 * r g or b is 1.0. 71 * 72 * Revision 1.3 93/09/09 17:15:58 mjh 73 * add IS_2D macro 74 * 75 * Revision 1.2 93/07/14 13:29:06 tjm 76 * added solaris ifdefs 77 * 78 * Revision 1.1 93/06/29 10:01:39 tjm 79 * Initial revision 80 * 81 * Revision 5.2 93/05/11 18:04:24 mjh 82 * Implement screen door transparency for the GT. 83 * 84 * Revision 5.1 93/03/30 14:41:58 ellen 85 * Moved these files from the 5.0.2 Branch 86 * 87 * Revision 5.0.2.11 93/03/10 16:24:58 mjh 88 * increase max lights to 9 to support lights 0-8 89 * 90 * Revision 5.0.2.10 93/02/01 22:22:06 mjh 91 * Implement pixel read/write, gnomon and zoom box echos. The gnomon echo is 92 * no longer double-buffered as this incurs the expense of copying the 93 * display buffer to the draw buffer as part of the interactor setup, and 94 * this is quite slow with the Sun GS card. The echo is now rendered into 95 * the draw buffer and then blitted into the display buffer. 96 * 97 * Revision 5.0.2.9 93/01/12 19:06:53 mjh 98 * fix double buffering 99 * 100 * Revision 5.0.2.8 93/01/10 22:17:38 mjh 101 * add lighting 102 * 103 * Revision 5.0.2.7 93/01/09 00:27:08 mjh 104 * frame buffer stuff 105 * 106 * Revision 5.0.2.6 93/01/08 18:48:51 owens 107 * got rid of X/dx conflicting Screen defs. 108 * 109 * Revision 5.0.2.5 93/01/08 13:34:02 mjh 110 * implement transformation pipeline 111 * 112 * Revision 5.0.2.4 93/01/07 03:54:21 mjh 113 * leave X11 definition of Screen alone for now 114 * 115 * Revision 5.0.2.3 93/01/06 17:00:52 mjh 116 * window creation and destruction 117 * 118 * Revision 5.0.2.2 93/01/06 04:41:56 mjh 119 * initial revision 120 * 121 \*---------------------------------------------------------------------------*/ 122 123 #include <xgl/xgl.h> 124 125 #include <X11/Xutil.h> 126 # if 0 127 #define CLAMP(dstP,srcP) \ 128 do { \ 129 register RGBColor newSrc = *(RGBColor*)(srcP); \ 130 float max; \ 131 if((max = (newSrc.r > newSrc.b && newSrc.r > newSrc.g ? newSrc.r : \ 132 (newSrc.g > newSrc.b ? newSrc.g : newSrc.b))) > 1.0) { \ 133 ((Xgl_color_rgb*)(dstP))->r = newSrc.r/max; \ 134 ((Xgl_color_rgb*)(dstP))->g = newSrc.g/max; \ 135 ((Xgl_color_rgb*)(dstP))->b = newSrc.b/max; \ 136 } else { \ 137 ((Xgl_color_rgb*)(dstP))->r = newSrc.r; \ 138 ((Xgl_color_rgb*)(dstP))->g = newSrc.g; \ 139 ((Xgl_color_rgb*)(dstP))->b = newSrc.b; \ 140 } \ 141 } while (0) 142 #else 143 #define CLAMPCHANNEL(dst,src) \ 144 (dst) = (src) > 1.0 ? 1.0 : (src) < 0.0 ? 0.0 : (src); 145 146 #define CLAMP(dstP,srcP) \ 147 do { \ 148 register RGBColor newSrc = *(RGBColor*)(srcP); \ 149 ((Xgl_color_rgb*)(dstP))->r = \ 150 newSrc.r > 1.0 ? 1.0 : newSrc.r < 0.0 ? 0.0 : newSrc.r; \ 151 ((Xgl_color_rgb*)(dstP))->g = \ 152 newSrc.g > 1.0 ? 1.0 : newSrc.g < 0.0 ? 0.0 : newSrc.g; \ 153 ((Xgl_color_rgb*)(dstP))->b = \ 154 newSrc.b > 1.0 ? 1.0 : newSrc.b < 0.0 ? 0.0 : newSrc.b; \ 155 } while (0) 156 #endif 157 158 #define NOBUFFER 0 159 #define BCKBUFFER 1 160 #define FRNTBUFFER 2 161 #define BOTHBUFFERS 3 162 163 typedef struct 164 { 165 Xgl_win_ras ras ; 166 Xgl_X_window xgl_x_win ; 167 Xgl_obj_desc obj_desc ; 168 Xgl_3d_ctx xglctx ; 169 #ifdef solaris 170 Xgl_pt_d3d dev_max_coords ; 171 #else 172 Xgl_pt_f3d dev_max_coords ; 173 #endif 174 Xgl_trans tmp_transform ; 175 Xgl_trans model_view_transform ; 176 Xgl_trans projection_transform ; 177 Xgl_ctx xgl_tmp_ctx ; 178 Xgl_ras screen_door_50 ; 179 Xgl_inquire *hw_info ; 180 181 int num_planes ; 182 Xgl_usgn32 num_buffers ; 183 int double_buffer_mode ; 184 int display_buffer, draw_buffer ; 185 int buffer_config_mode ; 186 int vp_left, vp_right, vp_bottom, vp_top ; 187 int screen_xmax, screen_ymax ; 188 int use_screen_door ; 189 hwTranslationP translation ; 190 Xgl_usgn32 planeCount; 191 } tdmXGLctxT, *tdmXGLctx ; 192 193 #define DEFCONTEXT(ctx) \ 194 register tdmXGLctx _portContext = (tdmXGLctx)(ctx) 195 196 #define XGLRAS (((tdmXGLctx)_portContext)->ras) 197 #define XGLCTX (((tdmXGLctx)_portContext)->xglctx) 198 #define XGLXWINID (((tdmXGLctx)_portContext)->xgl_x_win.X_window) 199 #define XGLDISPLAY ((Display *)((tdmXGLctx)_portContext)->xgl_x_win.X_display) 200 #define XGLSCREEN (((tdmXGLctx)_portContext)->xgl_x_win.X_screen) 201 #define XGLTMPCTX (((tdmXGLctx)_portContext)->xgl_tmp_ctx) 202 203 #define TMP_TRANSFORM (((tdmXGLctx)_portContext)->tmp_transform) 204 #define MODEL_VIEW_TRANSFORM (((tdmXGLctx)_portContext)->model_view_transform) 205 #define PROJECTION_TRANSFORM (((tdmXGLctx)_portContext)->projection_transform) 206 207 #define HW_INFO (((tdmXGLctx)_portContext)->hw_info) 208 #define NUM_PLANES (((tdmXGLctx)_portContext)->num_planes) 209 #define NUM_BUFFERS (((tdmXGLctx)_portContext)->num_buffers) 210 #define DOUBLE_BUFFER_MODE (((tdmXGLctx)_portContext)->double_buffer_mode) 211 #define DISPLAY_BUFFER (((tdmXGLctx)_portContext)->display_buffer) 212 #define DRAW_BUFFER (((tdmXGLctx)_portContext)->draw_buffer) 213 #define BUFFER_CONFIG_MODE (((tdmXGLctx)_portContext)->buffer_config_mode) 214 215 #define VP_LEFT (((tdmXGLctx)_portContext)->vp_left) 216 #define VP_RIGHT (((tdmXGLctx)_portContext)->vp_right) 217 #define VP_BOTTOM (((tdmXGLctx)_portContext)->vp_bottom) 218 #define VP_TOP (((tdmXGLctx)_portContext)->vp_top) 219 #define VP_XMAX (((tdmXGLctx)_portContext)->dev_max_coords.x) 220 #define VP_YMAX (((tdmXGLctx)_portContext)->dev_max_coords.y) 221 #define VP_ZMAX (((tdmXGLctx)_portContext)->dev_max_coords.z) 222 223 #define SCREEN_XMAX (((tdmXGLctx)_portContext)->screen_xmax) 224 #define SCREEN_YMAX (((tdmXGLctx)_portContext)->screen_ymax) 225 226 #define SCREEN_DOOR_50 (((tdmXGLctx)_portContext)->screen_door_50) 227 #define USE_SCREEN_DOOR (((tdmXGLctx)_portContext)->use_screen_door) 228 229 #define XGLTRANSLATION (((tdmXGLctx)_portContext)->translation) 230 #define CLIP_PLANE_CNT (((tdmXGLctx)_portContext)->planeCount) 231 232 /* light0 + light1 through light8 */ 233 #define MAX_LIGHTS 9 234 235 /* Is there any real limit?, Choose 2 clip boxes. */ 236 #define MAX_CLIP_PLANES 12 237 238 #define IS_2D(array,type,rank,shape) \ 239 (DXGetArrayInfo (array, NULL, &type, NULL, &rank, NULL) && \ 240 rank == 1 && type == TYPE_FLOAT && \ 241 DXGetArrayInfo (array, NULL, NULL, NULL, NULL, &shape) && \ 242 shape == 2) 243 244 245 #endif /* tdmPortXGL_h */ 246