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 #include <dxconfig.h> 10 11 12 #ifndef tdmXfield_h 13 #define tdmXfield_h 14 15 /*---------------------------------------------------------------------------*\ 16 $Source: /src/master/dx/src/exec/hwrender/hwXfield.h,v $ 17 Author: Tim Murphy 18 19 This file contains definitions for the 'xfield' structure. This structure 20 represents a DX fieldobject which has been converted to a form which is more 21 pallatable to the render(s). 22 23 \*---------------------------------------------------------------------------*/ 24 enum approxE { 25 approx_none, /* no approximation */ 26 approx_flat, /* flat shading - NOT IMPLEMENTED */ 27 approx_lines, /* line rendering - NOT IMPLEMENTED */ 28 approx_dots, /* dots */ 29 approx_box /* box */ 30 }; 31 32 typedef struct SavedTextureS { 33 void * Address; 34 int Index; 35 } SavedTextureT; 36 37 typedef struct approxS { 38 enum approxE approx; 39 int density; 40 } approxT; 41 42 enum xr { 43 XR_OPTIONAL=0, 44 XR_REQUIRED=1 45 }; 46 47 enum xd { 48 XD_NONE, 49 XD_GLOBAL, 50 XD_LOCAL 51 }; 52 53 typedef enum { 54 tw_repeat, 55 tw_clamp, 56 tw_clamp_to_edge, 57 tw_clamp_to_border 58 } textureWrapE; 59 60 typedef enum { 61 tf_nearest, 62 tf_linear, 63 tf_nearest_mipmap_nearest, 64 tf_nearest_mipmap_linear, 65 tf_linear_mipmap_nearest, 66 tf_linear_mipmap_linear 67 } textureFilterE; 68 69 typedef enum { 70 tfn_decal, 71 tfn_replace, 72 tfn_modulate, 73 tfn_blend 74 } textureFunctionE; 75 76 typedef enum { 77 cf_off, 78 cf_front, 79 cf_back, 80 cf_front_and_back 81 } cullFaceE; 82 83 typedef enum { 84 lm_one_side, 85 lm_two_side 86 } lightModelE; 87 88 /* dependencies XXX do NOT reorder these, they are used and indices into 89 * static arrays in xfield.c 90 */ 91 typedef enum dependencyE { 92 dep_none, 93 dep_field, 94 dep_positions, 95 dep_connections, 96 dep_polylines 97 } dependencyT,*dependencyP; 98 99 /* type of connections */ 100 typedef enum connectionTypeE { 101 ct_none, /* none specified */ 102 ct_lines, /* line segments */ 103 ct_polylines, /* external polylines */ 104 ct_triangles, /* triangles */ 105 ct_quads, /* quads */ 106 ct_tetrahedra, /* tetrahedra */ 107 ct_cubes, /* cubes */ 108 ct_tmesh, /* special internal case triangle mesh */ 109 ct_qmesh, /* special internal case quad mesh */ 110 ct_flatGrid, /* special internal case planer quad grid */ 111 ct_pline /* special internal case polylines */ 112 } connectionTypeT,*connectionTypeP; 113 114 typedef struct materialAttrS 115 { 116 float ambient; 117 float diffuse; 118 float specular; 119 float shininess; 120 } materialAttrT, *materialAttrP; 121 122 typedef struct attributeS { 123 124 hwFlagsT flags; /* booleans */ 125 int flat_z; /* use flat z in volume rendering ? */ 126 int skip; /* skip faces at random in volume rendering */ 127 float color_multiplier; /* multiplier for volume colors */ 128 float opacity_multiplier; /* multiplier for volume opacities */ 129 int shade; /* 0 = subpress lighting even if normals */ 130 approxT buttonDown; 131 approxT buttonUp; 132 float fuzz; 133 float ff; 134 float linewidth; 135 int aalines; /* 1 = turn on line anti-aliasing */ 136 materialAttrT front; 137 materialAttrT back; 138 139 float mm[4][4]; /* Model transformation matrix */ 140 float vm[4][4]; 141 142 dxObject texture; 143 144 textureWrapE texture_wrap_s; 145 textureWrapE texture_wrap_t; 146 textureFilterE texture_min_filter; 147 textureFilterE texture_mag_filter; 148 textureFunctionE texture_function; 149 150 cullFaceE cull_face; 151 lightModelE light_model; 152 153 } attributeT; 154 155 typedef struct xfieldS { 156 157 attributeT attributes; 158 159 float Near; /* near plane for perspective clipping */ 160 int ntransConnections; /* count of total transparent connections 161 in all fields */ 162 163 /* bounding box */ 164 Point box[8]; 165 166 /* XXX hack for SGI complier */ 167 #define nconnections ncntns 168 #define connections cntns 169 #define connections_array cntns_array 170 #define connections_data cntns_data 171 172 /* connections */ 173 Array connections_array; 174 ArrayHandle connections; 175 connectionTypeT connectionType; 176 int posPerConn; 177 int nconnections; 178 InvalidComponentHandle invCntns; /* invalid connections */ 179 180 /* 181 * texture-mapping stuff 182 */ 183 dxObject texture_field; 184 ubyte *texture; 185 int myTextureData; 186 Array uv_array; 187 ArrayHandle uv; 188 int textureWidth, textureHeight; 189 int textureIsRGBA; 190 191 Array polylines_array, edges_array; 192 int *polylines, npolylines; /* polylines are handled separately since */ 193 int *edges, nedges; /* they require an indirection through an */ 194 /* "edges" component */ 195 196 /* positions */ 197 Array positions_array; 198 ArrayHandle positions; 199 int npositions; 200 int shape; /* 2 = 2d data, 3 = 3d data */ 201 InvalidComponentHandle invPositions; /* invalid connections */ 202 203 204 /* normals */ 205 Array normals_array; 206 ArrayHandle normals; 207 int nnormals; 208 dependencyT normalsDep; 209 210 /* front colors */ 211 Array fcolors_array; 212 ArrayHandle fcolors; 213 int nfcolors; 214 dependencyT fcolorsDep; 215 dependencyT colorsDep; 216 217 /* back colors */ 218 Array bcolors_array; 219 ArrayHandle bcolors; 220 int nbcolors; 221 dependencyT bcolorsDep; 222 223 /* color map */ 224 Array cmap_array; 225 ArrayHandle cmap; 226 int ncmap; 227 228 /* opacities */ 229 Array opacities_array; 230 ArrayHandle opacities; 231 int nopacities; 232 dependencyT opacitiesDep; 233 234 /* opacity map */ 235 Array omap_array; 236 ArrayHandle omap; 237 int nomap; 238 239 /* neighbors */ 240 Array neighbors_array; 241 ArrayHandle neighbors; 242 int nneighbors; 243 244 /* meshes */ 245 Array meshes; 246 int nmeshes; 247 dxObject meshObject; 248 249 Array origConnections_array; 250 int origNConnections; 251 252 /* Lighting coeficients amb, diff, spec, shine */ 253 float lk[4]; 254 255 /* information about regular partition */ 256 int k[3]; /* counts, strides in each direction */ 257 258 int nClips; 259 Point *clipPts; 260 Vector *clipVecs; 261 262 /* DEVICE PRIVATE DATA */ 263 /* NOTE: XXX This should really be a pointer to a private section */ 264 265 void (*deletePrivate)(struct xfieldS *); 266 267 /* for OLD_PORT_LAYER_CALLS */ 268 Field field; 269 Pointer connections_data; 270 Pointer positions_data; 271 Pointer normals_data; 272 Pointer fcolors_data; 273 Pointer cmap_data; 274 Pointer opacities_data; 275 Pointer omap_data; 276 Pointer invCntns_data; 277 278 /* Fields collected only for texture mapping */ 279 Point v0,v1,v2,v3; /* Text world space quad corners */ 280 Field image; /* image field */ 281 282 /* This is for the device dependent GLobject */ 283 long glObject; 284 285 SavedTextureT FlatGridTexture; 286 287 int UseDisplayList; 288 int UseFastClip; 289 290 } xfieldT; 291 292 293 typedef struct clipS 294 { 295 unsigned char clip[8]; 296 } clipT, *clipP; 297 298 struct sortListElement 299 { 300 xfieldT *xf; 301 int poly; 302 float depth; 303 }; 304 305 xfieldO _dxf_newXfieldO(Field, attributeP, void *); 306 xfieldP _dxf_getXfieldData(xfieldO); 307 308 xfieldP _dxf_newXfieldP(Field, attributeP, void *); 309 int _dxf_xfieldNconnections(xfieldP xf); 310 int _dxf_xfieldSidesPerConnection(xfieldP xf); 311 attributeP _dxf_xfieldAttributes(xfieldP xf); 312 materialAttrP _dxf_attributeFrontMaterial(attributeP att); 313 314 Error _dxf_getHwXfieldClipPlanes(xfieldO xo, 315 int *nClips, Point **pts, Vector **vecs); 316 Error _dxf_setHwXfieldClipPlanes(xfieldO xo, 317 int nClips, Point *pts, Vector *vecs); 318 319 Error _dxf_deleteXfield(xfieldP xf); 320 321 #endif /* tdmXfield_h */ 322