HOOPS/3dGS I.M. Interface

     << Back      Full Index      Forward >>


driver.h

00001 /*
00002  * Copyright (c) 1998-2001 by Tech Soft 3D, LLC.
00003  * The information contained herein is confidential and proprietary to
00004  * Tech Soft 3D, LLC., and considered a trade secret as defined under
00005  * civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006  * and criminal remedies in the event of unauthorized use or misappropriation
00007  * of its trade secrets.  Use of this information by anyone other than
00008  * authorized employees of Tech Soft 3D, LLC. is granted only under a
00009  * written non-disclosure agreement, expressly prescribing the scope and
00010  * manner of such use.
00011  *
00012  * $Id: driver_8h-source.html,v 1.29 2008-03-10 07:09:28 stage Exp $
00013  */
00014 
00015 
00016 #ifndef DRIVER_DEFINED
00017 
00018 #ifndef DATABASE_DEFINED
00019 #   include "database.h"
00020 #endif
00021 #ifndef HOOPS_ERRORS_DEFINED
00022 #   include "hpserror.h"
00023 #endif
00024 
00025 #define TOTAL_FACE_BIT_PATTERNS 17   /* Should match patterns.h */
00026 #define DITHER_BIT_PATTERNS     65   /* intensities 0.0 thru 1.0, inclusive */
00027 #define TOTAL_BIT_PATTERNS      (TOTAL_FACE_BIT_PATTERNS+DITHER_BIT_PATTERNS)
00028 
00029 #define DITHER_BIT_RESOLUTION   64   /* ie, 1 part in 64 */
00030 
00031 #define MAX_NOMINAL_COLOR_RESOLUTION    256
00032 
00033 
00034 #define FONT_HASH_SIZE          128
00035 
00036 
00037 /* There is a clipping precision problem if we try to cut off almost all
00038  * of a line upon entering - ie, if the entering 't' value is very nearly
00039  * 1.0. If floats have 6 digits of precision, then "0.99" will allow
00040  * 4 digits to remain. Only a very few lines will be within but less
00041  * than 1% (1 - .99) within.
00042  */
00043 #define CLIP_T_TOLERANCE        0.01f
00044 #define MAX_T_ENTERING          (1.0f - CLIP_T_TOLERANCE)
00045 
00046 /* allow for very tiny round-off problems when clipping */
00047 #define PIXEL_FUDGE     0.001f
00048 
00049 /*
00050  * specifies the depth of the ortho space in z,
00051  * expressed relative to the camera-to-target distance
00052  * this value is applied to both sides of the target
00053  */
00054 #define ORTHO_RANGE    4.0f
00055 
00056 #define ZCLAMP(z,tr)    ((!tr->z_buffering) ? z : \
00057                          (z < 0.0f) ? 0.0f : (z > tr->z_max) ? tr->z_max : z)
00058 
00059 #define NOMINAL_RASTER_LENGTH   2048
00060 
00061 #define DEFAULT_MARKER_SIZE     0.015f
00062 
00063 
00064 
00065 /*
00066  * A macro to blow past specified geometry types in geometry list,
00067  * useful only in the render routine.
00068  */
00069     
00070 /*----------------------------------------------------------------
00071 #define SKIP_ALL(geom_list, geom_type) \
00072         do \
00073             if ((geom_list = geom_list->h.next) == null) return; \
00074         until (geom_list->h.type != geom_type);
00075 ----------------------------------------------------------------*/
00076 /*above is the old skip all kept for reference*/
00077 /*skip all now uses the geometry table*/
00078 /*
00079  * Note: macro above (and previous form of new macro) flaked if second argument was
00080  * effectively "geom_list->h.type" instead of a constant
00081  */
00082 #define SKIP_ALL(geom_list, geom_type) do { \
00083     int     test_type = geom_type; \
00084     if (geom_list->h.type == test_type) { \
00085         if (geom_list->h.next == null) { \
00086             geom_list = null; \
00087             return; \
00088         } \
00089         if (geom_list->h.owner == null) { \
00090             do if ((geom_list = geom_list->h.next) == null) return; \
00091             until (geom_list->h.type != test_type); \
00092         } \
00093         else { \
00094             int table_type = GT_REF_TYPE(test_type); \
00095             for (;;) { \
00096                 table_type++; \
00097                 if (table_type > GT_OO) { \
00098                     geom_list = null; \
00099                     return; \
00100                 } \
00101                 if (geom_list->h.owner->geometry_table[table_type] != null) { \
00102                     geom_list = geom_list->h.owner->geometry_table[table_type]; \
00103                     break;\
00104                 } \
00105             } \
00106         } \
00107     } \
00108 } while (0)
00109 
00110 
00111 struct HT_Int_Rectangle {
00112     int                 left,   right, bottom, top;
00113 };
00114 
00115 struct HT_Int_XY {
00116     int                 x, y;
00117 };
00118 
00119 struct HT_Int_Point{
00120     int                 x, y ,z;
00121 };
00122 
00123 struct HT_DC_Point {
00124     float               x, y, z;
00125 };
00126 
00127 #define COPY_DC_POINT(src, dest) ((dest) = (src))
00128 
00129 typedef float           HT_New_Character_Width;
00130 typedef short           HT_Character_Width;
00131 typedef HT_Integer32    HT_Incarnation;
00132 
00133 #define NEW_INCARNATION(dc) (++((HT_Display_Context alter *)dc)->last_incarnation)
00134 
00135 
00136 
00137 struct HT_Direct_RGB {
00138     unsigned char       PREFERRED_RGB32;
00139 };
00140 
00141 typedef HT_Integer32    HT_Gray_Level;
00142 typedef HT_Integer32    HT_Whichever_Color;
00143 
00144 union HT_Driver_Color {
00145     HT_Color_Index      map_index;      /* used with MAPPED_RGB color system */
00146     HT_Gray_Level       gray_level;     /* used with GRAY_SCALE color system */
00147     HT_Direct_RGB       direct_rgb;     /* used with DIRECT_RGB color system */
00148 
00149     HT_Whichever_Color  whichever;
00150 };
00151 
00152 
00153 typedef short HT_Info_Contents;
00154 #define Info_UNIFORM_RGBA               (HT_Info_Contents)0x0001
00155 #define Info_VERTEX_RGBAS               (HT_Info_Contents)0x0002
00156 #define Info_VERTEX_COLORS              (HT_Info_Contents)0x0004
00157 #define Info_VERTEX_PLANES              (HT_Info_Contents)0x0008
00158 #define Info_VERTEX_PARAMETERS          (HT_Info_Contents)0x0010
00159 #define Info_VERTEX_NORMALS             (HT_Info_Contents)0x0020
00160 
00161 #define PF_NONE                 (HT_Parameter_Flags)0x00000000
00162 #define PF_IGNORE_TRANSFORM     (HT_Parameter_Flags)0x00000001
00163 #define PF_VALID                (HT_Parameter_Flags)0x00000002
00164 #define PF_DEFERRED             (HT_Parameter_Flags)0x00000004
00165 #define PF_SOURCE_EXPLICIT      (HT_Parameter_Flags)0x00000010
00166 #define PF_SOURCE_IMPLICIT      (HT_Parameter_Flags)0x00000020
00167 #define PF_SOURCE_OTHER         (HT_Parameter_Flags)0x00000040
00168 #define PF_SOURCE_WORLD         (HT_Parameter_Flags)0x00000080
00169 #define PF_SOURCE_NORMAL        (HT_Parameter_Flags)0x00000100
00170 #define PF_SOURCE_SPHERE        (HT_Parameter_Flags)0x00000200
00171 #define PF_SOURCE_CYLINDER      (HT_Parameter_Flags)0x00000400
00172 #define PF_SOURCE_OBJECT        (HT_Parameter_Flags)0x00000800
00173 #define PF_NEED_FIXUPS          (HT_Parameter_Flags)0x00001000
00174 #define PF_SOURCE_NATURAL       (HT_Parameter_Flags)0x00002000
00175 
00176 
00177 #define PF_PARAM_SOURCE_ANYBITS (PF_SOURCE_WORLD|PF_SOURCE_NORMAL|PF_SOURCE_SPHERE|PF_SOURCE_CYLINDER|PF_SOURCE_OBJECT)
00178 
00179 
00180 
00181 /* numbers chosen so that when multiplied by 256, results are integral */
00182 #define RED_GRAYNESS            0.3125f
00183 #define GREEN_GRAYNESS          0.5000f     /* or .59? (NTSC) */
00184 #define BLUE_GRAYNESS           0.1875f     /* or .11? (NTSC) */
00185 
00186 #define RGB_TO_GRAY(r, g, b)    \
00187         (RED_GRAYNESS*(r) + GREEN_GRAYNESS*(g) + BLUE_GRAYNESS*(b))
00188 
00189 /*
00190  * This SAFE macro retrieves a driver color, which has already
00191  * been gamma corrected.
00192  */
00193 #define DRIVER_COLOR_TO_RGBAS32(idc, icolor, color_system, irgb32) do { \
00194             HT_Display_Context const  *m_dc = idc;          \
00195             HT_Driver_Color const     *m_in = &icolor;      \
00196             HT_RGBAS32                out;                  \
00197             out.whole_thing=0;                                          \
00198             switch (color_system) {                                     \
00199               case GRAY_SCALE: {                                        \
00200                   out.rgb.r =                                           \
00201                       (unsigned char)(255.99f * (float)m_in->gray_level / \
00202                       (float)(m_dc->physical.nominal_color_resolution - 1));\
00203                   out.rgb.g = out.rgb.r;                                \
00204                   out.rgb.b = out.rgb.r;                                \
00205                   out.rgb.a = COMPLETELY_OPAQUE_ALPHA;                  \
00206               }   break;                                                \
00207               case MAPPED_RGB: {                                        \
00208                   HT_RGB const          *map;                   \
00209                   map = &m_dc->rgb_map[m_in->map_index];                \
00210                   out.rgb.r = (unsigned char)(255.99f * map->red);  \
00211                   out.rgb.g = (unsigned char)(255.99f * map->green);    \
00212                   out.rgb.b = (unsigned char)(255.99f * map->blue); \
00213                   out.rgb.a = COMPLETELY_OPAQUE_ALPHA;                  \
00214               }   break;                                                \
00215               case DIRECT_RGB: {                                        \
00216                   out.rgb.r = m_in->direct_rgb.r;                       \
00217                   out.rgb.g = m_in->direct_rgb.g;                       \
00218                   out.rgb.b = m_in->direct_rgb.b;                       \
00219                   out.rgb.a = m_in->direct_rgb.a;                       \
00220               }   break;                                                \
00221             }                                                           \
00222             irgb32.whole_thing = out.whole_thing;                       \
00223         } while (0)
00224 
00225 
00226 #define NO_WHICHEVER    ((HT_Whichever_Color)0)
00227 
00228 #define INTERPOLATE_RGB(p0, p1, fraction, out) do {                                     \
00229             (out).red   = ((p0).red   + ((p1).red   - (p0).red  ) * (fraction));        \
00230             (out).green = ((p0).green + ((p1).green - (p0).green) * (fraction));        \
00231             (out).blue  = ((p0).blue  + ((p1).blue  - (p0).blue) * (fraction));     \
00232         } while (0)
00233 
00234 #define INTERPOLATE_RGBA(p0, p1, fraction, out) do {                                    \
00235             (out).red   = ((p0).red   + ((p1).red   - (p0).red  ) * (fraction));        \
00236             (out).green = ((p0).green + ((p1).green - (p0).green) * (fraction));        \
00237             (out).blue  = ((p0).blue  + ((p1).blue  - (p0).blue) * (fraction));     \
00238             (out).alpha = ((p0).alpha + ((p1).alpha - (p0).alpha) * (fraction));        \
00239         } while (0)
00240 
00241 #define INTERPOLATE_RGBAS32(p0, p1, fraction, out) do {                                                         \
00242             (out).rgb.r = (unsigned char)((p0).rgb.r + ((float)(p1).rgb.r - (float)(p0).rgb.r) * (fraction));   \
00243             (out).rgb.g = (unsigned char)((p0).rgb.g + ((float)(p1).rgb.g - (float)(p0).rgb.g) * (fraction));   \
00244             (out).rgb.b = (unsigned char)((p0).rgb.b + ((float)(p1).rgb.b - (float)(p0).rgb.b) * (fraction));   \
00245             (out).rgb.a = (unsigned char)((p0).rgb.a + ((float)(p1).rgb.a - (float)(p0).rgb.a) * (fraction));   \
00246         } while (0)
00247 
00248 
00249 #define INTERPOLATE_PLANE(p0, p1, fraction, out) do {   \
00250             (out).a = ((p0).a + ((p1).a - (p0).a) * (fraction));    \
00251             (out).b = ((p0).b + ((p1).b - (p0).b) * (fraction));    \
00252             (out).c = ((p0).c + ((p1).c - (p0).c) * (fraction));    \
00253             (out).d = ((p0).d + ((p1).d - (p0).d) * (fraction));    \
00254         } while (0)
00255 
00256 #define INTERPOLATE_PARAMETER(nr, p0, p1, fraction, out, ratio, param_width) do { \
00257             int iii; \
00258             if (BIT(nr->misc_rendition->simple_options, Rendo_PERSPECTIVE_CORRECTION)) { \
00259                 float inv_denom; \
00260                 inv_denom = (fraction) / ((ratio) + (1.0f - (ratio)) * (fraction)); \
00261                 for (iii=0; iii<(param_width); iii++) { \
00262                     (out)[iii] = ((p0)[iii] + ((p1)[iii] - (p0)[iii]) * inv_denom); \
00263                 } \
00264             } \
00265             else { \
00266                 for (iii=0; iii<(param_width); iii++) { \
00267                     (out)[iii] = ((p0)[iii] + ((p1)[iii] - (p0)[iii]) * (fraction)); \
00268                 } \
00269             } \
00270         } while (0)
00271 
00272 
00273 
00274 #define QUICK_NORMALIZE(vec) do {                                                                   \
00275             HT_Vector alter *   _vec_ = (HT_Vector alter *)&vec;                                \
00276             float _tmp_ = SQRT (_vec_->x*_vec_->x + _vec_->y*_vec_->y + _vec_->z*_vec_->z); \
00277             if (_tmp_ > 0.000001f) {                                                                \
00278                 _tmp_ = 1.0f / _tmp_;                                                               \
00279                 _vec_->x *= _tmp_;  _vec_->y *= _tmp_;  _vec_->z *= _tmp_;                          \
00280             }                                                                                       \
00281         } while (0)
00282 
00283 
00284 
00285 #define SOFTWARE_Z_BUFFER_DEPTH         24              /* sizeof(HT_Depth)*8 */
00286 #define SOFTWARE_Z_BUFFER_MAX           ((1<<SOFTWARE_Z_BUFFER_DEPTH)-1)
00287 #define SOFTWARE_Z_BUFFER_BACKGROUND    0x7F7F7F7F
00288 #define SOFTWARE_Z_BUFFER_OFFSET_SCALE(_tr_)((_tr_)->wlimit_software_offset_scale)
00289 
00290 
00291 struct HT_FBI_Vertex {
00292         HT_DC_Point const       *point;
00293         HT_RGBAS32 const            *color;
00294 
00295         HT_Plane const          *plane;
00296         float const             *parameter;     /* variable size */
00297 
00298         /* HT_RGB const         rgb; */
00299 };
00300 
00301 struct HT_FBI_Input {
00302     /* per-vertex values (line=2, triangle=3, rectangle=4 (ll,lr,ul,ur) */
00303     HT_FBI_Vertex       vertex[4];
00304 
00305     /* per-element values */
00306     HT_Key              key;
00307     HT_Driver_Color     color;
00308     int                 parameter_width;
00309 
00310 /* flags for items which may be Tested, Updated, and Interpolated */
00311 #define FBI_NONE        0x0000  /*     */
00312 #define FBI_Z_VALUE     0x0001  /* TUI */
00313 #define FBI_STENCIL     0x0002  /* TU  */
00314 #define FBI_IMAGE       0x0004  /*  U  */
00315 #define FBI_OCCLUSION   0x0008  /*  U  */
00316 #define FBI_RGB32       0x0002  /*   I */
00317 #define FBI_NORMAL      0x0004  /*   I */
00318 #define FBI_TEXTURE     0x0008  /*   I */
00319 
00320     struct {
00321         int             interpolate;
00322         int             test;
00323         int             update;
00324     }                   requested,      /* what a function normally does */
00325                         required,       /* special drawing modes need these */
00326                         blocked;        /*   but not these */
00327 
00328 
00329 #define TEST_NEVER      0x00
00330 #define TEST_LESS       0x01
00331 #define TEST_EQUAL      0x02
00332 #define TEST_GREATER    0x04
00333 #define TEST_LEQUAL     0x03
00334 #define TEST_GEQUAL     0x06
00335 #define TEST_NOTEQUAL   0x05
00336 #define TEST_ALWAYS     0x07
00337     int                 z_test;
00338     int                 stencil_test;
00339 
00340     int                 stencil_reference;
00341 
00342 #define UPDATE_KEEP     0
00343 #define UPDATE_REPLACE  1
00344 #define UPDATE_INCR     2
00345 #define UPDATE_DECR     3
00346 #define UPDATE_INVERT   4
00347 #define UPDATE_ZERO     5
00348     int                 stencil_fail;
00349     int                 stencil_zfail;
00350     int                 stencil_zpass;
00351 
00352     int                 pixel_limit;    
00353     int                 pixels_drawn;   /* really more output :) */
00354 };
00355 
00356 
00357 struct HT_Frame_Buffer_Info {
00358     HT_Frame_Buffer_Info        **backlink;
00359     /* Items for the software z-buffer */
00360     HT_Image alter              *color_buffer;
00361     HT_Image alter              *depth_buffer;
00362     void alter                  *color_buffer_driver_specific;
00363     void alter                  *depth_buffer_driver_specific;
00364 
00365     HT_Image_Format             required_format;
00366     bool                        need_alpha;
00367 
00368     HT_Int_XY                   offset;                 /* copy of tr->extent */
00369     HT_Net_Rendition const      *pending_window;
00370     bool                        touched;
00371     bool                        could_draw_as_block;
00372     bool                        please_clear_depth_buffer;
00373     bool                        force_window;
00374     bool                        previous_update_had_text;
00375     bool                        wanted_window;
00376     HT_Deferred_Text alter      *deferred_text;
00377     HT_Window_Rendition const   *window_rendition;
00378 
00379     /* items used by spriting */
00380     void alter                  *color_region[2];
00381     void alter                  *depth_region[2];
00382     HT_Image alter              *soft_color_region;
00383     HT_Image alter              *soft_depth_region;
00384     void alter                  *soft_color_region_driver_spec;
00385     void alter                  *soft_depth_region_driver_spec;
00386     HT_Int_Rectangle            region_area;
00387     HT_Int_Rectangle            dirty_region;
00388     HT_Int_Rectangle            old_dirty_region;
00389     bool                        saved_regions_valid;
00390 
00391     HT_FBI_Input                input;
00392     HT_Image alter              *stencil_buffer;
00393     void alter                  *stencil_buffer_driver_specific;
00394     HT_Image_Format             stencil_format;
00395     HT_Int_Rectangle            known_region;
00396     int                         generation;
00397 };
00398 
00399 #define REVERSE_PLANE(pln) do { \
00400             (pln).a = -(pln).a; \
00401             (pln).b = -(pln).b; \
00402             (pln).c = -(pln).c; \
00403             (pln).d = -(pln).d; \
00404         } while (0)
00405 
00406 #define REVERSE_CUTTING_PLANE_INSTANCE(rcpi) do {   \
00407             REVERSE_PLANE (rcpi->world_plane);      \
00408             REVERSE_PLANE (rcpi->dc_plane);         \
00409         } while (0)
00410 
00411 struct HT_Cutting_Plane_Instance {
00412     HT_Cutting_Plane_Instance alter *next;
00413     HT_Plane                        world_plane, dc_plane;
00414     int                             id;
00415 
00416     bool                            internal;   /* not from user, so not for cut geometry */
00417 };
00418 
00419 struct HT_Cutting_Plane_Set {
00420     HT_Cutting_Plane_Set alter      *   next;
00421 
00422     HT_Cutting_Plane_Instance const *   cutting_plane_instances;
00423     int                                 cutting_plane_count;
00424 };
00425 
00426 struct HT_Cutting_Plane_Rendition {
00427 
00428     HT_Cutting_Plane_Set const  *original_sets;         /* grouped as in database */
00429     HT_Cutting_Plane_Set const  *cutting_plane_sets;    /* grouped for drawing in multiple passes */
00430     HT_Cutting_Plane_Set const  *transparent_sets;      /* "" but with no overlapping subvolumes */
00431     int                         max_cutting_plane_count;
00432     int                         max_transparent_count;
00433     int                         cutting_plane_ids;
00434 
00435     HT_Incarnation              incarnation;
00436     HT_Reference_Count          refcount;
00437 };
00438 
00439 struct HT_Convex_Clip_Region {
00440     
00441     HT_Convex_Clip_Region       *next;
00442     HT_DC_Point                 *points;
00443     HT_Cutting_Plane_Instance   *edges;
00444     HT_Rectangle                bounds;
00445     int                         count;
00446     bool                        world_space;
00447     
00448     HT_Incarnation              incarnation;
00449     HT_Reference_Count          refcount;
00450 };
00451 
00452 
00453 typedef int HT_Clip_DC_Flags;
00454 
00455 #define DCCF_NONE           (HT_Clip_DC_Flags)0x00000000
00456 #define DCCF_HARD_CLIP      (HT_Clip_DC_Flags)0x00000001
00457 #define DCCF_CLIP_REGION    (HT_Clip_DC_Flags)0x00000002
00458 #define DCCF_CUTTING_PLANES (HT_Clip_DC_Flags)0x00000004
00459 #define DCCF_CRUDE_CLIP     (HT_Clip_DC_Flags)0x00000008
00460 #define DCCF_COLOR_SINGLE   (HT_Clip_DC_Flags)0x00000010
00461 #define DCCF_COLOR_VERTEX   (HT_Clip_DC_Flags)0x00000020
00462 #define DCCF_COLOR_EACH     (HT_Clip_DC_Flags)0x00000040
00463  
00464 #define DCCF_ALL    (DCCF_HARD_CLIP|DCCF_CLIP_REGION|DCCF_CUTTING_PLANES)
00465 
00466 #define CRUDE_CLIP_MARGIN   1024
00467 
00468 struct HT_User_Face_Pattern {
00469     HT_Incarnation              incarnation;
00470 
00471     unsigned char const         *pattern;
00472     int                         height;
00473     int                         width;
00474     bool                        top_to_bottom;
00475     int                         see_through;
00476 
00477     int                         stipple;
00478     HT_Reference_Count          refcount;
00479 };
00480 
00481 
00482 /* This rendition only tracks what was actually drawn in the window above the segment 
00483    being processed.  Window attributes are wound up and down into the ht_display_rendition->window */
00484 struct HT_Window_Rendition {
00485     HT_Segment_Cache            *segment_cache;
00486     HT_Texture const            *window_texture;
00487     HT_User_Face_Pattern const  *user_pattern;
00488 
00489     HT_Driver_Color             window_color;
00490     HT_Driver_Color             contrast_color;
00491     HT_RGB                      window_diffuse; /* ungamma'd version */
00492     HT_RGB                      contrast_diffuse; /* ungamma'd version */
00493 
00494     int                         window_pattern;
00495     bool                        window_blending;
00496 
00497     HT_Rectangle                extent;
00498     HT_Rectangle                soft_clip;
00499     HT_Int_Rectangle            net_extent,
00500                                 transform_extent,
00501                                 full_hard_clip,
00502                                 blend_extent,
00503                                 frame_widths;
00504     float                       aspect;
00505 
00506     HT_Window_Frame_Flags       frame_flags;
00507 
00508     float                       shadow_resolution;
00509 
00510     HT_Incarnation              incarnation;
00511     HT_Reference_Count          refcount;
00512 };
00513 
00514 
00515 
00516 struct HT_Material_Rendition {
00517 
00518 
00519     HT_Texture_Control_List     *diffuse_textures;
00520     HT_Texture                  *texture[MAT_TEXTURE_COUNT];
00521     HT_RGB                      diffuse_color;
00522     HT_RGB                      color[MAT_TEXTURE_COUNT];
00523 
00524     float                       opacity; /* 0.0=transparent, 1.0=opaque */
00525     float                       gloss;
00526     float                       index_of_refraction;
00527 
00528     bool                        has_textures;
00529 
00530     HT_Incarnation              incarnation;
00531     HT_Reference_Count          refcount;
00532 };
00533 
00534 struct HT_Color_Map_Rendition {
00535     HT_Color_Map const          *color_map;     /* pointer to database */
00536     HT_Driver_Color const       *driver_colors;  /* for non-MAPPED mode */
00537 
00538     HT_Color_Index              physical_map_offset; /* for MAPPED mode */
00539     HT_Color_Index              length;
00540 
00541     HT_Incarnation              incarnation;
00542     HT_Reference_Count          refcount;
00543 };
00544 
00545 struct HT_Texture_Rendition {
00546 
00547     HT_Texture                  **textures;
00548     HT_Integer32                *keys;
00549     int                         count;
00550     HT_Incarnation              incarnation;    
00551     HT_Reference_Count          refcount;
00552 };
00553 
00554 struct HT_Line_Style_Rendition {
00555     HT_Line_Style               **line_styles;
00556     HT_Line_Style               *solid_line_style;  
00557     HT_Integer32                *keys;
00558     int                         count;
00559     HT_Incarnation              incarnation;    
00560     HT_Reference_Count          refcount;
00561 };
00562 
00563 struct HT_Glyph_Rendition {
00564     HT_Glyph                    **glyphs;
00565     HT_Integer32                *keys;
00566     int                         count;
00567     HT_Incarnation              incarnation;    
00568     HT_Reference_Count          refcount;
00569 };
00570 
00571 struct HT_Misc_Rendition {
00572 
00573     HT_Texture_Matrix const     *texture_matrix;
00574 
00575     HT_Type_Flags               base_visibility,
00576                                 visibility,
00577                                 shadow_visibility,
00578                                 cut_geometry_visibility;
00579 
00580     HT_Rendo_Flags              complex_options;
00581     HT_Rendo_Flags              simple_options;
00582     HT_Rendo_Flags              interpolation_options;
00583     HT_Rendo_Debug              rendering_debug; /* see database.h for definitions */
00584     HT_Quantization_Flags       quantization;
00585     HT_Technology_Flags         technology;
00586     HT_HSR_Algorithm            hsr_algorithm;
00587 
00588 
00589     HT_Attribute_Lock           locks;
00590 
00591     HT_RGB                      ambient;
00592     HT_RGB                      lighting;
00593 
00594     /* only used during Standard_Select... */
00595     HT_Type_Flags               selectability,
00596                                 restricted_selectability,
00597                                 even_invisible;
00598     int                         related_selection_limit;
00599     struct {
00600         int                 shell, polyline;
00601     }                           internal_selection_limit;
00602     int                         selection_level;
00603 
00604     int                         pixel_threshold;
00605     bool                        use_octree;
00606     int                         maximum_extent;
00607     int                         maximum_extent_mode;
00608     int                         vertex_threshold;
00609 
00610     HT_Vector                   vector;
00611     float                       vector_tolerance;
00612 
00613     int                         display_lists;
00614     bool                        display_list_tree_here;
00615 
00616     bool                        mask_color_image;
00617 
00618     short                       antialias_options;
00619     
00620     HT_Incarnation              incarnation;
00621     HT_Reference_Count          refcount;
00622 };
00623 
00624 struct HT_Display_Rendition {
00625 
00626     HT_Color_Map_Rendition const *color_map_rendition;
00627 
00628     struct {
00629         HT_Buffer_Flags         options;
00630         int                     size_limit;
00631         HT_Color_Depth          color_depth;
00632     }                           buffer;
00633 
00634     struct {
00635         HT_Hidden_Line_Flags    options;
00636         HT_RGB                  color;
00637         HT_Line_Style           *line_style;
00638         float                   dim_factor;
00639         float                   face_displacement;
00640         HT_Generic_Size         weight;
00641         HT_HSR_Algorithm        hsr_algorithm;
00642     }                           hidden_line;
00643 
00644     struct {                    /* effective window values, held here until we actually get a window */
00645         HT_Driver_Color         color;
00646         HT_Driver_Color         contrast;
00647         HT_Driver_Color         base_color;
00648         HT_Driver_Color         base_contrast;
00649         HT_RGB                  diffuse; /* ungamma'd version */
00650         HT_RGB                  contrast_diffuse; /* ungamma'd version */
00651 
00652         HT_Texture const *texture;
00653         HT_User_Face_Pattern const      *user_pattern;
00654         int                     pattern;
00655         bool                blending;
00656         HT_Window_Frame_Flags   frame_flags;
00657     }                           window;
00658 
00659     struct {
00660         unsigned int *          bits;
00661         int                     count;
00662     }                           conditions;
00663 
00664     HT_Incarnation              incarnation;
00665     HT_Reference_Count          refcount;
00666 };
00667 
00668 struct HT_Geometry_Rendition {
00669 
00670     struct {
00671         HT_LOD_Flags            options;
00672         float                   ratio[LOD_MAX_LEVELS]; /* compression ratio */
00673         float                   threshold[LOD_MAX_LEVELS]; /* switch threshold */
00674         int                     min_triangle_count;
00675         int                     clamp;          /* clamp to level.  -1 if disabled */
00676         int                     num_levels;
00677         int                     max_degree;
00678         float                   tolerance;
00679         HT_Bounding             bounding;
00680         float                   cutoff[LOD_MAX_LEVELS]; /* calculation cutoff */
00681         int                     heuristic; /* usefulness heuristic (view independent) */
00682         int                     fallback; /* fallback in case we request a non-existent lod */
00683         int                     algorithm;
00684     }                           lod;
00685 
00686     HT_NURBS_Curve_Control          nurbs_curve;        
00687 
00688     HT_NURBS_Surface_Tessellation_Configs nurbs_surface_config;
00689 
00690     struct {
00691         int                     cylinder[LOD_MAX_LEVELS];
00692         int                     sphere[LOD_MAX_LEVELS];
00693     }                           tessellation;
00694 
00695     struct {
00696         float                   width_scale;
00697         float                   height_scale;
00698         HT_RGB                  tint_color;
00699     }                           image;
00700 
00701     int                         geometry_options;
00702     float                       hard_edge_dihedral;
00703 
00704     HT_Incarnation              incarnation;
00705     HT_Reference_Count          refcount;
00706 };
00707 
00708 struct HT_Visualization_Rendition {
00709 
00710     struct {
00711         HT_Plane                plane;
00712         HT_Vector               light;
00713         HT_RGBAS32              color;
00714         float                   opacity;
00715         int                     resolution;
00716         int                     blurring;
00717         bool                visible;
00718         bool                here;
00719     }                           simple_shadow;
00720 
00721     struct {
00722         int                     resolution;
00723         int                     samples;
00724         bool                visible;
00725         bool                jitter;
00726         int                     here;
00727     }                           shadow_map;
00728 
00729     struct {
00730         HT_Plane                plane;
00731         float                   opacity;
00732         float                   hither, yon;
00733         int                     blurring;
00734         bool                attenuation; /* by distance */
00735         bool                fading; /* by angle */
00736         bool                visible;
00737         bool                here;
00738     }                           simple_reflection;
00739 
00740     struct {
00741         int                     options;
00742         int                     style;
00743         HT_HSR_Algorithm        hsr_algorithm;
00744         int                     peeling_layers;
00745         float                   peeling_min_area;
00746         bool                    blending_active;
00747         bool                    zsort_fast;
00748     }                           transparency;
00749 
00750     struct {
00751         int                     level;
00752         float                   tolerance;
00753         float                   base_tolerance;
00754         bool                tolerance_is_percent;
00755         int                     match_color;
00756     }                           cut_geometry;
00757 
00758     struct {
00759         float                   hither;
00760         float                   yon;
00761     }                           fog;
00762 
00763     float                       ordered_weights[Heur_Order_COUNT];
00764 
00765     HT_Incarnation              incarnation;
00766     HT_Reference_Count          refcount;
00767 };
00768 
00769 
00770 struct HT_Light_Instance {
00771     HT_Light_Instance alter     *next;
00772     HT_Point const              *points;
00773     HT_Shadow_Map const         *shadow_map;
00774     HT_Key                      lightkey; 
00775     HT_Type                     type;
00776     HT_RGB                      color;
00777     HT_RGB                      ambient;
00778     HT_Point                    position;
00779     HT_Point                    target;
00780     HT_Vector                   direction;
00781     HT_Vector                   halfway;
00782     float                       inner,
00783                                 outer;
00784     float                       inner_cos,
00785                                 outer_cos;
00786     float                       concentration;
00787     int                         count;
00788     float                       area;
00789     int                         bright_side;
00790     HT_Type_Flags               visibility;
00791     HT_Type_Flags               shadow_visibility;
00792 };
00793 
00794 struct HT_Light_Rendition {
00795     HT_Light_Instance const     *lights;
00796     float                       scale;
00797     int                         count;
00798     bool                        compute_light_requires_xyz;
00799     HT_Incarnation              incarnation;
00800     HT_Reference_Count          refcount;
00801 };
00802 
00803 
00804 struct HT_Clip_Rectangle {
00805     HT_Clip_Rectangle alter     *next;
00806     int                         left, right, bottom, top;
00807 };
00808 
00809 typedef HT_Integer32    HT_TR_Flags;
00810 
00811 struct HT_Transform_Rendition {
00812 
00813     HT_Matrix const             *matrix;
00814     HT_Camera const             *camera;
00815     HT_Matrix const             *net_modelling_matrix;
00816     HT_Matrix const             *world_to_screen_matrix;
00817     HT_Matrix const             *object_to_view_matrix;
00818     HT_Matrix const             *object_to_projection_matrix;
00819 
00820     HT_Cutting_Plane_Rendition const *cutting_plane_rendition;
00821     HT_Convex_Clip_Region const *clip_region;
00822 
00823     int                         transform_type;
00824 
00825 #   define      TR_HARDWARE_LIGHTING            (HT_TR_Flags)0x00000001
00826 #   define      TR_LIGHTING                     (HT_TR_Flags)0x00000002
00827 #   define      TR_MODELLING_IS_3D              (HT_TR_Flags)0x00000004
00828 #   define      TR_RIGHT_HANDED_WORLD           (HT_TR_Flags)0x00000008
00829 
00830 #   define      TR_MATRIX_INCLUDES_SCREEN       (HT_TR_Flags)0x00000010
00831 #   define      TR_WORLD_TO_SCREEN_MATRIX_VALID (HT_TR_Flags)0x00000020
00832 #   define      TR_MATRIX_INCLUDES_MODELLING    (HT_TR_Flags)0x00000040
00833 #   define      TR_PLEASE_CULL                  (HT_TR_Flags)0x00000080
00834 
00835 #   define      TR_HARDWARE_CUTTING_PLANES      (HT_TR_Flags)0x00000100
00836 #   define      TR_CUTTING_PLANES               (HT_TR_Flags)0x00000200
00837 #   define      TR_PLEASE_SET_DC_CUT_PLANES     (HT_TR_Flags)0x00000400
00838 
00839 #   define      TR_SORT_HIDDEN_BY_YMIN          (HT_TR_Flags)0x00001000
00840 #   define      TR_SORT_HIDDEN_BY_PRIORITY      (HT_TR_Flags)0x00002000
00841 #   define      TR_SORT_HIDDEN_MASK             (HT_TR_Flags)0x00003000
00842 
00843 #   define      TR_CLIP_IS_NONNULL              (HT_TR_Flags)0x00004000
00844 #   define      TR_CLIP_IS_FULL                 (HT_TR_Flags)0x00008000
00845 
00846 #   define      TR_CLIPPING_NOT_NEEDED          (HT_TR_Flags)0x00010000
00847 
00848 #   define      TR_OBJECT_TO_PROJ_MATRIX_VALID  (HT_TR_Flags)0x00080000
00849 #   define      TR_CULLING_ALREADY_DONE         (HT_TR_Flags)0x00100000
00850 #   define      TR_OBJECT_TO_VIEW_MATRIX_VALID  (HT_TR_Flags)0x00200000
00851 
00852     HT_TR_Flags                 flags;
00853 
00854     bool                        z_buffering; /* not "TR" for low-lev conven. */
00855     bool                        disable_z_writes; 
00856     bool                        reverse_depth_test;
00857 
00858 
00859     HT_Clip_Rectangle           hard_clip;
00860     HT_Int_Rectangle            unframed_hard_clip;
00861 
00862     float                       wlimit;
00863     float                       wlimit_software_offset_scale;
00864     float                       z_max;
00865     float                       z_range[2];
00866     HT_Rectangle                screen_range;
00867     float                       face_displacement;
00868     float                       general_displacement;
00869     HT_Heuristics_Flags         heuristics;
00870     short                       culling;
00871 
00872 #   define      STEREO_OFF      0
00873 #   define      STEREO_LEFT     1
00874 #   define      STEREO_RIGHT    2
00875     char                        stereo_state;
00876     char                        stereo_pending_state;
00877     float                       stereo_separation;
00878     float                       stereo_distance;
00879 
00880     bool                    needs_stencil_test; /* only set to true if an IM callback needs the stencil test but has no clip_region */
00881 
00882 #   define      Deferral_NONE           0
00883 #   define      Deferral_DEFER          1
00884 #   define      Deferral_DRAW           2
00885 #   define      Deferral_NON_RECURSIVE  4
00886 
00887 #   define      Deferral_DEFER_UNIT     5
00888 #   define      Deferral_DRAW_LOCAL     6
00889 
00890     int                         deferral_mode;
00891 
00892     float                       unit_bounding_cutoff;
00893 
00894     int                         culling_result;
00895 
00896     HT_Incarnation              incarnation;
00897     HT_Reference_Count          refcount;
00898 };
00899 
00900 
00901 struct HT_Face_Rendition {
00902 
00903     HT_Material_Rendition const *material_rendition;
00904     HT_Material_Rendition const *back_material_rendition;
00905     HT_Light_Rendition const    *light_rendition;
00906     HT_User_Face_Pattern const  *user_pattern;
00907 
00908 
00909     HT_Driver_Color             color,
00910                                 contrast_color,
00911                                 back_color,
00912                                 base_color,
00913                                 base_contrast_color,
00914                                 base_back_color;
00915 
00916     int                         pattern;
00917 
00918 #   define      FACES_ONLY      1
00919 #   define      EDGES_ONLY      2
00920 #   define      FACES_AND_EDGES 3
00921     int                         include;
00922     HT_Type_Flags               base_visibility,
00923                                 visibility;
00924 
00925     HT_Reference_Count          refcount;
00926     HT_Incarnation              incarnation;
00927 };
00928 
00929 typedef int HT_Line_Rendition_Flags;
00930 
00931 #define LRF_NONE                        (HT_Line_Rendition_Flags) 0x00000000
00932 #define LRF_SUPPRESS_START_GLYPH        (HT_Line_Rendition_Flags) 0x00000001
00933 #define LRF_SUPPRESS_END_GLYPH          (HT_Line_Rendition_Flags) 0x00000002
00934 #define LRF_SUPPRESS_MIDDLE_GLYPH       (HT_Line_Rendition_Flags) 0x00000004
00935 #define LRF_FORCE_ABSOLUTE_WEIGHT       (HT_Line_Rendition_Flags) 0x00000010
00936 
00937 #define LRF_SUPPRESS_CAP_GLYPHS (LRF_SUPPRESS_START_GLYPH|LRF_SUPPRESS_END_GLYPH)
00938 #define LRF_SUPPRESS_GLYPHS     (LRF_SUPPRESS_CAP_GLYPHS|LRF_SUPPRESS_MIDDLE_GLYPH)     
00939 
00940 struct HT_Line_Rendition {
00941 
00942     HT_Material_Rendition const *material_rendition;
00943     HT_Light_Rendition const    *light_rendition;
00944     HT_Line_Style const         *line_style;
00945 
00946     HT_Face_Rendition const     *face_rendition;
00947     HT_Line_Rendition const     *solid_rendition;
00948     HT_Line_Rendition const     *contrast_rendition;
00949 
00950     HT_Incarnation              incarnation;
00951     HT_Reference_Count          refcount;
00952 
00953     HT_Driver_Color             color,
00954                                 contrast_color,
00955                                 base_color,
00956                                 base_contrast_color;
00957 
00958     HT_Line_Rendition_Flags     flags;
00959     int                         style;
00960     int                         weight;
00961     float                       join_cutoff_angle;
00962     float                       dbsize;
00963     HT_Generic_Size_Units       units;
00964 
00965 };
00966 
00967 typedef unsigned char HT_Marker_Rendition_Flags;
00968 #define MRF_NONE            (HT_Marker_Rendition_Flags) 0x00000000
00969 #define MRF_MIRROR          (HT_Marker_Rendition_Flags) 0x00000001
00970 #define MRF_TRANSFORMED     (HT_Marker_Rendition_Flags) 0x00000002
00971 
00972 struct HT_Marker_Rendition {
00973 
00974     HT_Material_Rendition const *material_rendition;
00975     HT_Light_Rendition const    *light_rendition;
00976     HT_Line_Rendition const     *solid_rendition;
00977     HT_Line_Rendition const     *contrast_rendition;
00978 
00979     HT_Glyph                    *glyph;
00980 
00981     HT_Incarnation              incarnation;
00982     HT_Reference_Count          refcount;
00983 
00984     HT_Driver_Color             color,
00985                                 contrast_color,
00986                                 base_color,
00987                                 base_contrast_color;
00988 
00989     float                       xsize,
00990                                 ysize;
00991     float                       dbsize;
00992     HT_Generic_Size_Units       units;
00993 
00994     HT_Marker_Rendition_Flags   flags;
00995 
00996 };
00997 
00998 #define INVALIDATE_XR(_xr) \
00999     _xr->fallback_index = 0; \
01000     _xr->font = null;
01001 
01002 struct HT_Text_Rendition {
01003 
01004     HT_Font_Instance const      *font;          /* driver land font */
01005     HT_Material_Rendition const *material_rendition;    
01006     HT_Line_Rendition const     *stroke_rendition; /* null if not needed */
01007     HT_Text_Font const          *names_ref; /* the struct that owns the names */
01008 
01009     HT_Incarnation              incarnation;
01010     HT_Reference_Count          refcount;
01011     
01012     HT_Driver_Color             color,
01013                                 contrast_color,
01014                                 base_color,
01015                                 base_contrast_color;
01016     int                         alignment;
01017     int                         justification;
01018     float                       spacing;
01019     HT_Point                    path;
01020 
01021     int                         fallback_index;
01022     bool                        font_stroked_fallback;
01023 
01024     /* the following are raw, copied from the database... */
01025     float                       dbsize,/* (db = database = prevent confusion) */
01026                                 size_tolerance,
01027                                 extra_space,
01028                                 greeking_limit;
01029     float                       rotation;
01030     float                       width_scale;
01031     float                       line_spacing;
01032     float                       slant;
01033     float                       renderer_cutoff;
01034     float                       preference_cutoff;
01035     bool                        rotation_follow_path;
01036     bool                        even_spacing;
01037     bool                        uniform_spacing;
01038     bool                        outline;
01039     bool                        underline;
01040     bool                        strikethrough;
01041     bool                        fill_edges;
01042     bool                        overline;
01043     bool                        bold;
01044     bool                        italic;
01045     bool                        skip_trim;  /* special handling for things like gather_screen_extent */
01046 
01047     int                         font_index; /* used for CGM font table */
01048 
01049     HT_Font_Transform           transform;
01050     HT_Font_Renderer            renderers[2];
01051     HT_Font_Preference          preferences[2];
01052     HT_Font_Greeking_Mode       greeking_mode;
01053 
01054     HT_Font_Size_Units          size_units,
01055                                 size_tolerance_units,
01056                                 extra_space_units,
01057                                 greeking_limit_units,
01058                                 renderer_cutoff_units,
01059                                 preference_cutoff_units;
01060 
01061 };
01062 
01063 
01064 struct HT_User_Rendition {
01065 
01066     HT_Indexed_User_Option const        *values;
01067     HT_Incarnation                      incarnation;
01068     HT_Reference_Count                  refcount;
01069     HT_Integer32                        count;
01070 };
01071 
01072 
01073 struct HT_Segment_Info {
01074     HT_Segment_Info     alter   *next;
01075     HT_Subsegment const         *instance;
01076     HT_Segment const            *segment;
01077     int                         save_depth;
01078     bool                        force_erase;
01079 };
01080 
01081 
01082 typedef int HT_Text_Info_Flags;
01083 #define TIF_NONE            (HT_Text_Info_Flags) 0x00000000
01084 #define TIF_ONE_AT_A_TIME   (HT_Text_Info_Flags) 0x00000001
01085 #define TIF_MISSING_CHARS   (HT_Text_Info_Flags) 0x00000002
01086 #define TIF_USING_BUILTIN   (HT_Text_Info_Flags) 0x00000004
01087 
01088 
01089 
01090 #define TKIF_NONE               (HT_Text_Info_Flags) 0x00000000
01091 #define TKIF_OMITTED            (HT_Text_Info_Flags) 0x00000001
01092 #define TKIF_INVISIBLE          (HT_Text_Info_Flags) 0x00000002
01093 #define TKIF_MISSING            (HT_Text_Info_Flags) 0x00000004
01094 #define TKIF_VERTICAL_OFFSET    (HT_Text_Info_Flags) 0x00000010
01095 
01096 struct HT_Text_Karacter_Info {
01097     HT_Net_Rendition    const   *nr;    
01098     HT_Text_Font                *tf_proxy;
01099     
01100     HT_Point                    position;
01101     HT_Point                    point;  
01102     float                       width;
01103     float                       height;
01104     struct {
01105         float                   width;
01106         float                   height;
01107         float                   x;
01108         float                   y;
01109     } string,   /* relative to basic path (before region) */
01110                                 screen; /* relative to screen (before region) */
01111     float                       slant_extra;
01112     float                       vertical_offset;
01113     float                       distance;
01114 
01115     HT_Text_Info_Flags          flags;
01116     int                         offset;
01117 };
01118 
01119 struct HT_Text_Info {
01120     HT_Text const           *text;  
01121     HT_Text_Karacter_Info   *kinfo;
01122     int                     *kindex;
01123 
01124     HT_KName                kname;
01125 
01126     HT_Point                position;
01127     HT_Point                reference;
01128     HT_Point                ref_adjust;
01129     HT_Point                db_point;
01130     HT_Vector               path;           /* final path of overall text */
01131     HT_Vector               cpath;          /* baseline path of each character */
01132     HT_Vector               contrib;
01133     HT_Vector               scale;
01134     HT_Vector               next_line;      /* jump to successive lines */
01135 
01136     /* these few only needed by I.M. but placed before the rest for alignment */
01137     HT_Vector               baseline;
01138     HT_Vector               longest_baseline;
01139     HT_Vector               vertical;
01140     HT_Point                special;
01141     int                     which;
01142     int                     line_index;
01143 
01144     float                   total_distance;
01145     float                   extra_space;
01146     float                   greeking_limit;
01147 
01148     /* largest from all characters */
01149     float                   max_vspace;
01150     float                   max_size;
01151 
01152     int                     omitted_count;
01153 
01154     HT_Text_Info_Flags      flags;
01155 };
01156 
01157 
01158 #define ACTION_CALL HC_CDECL
01159 #define DRIVER_ACTION(nr, routine) \
01160             (*(nr)->display_context->current_actions->routine)
01161 #define CALLBACK_ACTION(nr, routine) \
01162             (*(nr)->action_rendition->routine)
01163 
01164 EXTERNAL {
01165 
01166 typedef void (ACTION_CALL *HT_Draw_DC_Polytriangle_Action)
01167                  (HT_Net_Rendition const *nr,
01168                             int count,
01169                             HT_DC_Point const *points);
01170 
01171 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Polytriangle_Action)
01172                  (HT_Net_Rendition const *nr,
01173                             int count,
01174                             HT_DC_Point const *points,
01175                             HT_RGBAS32 const *color,
01176                             bool single);
01177 
01178 typedef void (ACTION_CALL *HT_Draw_DC_Gouraud_Polytriangle_Action)
01179                  (HT_Net_Rendition const *nr,
01180                             int count,
01181                             HT_DC_Point const *points,
01182                             HT_RGBAS32 const *colors);
01183 
01184 typedef void (ACTION_CALL *HT_Draw_DC_Phong_Polytriangle_Action)
01185                  (HT_Net_Rendition const *nr,
01186                             int count,
01187                             HT_DC_Point const *points,
01188                             HT_RGBA const *colors,
01189                             HT_Plane const *planes);
01190 
01191 typedef void (ACTION_CALL *HT_Draw_DC_Textured_Polytriangle_Action)
01192                  (HT_Net_Rendition const *nr,
01193                             int count,
01194                             HT_DC_Point const *points,
01195                             HT_RGBA const *colors,
01196                             HT_Plane const *planes,
01197                             float const *params,
01198                             int param_width,
01199                             HT_Integer32 param_flags);
01200 
01201 typedef void (ACTION_CALL *HT_Draw_DC_Polyline_Action)
01202                  (HT_Net_Rendition const *nr,
01203                             int count,
01204                             HT_DC_Point const *points);
01205 
01206 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Polyline_Action)
01207                  (HT_Net_Rendition const *nr,
01208                             int count,
01209                             HT_DC_Point const *points,
01210                             HT_RGBAS32 const *color,
01211                             bool single_color);
01212 
01213 typedef void (ACTION_CALL *HT_Draw_DC_Gouraud_Polyline_Action)
01214                  (HT_Net_Rendition const *nr,
01215                             int count,
01216                             HT_DC_Point const *points,
01217                             HT_RGBAS32 const *colors);
01218 
01219 typedef void (ACTION_CALL *HT_Draw_DC_Phong_Polyline_Action)
01220                  (HT_Net_Rendition const *nr,
01221                             int count,
01222                             HT_DC_Point const *points,
01223                             HT_RGBA const *colors,
01224                             HT_Plane const *planes);
01225 
01226 typedef void (ACTION_CALL *HT_Draw_DC_Textured_Polyline_Action)
01227                  (HT_Net_Rendition const *nr,
01228                             int count,
01229                             HT_DC_Point const *points,
01230                             HT_RGBA const *colors,
01231                             HT_Plane const *planes,
01232                             float const *params,
01233                             int param_width,
01234                             HT_Integer32 param_flags);
01235 
01236 typedef void (ACTION_CALL *HT_Draw_DC_Polymarker_Action)
01237                  (HT_Net_Rendition const *nr,
01238                             int count,
01239                             HT_DC_Point const *points,
01240                             float const *rotations,
01241                             float const *size_fixups);
01242 
01243 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Polymarker_Action)
01244                  (HT_Net_Rendition const *nr,
01245                             int count,
01246                             HT_DC_Point const *points,
01247                             HT_RGBAS32 const *color,
01248                             bool single_color,
01249                             float const *rotations,
01250                             float const *size_fixups);
01251 
01252 typedef void (ACTION_CALL *HT_Draw_DC_Polydot_Action)
01253                  (HT_Net_Rendition const *nr,
01254                             int count,
01255                             HT_DC_Point const *points);
01256 
01257                             
01258 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Polydot_Action)
01259                  (HT_Net_Rendition const *nr,
01260                             int count,
01261                             HT_DC_Point const *points,
01262                             HT_RGBAS32 const *color,
01263                             bool single);
01264 
01265 
01266 typedef void (ACTION_CALL *HT_Draw_DC_Triangle_Action)
01267                  (HT_Net_Rendition const *nr,
01268                             HT_DC_Point const *points);
01269 
01270 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Triangle_Action)
01271                  (HT_Net_Rendition const *nr,
01272                             HT_DC_Point const *points,
01273                             HT_RGBAS32 const *color);
01274 
01275 typedef void (ACTION_CALL *HT_Draw_DC_Gouraud_Triangle_Action)
01276                  (HT_Net_Rendition const *nr,
01277                             HT_DC_Point const *points,
01278                             HT_RGBAS32 const *colors);
01279 
01280 typedef void (ACTION_CALL *HT_Draw_DC_Reshaded_Triangle_Action)
01281                  (HT_Net_Rendition const *nr,
01282                             HT_DC_Point const *points,
01283                             HT_RGBA const *colors,
01284                             HT_Plane const *planes,
01285                             float const *params,
01286                             int param_width,
01287                             HT_Integer32 param_flags);
01288 
01289 typedef void (ACTION_CALL *HT_Draw_DC_Line_Action)
01290                  (HT_Net_Rendition const *nr,
01291                             HT_DC_Point const *points);
01292 
01293 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Line_Action)
01294                  (HT_Net_Rendition const *nr,
01295                             HT_DC_Point const *points,
01296                             HT_RGBAS32 const *color);
01297 
01298 typedef void (ACTION_CALL *HT_Draw_DC_Gouraud_Line_Action)
01299                  (HT_Net_Rendition const *nr,
01300                             HT_DC_Point const *points,
01301                             HT_RGBAS32 const *colors);
01302 
01303 typedef void (ACTION_CALL *HT_Draw_DC_Reshaded_Line_Action)
01304                  (HT_Net_Rendition const *nr,
01305                             HT_DC_Point const *points,
01306                             HT_RGBA const *colors,
01307                             HT_Plane const *planes,
01308                             float const *params,
01309                             int param_width,
01310                             HT_Integer32 param_flags);
01311 
01312 typedef void (ACTION_CALL *HT_Draw_DC_Marker_Action)
01313                  (HT_Net_Rendition const *nr,
01314                             HT_DC_Point const *where);
01315 
01316 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Marker_Action)
01317                  (HT_Net_Rendition const *nr,
01318                             HT_DC_Point const *where,
01319                             HT_RGBAS32 const *color);
01320 
01321 typedef void (ACTION_CALL *HT_Draw_DC_Face_Action)
01322                  (HT_Net_Rendition const *nr,
01323                             int count,
01324                             HT_DC_Point const *points);
01325 
01326 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Face_Action)
01327                  (HT_Net_Rendition const *nr,
01328                             int count,
01329                             HT_DC_Point const *points,
01330                             HT_RGBAS32 const *color);
01331 
01332 typedef void (ACTION_CALL *HT_Draw_DC_Edge_Action)
01333                   (HT_Net_Rendition const *nr,
01334                              int count,
01335                              HT_DC_Point const *points);
01336 
01337 typedef void (ACTION_CALL *HT_Draw_DC_Text_Stroke_Action)
01338                  (HT_Net_Rendition const *nr,
01339                             int count,
01340                             HT_DC_Point const *points);
01341 
01342 typedef void (ACTION_CALL *HT_Draw_DC_Text_Area_Action)
01343                  (HT_Net_Rendition const *nr,
01344                             int count,
01345                             HT_DC_Point const *points);
01346 
01347 typedef void (ACTION_CALL *HT_Draw_DC_Stenciled_Quad_Action)
01348                  (HT_Net_Rendition const *nr,
01349                             HT_DC_Point const *pts,
01350                             HT_Stencil_Bitmap const *sb);
01351 
01352 typedef void (ACTION_CALL *HT_Draw_Window_Action)
01353                  (HT_Net_Rendition const *nr,
01354                             HT_Int_Rectangle const *extent);
01355 
01356 typedef void (ACTION_CALL *HT_Draw_Window_Frame_Action)
01357                  (HT_Net_Rendition const *nr,
01358                             HT_Int_Rectangle const *extent,
01359                             HT_Int_Rectangle alter *frame,
01360                             bool calculate_only);
01361 
01362 typedef void (ACTION_CALL *HT_Draw_Text_Action)
01363                  (HT_Net_Rendition const *nr,
01364                             HT_Text_Info const *info);
01365 
01366 typedef void (ACTION_CALL *HT_Draw_3D_Marker_Action)
01367                  (HT_Net_Rendition const *nr,
01368                             HT_Marker const *pl);
01369 
01370 typedef void (ACTION_CALL *HT_Draw_3D_Polyline_Action)
01371                  (HT_Net_Rendition const *nr,
01372                             HT_Polyline const *pl);
01373 
01374 typedef void (ACTION_CALL *HT_Draw_3D_NURBS_Curve_Action)
01375                  (HT_Net_Rendition const *nr,
01376                             HT_NURBS_Curve const *crv);
01377 
01378 typedef void (ACTION_CALL *HT_Draw_3D_NURBS_Surface_Action)
01379                  (HT_Net_Rendition const *nr,
01380                             HT_NURBS_Surface const *srf);
01381 
01382 typedef void (ACTION_CALL *HT_Draw_3D_Polygon_Action)
01383                  (HT_Net_Rendition const *nr,
01384                             HT_Polygon const *pg);
01385 
01386 typedef void (ACTION_CALL *HT_Draw_3D_Contour_Action)
01387                  (HT_Net_Rendition const *nr,
01388                             HT_Contour const *con);
01389 
01390 typedef void (ACTION_CALL *HT_Draw_3D_Polyedge_Action)
01391                  (HT_Net_Rendition const *nr,
01392                             HT_Polyedge const *pe);
01393 
01394 typedef void (ACTION_CALL *HT_Draw_3D_Polymarker_Action)
01395                  (HT_Net_Rendition const *nr,
01396                             HT_Polymarker const *pm);
01397 
01398 typedef void (ACTION_CALL *HT_Draw_3D_Tristrip_Action)
01399                  (HT_Net_Rendition const *nr,
01400                             HT_Tristrip const *ts);
01401 
01402 typedef void (ACTION_CALL *HT_Draw_3D_Polyedge_From_Tristrip_Action)
01403                  (HT_Net_Rendition const *nr,
01404                             HT_Polyedge const *pe,
01405                             HT_Tristrip const *ts);
01406 
01407 typedef void (ACTION_CALL *HT_Draw_3D_Polyhedron_Action)
01408                  (HT_Net_Rendition const *nr,
01409                             HT_Polyhedron const *ph);
01410 
01411 typedef void (ACTION_CALL *HT_Draw_3D_Cylinder_Action)
01412                  (HT_Net_Rendition const *nr,
01413                             HT_Cylinder const *cyl);
01414 
01415 typedef void (ACTION_CALL *HT_Draw_3D_PolyCylinder_Action)
01416                  (HT_Net_Rendition const *nr,
01417                             HT_PolyCylinder const *pcyl);
01418 
01419 typedef void (ACTION_CALL *HT_Draw_3D_Sphere_Action)
01420                  (HT_Net_Rendition const *nr,
01421                             HT_Sphere const *s);
01422 
01423 typedef void (ACTION_CALL *HT_Draw_3D_Text_Action)
01424                  (HT_Net_Rendition const *nr,
01425                             HT_Text const *tx);
01426 
01427 typedef void (ACTION_CALL *HT_Draw_3D_Image_Action)
01428                  (HT_Net_Rendition const *nr,
01429                             HT_Image const *img);
01430 
01431 typedef void (ACTION_CALL *HT_Draw_3D_Grid_Action)
01432                  (HT_Net_Rendition const *nr,
01433                             HT_Grid const *gr);
01434 
01435 typedef void (ACTION_CALL *HT_Draw_3D_Ellipse_Action)
01436                  (HT_Net_Rendition const *nr,
01437                             HT_Ellipse const *el);
01438 
01439 typedef void (ACTION_CALL *HT_Draw_3D_Elliptical_Arc_Action)
01440                  (HT_Net_Rendition const *nr,
01441                             HT_Elliptical_Arc const *ela);
01442 
01443 typedef void (ACTION_CALL *HT_Draw_3D_Geometry_Action)
01444                  (HT_Net_Rendition const *nr,
01445                             HT_Geometry const *g);
01446 
01447 typedef void (ACTION_CALL *HT_Draw_3D_Text_Strokes_Action)
01448                  (HT_Net_Rendition const *nr,
01449                             HT_Polyline const *pl);
01450 
01451 typedef void (ACTION_CALL *HT_Draw_3D_Text_Areas_Action)
01452                  (HT_Net_Rendition const *nr,
01453                             HT_Polygon const *pg);
01454 
01455 typedef void (ACTION_CALL *HT_Draw_3D_Stenciled_Quad_Action)
01456                  (HT_Net_Rendition const *nr,
01457                             HT_Point const *pts,
01458                             HT_Stencil_Bitmap const *sb);
01459 
01460 
01461 typedef void (ACTION_CALL *HT_Draw_Segment_Action)
01462                  (HT_Net_Rendition const *nr,
01463                             HT_Segment_Info const *info);
01464 
01465 typedef void (ACTION_CALL *HT_Draw_Segment_Tree_Action)
01466                  (HT_Net_Rendition const *nr,
01467                             HT_Segment_Info const *info);
01468 
01469 typedef void (ACTION_CALL *HT_Get_Actions_Action)
01470                  (HT_Action_Table alter *at);
01471 
01472 typedef void (ACTION_CALL *HT_Driver_Startup_Action)
01473                  (HT_Net_Rendition const *nr);
01474 typedef void (ACTION_CALL *HT_Driver_Shutdown_Action)
01475                  (HT_Net_Rendition const *nr);
01476 
01477 typedef void (ACTION_CALL *HT_Init_Picture_Action)
01478                  (HT_Net_Rendition const *nr);
01479 
01480 typedef void (ACTION_CALL *HT_Finish_Picture_Action)
01481                  (HT_Net_Rendition const *nr,
01482                             bool swap_buffers);
01483 
01484 
01485 typedef void (ACTION_CALL *HT_Create_Region_Action)
01486                  (HT_Net_Rendition const *nr,
01487                             HT_Int_Rectangle const *area,
01488                             void alter * alter *image_buffer,
01489                             void alter * alter *z_buffer);
01490 
01491 typedef void (ACTION_CALL *HT_Save_Region_Action)
01492                  (HT_Net_Rendition const *nr,
01493                             HT_Int_Rectangle const *area,
01494                             void alter *image_buffer,
01495                             void alter *z_buffer);
01496 
01497 typedef void (ACTION_CALL *HT_Restore_Region_Action)
01498                  (HT_Net_Rendition const *nr,
01499                             HT_Int_Rectangle const *area,
01500                             void alter *image_buffer,
01501                             void alter *z_buffer);
01502 
01503 typedef void (ACTION_CALL *HT_Destroy_Region_Action)
01504                  (HT_Net_Rendition const *nr,
01505                             void alter *image_buffer,
01506                             void alter *z_buffer);
01507 
01508 typedef void (ACTION_CALL *HT_Draw_3D_Light_Action)
01509                  (HT_Net_Rendition const *nr,
01510                             HT_Light const *el);
01511 
01512 
01513 typedef void (ACTION_CALL *HT_Stop_Device_Action)
01514                  (HT_Display_Context alter *dc);
01515 
01516 typedef void (ACTION_CALL *HT_Get_Physical_Info_Action)
01517                  (HT_Display_Context alter *dc);
01518 
01519 typedef void (ACTION_CALL *HT_Get_Current_Info_Action)
01520                  (HT_Display_Context alter *dc);
01521 
01522 typedef bool (ACTION_CALL *HT_Update_Action)
01523                  (HT_Display_Context alter *dc);
01524 
01525 typedef void (ACTION_CALL *HT_Draw_Tree_Action)
01526                  (HT_Net_Rendition const *nr,
01527                             HT_Subsegment const *subseg);
01528 
01529 typedef void (ACTION_CALL *HT_Render_Action)
01530                  (HT_Net_Rendition const *nr,
01531                             HT_Geometry const *geom,
01532                             unsigned HT_Integer32 mask,
01533                             bool single);
01534 
01535 typedef bool (ACTION_CALL *HT_Select_Action)
01536                  (HT_Display_Context alter *dc,
01537                             HT_Selection_Event alter *se);
01538 
01539 typedef void (ACTION_CALL *HT_Init_Update_Action)
01540                  (HT_Display_Context const *dc);
01541 
01542 typedef void (ACTION_CALL *HT_Finish_Update_Action)
01543                  (HT_Display_Context const *dc);
01544 
01545 typedef POINTER_SIZED_INT (ACTION_CALL *HT_Get_Outer_Window_Action)
01546                  (HT_Display_Context const *dc);
01547 
01548 typedef void (ACTION_CALL *HT_Free_Outer_Window_Action)
01549                  (HT_Display_Context const *dc);
01550 
01551 typedef void (ACTION_CALL *HT_Resize_Outer_Window_Action)
01552                  (HT_Display_Context const *dc);
01553 
01554 typedef void (ACTION_CALL *HT_Retitle_Outer_Window_Action)
01555                  (HT_Display_Context const *dc);
01556 
01557 typedef void (ACTION_CALL *HT_Pop_Outer_Window_Action)
01558                  (HT_Display_Context const *dc);
01559 
01560 typedef void (ACTION_CALL *HT_Draw_DC_Ellipse_Action)
01561                  (HT_Net_Rendition const *nr,
01562                             HT_DC_Point const *where,
01563                             HT_DC_Point const *radius);
01564 
01565 typedef void (ACTION_CALL *HT_Draw_DC_Elliptical_Arc_Action)
01566                  (HT_Net_Rendition const *nr,
01567                             HT_DC_Point const *where,
01568                             HT_DC_Point const *radius,
01569                             float start,
01570                             float end);
01571 
01572 typedef void (ACTION_CALL *HT_Draw_DC_Outline_Ellipse_Action)
01573                  (HT_Net_Rendition const *nr,
01574                             HT_DC_Point const *where,
01575                             HT_DC_Point const *radius);
01576 
01577 typedef void (ACTION_CALL *HT_Draw_DC_Polygon_Action)
01578                  (HT_Net_Rendition const *nr,
01579                             int count,
01580                             HT_DC_Point const *points);
01581 
01582 typedef void (ACTION_CALL *HT_Draw_DC_Rectangle_Action)
01583                  (HT_Net_Rendition const *nr,
01584                             int left,
01585                             int right,
01586                             int bottom,
01587                             int top);
01588 
01589 typedef void (ACTION_CALL *HT_Draw_DC_Image_Action)
01590                  (HT_Net_Rendition const *nr,
01591                             HT_DC_Point const *start,
01592                             HT_DC_Point const *end,
01593                             int hoffset,
01594                             HT_Image_Format format,
01595                             int row_bytes,
01596                             void const *const *rasters,
01597                             int pattern,
01598                             HT_Driver_Color const *contrast_color,
01599                             HT_Image const *db_image);
01600 
01601 typedef void (ACTION_CALL *HT_Draw_DC_Dot_Action)
01602                  (HT_Net_Rendition const *nr,
01603                             HT_DC_Point const *point);
01604 
01605 typedef void (ACTION_CALL *HT_Draw_DC_Text_Action)
01606                  (HT_Net_Rendition const *nr,
01607                             HT_DC_Point const *where,
01608                             int count,
01609                             unsigned short const *kstring);
01610 
01611 typedef bool (ACTION_CALL *HT_Measure_Char_Action)
01612                 (HT_Net_Rendition const *nr,
01613                             HT_Font_Instance const *font_instance,
01614                             unsigned short karacter,
01615                             float *size_out,
01616                             bool *missing,
01617                             void ** per_char_data);
01618 
01619 typedef void (ACTION_CALL *HT_Draw_Font_Action)
01620                 (HT_Net_Rendition const *nr,
01621                             HT_Font_Instance const *font_instance,
01622                             HT_Point const *position,
01623                             int count,
01624                             unsigned short const *karacter,
01625                             HT_Vector const *scale);
01626 
01627 typedef bool (ACTION_CALL *HT_Name_Font_Action)
01628                 (HT_Net_Rendition const *nr,
01629                             HT_Font_Name const *font_name_in,
01630                             HT_Font_Name alter *font_name_out);
01631                     
01632 typedef void (ACTION_CALL *HT_Size_Font_Action)
01633                 (HT_Net_Rendition const *nr,
01634                             HT_Font_Instance alter *font_instance);
01635 
01636 typedef bool (ACTION_CALL *HT_Will_Use_Stencil_Font_Action)
01637                 (HT_Net_Rendition const *nr,
01638                             HT_Font_Instance const *font_instance);
01639 
01640 typedef unsigned short (ACTION_CALL *HT_Map_Font_Char_Index_Action)
01641                 (HT_Font_Instance const *font_instance,
01642                             unsigned short count);
01643 
01644 typedef HT_Stencil_Bitmap * (ACTION_CALL *HT_Make_Font_Stencil_Action)
01645                 (HT_Net_Rendition const *nr,
01646                             HT_Font_Instance const *font_instance,
01647                             unsigned short mapped_index,
01648                             int bitmap_height,
01649                             int bolding_level,
01650                             float slant,
01651                             float rotation,
01652                             float width_scale,
01653                             bool antialias);
01654 
01655 typedef void (ACTION_CALL *HT_Draw_DC_Spans_Action)
01656                  (HT_Net_Rendition const *nr,
01657                             HT_Span_Rendition const *sr,
01658                             HT_Span const *span,
01659                             int num_spans,
01660                             int top);
01661 
01662 typedef void (ACTION_CALL *HT_Draw_DC_Colorized_Spans_Action)
01663                  (HT_Net_Rendition const *nr,
01664                             HT_Span_Rendition const *sr,
01665                             HT_Span const *span,
01666                             int num_spans,
01667                             int top);
01668 
01669 typedef void (ACTION_CALL *HT_Draw_DC_Gouraud_Spans_Action)
01670                  (HT_Net_Rendition const *nr,
01671                             HT_Span_Rendition const *sr,
01672                             HT_Span const *span,
01673                             int num_spans,
01674                             int top);
01675 
01676 typedef void (ACTION_CALL *HT_Draw_DC_Reshaded_Spans_Action)
01677                  (HT_Net_Rendition const *nr,
01678                             HT_Span_Rendition const *sr,
01679                             HT_Span const *span,
01680                             int num_spans,
01681                             int top,
01682                             HT_Integer32 param_flags);
01683 
01684 typedef void (ACTION_CALL *HT_Draw_DC_Bit_Rasters_Action)
01685                  (HT_Net_Rendition const *nr,
01686                             HT_DC_Point const *start,
01687                             HT_DC_Point const *end,
01688                             int row_bytes,
01689                             unsigned char const *rasters);
01690 
01691 typedef void (ACTION_CALL *HT_Draw_DC_Gray8_Rasters_Action)
01692                  (HT_Net_Rendition const *nr,
01693                             HT_DC_Point const *start,
01694                             HT_DC_Point const *end,
01695                             int row_bytes,
01696                             unsigned char const *rasters);
01697 
01698 typedef void (ACTION_CALL *HT_Draw_DC_Mapped8_Rasters_Action)
01699                  (HT_Net_Rendition const *nr,
01700                             HT_DC_Point const *start,
01701                             HT_DC_Point const *end,
01702                             int row_bytes,
01703                             unsigned char const *rasters);
01704 
01705 typedef void (ACTION_CALL *HT_Draw_DC_Mapped16_Rasters_Action)
01706                  (HT_Net_Rendition const *nr,
01707                             HT_DC_Point const *start,
01708                             HT_DC_Point const *end,
01709                             int row_bytes,
01710                             unsigned short const *rasters);
01711 
01712 typedef void (ACTION_CALL *HT_Draw_DC_RGB32_Rasters_Action)
01713                  (HT_Net_Rendition const *nr,
01714                             HT_DC_Point const *start,
01715                             HT_DC_Point const *end,
01716                             int row_bytes,
01717                             HT_RGBAS32 const *rasters);
01718 
01719 typedef void (ACTION_CALL *HT_Draw_Inter_Text_Action)
01720                  (HT_Net_Rendition const *nr,
01721                             HT_Text_Info const *text_info);
01722 
01723 typedef void (ACTION_CALL *HT_Draw_Plain_Text_Action)
01724                  (HT_Net_Rendition const * nr,
01725                             HT_Text const * text,
01726                             HT_Point const * position,
01727                             int count,
01728                             unsigned short const * kp,
01729                             HT_Text_Karacter_Info const * kinfo);
01730 
01731 typedef void (ACTION_CALL *HT_Draw_Overlay_List_Action)
01732                  (HT_Net_Rendition const *nr);
01733 
01734 typedef void (ACTION_CALL *HT_Undraw_Overlay_List_Action)
01735                  (HT_Net_Rendition const *nr);
01736 
01737 typedef bool (ACTION_CALL *HT_Request_Location_Action)
01738                  (HT_Display_Context const *dc,
01739                             int alter *button,
01740                             int alter *x,
01741                             int alter *y);
01742 
01743 typedef bool (ACTION_CALL *HT_Request_Keyboard_Action)
01744                  (HT_Display_Context const *dc,
01745                             int alter *button,
01746                             int alter *status);
01747 
01748 typedef void (ACTION_CALL *HT_Set_Device_Color_Map_Action)
01749                  (HT_Display_Context const *dc,
01750                             unsigned int r,
01751                             unsigned int g,
01752                             unsigned int b,
01753                             int index);
01754 
01755 typedef void (ACTION_CALL *HT_Find_Several_Fonts_Action)
01756                  (HT_Display_Context alter *dc);
01757 
01758 typedef bool (ACTION_CALL *HT_Find_One_Font_Action)
01759                  (HT_Display_Context alter *dc,
01760                             char const *name);
01761 
01762 typedef void * (ACTION_CALL *HT_Load_Font_Action)
01763                  (HT_Display_Context const *dc,
01764                             char const *name,
01765                             HT_Font_Instance alter *instance);
01766 
01767 typedef void (ACTION_CALL *HT_Unload_Font_Action)
01768                  (HT_Display_Context const *dc,
01769                             HT_Font_Instance alter *instance);
01770 
01771 typedef void (ACTION_CALL *HT_Clear_Z_Buffer_Action)
01772                  (HT_Net_Rendition const *nr,
01773                             int left,
01774                             int right,
01775                             int bottom,
01776                             int top);
01777 
01778 typedef void (ACTION_CALL *HT_Compute_Shading_Action)
01779                  (HT_Net_Rendition const *nr,
01780                             HT_Light_Rendition const *lir,
01781                             HT_Material_Rendition const *mr,
01782                             HT_Point const *location,
01783                             HT_RGB const *color,
01784                             HT_Plane const *plane,
01785                             HT_Vector const *aligner,
01786                             float const *params,
01787                             int param_width,
01788                             int param_flags,
01789                             HT_RGBA alter *result,
01790                             HT_RGBA alter *specular_result);
01791 
01792 typedef void (ACTION_CALL *HT_Start_Inclusion_Action)
01793                   (HT_Net_Rendition const *nr,
01794                              long priority);
01795 
01796 typedef void (ACTION_CALL *HT_Finish_Inclusion_Action)
01797                   (HT_Net_Rendition const *nr);
01798 
01799 typedef void (ACTION_CALL *HT_Destroy_List_Action)
01800                  (HT_Display_Context alter *dc, void * id);
01801 
01802 typedef void (ACTION_CALL *HT_Flush_Display_Lists_Action)
01803                  (HT_Display_Context alter *dc);
01804 
01805 typedef void (ACTION_CALL *HT_Show_Image_Data_Action)
01806                  (void * id);
01807 
01808 
01809 typedef void * (ACTION_CALL *HT_Begin_Occlusion_Query_Action)
01810                  (HT_Net_Rendition const *nr,
01811                             bool disable_write);
01812 typedef void (ACTION_CALL *HT_End_Occlusion_Query_Action)
01813                  (HT_Net_Rendition const *nr,
01814                             void * id);
01815 typedef int (ACTION_CALL *HT_Get_Occlusion_Query_Action)
01816                  (HT_Net_Rendition const *nr,
01817                             void * id);
01818 typedef void (ACTION_CALL *HT_Delete_Occlusion_Query_Action)
01819                  (HT_Net_Rendition const *nr,
01820                             void * id);
01821 
01822 
01823 typedef void (ACTION_CALL *HT_Create_Frame_Buffer_Action)
01824                  (HT_Net_Rendition const *nr,
01825                             int width,
01826                             int height,
01827                             HT_Image_Format format,
01828                             HT_Image alter * alter *image,
01829                             void alter * alter *driver_specific);
01830 
01831 typedef void (ACTION_CALL *HT_Display_Frame_Buffer_Action)
01832                  (HT_Net_Rendition const *nr,
01833                             HT_DC_Point const *start,
01834                             HT_DC_Point const *end,
01835                             HT_Image const *image,
01836                             int hoffset,
01837                             int voffset,
01838                             void const *driver_specific);
01839 
01840 typedef void (ACTION_CALL *HT_Destroy_Frame_Buffer_Action)
01841                  (HT_Net_Rendition const *nr,
01842                             HT_Image alter *buffer,
01843                             void alter *driver_specific);
01844 
01845 typedef bool (ACTION_CALL *HT_Await_Events_Action)
01846                  (void);
01847 
01848 typedef bool (ACTION_CALL *HT_Enable_Wakeup_Action)
01849                  (void);
01850 
01851 typedef bool (ACTION_CALL *HT_Disable_Wakeup_Action)
01852                  (void);
01853 
01854 typedef bool (ACTION_CALL *HT_Snapshot_Action)
01855                  (HT_Net_Rendition const *nr,
01856                             int width,
01857                             int height,
01858                             unsigned char alter *data);
01859 
01860 typedef void (ACTION_CALL *HT_Shadow_Map_Draw_Tree_Action)
01861                  (HT_Net_Rendition const *nr,
01862                             HT_Subsegment const *subseg);
01863 
01864 typedef void (ACTION_CALL *HT_Simple_Shadow_Draw_Tree_Action)
01865                  (HT_Net_Rendition const *nr,
01866                             HT_Subsegment const *subseg);
01867 
01868 typedef void (ACTION_CALL *HT_Reflection_Plane_Draw_Tree_Action)
01869                  (HT_Net_Rendition const *nr,
01870                             HT_Subsegment const *subseg,
01871                             float opacity,
01872                             float radius);
01873 
01874 
01875 
01876 typedef void (ACTION_CALL *HT_Depth_Peeling_Action)
01877                  (HT_Display_Context alter *dc);
01878 
01879 
01880 typedef void (ACTION_CALL *HT_Begin_Display_List_Action)
01881                  (HT_Net_Rendition const *nr,
01882                             HT_Display_List **dll,
01883                             unsigned HT_Integer32 *mask,
01884                             bool compile_only);
01885 
01886 typedef void (ACTION_CALL *HT_Check_Display_List_Action)
01887                  (HT_Net_Rendition const *nr,
01888                             HT_Display_List **dll,
01889                             unsigned HT_Integer32 *mask);
01890 
01891 typedef void (ACTION_CALL *HT_End_Display_List_Action)
01892                  (HT_Net_Rendition const *nr,
01893                             HT_Display_List **dll,
01894                             bool compile_only);
01895 
01896 typedef void (ACTION_CALL *HT_Execute_Display_List_Action)
01897                  (HT_Net_Rendition const *nr,
01898                             HT_Display_List *dll);
01899 
01900 
01901 typedef void * (ACTION_CALL *HT_IM_Utility_Action)
01902                  (HT_Net_Rendition const *nr,
01903                     long request,
01904                     void *pointer,
01905                     POINTER_SIZED_INT v1, 
01906                     POINTER_SIZED_INT v2, 
01907                     POINTER_SIZED_INT v3,
01908                     POINTER_SIZED_INT v4,
01909                     float f1,
01910                     float f2,
01911                     float f3,
01912                     float f4);
01913 
01914 
01915 typedef bool (ACTION_CALL *HT_Start_Device_Action)
01916                  (HT_Display_Context alter *dc);
01917 
01918 
01919 typedef bool    (HC_CDECL * HT_Exit_Update_Function) (HT_Net_Rendition const*);
01920 
01921 } // EXTERNAL
01922 
01923 typedef long    HT_Drawing_Mode;
01924 
01925 struct HT_Action_Rendition {
01926 
01927     HT_Draw_DC_Polytriangle_Action              draw_dc_polytriangle;
01928     HT_Draw_DC_Colorized_Polytriangle_Action    draw_dc_colorized_polytriangle;
01929     HT_Draw_DC_Gouraud_Polytriangle_Action      draw_dc_gouraud_polytriangle;
01930     HT_Draw_DC_Phong_Polytriangle_Action        draw_dc_phong_polytriangle;
01931     HT_Draw_DC_Textured_Polytriangle_Action     draw_dc_textured_polytriangle;
01932     HT_Draw_DC_Polyline_Action                  draw_dc_polyline;
01933     HT_Draw_DC_Colorized_Polyline_Action        draw_dc_colorized_polyline;
01934     HT_Draw_DC_Gouraud_Polyline_Action          draw_dc_gouraud_polyline;
01935     HT_Draw_DC_Phong_Polyline_Action            draw_dc_phong_polyline;
01936     HT_Draw_DC_Textured_Polyline_Action         draw_dc_textured_polyline;
01937     HT_Draw_DC_Polymarker_Action                draw_dc_polymarker;
01938     HT_Draw_DC_Colorized_Polymarker_Action      draw_dc_colorized_polymarker;
01939     HT_Draw_DC_Polydot_Action                   draw_dc_polydot;
01940     HT_Draw_DC_Colorized_Polydot_Action         draw_dc_colorized_polydot;
01941 
01942     HT_Draw_DC_Triangle_Action                  draw_dc_triangle;
01943     HT_Draw_DC_Colorized_Triangle_Action        draw_dc_colorized_triangle;
01944     HT_Draw_DC_Gouraud_Triangle_Action          draw_dc_gouraud_triangle;
01945     HT_Draw_DC_Reshaded_Triangle_Action         draw_dc_reshaded_triangle;
01946     HT_Draw_DC_Line_Action                      draw_dc_line;
01947     HT_Draw_DC_Colorized_Line_Action            draw_dc_colorized_line;
01948     HT_Draw_DC_Gouraud_Line_Action              draw_dc_gouraud_line;
01949     HT_Draw_DC_Reshaded_Line_Action             draw_dc_reshaded_line;
01950     HT_Draw_DC_Marker_Action                    draw_dc_marker;
01951     HT_Draw_DC_Colorized_Marker_Action          draw_dc_colorized_marker;
01952     HT_Draw_DC_Face_Action                      draw_dc_face;
01953     HT_Draw_DC_Colorized_Face_Action            draw_dc_colorized_face;
01954     HT_Draw_DC_Edge_Action                      draw_dc_edge;
01955     HT_Draw_DC_Text_Stroke_Action               draw_dc_text_stroke;
01956     HT_Draw_DC_Text_Area_Action                 draw_dc_text_area;
01957     HT_Draw_Window_Action                       draw_window;
01958     HT_Draw_Window_Frame_Action                 draw_window_frame;
01959     HT_Draw_Text_Action                         draw_text;
01960     HT_Draw_3D_Marker_Action                    draw_3d_marker;
01961     HT_Draw_3D_Polyline_Action                  draw_3d_polyline;
01962     HT_Draw_3D_Polyline_Action                  draw_3d_infinite_line;
01963     HT_Draw_3D_Polygon_Action                   draw_3d_polygon;
01964     HT_Draw_3D_Contour_Action                   draw_3d_contour;
01965     HT_Draw_3D_Polyedge_Action                  draw_3d_polyedge;
01966     HT_Draw_3D_Polymarker_Action                draw_3d_polymarker;
01967     HT_Draw_3D_Tristrip_Action                  draw_3d_tristrip;
01968     HT_Draw_3D_Polyhedron_Action                draw_3d_polyhedron;
01969     HT_Draw_3D_NURBS_Curve_Action               draw_3d_nurbs_curve;
01970     HT_Draw_3D_NURBS_Surface_Action             draw_3d_nurbs_surface;
01971     HT_Draw_3D_Cylinder_Action                  draw_3d_cylinder;
01972     HT_Draw_3D_PolyCylinder_Action              draw_3d_polycylinder;
01973     HT_Draw_3D_Sphere_Action                    draw_3d_sphere;
01974     HT_Draw_3D_Text_Action                      draw_3d_text;
01975     HT_Draw_3D_Image_Action                     draw_3d_image;
01976     HT_Draw_3D_Grid_Action                      draw_3d_grid;
01977     HT_Draw_3D_Ellipse_Action                   draw_3d_ellipse;
01978     HT_Draw_3D_Elliptical_Arc_Action            draw_3d_elliptical_arc;
01979     HT_Draw_3D_Geometry_Action                  draw_3d_geometry;
01980     HT_Draw_3D_Text_Strokes_Action              draw_3d_text_strokes;
01981     HT_Draw_3D_Text_Areas_Action                draw_3d_text_areas;
01982     HT_Draw_Segment_Action                      draw_segment;
01983     HT_Draw_Segment_Tree_Action                 draw_segment_tree;
01984 
01985     HT_Driver_Startup_Action                    driver_startup;
01986     HT_Driver_Shutdown_Action                   driver_shutdown;
01987 
01988     HT_Draw_DC_Polyline_Action                  draw_dc_cut_line;
01989     HT_Draw_3D_Polyedge_Action                  draw_3d_isoline;
01990 
01991     HT_Draw_DC_Polyline_Action                  draw_hlr_polyline;
01992     HT_Draw_DC_Marker_Action                    draw_hlr_marker;
01993     HT_Draw_DC_Polyline_Action                  draw_hlr_hidden_polyline;
01994     HT_Draw_DC_Marker_Action                    draw_hlr_hidden_marker;
01995 
01996     HT_Finish_Picture_Action                    finish_picture;
01997 
01998     HT_Create_Region_Action                     create_region;
01999     HT_Save_Region_Action                       save_region;
02000     HT_Restore_Region_Action                    restore_region;
02001     HT_Destroy_Region_Action                    destroy_region;
02002 
02003     HT_Segment const *                          associated_segment[CBT_LAST+1];
02004     void const *                                associated_data[CBT_LAST+1];
02005 
02006     HT_Incarnation              incarnation;
02007     HT_Reference_Count          refcount;
02008     HT_Drawing_Mode             drawmode;
02009 };
02010 
02011 #define Draw_2D                         (HT_Drawing_Mode)0x00000001
02012 #define Draw_OVERLAY                    (HT_Drawing_Mode)0x00000002
02013 #define Draw_SPRITED                    (HT_Drawing_Mode)0x00000004
02014 #define Draw_HIDDEN                     (HT_Drawing_Mode)0x00000008
02015 #define Draw_WINDOW                     (HT_Drawing_Mode)0x00000010
02016 #define Draw_LIGHTED                    (HT_Drawing_Mode)0x00000020
02017 #define Draw_Z_BUFFERED                 (HT_Drawing_Mode)0x00000040
02018 #define Draw_OUT_OF_ORDER               (HT_Drawing_Mode)0x00000080
02019 #define Draw_AIR                        (HT_Drawing_Mode)0x00000100
02020 #define Draw_SOFTWARE_FRAME_BUFFERED    (HT_Drawing_Mode)0x00000200
02021 #define Draw_SOFTWARE_Z_BUFFERED        (HT_Drawing_Mode)0x00000400
02022 #define Draw_VANILLA_3D_FACES           (HT_Drawing_Mode)0x00000800
02023 #define Draw_VANILLA_3D_LINES           (HT_Drawing_Mode)0x00001000
02024 #define Draw_CUTTING_PLANED             (HT_Drawing_Mode)0x00002000
02025 #define Draw_VANILLA_3D_MARKERS         (HT_Drawing_Mode)0x00004000
02026 #define Draw_ACTUAL_WINDOW              (HT_Drawing_Mode)0x00008000
02027 #define Draw_VANILLA_3D_MISC            (HT_Drawing_Mode)0x00010000
02028 #define Draw_TRANSPARENT                (HT_Drawing_Mode)0x00020000
02029 #define Draw_OCCLUDED                   (HT_Drawing_Mode)0x00040000
02030 #define Draw_DEFERRED_LINES             (HT_Drawing_Mode)0x00080000
02031 #define Draw_SORTED_PRIORITIZE          (HT_Drawing_Mode)0x00100000
02032 #define Draw_SORTED_SORT_GRID           (HT_Drawing_Mode)0x00200000
02033 #define Draw_DEFERRED_TEXT              (HT_Drawing_Mode)0x00400000
02034 #define Draw_VISIT_ONLY                 (HT_Drawing_Mode)0x80000000
02035 
02036 /* not really a state but a flag for a special case, its usage 'should'
02037  * never conflict with VISIT_ONLY, so we can use the same bit
02038  */
02039 #define Draw_GENERATE_CUT_GEOMETRY      (HT_Drawing_Mode)0x80000000
02040 
02041 #define Draw_ANY_HIDDEN         \
02042        (Draw_HIDDEN|Draw_SOFTWARE_Z_BUFFERED|Draw_Z_BUFFERED)
02043 
02044 #define Draw_VANILLA_3D         \
02045         (Draw_VANILLA_3D_FACES|Draw_VANILLA_3D_LINES| \
02046          Draw_VANILLA_3D_MARKERS|Draw_VANILLA_3D_MISC)
02047 
02048 #define Draw_KEEP_ON_DEFERRAL       (Draw_SORTED_PRIORITIZE)
02049 
02050 
02051 struct HT_Drawing_State {
02052     HT_Drawing_Mode             current,
02053                                 pending;
02054 
02055     HT_Incarnation              incarnation;
02056     HT_Reference_Count          refcount;
02057 };
02058 
02059 
02060 
02061 struct HT_Net_Rendition {
02062     HT_Display_Context const        *display_context;
02063     HT_Drawing_State const          *drawing_state;
02064 
02065     HT_Action_Rendition const       *action_rendition;
02066     HT_Face_Rendition const         *simple_reflection_face_rendition;
02067     HT_Face_Rendition const         *cut_face_rendition;
02068     HT_Line_Rendition const         *cut_edge_rendition;
02069     HT_Display_Rendition const      *display_rendition;
02070     HT_Line_Rendition const         *edge_rendition;
02071     HT_Face_Rendition const         *face_rendition;
02072     HT_Geometry_Rendition const     *geometry_rendition;
02073     HT_Glyph_Rendition const        *glyph_rendition;
02074     HT_Line_Rendition const         *line_rendition;
02075     HT_Line_Style_Rendition const   *line_style_rendition;
02076     HT_Marker_Rendition const       *marker_rendition;
02077     HT_Misc_Rendition const         *misc_rendition;
02078     HT_Text_Rendition const         *text_rendition;
02079     HT_Texture_Rendition const      *texture_rendition;
02080     HT_Transform_Rendition const    *transform_rendition;
02081     HT_User_Rendition const         *user_rendition;
02082     HT_Marker_Rendition const       *vertex_rendition;
02083     HT_Visualization_Rendition const *visualization_rendition;
02084     HT_Window_Rendition const       *window_rendition;
02085 
02086     HT_Incarnation                  incarnation;
02087     HT_Reference_Count              refcount;
02088 };
02089 
02090 
02091 
02092 struct HT_Cut_Geometry {
02093     HT_Cut_Geometry             *next;
02094     HT_Geometry                 *geometry;
02095     int                         plane_id;
02096 };
02097 
02098 struct HT_Cut_Geometry_Set {
02099     HT_Cut_Geometry             *geometries;
02100     HT_Driver_Color             face_color;
02101     HT_Driver_Color             line_color;
02102     HT_Driver_Color             base_face_color;
02103     HT_Driver_Color             base_line_color;
02104     bool                        valid;
02105 };
02106 
02107 
02108 
02109 struct HT_Simple_Shadow {
02110     HT_Image                    *image;
02111     HT_Texture                  *texture;
02112     HT_Net_Rendition const      *master_rendition;
02113     HT_Point                    points[5];
02114     float                       u_scale, v_scale;
02115     float                       world_resolution;
02116     bool                        valid;
02117     bool                        valid_pending;
02118     bool                        useful;
02119     bool                        in_place;
02120 };
02121 
02122 
02123 struct HT_Shadow_Map {
02124     HT_Shadow_Map const         *next;
02125     HT_Display_List             *depth_image;
02126     HT_Net_Rendition const      *master_rendition;  
02127     
02128     HT_Key                      lightkey;
02129     float                       light_projection[16];
02130     float                       light_modelview[16];
02131     float                       light_eye_distance;
02132     
02133     bool                        valid;
02134     bool                        valid_pending;
02135     bool                        useful;
02136     bool                        used;
02137     bool                        in_place;
02138 
02139 /* SIL: Enable this define here only for distortion demo build. */
02140 /* #define SHADOW_DISTORTION_DEMO */
02141 
02142 #ifdef SHADOW_DISTORTION_DEMO
02143     /* SIL: Camera position of containing scene. */
02144     HT_Point                scene_camera_position;
02145 #endif /* SHADOW_DISTORTION_DEMO */
02146 };
02147 
02148 
02149 struct HT_Octree_Item {
02150     HT_Octree_Item              *next;
02151     HT_Subsegment const         *item;
02152     HT_Point                    bounds[2];      /* min, max */
02153 };
02154 
02155 struct HT_Octree {
02156     HT_Octree           *parent;
02157     HT_Octree           **children;
02158     HT_Octree_Item      *items; 
02159     void *              query_id;
02160     HT_Point            limits[2];      /* min, max of octree node*/
02161     HT_Point            bounds[2];      /* min, max of geometry */
02162     int                 count;          /* number of items if not subdivided */
02163 /* making the first 2 octree flags match segment flags allows simpler code */
02164 #define Octree_OCCLUDED         Seg_OCCLUDED
02165 #define Octree_CULLED           Seg_CULLED
02166 #define Octree_CHILD_OCCLUDED   Seg_STREAMING       /* anything different */
02167     int                 flags;
02168 
02169     int                 occlusion_delay1;
02170     int                 occlusion_delay2;
02171 };
02172 
02173 
02174 
02175 struct HT_Octree_Base {
02176     HT_Octree           *root;
02177     HT_VList            *root_list;
02178     int                 normal_limit;
02179     int                 test_delay;
02180 
02181     HT_Point            bounds[2];      /* min, max of geometry */
02182     float               close_limit;
02183  
02184 };
02185 
02186 
02187 struct HT_Deferred_Octree {
02188     HT_Deferred_Octree  *next;
02189     HT_Net_Rendition    *nr;
02190     HT_Octree_Base      *octree;
02191 };
02192 
02193 
02194 struct HT_Sort_Grid_Item {
02195     HT_VList            *keylist;
02196 };
02197 
02198 struct HT_Sort_Grid {
02199     HT_Sort_Grid_Item   *items;
02200     HT_VList            *deferred_draw_tree_list;
02201     HT_VHash            *grid_item_drawn;
02202     HT_VHash            *ddt_drawn;
02203 
02204     HT_Point            max;
02205     HT_Point            min;
02206     HT_Point            delta;
02207     int                 x_size, y_size, z_size;
02208 };
02209 
02210 
02211 
02212 struct HT_DC_Polydot_Batch {
02213     HT_DC_Point                 *pts;
02214     HT_RGBAS32                  *colors;
02215     int                         allocated;
02216     int                         used;
02217 };
02218 
02219 
02220 #define NO_INDEX                ((HT_Color_Index)-1)
02221 
02222 struct HT_Singleton_Color {
02223     HT_Singleton_Color alter       *next;
02224     HT_Color_Index                  index;
02225     HT_Driver_Color                 driver_color; /* always .rgb */
02226 };
02227 
02228 struct HT_Soft_Color_Map {
02229     HT_Soft_Color_Map alter         *next;
02230     HT_Color_Map const              *database_origin;
02231     HT_Color_Index                  base_index;
02232     int                             length;
02233     bool                            force_load;
02234 };
02235 
02236 
02237 
02238 
02239 /**********************************************************************
02240 
02241     The drawing sequence for each primitive, except tristrips, polymarkers,
02242     and polyedges, is:
02243 
02244         3D              - does transform-and-clip
02245         Trimmed         - does cutting planes
02246         Big             - does oversize faces/polylines
02247         Lighted         - turns light into a local color
02248             Colorized   - triangulates to colorized triangles
02249                            (or gets captured by hidden)
02250         DC HT_Callback  - user does what s/he wants
02251         Hide_xxx        - software hidden-surfaces happen
02252         DC              - draws
02253 
02254     *In that order.*   Each layer is responsible for making sure that
02255     the next "necessary" layer is called, in sequence. For efficiency,
02256     "necessary" usually gets determined by the caller rather than the
02257     callee.
02258 
02259     For tristrips, polymarkers, polyedges, the sequence is:
02260 
02261         3D_Polyhedron   - master of ceremonies
02262         Indexicated     - does contours
02263         3D_xxx          - does transform, clip/cut-testing, lighting & planes
02264         Clipped         - does clipping, cutting planes
02265         CP              - unpacks the data, cuts "big" ones, generates DC calls
02266         (DC HT_Callback - user does what s/he wants - Not implemented)
02267         Hide_xxx        - software hidden-surfaces happen
02268         DC              - draws
02269 
02270 **********************************************************************/
02271 
02272 
02273 
02274 typedef unsigned HT_Integer32   HT_Action_Mask;
02275 
02276 /* primary functions */
02277 #define Action_Mask_DRAW_TREE                           0x00000001
02278 #define Action_Mask_RENDER                              0x00000002
02279 /* basic geometry types */
02280 #define Action_Mask_DRAW_3D_MARKER                      0x00000004
02281 #define Action_Mask_DRAW_3D_ELLIPSE                     0x00000008
02282 
02283 #define Action_Mask_DRAW_3D_ELLIPTICAL_ARC              0x00000010
02284 #define Action_Mask_DRAW_3D_POLYLINE                    0x00000020
02285 #define Action_Mask_DRAW_3D_NURBS_CURVE                 0x00000040
02286 #define Action_Mask_ANY_POLYLINE                        0x00000070
02287 
02288 #define Action_Mask_DRAW_3D_GRID                        0x00000080
02289 #define Action_Mask_DRAW_3D_INFINITE_LINE               0x00000100
02290 #define Action_Mask_DRAW_3D_POLYGON                     0x00000200
02291 #define Action_Mask_DRAW_3D_CONTOUR                     0x00000400
02292 #define Action_Mask_DRAW_3D_IMAGE                       0x00000800
02293 #define Action_Mask_DRAW_3D_TEXT                        0x00001000
02294 #define Action_Mask_DRAW_3D_LIGHT                       0x00002000
02295 /* higher order surfaces */
02296 #define Action_Mask_DRAW_3D_CYLINDER                    0x00004000 /* also polycylinders and spheres */
02297 #define Action_Mask_DRAW_3D_NURBS_SURFACE               0x00008000
02298 #define Action_Mask_DRAW_3D_POLYHEDRON                  0x00010000
02299 /* basic derived geometry types */
02300 #define Action_Mask_DRAW_3D_POLYMARKER                  0x00020000
02301 #define Action_Mask_DRAW_3D_TRISTRIP                    0x00040000
02302 #define Action_Mask_DRAW_INDEXED_TRISTRIP               0x00080000
02303 #define Action_Mask_DRAW_3D_POLYEDGE                    0x00100000
02304 #define Action_Mask_DRAW_INDEXED_POLYEDGE               0x00200000
02305 #define Action_Mask_DRAW_3D_STENCILED_QUAD              0x00400000
02306 /* misc derived geometry types */
02307 #define Action_Mask_DRAW_SILHOUETTE_POLYEDGE            0x00800000
02308 #define Action_Mask_DRAW_NONCULLED_POLYEDGE             0x01000000
02309 #define Action_Mask_DRAW_3D_POLYEDGE_FROM_TRISTRIP      0x02000000
02310 
02311 #define Action_Mask_ANY_TRISTRIP (                  \
02312             Action_Mask_DRAW_3D_TRISTRIP |          \
02313             Action_Mask_DRAW_INDEXED_TRISTRIP)
02314 
02315 #define Action_Mask_ANY_POLYEDGE (                  \
02316             Action_Mask_DRAW_3D_POLYEDGE |          \
02317             Action_Mask_DRAW_INDEXED_POLYEDGE  |    \
02318             Action_Mask_DRAW_SILHOUETTE_POLYEDGE |  \
02319             Action_Mask_DRAW_NONCULLED_POLYEDGE |   \
02320             Action_Mask_DRAW_3D_POLYEDGE_FROM_TRISTRIP)
02321 
02322 #define Action_Mask_ANY_POLYHEDRON_DERIVATIVE (     \
02323             Action_Mask_ANY_TRISTRIP |              \
02324             Action_Mask_ANY_POLYEDGE |              \
02325             Action_Mask_DRAW_3D_POLYMARKER)
02326 
02327 #define Action_Mask_ANY_HIGHER_ORDER (              \
02328             Action_Mask_DRAW_3D_CYLINDER |          \
02329             Action_Mask_DRAW_3D_NURBS_SURFACE |     \
02330             Action_Mask_DRAW_3D_POLYHEDRON)
02331 
02332 
02333 #define Action_Mask_DRAW_3D_POLYCYLINDER                Action_Mask_DRAW_3D_CYLINDER
02334 #define Action_Mask_DRAW_3D_SPHERE                      Action_Mask_DRAW_3D_CYLINDER
02335 #define Action_Mask_ANY_GEOMETRY                        0xFFFFFFFC
02336 #define Action_Mask_ALL                                 0xFFFFFFFF
02337 
02338 #define ACTION_ACTIVE(_nr_, _type_)     ANYBIT ((_nr_)->display_context->current_actions->mask, _type_)
02339 
02340 /* be sure to add to get actions */
02341 struct HT_Action_Table {
02342     HT_Action_Table                             *prev;
02343     char const                                  *id;
02344     HT_Drawing_Mode                             mode;
02345     HT_Action_Mask                              mask;
02346 
02347     HT_Start_Device_Action                      start_device;
02348     HT_Stop_Device_Action                       stop_device;
02349     HT_Get_Physical_Info_Action                 get_physical_info;
02350     HT_Get_Current_Info_Action                  get_current_info;
02351 
02352     HT_Update_Action                            update;
02353     HT_Draw_Tree_Action                         draw_tree;
02354     HT_Render_Action                            render;
02355     HT_Select_Action                            select;
02356 
02357     HT_Init_Update_Action                       init_update;
02358     HT_Finish_Update_Action                     finish_update;
02359 
02360     HT_Init_Picture_Action                      init_picture;
02361     HT_Finish_Picture_Action                    finish_picture;
02362 
02363     HT_Get_Outer_Window_Action                  get_outer_window;
02364     HT_Free_Outer_Window_Action                 free_outer_window;
02365     HT_Resize_Outer_Window_Action               resize_outer_window;
02366     HT_Retitle_Outer_Window_Action              retitle_outer_window;
02367 
02368     HT_Draw_3D_Ellipse_Action                   draw_3d_ellipse;
02369     HT_Draw_3D_Elliptical_Arc_Action            draw_3d_elliptical_arc;
02370     HT_Draw_3D_Grid_Action                      draw_3d_grid;
02371     HT_Draw_3D_Marker_Action                    draw_3d_marker;
02372     HT_Draw_3D_Polyline_Action                  draw_3d_polyline;
02373     HT_Draw_3D_Polyline_Action                  draw_3d_infinite_line;
02374     HT_Draw_3D_NURBS_Curve_Action               draw_3d_nurbs_curve;
02375     HT_Draw_3D_NURBS_Surface_Action             draw_3d_nurbs_surface;
02376     HT_Draw_3D_Cylinder_Action                  draw_3d_cylinder;
02377     HT_Draw_3D_PolyCylinder_Action              draw_3d_polycylinder;
02378     HT_Draw_3D_Sphere_Action                    draw_3d_sphere;
02379     HT_Draw_3D_Polygon_Action                   draw_3d_polygon;
02380     HT_Draw_3D_Contour_Action                   draw_3d_contour;
02381     HT_Draw_3D_Image_Action                     draw_3d_image;
02382     HT_Draw_3D_Polyhedron_Action                draw_3d_polyhedron;
02383     HT_Draw_3D_Text_Action                      draw_3d_text;
02384     HT_Draw_3D_Light_Action                     draw_3d_light;
02385 
02386     HT_Draw_3D_Stenciled_Quad_Action            draw_3d_stenciled_quad;
02387 
02388     HT_Draw_3D_Polyedge_Action                  draw_3d_polyedge;
02389     HT_Draw_3D_Tristrip_Action                  draw_3d_tristrip;
02390     HT_Draw_3D_Polymarker_Action                draw_3d_polymarker;
02391 
02392     HT_Draw_3D_Polyedge_Action                  draw_silhouette_polyedge;
02393     HT_Draw_3D_Polyedge_Action                  draw_nonculled_polyedge;
02394     HT_Draw_3D_Polyedge_From_Tristrip_Action    draw_3d_polyedge_from_tristrip;
02395 
02396     HT_Draw_3D_Polyedge_Action                  draw_indexed_polyedge;
02397     HT_Draw_3D_Tristrip_Action                  draw_indexed_tristrip;
02398 
02399     HT_Draw_Window_Action                       draw_window;
02400     HT_Draw_Window_Frame_Action                 draw_window_frame;
02401 
02402     HT_Draw_DC_Rectangle_Action                 draw_dc_rectangle;
02403 
02404     HT_Draw_DC_Polytriangle_Action              draw_dc_polytriangle;
02405     HT_Draw_DC_Colorized_Polytriangle_Action    draw_dc_colorized_polytriangle;
02406     HT_Draw_DC_Gouraud_Polytriangle_Action      draw_dc_gouraud_polytriangle;
02407     HT_Draw_DC_Phong_Polytriangle_Action        draw_dc_phong_polytriangle;
02408     HT_Draw_DC_Textured_Polytriangle_Action     draw_dc_textured_polytriangle;
02409     HT_Draw_DC_Polyline_Action                  draw_dc_polyline;
02410     HT_Draw_DC_Colorized_Polyline_Action        draw_dc_colorized_polyline;
02411     HT_Draw_DC_Gouraud_Polyline_Action          draw_dc_gouraud_polyline;
02412     HT_Draw_DC_Phong_Polyline_Action            draw_dc_phong_polyline;
02413     HT_Draw_DC_Textured_Polyline_Action         draw_dc_textured_polyline;
02414     HT_Draw_DC_Polymarker_Action                draw_dc_polymarker;
02415     HT_Draw_DC_Colorized_Polymarker_Action      draw_dc_colorized_polymarker;
02416     HT_Draw_DC_Polydot_Action                   draw_dc_polydot;
02417     HT_Draw_DC_Colorized_Polydot_Action         draw_dc_colorized_polydot;
02418 
02419     HT_Draw_DC_Polygon_Action                   draw_dc_polygon;
02420     HT_Draw_DC_Face_Action                      draw_dc_face;
02421     HT_Draw_DC_Colorized_Face_Action            draw_dc_colorized_face;
02422 
02423     HT_Draw_DC_Ellipse_Action                   draw_dc_ellipse;
02424     HT_Draw_DC_Elliptical_Arc_Action            draw_dc_elliptical_arc;
02425     HT_Draw_DC_Outline_Ellipse_Action           draw_dc_outline_ellipse;
02426 
02427     HT_Draw_DC_Image_Action                     draw_dc_image;
02428     HT_Draw_DC_Text_Action                      draw_dc_text;
02429     HT_Draw_DC_Stenciled_Quad_Action            draw_dc_stenciled_quad;
02430 
02431     HT_Draw_DC_Spans_Action                     draw_dc_spans;
02432     HT_Draw_DC_Colorized_Spans_Action           draw_dc_colorized_spans;
02433     HT_Draw_DC_Gouraud_Spans_Action             draw_dc_gouraud_spans;
02434     HT_Draw_DC_Reshaded_Spans_Action            draw_dc_reshaded_spans;
02435 
02436     HT_Draw_DC_Bit_Rasters_Action               draw_dc_bit_rasters;
02437     HT_Draw_DC_Gray8_Rasters_Action             draw_dc_gray8_rasters;
02438     HT_Draw_DC_Mapped8_Rasters_Action           draw_dc_mapped8_rasters;
02439     HT_Draw_DC_Mapped16_Rasters_Action          draw_dc_mapped16_rasters;
02440     HT_Draw_DC_RGB32_Rasters_Action             draw_dc_rgb32_rasters;
02441 
02442     HT_Draw_Inter_Text_Action                   draw_inter_text;
02443     HT_Draw_Plain_Text_Action                   draw_plain_text;
02444 
02445     HT_Draw_Overlay_List_Action                 draw_overlay_list;
02446     HT_Undraw_Overlay_List_Action               undraw_overlay_list;
02447 
02448     HT_Request_Location_Action                  request_location;
02449     HT_Request_Keyboard_Action                  request_keyboard;
02450 
02451     HT_Set_Device_Color_Map_Action              set_device_color_map;
02452 
02453     HT_Find_Several_Fonts_Action                find_basic_fonts;
02454     HT_Find_Several_Fonts_Action                find_all_fonts;
02455     HT_Find_One_Font_Action                     find_one_font;
02456     HT_Load_Font_Action                         load_font;
02457     HT_Unload_Font_Action                       unload_font;
02458     HT_Measure_Char_Action                      measure_char;
02459     HT_Draw_Font_Action                         draw_font;
02460     HT_Name_Font_Action                         name_font;
02461     HT_Map_Font_Char_Index_Action               map_font_char_index;
02462     HT_Size_Font_Action                         size_font;
02463     HT_Will_Use_Stencil_Font_Action             will_use_stencil;
02464     HT_Make_Font_Stencil_Action                 make_font_stencil;
02465 
02466     HT_Clear_Z_Buffer_Action                    clear_z_buffer;
02467 
02468     HT_Compute_Shading_Action                   compute_shading;
02469 
02470     HT_Start_Inclusion_Action                   start_inclusion;
02471     HT_Finish_Inclusion_Action                  finish_inclusion;
02472 
02473     HT_Create_Frame_Buffer_Action               create_frame_buffer;
02474     HT_Display_Frame_Buffer_Action              display_frame_buffer;
02475     HT_Destroy_Frame_Buffer_Action              destroy_frame_buffer;
02476     HT_Await_Events_Action                      await_events;
02477     HT_Enable_Wakeup_Action                     enable_wakeup;
02478     HT_Disable_Wakeup_Action                    disable_wakeup;
02479 
02480     HT_Destroy_List_Action                      destroy_list;
02481     HT_Flush_Display_Lists_Action               flush_display_lists;
02482 
02483     HT_Show_Image_Data_Action                   show_image_data;
02484 
02485     HT_Begin_Occlusion_Query_Action             begin_occlusion_query;
02486     HT_End_Occlusion_Query_Action               end_occlusion_query;
02487     HT_Get_Occlusion_Query_Action               get_occlusion_query;
02488     HT_Delete_Occlusion_Query_Action            delete_occlusion_query;
02489 
02490     HT_Create_Region_Action                     create_region;
02491     HT_Save_Region_Action                       save_region;
02492     HT_Restore_Region_Action                    restore_region;
02493     HT_Destroy_Region_Action                    destroy_region;
02494 
02495     HT_Depth_Peeling_Action                     depth_peeling;
02496 
02497     HT_Begin_Display_List_Action                begin_display_list;
02498     HT_Check_Display_List_Action                check_display_list;
02499     HT_End_Display_List_Action                  end_display_list;
02500     HT_Execute_Display_List_Action              execute_display_list;
02501 
02502     HT_Snapshot_Action                          snapshot;
02503     HT_IM_Utility_Action                        im_utility;
02504 
02505     HT_Shadow_Map_Draw_Tree_Action              shadow_map_draw_tree;
02506     HT_Simple_Shadow_Draw_Tree_Action           simple_shadow_draw_tree;
02507     HT_Reflection_Plane_Draw_Tree_Action        reflection_plane_draw_tree;
02508 };
02509 /* be sure to add to get actions */
02510 
02511 #define PUSH_ACTIONS(_idc_, _id_, _ds_) do {                                \
02512             HT_Display_Context * _dc_ = (HT_Display_Context *) _idc_;       \
02513             HT_Action_Table *   _at_;                                       \
02514             ALLOC (_at_, HT_Action_Table);                                  \
02515             COPY_STRUCT (_dc_->current_actions, HT_Action_Table, _at_);     \
02516             _at_->prev = _dc_->current_actions;                             \
02517             _dc_->current_actions = _at_;                                   \
02518             _at_->id = _id_;                                                \
02519             _at_->mode = _ds_->current;                                     \
02520         } while (0)
02521 
02522 #define POP_ACTIONS(_idc_) do {                                             \
02523             HT_Display_Context * _dc_ = (HT_Display_Context *) _idc_;       \
02524             HT_Action_Table *   _at_ = _dc_->current_actions;               \
02525             if (_at_->prev == null)                                         \
02526                 HE_INTERNAL_ERROR (HEC_INTERNAL_ERROR, HES_PROCEDURAL_ERROR,\
02527                                    "Push/Pop _Actions mismatch");           \
02528             else {                                                          \
02529                 _dc_->current_actions = _at_->prev;                         \
02530                 FREE (_at_, HT_Action_Table);                               \
02531             }                                                               \
02532         } while (0)
02533 
02534 #define USE_PREVIOUS_ACTIONS(_idc_) do {                                    \
02535             HT_Display_Context * _dc_ = (HT_Display_Context *) _idc_;       \
02536             HT_Action_Table *   _at_ = _dc_->current_actions;               \
02537             if (_at_->prev == null)                                         \
02538                 HE_INTERNAL_ERROR (HEC_INTERNAL_ERROR, HES_PROCEDURAL_ERROR,\
02539                                    "Push/Pop _Actions mismatch");           \
02540             else {                                                          \
02541                 _dc_->current_actions = _at_->prev;                         \
02542                 _at_->prev = _dc_->suspended_actions;                       \
02543                 _dc_->suspended_actions = _at_;                             \
02544             }                                                               \
02545         } while (0)
02546 
02547 #define RESUME_CURRENT_ACTIONS(_idc_) do {                                  \
02548             HT_Display_Context * _dc_ = (HT_Display_Context *) _idc_;       \
02549             HT_Action_Table *   _at_ = _dc_->suspended_actions;             \
02550             if (_at_ == null)                                               \
02551                 HE_INTERNAL_ERROR (HEC_INTERNAL_ERROR, HES_PROCEDURAL_ERROR,\
02552                                    "Previous/Resume _Actions mismatch");    \
02553             else {                                                          \
02554                 _dc_->suspended_actions = _at_->prev;                       \
02555                 _at_->prev = _dc_->current_actions;                         \
02556                 _dc_->current_actions = _at_;                               \
02557             }                                                               \
02558         } while (0)
02559 
02560 
02561 
02562 struct HT_Net_Driver_Options {
02563     HT_Drivo_Flags              flags;
02564     HT_Drivo_Flags              values;
02565     bool                        backing_store;
02566     bool                        border;
02567     bool                        control_area;
02568     int                         debug_count;
02569     int                         *debug_array;
02570     int                         debug;
02571     bool                        disable_input;
02572     bool                        disable_all_input;      
02573     bool                        double_buffering;
02574     int                         first_color;
02575     int                         fixed_colors;
02576     int                         fixed_colors_parts[3];
02577     bool                        force_black_and_white;
02578     bool                        force_grayscale;
02579     bool                        gamma_correction;
02580     int                         landscape_orientation;
02581 #ifndef Drivo_Landscape_OFF
02582 #   define    Drivo_Landscape_OFF               0
02583 #   define    Drivo_Landscape_ON                1
02584 #   define    Drivo_Landscape_ENVIRONMENT       2
02585 #endif
02586 
02587     float                       light_scaling;
02588     float                       color_consolidation;
02589     float                       locater_transform[3][2];
02590     HT_Integer32                number_of_colors;
02591     float                       pen_speed;
02592     HT_XY                       physical_size;
02593     float                       selection_proximity;
02594     bool                        special_events;
02595     HT_Rectangle                subscreen;
02596     bool                        subscreen_moving;
02597     bool                        subscreen_resizing;
02598     bool                        subscreen_stretching;
02599     HT_Name                     title;
02600     HT_Font_Name                *fallback_font_names;
02601     HT_Font_Name                *font_table;
02602     int                         update_interrupts;
02603     POINTER_SIZED_INT           use_colormap_ID;
02604     POINTER_SIZED_INT           use_window_ID;
02605     POINTER_SIZED_INT           use_window_ID2;
02606     POINTER_SIZED_INT           use_clip_override;
02607     int                         write_mask;
02608     HT_Name_List                *output_format;
02609     bool                        subscreen_by_program;
02610     int                         hardcopy_resolution;
02611     int                         qmoves_preferences[LAST_QMOVES+1];
02612     int                         shadow_preference;
02613     bool                        text_prefers_outline;
02614     bool                        stereo_requested;
02615     bool                        anti_alias_requested;
02616     int                         anti_alias_samples;
02617     bool                        stencil_requested;
02618     bool                        absolute_line_weight;
02619     bool                        hidden_window;
02620     bool                        display_stats;
02621     bool                        display_time_stats;
02622     int                         display_interrupted_update_mode;
02623     HT_Exit_Update_Function     exit_update;
02624 };
02625 
02626 struct HT_Event_State {
02627     HT_Integer32 const          *which_buttons;
02628     bool                        mouse_up,
02629                                 mouse_down,
02630                                 mouse_moved,    
02631                                 buttons;        
02632 };
02633 
02634 struct HT_Deferred_Draw_Tree {
02635     HT_Deferred_Draw_Tree alter     *next;
02636     HT_Subsegment const             *subseg;
02637     HT_Net_Rendition const          *net_rendition; 
02638     HT_Activity                     activity;
02639     bool                            force_save;
02640 };
02641 
02642 
02643 struct HT_Deferred_Tree_List {
02644     HT_Deferred_Draw_Tree const *           list;
02645     HT_Deferred_Draw_Tree alter * alter *   linker;
02646 };
02647 
02648 #define Deferred_WINDOW         0
02649 #define Deferred_GEOMETRY       1
02650 #define Deferred_2D             2
02651 #define Deferred_COUNT          3
02652 #define Deferred_batches_MAX    10
02653 
02654 
02655 struct HT_Font_Hash_Header {
02656     HT_Font_Hash alter              *hash_next;
02657     HT_Name                         name;
02658     short                           type;
02659 
02660 #   define      FH_FAMILY       0
02661 #   define      FH_INSTANCE     1
02662 };
02663 
02664 /* identifiers for built in fonts */
02665 #define Builtin_MONO            1L
02666 #define Builtin_SIMPLEX         2L
02667 #define Builtin_DUPLEX          3L
02668 
02669 /* font types */
02670 #define Font_Type_DRIVER                0
02671 #define Font_Type_FREETYPE              1
02672 #define Font_Type_DEFINED               2
02673 
02674 #define FONT_TYPE_COUNT                 3
02675 
02676 struct HT_Font_Family {
02677     HT_Font_Hash_Header         h;      /* name = nickname w/trailing \0 */
02678     HT_Font_Family alter        *next;
02679     int                         type;
02680     bool                        scaleable,
02681                                 unnamed_members_exist;
02682     HT_Font     const           *font;
02683     HT_Font_Instance const      *members;
02684 
02685     void const                  *data;
02686 };
02687 
02688 #define FONT_INSTANCE_WIDTH_COUNT 32
02689 
02690 struct HT_Font_Instance_Char_Data {
02691 
02692     /*data is a non-owning reference*/
02693     void * data;
02694     HT_Font_Instance const * fall_font;
02695 
02696     int valid;
02697 
02698     float measured_width; /* basic char Aheight */
02699     float measured_width_current_Aheight; /* Aheight of measured_width */
02700 
02701     HT_Karacter karacter;
02702     HT_Karacter fall_karacter;
02703 
02704 };
02705 
02706 struct HT_Font_Instance {
02707     HT_Font_Hash_Header             h;      /* name = full explicit name w/ \0 */
02708 
02709     HT_Font_Instance alter          *next_in_family;        /* sorted by height */
02710     HT_Font_Instance alter          *next_in_generic;       /* sorted by height */
02711     HT_Font_Instance const          *next;                  /* MRU order */
02712 
02713     HT_Font_Family const            *family;
02714     HT_Font_Instance const          *base_instance;
02715     void *                          identifier;     /* valid when loaded */
02716 
02717 #define FONT_INSTANCE_CHAR_DATA_COUNT 256
02718 #define KARACTER_2_CHAR_DATA_INDEX(k) (k&0xFF)
02719     HT_Font_Instance_Char_Data *     char_data;
02720 
02721 
02722     
02723 
02724 
02725     HT_Load_Font_Action             load_font;
02726     HT_Unload_Font_Action           unload_font;
02727     HT_Measure_Char_Action          measure_char;
02728     HT_Draw_Font_Action             draw_font;
02729     HT_Map_Font_Char_Index_Action   map_font_char_index;
02730     HT_Size_Font_Action             size_font;
02731     HT_Make_Font_Stencil_Action     make_font_stencil;
02732     HT_Will_Use_Stencil_Font_Action will_use_stencil;
02733 
02734     float                           Aheight;    /* height of letter A */
02735     float                           vspace;     /* nominal vertical spacing */
02736 
02737 
02738     float                           correction; /* post load size correction */ 
02739     float                           current_Aheight; /* updated in draw 3d text */
02740     float                           current_Aheight_fixup;
02741     bool                            current_using_stencil; 
02742 
02743     bool                            loaded;         /* ready for drawing */
02744     bool                            dead;           /* don't try to load this */
02745     bool                            draw_stenciled; /* decided by load font */
02746     HT_Generic_Font_Name            generic_name;
02747 
02748     
02749 
02750 
02751 #define TT_NEVER                0x00
02752 
02753 #define TT_90_DEGREE            0x01    /* basic forms */
02754 #define TT_ANY_ANGLE            0x02
02755 #define TT_WIDTH                0x04
02756 #define TT_SLANT                0x08
02757 #define TT_3D                   0x10
02758 #define TT_PER_CHAR             0x20    /* do any transforms 1 char at a time */
02759 
02760 #define TT_ANY                  0x0E    /* standard combinations */
02761 #define TT_ANY_3D               0x1E
02762     int                             transformable;
02763 
02764     HT_Name                         alias_name;
02765     long                            face_index; 
02766     HT_Text_Encoding                encoding;       /* encoding of this font */
02767 
02768 };
02769 
02770 union HT_Font_Hash {
02771     HT_Font_Hash_Header         h;
02772     HT_Font_Family              family;
02773     HT_Font_Instance            instance;
02774 };
02775 
02776 
02777 struct HT_Freetype_Font {
02778     void                *freetype_font_data;    
02779     HT_Name             full_name;
02780     HT_Name             postscript_name;
02781     HT_Reference_Count  refcount;
02782 };
02783 
02784 struct HT_Freetype_Globals {
02785         void *          library;
02786         void *          name_cache;
02787 };
02788 
02789 
02790 struct HT_Polygon_Collector {
02791     int count;
02792     int *points;
02793 };
02794 
02795 
02796 struct HT_Deferred_3D {
02797     HT_Deferred_3D              *next;
02798     void const                  *item;
02799     HT_Net_Rendition const      *nr;
02800     HT_Matrix const             *geo_ref_mat;
02801     int                         type;
02802     /* positive types are normal HK_XXX geometry items */
02803 #   define  Deferred_3D_TRISTRIP    (-1)
02804 #   define  Deferred_3D_POLYEDGE    (-2)
02805 #   define  Deferred_3D_POLYMARKER  (-3)
02806 };
02807 
02808 struct HT_Text_Selection {
02809     HT_Text     const           *current_text;
02810     HT_String_Cursor const      *current_cursor;
02811     int                         current_offset;
02812     float                       best_prox,
02813                                 best_zw;
02814     int                         best_offset;
02815     HT_Type_Flags               selectables;
02816 };
02817 
02818 
02819 struct HT_Display_Context {
02820     HT_Driver const             *actor;
02821     HT_Segment const            *actor_segment;
02822     char const                  *actor_name;    /* zero-terminated */
02823     int                         actor_name_length;
02824     void alter                  *data;
02825     void alter                  *data2; /* for hybrid drivers */
02826     HT_Mutex                    mutex;
02827     HT_Action_Table             actions;
02828     HT_Action_Table             *current_actions;
02829     HT_Action_Table             *suspended_actions;
02830     HT_Net_Driver_Options       options;
02831 
02832     bool                        upwinding,
02833                                 update_in_progress;
02834 
02835     struct {
02836         bool                    window_exists;
02837         HT_Int_Rectangle        extent,
02838                                 actual_extent; /* after resize_subscreen */
02839     }                           outer;
02840 
02841     HT_Incarnation              last_incarnation;
02842 
02843     HT_Activity                 activity;
02844 
02845     int                         soft_map_colors,
02846                                 first_soft_map_color,
02847                                 singleton_colors,
02848                                 first_singleton_color,
02849                                 fixed_colors,
02850                                 first_fixed_color;
02851     HT_Int_RGB                  fixed_color_resolution,
02852                                 fixed_color_multiplier,
02853                                 fixed_color_range;
02854 
02855     /*
02856      * Actual_color_res is used internally as the "real" number
02857      * of distinguishable shades of colors.  It's controlled by
02858      * the "color consolidation" driver option and the
02859      * physical value "nominal color resolution".
02860      */
02861     int                         actual_color_resolution;
02862 
02863     HT_Singleton_Color alter    *last_singletons;
02864     HT_Singleton_Color alter    *current_singletons;
02865 
02866     HT_Soft_Color_Map alter     *last_soft_maps;
02867     HT_Soft_Color_Map alter     *current_soft_maps;
02868 
02869     HT_Driver_Color const       *color_map; /* 1 for each - rgb only */
02870     HT_RGB const                *rgb_map;   /* and the matching float HT_RGB */
02871     int                         color_warning_needed;
02872     HT_Driver_Color             force_foreground,
02873                                 force_background;
02874     bool                        forced_background_white;
02875 
02876     struct {
02877         /*      color info */
02878         int                     first_color;
02879         HT_Integer32            number_of_colors;
02880         int                     fixed_colors;
02881 
02882         /*      size info */
02883         HT_Int_XY               number_of_pixels;
02884         HT_Int_XY               offset_in_pixels;
02885         HT_Rectangle            extent;                 /* min/max*/
02886 
02887         /* the rest include the effects of the 'physical size' Option */
02888         HT_XY                   resolution;             /* pixels/cm */
02889         float                   pixel_aspect;   /* height/pix / width/pix */
02890 
02891         /* 'size' also includes the subscreen, etc */
02892         HT_XY                   size;                   /* in centimeters */
02893 
02894         POINTER_SIZED_INT       window_ID;      /* window systems only */
02895         POINTER_SIZED_INT       window_ID2;     /* window systems only */
02896 
02897         HT_Int_Rectangle        border;
02898 
02899         long                    colormap_ID;    /* window systems only */
02900     }                           current;
02901 
02902     struct {
02903         /*      color info */
02904         int                     first_color;
02905         HT_Integer32            number_of_colors,
02906                                 max_number_of_colors;
02907         int                     fixed_colors;
02908 
02909         /*      size info */
02910         HT_Int_XY               number_of_pixels;
02911         HT_Int_XY               offset_in_pixels;
02912 
02913         HT_XY                   size;                   /* in centimeters */
02914         HT_Rectangle            extent;                 /* min/max*/
02915 
02916         /* more color info */
02917 
02918 #       define MAPPED_RGB       0       /* 1-channel (2/4/8-bit) */
02919 #       define DIRECT_RGB       1       /* 3-channel (24-bit) */
02920 #       define GRAY_SCALE       2       /* something else */
02921         int                             color_system;
02922 
02923         /* nominal_color_res is used as the scale factor for DIRECT and
02924          * GRAY stored HT_Driver_Color values, and as the scale factor for
02925          * MAPPED calls to "set_device_color_map". It is usually a power
02926          * of 2. For DIRECT colors, it must be <= 256, since that's all that
02927          * will fit in direct_rgb.r/g/b.
02928          */
02929         HT_Integer32            nominal_color_resolution;
02930 
02931         /* more size info */
02932         int                     absolute_coordinates;
02933 
02934         int                     default_line_weight; /* weight of "1.0" line;
02935                                                         should be ODD number */
02936 #define Double_Buffer_NONE      0
02937 #define Double_Buffer_COPY      1
02938 #define Double_Buffer_SWAP      2
02939         int                     double_buffer_method;
02940 
02941 #define QMoves_NONE             0
02942 #define QMoves_XOR              1
02943 #define QMoves_Real_Overlay     2
02944 #define QMoves_Spriting         3
02945 #define QMoves_Accumulation     4 
02946         int                     qmoves_methods[LAST_QMOVES+1];
02947 
02948         /* let upper level dither on "nearly" rgb devices */
02949         bool                    dither_rgb32_to_mapped8;
02950         HT_Int_RGB              dither_resolution;
02951         int                     dither_offset;
02952 
02953         bool                    has_display,
02954                                 has_locater,
02955                                 has_keyboard;
02956 
02957         int                     number_of_locater_buttons;
02958         char const              *driver_type;
02959         char const              *driver_version;         /* RCS id */
02960         char const              *display_type;
02961         char const              *locater_type;
02962 
02963         bool                    windowing_system;
02964         bool                    driver_controls_stretching;
02965 
02966         int                     z_buffer_depth;
02967         float                   default_z_max; /* computed from z_buffer_depth*/
02968 
02969         int                     hardware_lights,
02970                                 hardware_cutting_planes;
02971         bool                    has_gouraud_shading,
02972                                 has_gouraud_lighting,
02973                                 has_phong_lighting,
02974                                 has_transparency;
02975 
02976         /* the following should be true iff the clear_Z_buffer window
02977          * is observed AND iff when geometry is equal in depth, the newer
02978          * one gets painted.
02979          */
02980         bool                    incremental_z_updates;
02981 
02982         bool                    incremental_updates;
02983 
02984         bool                    draw_polygon_edges_separately;
02985 
02986         /* but allow for the driver not handling text in overlay */
02987         bool                    cannot_overlay_text;
02988         bool                    cannot_overlay_at_all;
02989 
02990         bool                    needs_gamma_correction;
02991 
02992 #       if MAX_NOMINAL_COLOR_RESOLUTION > 256
02993             short               gamma[MAX_NOMINAL_COLOR_RESOLUTION];
02994 #       else
02995             unsigned char       gamma[MAX_NOMINAL_COLOR_RESOLUTION];
02996 #       endif
02997 
02998         /* scale factor for patterned polylines */
02999         float                   pattern_scale;
03000 
03001         /* scale factor for weighted polylines */
03002         float                   weight_scale;
03003 
03004         /* True if loading a font requires attaching it to a window */
03005         bool                    load_font_requires_window;
03006 
03007         /* True if driver would like to have face normals passed down
03008          * to draw_3d_tristrip whenever vertex normals are passed.
03009          */
03010         bool                    needs_fnormals_with_vnormals;
03011 
03012         /* True if driver would like to have edge normals passed down
03013          * to draw_3d_polyedge whenever vertex normals are passed.
03014          */
03015         bool                    needs_enormals_with_vnormals;
03016 
03017         /* True if the driver has a hardware pipeline that is
03018          * easily stalled by rendition changes
03019          */
03020         bool                    transform_changes_are_expensive;
03021 
03022         /* true if the driver can make use of the "landscape orientation"
03023          * driver option
03024          */
03025         bool                    can_do_landscape;
03026 
03027         /* true if the driver overloaded draw_font can do truetype fonts */
03028         bool                    driver_does_truetype;
03029 
03030         /* True if driver can save & restore image/z-buffer */
03031         bool                    can_save_and_restore_regions;
03032     
03033         /* preference for generated text */
03034         bool                    text_prefers_outline;
03035 
03036         /* preference for line drawing */
03037         bool                    wants_wide_lines;
03038 
03039         /* preference for text drawing */
03040         bool                    wants_contours;
03041 
03042         /* has stereo support */
03043         bool                    can_display_stereo;
03044 
03045         bool                    can_antialias;
03046         bool                    can_antialias_lines;
03047 
03048         bool                    can_mask_color_image;
03049         bool                    can_reverse_depth_test;
03050 
03051         bool                    display_lists_must_have_handedness;
03052         bool                    must_display_list;
03053         bool                    can_shadow_map;
03054 
03055         bool                    file_output;    /* override things like text greeking */
03056         
03057         bool                    window_id_change_ok;
03058 
03059         int                     depth_peeling_layers;
03060     }                           physical;
03061 
03062 #   define  Alternate_STEREO        0x01
03063 #   define  Alternate_OVERLAY       0x02
03064 #   define  Alternate_SPRITED       0x04
03065 #   define  Alternate_REFLECTION    0x08
03066 #   define  Alternate_COUNT         16
03067 
03068     int                         alternate_mode;
03069 
03070     struct {
03071         bool                    collecting;
03072         int                     layers;
03073         float                   min_area;
03074         HT_Deferred_3D          *lists[Alternate_COUNT];
03075     }                           depth_peeling;
03076 
03077     HT_Deferred_3D              *deferred_3d_lists[Alternate_COUNT];
03078     unsigned int                deferred_3d_action_mask;
03079     HT_Geometry const           *deferred_3d_most_recently_processed; /* dumb pointer -- do not refcount */
03080 
03081     int                         hidden_counts[Alternate_COUNT];
03082     HT_Hidden const             *hidden_roots[Alternate_COUNT];
03083     unsigned int                hidden_action_mask;
03084     HT_Geometry const           *hidden_most_recently_processed; /* dumb pointer -- do not refcount */
03085     HT_Hidden_Slab const        *hidden_slabs[Alternate_COUNT];
03086     HT_Hidden const             *current_inclusion;
03087     HT_Hidden_Cache alter       *hidden_cache;
03088     HT_Hidden_Tristrip_Heap     *hidden_tristrip_heap;
03089 
03090     HT_Integer32                sizeof_raster_buffer;
03091     void alter                  *raster_buffer;
03092 
03093     unsigned short const        *bit_pattern[TOTAL_BIT_PATTERNS];
03094     int                         bit_pattern_size; /* which are loaded? 0/8/16 */
03095     bool                        bit_patterns_reversed; /* NB: bool preserves alignment */
03096 
03097     bool                        fixed_colors_allocated;
03098 
03099     bool                        scene_changed;
03100     bool                        overlay_geometry;
03101 
03102     HT_Overlay_Segment const    *overlay_segments;
03103     HT_Overlay_Segment const    *overlay_subwindow_segments;
03104 
03105     bool                        timer_interrupts_enabled,
03106                                 update_interrupted,
03107                                 drawing_interrupted;
03108     bool                        interrupt_and_recycle;
03109     bool                        damaged_z;
03110 
03111     HT_Drawing_Mode             outer_pending_drawing_state;
03112     HT_Activity                 pending_forced_activity;
03113 
03114     HT_Deferred_Tree_List       deferred_trees[Deferred_COUNT];
03115     HT_Deferred_Draw_Tree       *deferred_batch_start[Deferred_batches_MAX];
03116     HT_Deferred_Draw_Tree       *deferred_batch_end[Deferred_batches_MAX];
03117 
03118     HT_Deferred_Tree_List       also_draw_list;
03119 
03120     int                         deferred_batch_num;
03121     bool                        may_defer;
03122     void                        *priority_heap;
03123     HT_Sort_Grid                *sort_grid;
03124     HT_Bounding                 *global_bounds;
03125 
03126     HT_Selection_Context alter  *selection_context;     /* pass-through */
03127 
03128     HT_Text_Selection alter     *text_in_progress;      /* for selection */
03129     HT_Geometry const           *geometry_in_progress;  /* for callbacks */
03130     HT_Subsegment const         *instance_in_progress;
03131     bool                        partial_erasing;
03132     bool                        im_callthrough;
03133     HT_Segment_Info const       *im_segments;
03134 
03135     HT_Net_Rendition const      *outer_rendition;
03136 
03137     /* FONT STUFF */
03138     HT_Font_Family const        *font_families;
03139     HT_Font_Hash const          *font_hash[FONT_HASH_SIZE];
03140     HT_Font_Instance const      *generic_instances[GFN_LAST_GFN+1];
03141 
03142     bool                        one_font_located;
03143     bool                        basic_fonts_located;
03144     bool                        all_fonts_located;
03145     bool                        all_freetype_fonts_located;
03146 
03147     unsigned int                fonts_active_n[FONT_TYPE_COUNT];                                
03148     HT_Font_Instance const      *fonts_active[FONT_TYPE_COUNT];
03149     HT_Name_List                *find_one_failures;
03150 
03151     HT_HL_Data alter            *hidden_line_data;
03152 
03153     HT_Spriting_Item alter          *sprite_list[2];
03154     HT_Spriting_Item alter * alter  *sprite_linker;
03155     HT_Spriting_Item alter          *overlay_list;
03156     HT_Spriting_Item alter * alter  *overlay_linker;
03157     HT_Spriting_Item alter          *overlay_undraw_list;
03158 
03159     /* qmoves_method is the marriage between what the driver supports and 
03160      * the user's driver options requests */
03161     int                                     qmoves_method;
03162 
03163 #   define  NORMAL_DRAWING                  0
03164 #   define  SHADOW_ONLY_DRAWING             1
03165 
03166 #   define  ZHLR_PASS_WINDOW                1
03167 #   define  ZHLR_PASS_RENDERED_FACES        2
03168 #   define  ZHLR_PASS_POPULATE_Z_BUFFER     3
03169 #   define  ZHLR_PASS_HIDDEN_GEOMETRIES     4
03170 #   define  ZHLR_PASS_VISIBLE_GEOMETRIES    5
03171 
03172 #   define  NOT_DRAWING                     6
03173 
03174 
03175     int                         drawing_pass;
03176 
03177     bool                        first_update_done;
03178     bool                        stereo_seen;
03179 
03180     float                       soft_clip_allowance;
03181 
03182     int                         facings_allocated;
03183     int                         *facings_buffer;
03184 
03185     bool                        drawing_hidden;
03186 
03187     float                       (*deferred_texture_matrix)[4];
03188 
03189     HT_Cut_Geometry_Pieces *        cut_geometry_pieces;
03190     HT_Subsegment const *               cut_geometry_start;
03191     HT_Driver_Color                     cut_geometry_face_color;
03192     HT_Driver_Color                     cut_geometry_line_color;
03193     bool                                cut_geometry_use_colors;
03194 
03195     struct {
03196         HT_Image *              image;
03197         HT_Driver *             actor;
03198         HT_Start_Device_Action          start_device;
03199         HT_Get_Current_Info_Action      get_current_info;
03200         int                             debug_bits;
03201         HT_Simple_Shadow *              current;
03202         bool                            processing;
03203         bool                            first;
03204     }                                   simple_shadow;
03205 
03206     struct {
03207         HT_Shadow_Map *                 current;
03208         bool                            processing;
03209         bool                            first;
03210     }                                   shadow_map;
03211 
03212     struct {
03213         HT_Int_RGB                      color, color_delta;     /* window color and change to contrast */
03214     }                                   partial_erase;
03215 
03216     HT_Octree_Base *                    octree;
03217 
03218     HT_Bounding *                       gather_bounding;
03219     
03220     HT_Texture *                        antialias_line_texture;
03221 
03222 
03223     struct {
03224         long                            dots_dc;
03225         long                            dots_3d;
03226         long                            lines_dc;
03227         long                            lines_3d;
03228         long                            dl_lines_3d;
03229         long                            polygons_dc;
03230         long                            polygons_3d;
03231         long                            triangles_dc;
03232         long                            triangles_3d;
03233         long                            dl_triangles_3d;
03234         long                            rasters;
03235         long                            analytics;
03236         long                            occlusion_queries;
03237         long                            polyhedrons;
03238         long                            tristrips;
03239         long                            dl_strips;
03240         long                            ndl_strips;
03241         long                            dl_deletes;
03242         long                            segments;
03243         long                            segments_extent_culled;
03244         long                            segments_frustum_culled;
03245         long                            segments_vector_culled;
03246         long                            segments_occlusion_culled;
03247         long                            polyhedron_extent_culled;
03248         long                            polyhedron_frustum_culled;
03249         HT_Time                         update_time;
03250         HT_Time                         static_time;
03251         HT_Time                         shadow_time;
03252         HT_Time                         assemble_time;
03253         bool                            event_interrupted;
03254     }   stats;
03255 
03256     float           last_stats_height, last_stats_width;
03257 
03258     HT_Segment  const                   *associated_segment;
03259     void        const                   *associated_data;
03260     HT_DC_Polydot_Batch                 *polydot_batch;
03261 
03262     bool                                compiling_polyline_display_list;
03263 
03264     bool                                visited_spriting_segment;
03265 
03266     bool                                processing_priority_segment;
03267 
03268     bool                                mirroring;
03269 
03270     int                                 collecting_segment_level_display_list;
03271 
03272     bool                                processing_cut_geometry;
03273 
03274     HT_Display_List_Cleanup_List        *dl_cleanup_list;
03275 
03276     struct {
03277         void                    *ref_list;  /* geometry reference stack (references can be chained)*/
03278         HT_Matrix const         *matrix;  /* net modeling matrix on reference stack */
03279     }   current_geo_ref;
03280 
03281     HT_Deferred_Octree *                deferred_octrees;
03282 
03283     HT_Matrix                           *line_pattern_transform;
03284 };
03285 
03286 #define STATS(x) ((HT_Display_Context alter*)nr->display_context)->stats.x
03287 
03288 #define DC_STATS(x) ((HT_Display_Context alter*)dc)->stats.x
03289 
03290 struct HT_Overlay_Segment {
03291     HT_Overlay_Segment alter    *next;
03292     HT_Subsegment const         *subseg;
03293 };
03294 
03295 
03296 struct HT_Spriting_Item {
03297     HT_Spriting_Item alter      *next;
03298     HT_Net_Rendition const      *nr;
03299     HT_Geometry const           *geometry;
03300     HT_Tristrip alter           *shadow_tristrip;
03301     HT_Action_Mask              mask;
03302     bool                        single;
03303 };
03304 
03305 
03306 #define INTERCHAR_SPACE         0.20f /* of char width: a guess */
03307 #define INTERLINE_SPACE         0.44f /* of char height: a guess */
03308 #define DESCENDER_SIZE          0.40f /* of char height: a guess */
03309 
03310 
03311 /* the following is just for polygon clipping */
03312 typedef int     HT_Crossing_Case;
03313 
03314 
03315 struct HT_Edge_End {
03316     HT_Edge_End alter                   *next;          /* for polygon */
03317     HT_Edge_End alter                   *snext; /* for sort perimeter list */
03318     HT_Edge_Interval alter              *edge;
03319     struct ht_connected_poly alter      *poly;
03320     HT_DC_Point alter                   *point;
03321     int                                 metric;
03322     bool                                clockwise_to_inner_side;
03323     HT_Crossing_Case                    ccase;
03324 #   define WITHIN               (HT_Crossing_Case)0
03325 #   define OFF_TO_LEFT          (HT_Crossing_Case)1  /* must be in order! */
03326 #   define OFF_TO_TOP           (HT_Crossing_Case)2
03327 #   define OFF_TO_RIGHT         (HT_Crossing_Case)3
03328 #   define OFF_TO_BOTTOM        (HT_Crossing_Case)4
03329 };
03330 
03331 struct HT_Edge_Interval {
03332     HT_Edge_Interval alter      *prev;
03333     HT_Edge_End                 start,
03334                                 end;
03335 };
03336 
03337 
03338 #ifdef HOOPS_WINDOWS_HDI_DRIVER
03339 #   define EXPORT_DLL_ENTRY_POINT(get_actions) \
03340         GLOBAL_FUNCTION __declspec(dllexport) bool HD_Driver (\
03341             HT_Driver alter *actor, \
03342             int             request) { \
03343             return HD_Connect_Standard_Driver (actor, \
03344                                                request, \
03345                                                get_actions); \
03346         }
03347 #else
03348 /*This pathetic construct is to provide a ref to the macro arg*/
03349 /*with out causing a unref warning in the process*/
03350 #   define EXPORT_DLL_ENTRY_POINT(get_actions) \
03351         local   void get_actions_reference_dummy(void) { \
03352                 get_actions(0); get_actions_reference_dummy();}
03353 #endif 
03354 
03355 /* Retrieves a modeling matrix from a geometry reference */
03356 #define GET_GEO_REF_MATRIX(gref,mm) SEMI_PROTECT(\
03357     HT_Attribute const *_att; \
03358     mm = null; \
03359     if ((_att = gref->h.attributes) != null) do { \
03360         if (_att->h.type == HK_MODELLING_MATRIX) { \
03361             mm = &_att->modelling_matrix.matrix; \
03362             if (!BIT(mm->contents, Matrix_Contents_ANYTHING)) \
03363                 mm = null; \
03364         } \
03365     } while ((_att = _att->h.next) != null); \
03366 )
03367 
03368 #define PUSH_GEO_REF(dc,gref) SEMI_PROTECT(\
03369     if (!dc->current_geo_ref.ref_list) \
03370         dc->current_geo_ref.ref_list = HI_New_VList (); \
03371     HI_VList_Add_First ((HT_VList *)dc->current_geo_ref.ref_list, (void *)gref); \
03372     HD_Process_Geo_Ref_List (dc); \
03373 )
03374 
03375 #define POP_GEO_REF(dc) SEMI_PROTECT(\
03376     HI_VList_Remove_First ((HT_VList *)dc->current_geo_ref.ref_list); \
03377     HD_Process_Geo_Ref_List (dc); \
03378 )
03379 
03380 
03381 #ifndef DISABLE_MUTEX
03382 # define SET_TIMER_EXPIRED(flag) do {       \
03383         HT_Thread_Specific_Data     *_td_;  \
03384         bool    _exp_ = (flag);         \
03385         HT_Time _time_ = HI_What_Time();    \
03386         _td_ = &OUR (main_thread);          \
03387         do {_td_->time_stamp = _time_;      \
03388             _td_->timer_expired = _exp_;    \
03389         } while ((_td_ = _td_->next) != null);\
03390     } while (0)
03391 #else
03392 # define SET_TIMER_EXPIRED(flag) do { \
03393         bool    _exp_ = (flag); \
03394         OUR(main_thread).timer_expired = _exp_; \
03395         OUR(main_thread).time_stamp = HI_What_Time(); \
03396     } while (0)
03397 #endif
03398 
03399     
03400 #define TIMER_HAS_EXPIRED(_td_)             \
03401     (_td_->timer_expired || \
03402         OUR(timer_enables) == 0 && _td_->update_end_time_check && \
03403              (_td_->update_end_time_check = (_td_->update_end_time_check & 0x01FF) + 1) == 1)
03404 
03405 #define EXIT_UPDATE(_nr_) \
03406     (_nr_->display_context->options.exit_update? \
03407         (_nr_->display_context->options.exit_update(_nr_), \
03408             _nr_->display_context->update_interrupted): \
03409                 HD_Exit_Update ((HT_Display_Context alter*)_nr_->display_context))
03410 
03411 #define CHECK_EXIT_UPDATE(_td_, _nr_) \
03412     (_nr_->display_context->update_interrupted? \
03413         (_nr_->display_context->update_interrupted): \
03414         (_td_->update_end_time_check != 0 && _td_->time_stamp >= _td_->update_end_time)? \
03415             (HD_Interrupt_Update(_nr_->display_context, false, false), _nr_->display_context->update_interrupted): \
03416             (TIMER_HAS_EXPIRED((_td_)) && EXIT_UPDATE ((_nr_))))
03417 
03418 
03419 /* HIA macros */
03420 
03421 #define ASSOCIATE_CALLBACK_DATA(nr, cbid) do { \
03422     HT_Display_Context *_alter_dc_ = (HT_Display_Context alter *)(nr)->display_context; \
03423     _alter_dc_->associated_data = (nr)->action_rendition->associated_data[(cbid)]; \
03424     _alter_dc_->associated_segment = (nr)->action_rendition->associated_segment[(cbid)]; \
03425 } while (0)
03426 
03427 #define UNASSOCIATE_CALLBACK_DATA(nr) do { \
03428     HT_Display_Context *_alter_dc_ = (HT_Display_Context alter *)(nr)->display_context; \
03429     _alter_dc_->associated_data = 0; \
03430     _alter_dc_->associated_segment = 0; \
03431 } while (0)
03432 
03433 #define HIA_Driver_Startup(nr) \
03434     do if ((nr)->action_rendition->driver_startup != nullroutine) { \
03435         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRIVER_STARTUP); \
03436         CALLBACK_ACTION (nr, driver_startup) (nr); \
03437         UNASSOCIATE_CALLBACK_DATA(nr); \
03438 } while (0)
03439 
03440 #define HIA_Driver_Shutdown(nr) \
03441     do if ((nr)->action_rendition->driver_shutdown != nullroutine) { \
03442         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRIVER_SHUTDOWN); \
03443         CALLBACK_ACTION (nr, driver_shutdown) (nr); \
03444         UNASSOCIATE_CALLBACK_DATA(nr); \
03445 } while (0)
03446 
03447 #define HIA_Draw_DC_Polytriangle(nr, count, points) do { \
03448     if ((nr)->action_rendition->draw_dc_polytriangle != nullroutine) { \
03449         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_POLYTRIANGLE); \
03450         CALLBACK_ACTION (nr, draw_dc_polytriangle)(nr, count, points); \
03451         UNASSOCIATE_CALLBACK_DATA(nr); \
03452     } else if ((nr)->action_rendition->draw_dc_triangle != nullroutine) { \
03453         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_TRIANGLE); \
03454         HD_Unwrap_Polytriangle (nr, count, points); \
03455         UNASSOCIATE_CALLBACK_DATA(nr); \
03456     } else \
03457         DRIVER_ACTION (nr, draw_dc_polytriangle)(nr, count, points); \
03458 } while (0)
03459 
03460 #define HIA_Draw_DC_Colorized_Polytriangle(nr, count, points, color, single) do { \
03461     if ((nr)->action_rendition->draw_dc_colorized_polytriangle != nullroutine) { \
03462         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_COLORIZED_POLYTRIANGLE); \
03463         CALLBACK_ACTION (nr, draw_dc_colorized_polytriangle)(nr, count, points, color, single); \
03464         UNASSOCIATE_CALLBACK_DATA(nr); \
03465     } else if ((nr)->action_rendition->draw_dc_colorized_triangle != nullroutine) { \
03466         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_COLORIZED_TRIANGLE); \
03467         HD_Unwrap_Colorized_Polytriangle (nr, count, points, color, single); \
03468         UNASSOCIATE_CALLBACK_DATA(nr); \
03469     } else \
03470         DRIVER_ACTION (nr, draw_dc_colorized_polytriangle)(nr, count, points, color, single); \
03471 } while (0)
03472 
03473 #define HIA_Draw_DC_Gouraud_Polytriangle(nr, count, points, colors) do { \
03474     if ((nr)->action_rendition->draw_dc_gouraud_polytriangle != nullroutine) { \
03475         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_GOURAUD_POLYTRIANGLE); \
03476         CALLBACK_ACTION (nr, draw_dc_gouraud_polytriangle)(nr, count, points, colors); \
03477         UNASSOCIATE_CALLBACK_DATA(nr); \
03478     } else if ((nr)->action_rendition->draw_dc_gouraud_triangle != nullroutine) { \
03479         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_GOURAUD_TRIANGLE); \
03480         HD_Unwrap_Gouraud_Polytriangle (nr, count, points, colors); \
03481         UNASSOCIATE_CALLBACK_DATA(nr); \
03482     } else \
03483                 DRIVER_ACTION (nr, draw_dc_gouraud_polytriangle)(nr, count, points, colors); \
03484 } while (0)
03485 
03486 #define HIA_Draw_DC_Phong_Polytriangle(nr, count, points, colors, planes) do { \
03487     if ((nr)->action_rendition->draw_dc_phong_polytriangle != nullroutine) { \
03488         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_PHONG_POLYTRIANGLE); \
03489         CALLBACK_ACTION (nr, draw_dc_phong_polytriangle)(nr, count, points, colors, planes); \
03490         UNASSOCIATE_CALLBACK_DATA(nr); \
03491     } else if ((nr)->action_rendition->draw_dc_reshaded_triangle != nullroutine) { \
03492         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_RESHADED_TRIANGLE); \
03493         HD_Unwrap_Reshaded_Polytriangle (nr, count, points, colors, planes, 0, 0, 0); \
03494         UNASSOCIATE_CALLBACK_DATA(nr); \
03495     } else \
03496         DRIVER_ACTION (nr, draw_dc_phong_polytriangle)(nr, count, points, colors, planes); \
03497 } while (0)
03498 
03499 #define HIA_Draw_DC_Textured_Polytriangle(nr, count, points, colors, planes, params, param_width, param_flags) do { \
03500     if ((nr)->action_rendition->draw_dc_textured_polytriangle != nullroutine) { \
03501         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_TEXTURED_POLYTRIANGLE); \
03502         CALLBACK_ACTION (nr, draw_dc_textured_polytriangle)(nr, count, points, colors, planes, params, param_width, param_flags); \
03503         UNASSOCIATE_CALLBACK_DATA(nr); \
03504     } else if ((nr)->action_rendition->draw_dc_reshaded_triangle != nullroutine) { \
03505         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_RESHADED_TRIANGLE); \
03506         HD_Unwrap_Reshaded_Polytriangle (nr, count, points, colors, planes, params, param_width, param_flags); \
03507         UNASSOCIATE_CALLBACK_DATA(nr); \
03508     } else \
03509                 DRIVER_ACTION (nr, draw_dc_textured_polytriangle)(nr, count, points, colors, planes, params, param_width, param_flags); \
03510 } while (0)
03511 
03512 #define HIA_Draw_DC_Polyline(nr, count, points) do { \
03513     if ((nr)->action_rendition->draw_dc_polyline != nullroutine) { \
03514         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_POLYLINE); \
03515         CALLBACK_ACTION (nr, draw_dc_polyline)(nr, count, points); \
03516         UNASSOCIATE_CALLBACK_DATA(nr); \
03517     } else if ((nr)->action_rendition->draw_dc_line != nullroutine) { \
03518         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_LINE); \
03519         HD_Unwrap_Polyline (nr, count, points); \
03520         UNASSOCIATE_CALLBACK_DATA(nr); \
03521     } else \
03522                 DRIVER_ACTION (nr, draw_dc_polyline)(nr, count, points); \
03523 } while (0)
03524 
03525 #define HIA_Draw_DC_Colorized_Polyline(nr, count, points, color, single) do { \
03526     if ((nr)->action_rendition->draw_dc_colorized_polyline != nullroutine) { \
03527         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_COLORIZED_POLYLINE); \
03528         CALLBACK_ACTION (nr, draw_dc_colorized_polyline)(nr, count, points, color, single); \
03529         UNASSOCIATE_CALLBACK_DATA(nr); \
03530     } else if ((nr)->action_rendition->draw_dc_colorized_line != nullroutine) { \
03531         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_COLORIZED_LINE); \
03532         HD_Unwrap_Colorized_Polyline (nr, count, points, color, single); \
03533         UNASSOCIATE_CALLBACK_DATA(nr); \
03534     } else \
03535         DRIVER_ACTION (nr, draw_dc_colorized_polyline)(nr, count, points, color, single); \
03536 } while (0)
03537 
03538 #define HIA_Draw_DC_Gouraud_Polyline(nr, count, points, colors) do { \
03539     if ((nr)->action_rendition->draw_dc_gouraud_polyline != nullroutine) { \
03540         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_GOURAUD_POLYLINE); \
03541         CALLBACK_ACTION (nr, draw_dc_gouraud_polyline)(nr, count, points, colors); \
03542         UNASSOCIATE_CALLBACK_DATA(nr); \
03543     } else if ((nr)->action_rendition->draw_dc_gouraud_line != nullroutine) { \
03544         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_GOURAUD_LINE); \
03545         HD_Unwrap_Gouraud_Polyline (nr, count, points, colors); \
03546         UNASSOCIATE_CALLBACK_DATA(nr); \
03547     } else \
03548         DRIVER_ACTION (nr, draw_dc_gouraud_polyline)(nr, count, points, colors); \
03549 } while (0)
03550 
03551 #define HIA_Draw_DC_Phong_Polyline(nr, count, points, colors, planes) do { \
03552     if ((nr)->action_rendition->draw_dc_phong_polyline != nullroutine) { \
03553         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_PHONG_POLYLINE); \
03554         CALLBACK_ACTION (nr, draw_dc_phong_polyline)(nr, count, points, colors, planes); \
03555         UNASSOCIATE_CALLBACK_DATA(nr); \
03556     } else if ((nr)->action_rendition->draw_dc_reshaded_line != nullroutine) { \
03557         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_RESHADED_LINE); \
03558         HD_Unwrap_Reshaded_Polyline (nr, count, points, colors, planes, 0, 0, 0); \
03559         UNASSOCIATE_CALLBACK_DATA(nr); \
03560     } else \
03561         DRIVER_ACTION (nr, draw_dc_phong_polyline)(nr, count, points, colors, planes); \
03562 } while (0)
03563 
03564 #define HIA_Draw_DC_Textured_Polyline(nr, count, points, colors, planes, params, param_width, param_flags) do { \
03565     if ((nr)->action_rendition->draw_dc_textured_polyline != nullroutine) { \
03566         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_TEXTURED_POLYLINE); \
03567         CALLBACK_ACTION (nr, draw_dc_textured_polyline)(nr, count, points, colors, planes, params, param_width, param_flags); \
03568         UNASSOCIATE_CALLBACK_DATA(nr); \
03569     } else if ((nr)->action_rendition->draw_dc_reshaded_line != nullroutine) { \
03570         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_RESHADED_LINE); \
03571         HD_Unwrap_Reshaded_Polyline (nr, count, points, colors, planes, params, param_width, param_flags); \
03572         UNASSOCIATE_CALLBACK_DATA(nr); \
03573     } else \
03574         DRIVER_ACTION (nr, draw_dc_textured_polyline)(nr, count, points, colors, planes, params, param_width, param_flags); \
03575 } while (0)
03576 
03577 #define HIA_Draw_DC_Polymarker(nr, count, points, rotations, size_fixups) do { \
03578     if ((nr)->action_rendition->draw_dc_polymarker != nullroutine) { \
03579         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_POLYMARKER); \
03580         CALLBACK_ACTION (nr, draw_dc_polymarker)(nr, count, points, rotations, size_fixups); \
03581         UNASSOCIATE_CALLBACK_DATA(nr); \
03582     } else if ((nr)->action_rendition->draw_dc_marker != nullroutine) { \
03583         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_MARKER); \
03584         HD_Unwrap_Polymarker (nr, count, points, rotations, size_fixups); \
03585         UNASSOCIATE_CALLBACK_DATA(nr); \
03586     } else \
03587         DRIVER_ACTION (nr, draw_dc_polymarker)(nr, count, points, rotations, size_fixups); \
03588 } while (0)
03589 
03590 #define HIA_Draw_DC_Colorized_Polymarker(nr, count, points, color, single_color, rotations, size_fixups) do { \
03591     if ((nr)->action_rendition->draw_dc_colorized_polymarker != nullroutine) { \
03592         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_COLORIZED_POLYMARKER); \
03593         CALLBACK_ACTION (nr, draw_dc_colorized_polymarker)(nr, count, points, color, single_color, rotations, size_fixups); \
03594         UNASSOCIATE_CALLBACK_DATA(nr); \
03595     } else if ((nr)->action_rendition->draw_dc_colorized_marker != nullroutine) { \
03596         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_COLORIZED_MARKER); \
03597         HD_Unwrap_Colorized_Polymarker (nr, count, points, color, single_color, rotations, size_fixups); \
03598         UNASSOCIATE_CALLBACK_DATA(nr); \
03599     } else \
03600         DRIVER_ACTION (nr, draw_dc_colorized_polymarker)(nr, count, points, color, single_color, rotations, size_fixups); \
03601 } while (0)
03602 
03603 #define HIA_Draw_DC_Face(nr, count, points) do { \
03604     if ((nr)->action_rendition->draw_dc_face != nullroutine) { \
03605         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_FACE); \
03606         CALLBACK_ACTION (nr, draw_dc_face)(nr, count, points); \
03607         UNASSOCIATE_CALLBACK_DATA(nr); \
03608     } else \
03609         DRIVER_ACTION (nr, draw_dc_face)(nr, count, points); \
03610 } while (0)
03611 
03612 #define HIA_Draw_DC_Colorized_Face(nr, count, points, rgb) do { \
03613     if ((nr)->action_rendition->draw_dc_colorized_face != nullroutine) { \
03614         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_COLORIZED_FACE); \
03615         CALLBACK_ACTION (nr, draw_dc_colorized_face)(nr, count, points, rgb); \
03616         UNASSOCIATE_CALLBACK_DATA(nr); \
03617     } else \
03618         DRIVER_ACTION (nr, draw_dc_colorized_face)(nr, count, points, rgb); \
03619 } while (0)
03620 
03621 #define HIA_Draw_DC_Cut_Line(nr, count, points) do { \
03622     if ((nr)->action_rendition->draw_dc_cut_line != nullroutine) { \
03623         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_DC_CUT_LINE); \
03624         CALLBACK_ACTION (nr, draw_dc_cut_line)(nr, count, points); \
03625         UNASSOCIATE_CALLBACK_DATA(nr); \
03626     } else \
03627         DRIVER_ACTION (nr, draw_dc_polyline)(nr, count, points); \
03628 } while (0)
03629 
03630 #define HIA_Draw_DC_Stenciled_Quad(nr, points, stencil) do { \
03631     DRIVER_ACTION (nr, draw_dc_stenciled_quad)(nr, points, stencil); \
03632 } while (0)
03633 
03634 #define  HIA_Draw_Text(nr, text_info) do { \
03635     if ((nr)->action_rendition->draw_text != nullroutine) { \
03636         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_TEXT); \
03637         CALLBACK_ACTION (nr, draw_text) (nr, text_info); \
03638         UNASSOCIATE_CALLBACK_DATA(nr); \
03639     } else \
03640         DRIVER_ACTION (nr, draw_inter_text)(nr, text_info); \
03641 } while (0)
03642 
03643 #define HIA_Draw_3D_Marker(nr, marker) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_MARKER)) { \
03644     if ((nr)->action_rendition->draw_3d_marker != nullroutine) { \
03645         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_MARKER); \
03646         CALLBACK_ACTION (nr, draw_3d_marker)(nr, marker); \
03647         UNASSOCIATE_CALLBACK_DATA(nr); \
03648     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03649         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03650         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)marker); \
03651         UNASSOCIATE_CALLBACK_DATA(nr); \
03652     } else \
03653         DRIVER_ACTION (nr, draw_3d_marker)(nr, marker); \
03654 } while (0)
03655 
03656 #define HIA_Draw_3D_Polyline(nr, polyline) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_POLYLINE)) { \
03657     if ((nr)->action_rendition->draw_3d_polyline != nullroutine) { \
03658         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_POLYLINE); \
03659         CALLBACK_ACTION (nr, draw_3d_polyline)(nr, polyline); \
03660         UNASSOCIATE_CALLBACK_DATA(nr); \
03661     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03662         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03663         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)polyline); \
03664         UNASSOCIATE_CALLBACK_DATA(nr); \
03665     } else \
03666         DRIVER_ACTION (nr, draw_3d_polyline)(nr, polyline); \
03667 } while (0)
03668 
03669 #define HIA_Draw_3D_Infinite_Line(nr, polyline) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_INFINITE_LINE)) { \
03670     if ((nr)->action_rendition->draw_3d_infinite_line != nullroutine) { \
03671         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_INFINITE_LINE); \
03672         CALLBACK_ACTION (nr, draw_3d_infinite_line)(nr, polyline); \
03673         UNASSOCIATE_CALLBACK_DATA(nr); \
03674     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03675         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03676         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)polyline); \
03677         UNASSOCIATE_CALLBACK_DATA(nr); \
03678     } else \
03679         DRIVER_ACTION (nr, draw_3d_infinite_line)(nr, polyline); \
03680 } while (0)
03681 
03682 #define HIA_Draw_3D_NURBS_Curve(nr, curve) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_NURBS_CURVE)) { \
03683     if ((nr)->action_rendition->draw_3d_nurbs_curve != nullroutine) { \
03684         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_CURVE); \
03685         CALLBACK_ACTION (nr, draw_3d_nurbs_curve)(nr, curve); \
03686         UNASSOCIATE_CALLBACK_DATA(nr); \
03687     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03688         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03689         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)curve); \
03690         UNASSOCIATE_CALLBACK_DATA(nr); \
03691     } else \
03692         DRIVER_ACTION (nr, draw_3d_nurbs_curve)(nr, curve); \
03693 } while (0)
03694 
03695 #define HIA_Draw_3D_NURBS_Surface(nr, surface) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_NURBS_SURFACE)) { \
03696     if ((nr)->action_rendition->draw_3d_nurbs_surface != nullroutine) { \
03697         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_SURFACE); \
03698         CALLBACK_ACTION (nr, draw_3d_nurbs_surface)(nr, surface); \
03699         UNASSOCIATE_CALLBACK_DATA(nr); \
03700     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03701         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03702         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)surface); \
03703         UNASSOCIATE_CALLBACK_DATA(nr); \
03704     } else \
03705         DRIVER_ACTION (nr, draw_3d_nurbs_surface)(nr, surface); \
03706 } while (0)
03707 
03708 #define HIA_Draw_3D_Cylinder(nr, cyl) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_CYLINDER)) { \
03709     if ((nr)->action_rendition->draw_3d_cylinder != nullroutine) { \
03710         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_CYLINDER); \
03711         CALLBACK_ACTION (nr, draw_3d_cylinder)(nr, cyl); \
03712         UNASSOCIATE_CALLBACK_DATA(nr); \
03713     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03714         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03715         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)cyl); \
03716         UNASSOCIATE_CALLBACK_DATA(nr); \
03717     } else \
03718         DRIVER_ACTION (nr, draw_3d_cylinder)(nr, cyl); \
03719 } while (0)
03720 
03721 #define HIA_Draw_3D_PolyCylinder(nr, pcyl) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_POLYCYLINDER)) { \
03722     if ((nr)->action_rendition->draw_3d_polycylinder != nullroutine) { \
03723         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_POLYCYLINDER); \
03724         CALLBACK_ACTION (nr, draw_3d_polycylinder)(nr, pcyl); \
03725         UNASSOCIATE_CALLBACK_DATA(nr); \
03726     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03727         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03728         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)pcyl); \
03729         UNASSOCIATE_CALLBACK_DATA(nr); \
03730     } else \
03731         DRIVER_ACTION (nr, draw_3d_polycylinder)(nr, pcyl); \
03732 } while (0)
03733 
03734 #define HIA_Draw_3D_Sphere(nr, pcyl) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_SPHERE)) { \
03735     if ((nr)->action_rendition->draw_3d_sphere != nullroutine) { \
03736         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_SPHERE); \
03737         CALLBACK_ACTION (nr, draw_3d_sphere)(nr, pcyl); \
03738         UNASSOCIATE_CALLBACK_DATA(nr); \
03739     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03740         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03741         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)pcyl); \
03742         UNASSOCIATE_CALLBACK_DATA(nr); \
03743     } else \
03744         DRIVER_ACTION (nr, draw_3d_sphere)(nr, pcyl); \
03745 } while (0)
03746 
03747 #define HIA_Draw_3D_Polygon(nr, polygon) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_POLYGON)) { \
03748     if ((nr)->action_rendition->draw_3d_polygon != nullroutine) { \
03749         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_POLYGON); \
03750         CALLBACK_ACTION (nr, draw_3d_polygon)(nr, polygon); \
03751         UNASSOCIATE_CALLBACK_DATA(nr); \
03752     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03753         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03754         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)polygon); \
03755         UNASSOCIATE_CALLBACK_DATA(nr); \
03756     } else \
03757         DRIVER_ACTION (nr, draw_3d_polygon)(nr, polygon); \
03758 } while (0)
03759 
03760 #if 0
03761 #define HIA_Draw_3D_Contour(nr, contour) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_CONTOUR)) { \
03762     if ((nr)->action_rendition->draw_3d_contour != nullroutine) { \
03763         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_CONTOUR); \
03764         CALLBACK_ACTION (nr, draw_3d_contour)(nr, contour); \
03765         UNASSOCIATE_CALLBACK_DATA(nr); \
03766     } else \
03767         DRIVER_ACTION (nr, draw_3d_contour)(nr, contour); \
03768 } while (0)
03769 #endif
03770 
03771 #define HIA_Draw_3D_Text(nr, text) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_TEXT)) { \
03772     if ((nr)->action_rendition->draw_3d_text != nullroutine) { \
03773         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_TEXT); \
03774         CALLBACK_ACTION (nr, draw_3d_text)(nr, text); \
03775         UNASSOCIATE_CALLBACK_DATA(nr); \
03776     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03777         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03778         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)text); \
03779         UNASSOCIATE_CALLBACK_DATA(nr); \
03780     } else \
03781         DRIVER_ACTION (nr, draw_3d_text)(nr, text); \
03782 } while (0)
03783 
03784 
03785 #define HIA_Draw_3D_Stenciled_Quad(nr, points, stencil) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_STENCILED_QUAD)) { \
03786     DRIVER_ACTION (nr, draw_3d_stenciled_quad)(nr, points, stencil); \
03787 } while (0)
03788 
03789 #define HIA_Draw_3D_Image(nr, image) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_IMAGE)) { \
03790     if ((nr)->action_rendition->draw_3d_image != nullroutine) { \
03791         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_IMAGE); \
03792         CALLBACK_ACTION (nr, draw_3d_image)(nr, image); \
03793         UNASSOCIATE_CALLBACK_DATA(nr); \
03794     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03795         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03796         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)image); \
03797         UNASSOCIATE_CALLBACK_DATA(nr); \
03798     } else \
03799         DRIVER_ACTION (nr, draw_3d_image)(nr, image); \
03800 } while (0)
03801 
03802 #define HIA_Draw_3D_Grid(nr, grid) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_GRID)) { \
03803     if ((nr)->action_rendition->draw_3d_grid != nullroutine) { \
03804         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GRID); \
03805         CALLBACK_ACTION (nr, draw_3d_grid)(nr, grid); \
03806         UNASSOCIATE_CALLBACK_DATA(nr); \
03807     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03808         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03809         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)grid); \
03810         UNASSOCIATE_CALLBACK_DATA(nr); \
03811     } else \
03812         DRIVER_ACTION (nr, draw_3d_grid)(nr, grid); \
03813 } while (0)
03814 
03815 #define HIA_Draw_3D_Mesh(nr, mesh) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_POLYHEDRON)) { \
03816     if ((nr)->action_rendition->draw_3d_polyhedron != nullroutine) { \
03817         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_POLYHEDRON); \
03818         CALLBACK_ACTION (nr, draw_3d_polyhedron)(nr, mesh); \
03819         UNASSOCIATE_CALLBACK_DATA(nr); \
03820     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03821         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03822         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)mesh); \
03823         UNASSOCIATE_CALLBACK_DATA(nr); \
03824     } else \
03825         DRIVER_ACTION (nr, draw_3d_polyhedron)(nr, mesh); \
03826 } while (0)
03827 
03828 #define HIA_Draw_3D_Shell(nr, shell) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_POLYHEDRON)) { \
03829     if ((nr)->action_rendition->draw_3d_polyhedron != nullroutine) { \
03830         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_POLYHEDRON); \
03831         CALLBACK_ACTION (nr, draw_3d_polyhedron)(nr, shell); \
03832         UNASSOCIATE_CALLBACK_DATA(nr); \
03833     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03834         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03835         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)shell); \
03836         UNASSOCIATE_CALLBACK_DATA(nr); \
03837     } else \
03838         DRIVER_ACTION (nr, draw_3d_polyhedron)(nr, shell); \
03839 } while (0)
03840 
03841 #define HIA_Draw_3D_Ellipse(nr, ellipse) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_ELLIPSE)) { \
03842     if ((nr)->action_rendition->draw_3d_ellipse != nullroutine) { \
03843         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_ELLIPSE); \
03844         CALLBACK_ACTION (nr, draw_3d_ellipse)(nr, ellipse); \
03845         UNASSOCIATE_CALLBACK_DATA(nr); \
03846     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03847         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03848         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)ellipse); \
03849         UNASSOCIATE_CALLBACK_DATA(nr); \
03850     } else \
03851         DRIVER_ACTION (nr, draw_3d_ellipse)(nr, ellipse); \
03852 } while (0)
03853 
03854 #define HIA_Draw_3D_Elliptical_Arc(nr, elliparc) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_ELLIPTICAL_ARC)) { \
03855     if ((nr)->action_rendition->draw_3d_elliptical_arc != nullroutine) { \
03856         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_ELLIPTICAL_ARC); \
03857         CALLBACK_ACTION (nr, draw_3d_elliptical_arc)(nr, elliparc); \
03858         UNASSOCIATE_CALLBACK_DATA(nr); \
03859     } else if ((nr)->action_rendition->draw_3d_geometry != nullroutine) { \
03860         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_GEOMETRY); \
03861         CALLBACK_ACTION (nr, draw_3d_geometry)(nr, (HT_Geometry const *)elliparc); \
03862         UNASSOCIATE_CALLBACK_DATA(nr); \
03863     } else \
03864         DRIVER_ACTION (nr, draw_3d_elliptical_arc)(nr, elliparc); \
03865 } while (0)
03866 
03867 #define HIA_Draw_3D_Tristrip(nr, ts) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_TRISTRIP)) { \
03868     if ((nr)->action_rendition->draw_3d_tristrip != nullroutine) { \
03869         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_TRISTRIP); \
03870         CALLBACK_ACTION (nr, draw_3d_tristrip)(nr, ts); \
03871         UNASSOCIATE_CALLBACK_DATA(nr); \
03872     } else \
03873         DRIVER_ACTION (nr, draw_3d_tristrip)(nr, ts); \
03874 } while (0)
03875 
03876 #define HIA_Draw_Indexicated_3D_Tristrip(nr, ts) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_INDEXED_TRISTRIP)) { \
03877     if ((nr)->action_rendition->draw_3d_tristrip != nullroutine) { \
03878         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_TRISTRIP); \
03879         CALLBACK_ACTION (nr, draw_3d_tristrip)(nr, ts); \
03880         UNASSOCIATE_CALLBACK_DATA(nr); \
03881     } else \
03882         DRIVER_ACTION (nr, draw_indexed_tristrip)(nr, ts); \
03883 } while (0)
03884 
03885 #define HIA_Draw_3D_Polyedge(nr, pe) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_POLYEDGE)) { \
03886     if ((nr)->action_rendition->draw_3d_polyedge != nullroutine) { \
03887         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_POLYEDGE); \
03888         CALLBACK_ACTION (nr, draw_3d_polyedge)(nr, pe); \
03889         UNASSOCIATE_CALLBACK_DATA(nr); \
03890     } else \
03891         DRIVER_ACTION (nr, draw_3d_polyedge)(nr, pe); \
03892 } while (0)
03893 
03894 #define HIA_Draw_3D_Isoline(nr, pe) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_POLYEDGE)) { \
03895     if ((nr)->action_rendition->draw_3d_isoline != nullroutine) { \
03896         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_ISOLINE); \
03897         CALLBACK_ACTION (nr, draw_3d_isoline)(nr, pe); \
03898         UNASSOCIATE_CALLBACK_DATA(nr); \
03899     } else \
03900         DRIVER_ACTION (nr, draw_3d_polyedge)(nr, pe); \
03901 } while (0)
03902 
03903 #define HIA_Draw_Indexicated_3D_Polyedge(nr, pe) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_INDEXED_POLYEDGE)) { \
03904     if ((nr)->action_rendition->draw_3d_polyedge != nullroutine) { \
03905         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_POLYEDGE); \
03906         CALLBACK_ACTION (nr, draw_3d_polyedge)(nr, pe); \
03907         UNASSOCIATE_CALLBACK_DATA(nr); \
03908     } else \
03909         DRIVER_ACTION (nr, draw_indexed_polyedge)(nr, pe); \
03910 } while (0)
03911 
03912 #define HIA_Draw_3D_Polymarker(nr, pm) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_3D_POLYMARKER)) { \
03913     if ((nr)->action_rendition->draw_3d_polymarker != nullroutine) { \
03914         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_3D_POLYMARKER); \
03915         CALLBACK_ACTION (nr, draw_3d_polymarker)(nr, pm); \
03916         UNASSOCIATE_CALLBACK_DATA(nr); \
03917     } else \
03918         DRIVER_ACTION (nr, draw_3d_polymarker)(nr, pm); \
03919 } while (0)
03920 
03921 /*
03922  * Internal HII macros
03923  */
03924 
03925 #define HII_Show_Driver_Color(nr, specific, chan, lchan) \
03926     ((nr)->display_context->physical.color_system == DIRECT_RGB ? \
03927         (nr)->specific.direct_rgb.chan * (1.0f/255.0f) :\
03928      (nr)->display_context->physical.color_system == GRAY_SCALE ? \
03929         (nr)->specific.gray_level / ((nr)->display_context->physical.nominal_color_resolution - 1) : \
03930      (nr)->display_context->rgb_map != null ? \
03931         (nr)->display_context->rgb_map[(nr)->specific.map_index].lchan : \
03932      0)
03933 
03934 /* show driver colors */
03935 
03936 #define HII_Show_Window_Color_Red(nr) \
03937     HII_Show_Driver_Color (nr, window_rendition->window_color, r, red)
03938 
03939 #define HII_Show_Window_Color_Green(nr) \
03940     HII_Show_Driver_Color (nr, window_rendition->window_color, g, green)
03941 
03942 #define HII_Show_Window_Color_Blue(nr) \
03943     HII_Show_Driver_Color (nr, window_rendition->window_color, b, blue)
03944 
03945 #define HII_Show_Window_Contrast_Color_Red(nr) \
03946     HII_Show_Driver_Color (nr, window_rendition->contrast_color, r, red)
03947 
03948 #define HII_Show_Window_Contrast_Color_Green(nr) \
03949     HII_Show_Driver_Color (nr, window_rendition->contrast_color, g, green)
03950 
03951 #define HII_Show_Window_Contrast_Color_Blue(nr) \
03952     HII_Show_Driver_Color (nr, window_rendition->contrast_color, b, blue)
03953 
03954 #define HII_Show_Face_Color_Red(nr) \
03955     HII_Show_Driver_Color (nr, face_rendition->color, r, red)
03956 
03957 #define HII_Show_Face_Color_Green(nr) \
03958     HII_Show_Driver_Color (nr, face_rendition->color, g, green)
03959 
03960 #define HII_Show_Face_Color_Blue(nr) \
03961     HII_Show_Driver_Color (nr, face_rendition->color, b, blue)
03962 
03963 #define HII_Show_Face_Back_Color_Red(nr) \
03964     HII_Show_Driver_Color (nr, face_rendition->back_color, r, red)
03965 
03966 #define HII_Show_Face_Back_Color_Green(nr) \
03967     HII_Show_Driver_Color (nr, face_rendition->back_color, g, green)
03968 
03969 #define HII_Show_Face_Back_Color_Blue(nr) \
03970     HII_Show_Driver_Color (nr, face_rendition->back_color, b, blue)
03971 
03972 #define HII_Show_Face_Contrast_Color_Red(nr) \
03973     HII_Show_Driver_Color (nr, face_rendition->contrast_color, r, red)
03974 
03975 #define HII_Show_Face_Contrast_Color_Green(nr) \
03976     HII_Show_Driver_Color (nr, face_rendition->contrast_color, g, green)
03977 
03978 #define HII_Show_Face_Contrast_Color_Blue(nr) \
03979     HII_Show_Driver_Color (nr, face_rendition->contrast_color, b, blue)
03980 
03981 #define HII_Show_Line_Color_Red(nr) \
03982     HII_Show_Driver_Color (nr, line_rendition->color, r, red)
03983 
03984 #define HII_Show_Line_Color_Green(nr) \
03985     HII_Show_Driver_Color (nr, line_rendition->color, g, green)
03986 
03987 #define HII_Show_Line_Color_Blue(nr) \
03988     HII_Show_Driver_Color (nr, line_rendition->color, b, blue)
03989 
03990 #define HII_Show_Marker_Color_Red(nr) \
03991     HII_Show_Driver_Color (nr, marker_rendition->color, r, red)
03992 
03993 #define HII_Show_Marker_Color_Green(nr) \
03994     HII_Show_Driver_Color (nr, marker_rendition->color, g, green)
03995 
03996 #define HII_Show_Marker_Color_Blue(nr) \
03997     HII_Show_Driver_Color (nr, marker_rendition->color, b, blue)
03998 
03999 #define HII_Show_Text_Color_Red(nr) \
04000     HII_Show_Driver_Color (nr, text_rendition->color, r, red)
04001 
04002 #define HII_Show_Text_Color_Green(nr) \
04003     HII_Show_Driver_Color (nr, text_rendition->color, g, green)
04004 
04005 #define HII_Show_Text_Color_Blue(nr) \
04006     HII_Show_Driver_Color (nr, text_rendition->color, b, blue)
04007 
04008 /* draw calls */
04009 
04010 #define HII_Draw_Silhouette_Polyedge(nr, pe) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_SILHOUETTE_POLYEDGE)) { \
04011     DRIVER_ACTION (nr, draw_silhouette_polyedge)(nr, pe); \
04012 } while (0)
04013 
04014 #define HII_Draw_NonCulled_Polyedge(nr, pe) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_NONCULLED_POLYEDGE)) { \
04015     DRIVER_ACTION (nr, draw_nonculled_polyedge)(nr, pe); \
04016 } while (0)
04017 
04018 #define HIA_Draw_Window(nr) do { \
04019     if ((nr)->action_rendition->draw_window != nullroutine) { \
04020         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_WINDOW); \
04021         CALLBACK_ACTION (nr, draw_window)(nr, &(nr)->window_rendition->net_extent); \
04022         UNASSOCIATE_CALLBACK_DATA(nr); \
04023     } else \
04024         DRIVER_ACTION (nr, draw_window)(nr, &(nr)->window_rendition->net_extent); \
04025 } while (0)
04026 
04027 #define HIA_Draw_Window_Frame(nr, extent, frame, calc) do { \
04028     if ((nr)->action_rendition->draw_window_frame != nullroutine) { \
04029         ASSOCIATE_CALLBACK_DATA(nr, CBT_DRAW_WINDOW_FRAME); \
04030         CALLBACK_ACTION (nr, draw_window_frame)(nr, extent, frame, calc); \
04031         UNASSOCIATE_CALLBACK_DATA(nr); \
04032     } else \
04033         DRIVER_ACTION (nr, draw_window_frame)(nr, extent, frame, calc); \
04034 } while (0)
04035 
04036 #define HIA_Finish_Picture(nr, swap_buffers) do { \
04037     if ((nr)->action_rendition->finish_picture != nullroutine) { \
04038         ASSOCIATE_CALLBACK_DATA(nr, CBT_FINISH_PICTURE); \
04039         CALLBACK_ACTION (nr, finish_picture)(nr, swap_buffers); \
04040         UNASSOCIATE_CALLBACK_DATA(nr); \
04041     } else \
04042         DRIVER_ACTION (nr, finish_picture)(nr, swap_buffers); \
04043 } while (0)
04044 
04045 #define HIA_Create_Region(nr, area, image_buffer, z_buffer) do { \
04046     if ((nr)->action_rendition->create_region != nullroutine) { \
04047         ASSOCIATE_CALLBACK_DATA(nr, CBT_CREATE_REGION); \
04048         CALLBACK_ACTION (nr, create_region)(nr, area, image_buffer, z_buffer); \
04049         UNASSOCIATE_CALLBACK_DATA(nr); \
04050     } else \
04051         DRIVER_ACTION (nr, create_region)(nr, area, image_buffer, z_buffer); \
04052 } while (0)
04053 
04054 #define HIA_Save_Region(nr, area, image_buffer, z_buffer) do { \
04055     if ((nr)->action_rendition->save_region != nullroutine) { \
04056         ASSOCIATE_CALLBACK_DATA(nr, CBT_SAVE_REGION); \
04057         CALLBACK_ACTION (nr, save_region)(nr, area, image_buffer, z_buffer); \
04058         UNASSOCIATE_CALLBACK_DATA(nr); \
04059     } else \
04060         DRIVER_ACTION (nr, save_region)(nr, area, image_buffer, z_buffer); \
04061 } while (0)
04062 
04063 #define HIA_Restore_Region(nr, area, image_buffer, z_buffer) do { \
04064     if ((nr)->action_rendition->restore_region != nullroutine) { \
04065         ASSOCIATE_CALLBACK_DATA(nr, CBT_RESTORE_REGION); \
04066         CALLBACK_ACTION (nr, restore_region)(nr, area, image_buffer, z_buffer); \
04067         UNASSOCIATE_CALLBACK_DATA(nr); \
04068     } else \
04069         DRIVER_ACTION (nr, restore_region)(nr, area, image_buffer, z_buffer); \
04070 } while (0)
04071 
04072 #define HIA_Destroy_Region(nr, image_buffer, z_buffer) do { \
04073     if ((nr)->action_rendition->destroy_region != nullroutine) { \
04074         ASSOCIATE_CALLBACK_DATA(nr, CBT_DESTROY_REGION); \
04075         CALLBACK_ACTION (nr, destroy_region)(nr, image_buffer, z_buffer); \
04076         UNASSOCIATE_CALLBACK_DATA(nr); \
04077     } else \
04078         DRIVER_ACTION (nr, destroy_region)(nr, image_buffer, z_buffer); \
04079 } while (0)
04080 
04081 
04082 /* post-hlr intercepts */
04083 
04084 #define HIA_Draw_HLR_Polyline(nr, count, points) do { \
04085     if ((nr)->action_rendition->draw_hlr_polyline != nullroutine) \
04086             CALLBACK_ACTION (nr, draw_hlr_polyline)(nr, count, points); \
04087         else \
04088             DRIVER_ACTION (nr, draw_dc_polyline)(nr, count, points); \
04089 } while (0)
04090 
04091 #define HIA_Draw_HLR_Marker(nr, point, rotation, size_fixup) do { \
04092     if ((nr)->action_rendition->draw_hlr_marker != nullroutine) \
04093         CALLBACK_ACTION (nr, draw_hlr_marker)(nr, point); \
04094     else \
04095         DRIVER_ACTION (nr, draw_dc_polymarker)(nr, 1, point, rotation, size_fixup); \
04096 } while (0)
04097 
04098 #define HIA_Draw_HLR_Hidden_Polyline(nr, count, points) do { \
04099     if ((nr)->action_rendition->draw_hlr_hidden_polyline != nullroutine) \
04100         CALLBACK_ACTION (nr, draw_hlr_hidden_polyline)(nr, count, points); \
04101     else \
04102         DRIVER_ACTION (nr, draw_dc_polyline)(nr, count, points); \
04103 } while (0)
04104 
04105 #define HIA_Draw_HLR_Hidden_Marker(nr, point, rotation, size_fixup) do { \
04106     if ((nr)->action_rendition->draw_hlr_hidden_marker != nullroutine) \
04107         CALLBACK_ACTION (nr, draw_hlr_hidden_marker)(nr, point); \
04108     else \
04109         DRIVER_ACTION (nr, draw_dc_polymarker)(nr, 1, point, rotation, size_fixup); \
04110 } while (0)
04111 
04112 
04113 
04114 /* internal segment processing */
04115 
04116 #define HII_Draw_Tree(nr, tree) do if (ACTION_ACTIVE (nr, Action_Mask_DRAW_TREE)) { \
04117     DRIVER_ACTION (nr, draw_tree)(nr, tree); \
04118 } while (0)
04119 
04120 #define HII_Render(nr, gg, mm, ss) do if (ACTION_ACTIVE (nr, Action_Mask_RENDER)) { \
04121     DRIVER_ACTION (nr, render)(nr, gg, mm, ss); \
04122 } while (0)
04123 
04124 
04125 /* internal dc drawing */
04126 
04127 #define HII_Draw_Plain_Text(nr, text, position, count, kp, ki) \
04128     DRIVER_ACTION (nr, draw_plain_text)(nr, text, position, count, kp, ki)
04129 
04130 #define HII_Draw_DC_Stenciled_Quad(nr, points, stencil) \
04131     DRIVER_ACTION (nr, draw_dc_stenciled_quad)(nr, points, stencil)
04132 
04133 #define HII_Draw_DC_Dot(nr, point) \
04134     DRIVER_ACTION (nr, draw_dc_polydot)(nr, 1, point)
04135 
04136 #define HII_Draw_DC_Polydot(nr, count, point) \
04137     DRIVER_ACTION (nr, draw_dc_polydot)(nr, count, point)
04138 
04139 #define HII_Draw_DC_Colorized_Polydot(nr, count, point, color, single) \
04140     DRIVER_ACTION (nr, draw_dc_colorized_polydot)(nr, count, point, color, single)
04141 
04142 #define HII_Draw_DC_Polygon(nr, count, points) \
04143     DRIVER_ACTION (nr, draw_dc_polygon)(nr, count, points)
04144 
04145 #define HII_Draw_DC_Face(nr, count, points) \
04146     DRIVER_ACTION (nr, draw_dc_face)(nr, count, points)
04147 
04148 #define HII_Draw_DC_Ellipse(nr, where, radius) \
04149     DRIVER_ACTION (nr, draw_dc_ellipse)(nr, where, radius)
04150 
04151 #define HII_Draw_DC_Elliptical_Arc(nr, where, radius, start, end) \
04152     DRIVER_ACTION (nr, draw_dc_elliptical_arc)(nr, where, radius, start, end)
04153 
04154 #define HII_Draw_DC_Outline_Ellipse(nr, where, radius) \
04155     DRIVER_ACTION (nr, draw_dc_outline_ellipse)(nr, where, radius)
04156 
04157 #define HII_Draw_DC_Colorized_Face(nr, count, points, color) \
04158     DRIVER_ACTION (nr, draw_dc_colorized_face)(nr, count, points, color)
04159 
04160 #define HII_Draw_DC_Rectangle(nr, left, right, bottom, top) \
04161     DRIVER_ACTION (nr, draw_dc_rectangle)(nr, left, right, bottom, top)
04162 
04163 #define HII_Draw_DC_Image(nr, start, end, hoffset, format, rowbytes, rasters, pattern, contrast_color, dbi) \
04164     DRIVER_ACTION (nr, draw_dc_image)(nr, start, end, hoffset, format, rowbytes, rasters, pattern, contrast_color, dbi)
04165 
04166 #define HII_Draw_DC_Text(nr, where, count, string) \
04167     DRIVER_ACTION (nr, draw_dc_text)(nr, where, count, string)
04168 
04169 #define HII_Draw_DC_Triangle(nr, points) \
04170     DRIVER_ACTION (nr, draw_dc_polytriangle)(nr, 3, points)
04171 
04172 #define HII_Draw_DC_Colorized_Triangle(nr, points, color) \
04173     DRIVER_ACTION (nr, draw_dc_colorized_polytriangle)(nr, 3, points, color, true)
04174 
04175 #define HII_Draw_DC_Gouraud_Triangle(nr, points, colors) \
04176     DRIVER_ACTION (nr, draw_dc_gouraud_polytriangle)(nr, 3, points, colors)
04177 
04178 #define HII_Draw_DC_Reshaded_Triangle(nr, points, colors, planes, params, param_width, param_flags) \
04179     DRIVER_ACTION (nr, draw_dc_textured_polytriangle)(nr, 3, points, colors, planes, params, param_width, param_flags)
04180 
04181 #define HII_Draw_DC_Polytriangle(nr, count, points) \
04182     DRIVER_ACTION (nr, draw_dc_polytriangle)(nr, count, points)
04183 
04184 #define HII_Draw_DC_Colorized_Polytriangle(nr, count, points, color, single) \
04185     DRIVER_ACTION (nr, draw_dc_colorized_polytriangle)(nr, count, points, color, single)
04186 
04187 #define HII_Draw_DC_Gouraud_Polytriangle(nr, count, points, colors) \
04188     DRIVER_ACTION (nr, draw_dc_gouraud_polytriangle)(nr, count, points, colors)
04189 
04190 #define HII_Draw_DC_Phong_Polytriangle(nr, count, points, colors, planes) \
04191     DRIVER_ACTION (nr, draw_dc_phong_polytriangle)(nr, count, points, colors, planes)
04192 
04193 #define HII_Draw_DC_Textured_Polytriangle(nr, count, points, colors, planes, params, param_width, param_flags) \
04194     DRIVER_ACTION (nr, draw_dc_textured_polytriangle)(nr, count, points, colors, planes, params, param_width, param_flags)
04195 
04196 #define HII_Draw_DC_Marker(nr, point) \
04197     DRIVER_ACTION (nr, draw_dc_polymarker)(nr, 1, point, null, null)
04198 
04199 #define HII_Draw_DC_Polymarker(nr, count, point, rotations, size_fixups) \
04200     DRIVER_ACTION (nr, draw_dc_polymarker)(nr, count, point, rotations, size_fixups)
04201 
04202 #define HII_Draw_DC_Line(nr, points) \
04203     DRIVER_ACTION (nr, draw_dc_polyline)(nr, 2, points)
04204 
04205 #define HII_Draw_DC_Colorized_Line(nr, points, color) \
04206     DRIVER_ACTION (nr, draw_dc_colorized_polyline)(nr, 2, points, color, true)
04207 
04208 #define HII_Draw_DC_Gouraud_Line(nr, points, colors) \
04209     DRIVER_ACTION (nr, draw_dc_gouraud_polyline)(nr, 2, points, colors)
04210 
04211 #define HII_Draw_DC_Reshaded_Line(nr, points, colors, planes, params, param_width, param_flags) \
04212     DRIVER_ACTION (nr, draw_dc_textured_polyline)(nr, 2, points, colors, planes, params, param_width, param_flags)
04213 
04214 #define HII_Draw_DC_Polyline(nr, count, points) \
04215     DRIVER_ACTION (nr, draw_dc_polyline)(nr, count, points)
04216 
04217 #define HII_Draw_DC_Colorized_Polyline(nr, count, points, color, single) \
04218     DRIVER_ACTION (nr, draw_dc_colorized_polyline)(nr, count, points, color, single)
04219 
04220 #define HII_Draw_DC_Gouraud_Polyline(nr, count, points, colors) \
04221     DRIVER_ACTION (nr, draw_dc_gouraud_polyline)(nr, count, points, colors)
04222 
04223 #define HII_Draw_DC_Phong_Polyline(nr, count, points, colors, planes) \
04224     DRIVER_ACTION (nr, draw_dc_phong_polyline)(nr, count, points, colors, planes)
04225 
04226 #define HII_Draw_DC_Textured_Polyline(nr, count, points, colors, planes, params, param_width, param_flags) \
04227     DRIVER_ACTION (nr, draw_dc_textured_polyline)(nr, count, points, colors, planes, params, param_width, param_flags)
04228 
04229 
04230 /* internal 3d drawing */
04231 
04232 #define HII_Draw_3D_Ellipse(nr, ellipse) \
04233     DRIVER_ACTION (nr, draw_3d_ellipse)(nr, ellipse)
04234 
04235 #define HII_Draw_3D_Elliptical_Arc(nr, arc) \
04236     DRIVER_ACTION (nr, draw_3d_elliptical_arc)(nr, arc)
04237 
04238 #define HII_Draw_3D_NURBS_Curve(nr, curve) \
04239     DRIVER_ACTION (nr, draw_3d_nurbs_curve)(nr, curve)
04240 
04241 #define HII_Draw_3D_NURBS_Surface(nr, surface) \
04242     DRIVER_ACTION (nr, draw_3d_nurbs_surface)(nr, surface)
04243 
04244 #define HII_Draw_3D_Cylinder(nr, cylinder) \
04245     DRIVER_ACTION (nr, draw_3d_cylinder)(nr, cylinder)
04246 
04247 #define HII_Draw_3D_PolyCylinder(nr, polycylinder) \
04248     DRIVER_ACTION (nr, draw_3d_polycylinder)(nr, polycylinder)
04249 
04250 #define HII_Draw_3D_Sphere(nr, sphere) \
04251     DRIVER_ACTION (nr, draw_3d_sphere)(nr, sphere)
04252 
04253 #define HII_Draw_3D_Grid(nr, grid) \
04254     DRIVER_ACTION (nr, draw_3d_grid)(nr, grid)
04255 
04256 #define HII_Draw_3D_Image(nr, image) \
04257     DRIVER_ACTION (nr, draw_3d_image)(nr, image)
04258 
04259 #define HII_Draw_3D_Light(nr, light) \
04260     DRIVER_ACTION (nr, draw_3d_light)(nr, light)
04261 
04262 #define HII_Draw_3D_Polymarker(nr, pm) \
04263     DRIVER_ACTION (nr, draw_3d_polymarker)(nr, pm)
04264 
04265 #define HII_Draw_3D_Marker(nr, marker) \
04266     DRIVER_ACTION (nr, draw_3d_marker)(nr, marker)
04267 
04268 #define HII_Draw_3D_Polyline(nr, polyline) \
04269     DRIVER_ACTION (nr, draw_3d_polyline)(nr, polyline)
04270 
04271 #define HII_Draw_3D_Infinite_Line(nr, polyline) \
04272     DRIVER_ACTION (nr, draw_3d_infinite_line)(nr, polyline)
04273 
04274 #define HII_Draw_3D_Polygon(nr, polygon) \
04275     DRIVER_ACTION (nr, draw_3d_polygon)(nr, polygon)
04276 
04277 #define HII_Draw_3D_Text(nr, text) \
04278     DRIVER_ACTION (nr, draw_3d_text)(nr, text)
04279 
04280 #define HII_Draw_3D_Stenciled_Quad(nr, points, stencil) \
04281     DRIVER_ACTION (nr, draw_3d_stenciled_quad)(nr, points, stencil)
04282 
04283 #define HII_Draw_3D_Tristrip(nr, ts) \
04284     if ((ts)->vertex_findices != null) \
04285         DRIVER_ACTION (nr, draw_indexed_tristrip)(nr, ts); \
04286     else DRIVER_ACTION (nr, draw_3d_tristrip)(nr, ts)
04287 
04288 #define HII_Draw_3D_Polyhedron(nr, phon)                        \
04289         DRIVER_ACTION (nr, draw_3d_polyhedron)(nr, phon);           
04290 
04291 #define HII_Draw_3D_Shell(nr, phon)                     \
04292     DRIVER_ACTION (nr, draw_3d_polyhedron)(nr, phon);           
04293 
04294 #define HII_Draw_3D_Mesh(nr, phon)                      \
04295     DRIVER_ACTION (nr, draw_3d_polyhedron)(nr, phon);   
04296 
04297 #define HII_Draw_3D_Tristrip(nr, ts) \
04298     if ((ts)->vertex_findices != null) \
04299         DRIVER_ACTION (nr, draw_indexed_tristrip)(nr, ts); \
04300     else DRIVER_ACTION (nr, draw_3d_tristrip)(nr, ts)
04301 
04302 #define HII_Draw_3D_Polyedge(nr, pe) \
04303     if ((pe)->vertex_findices != null) \
04304         DRIVER_ACTION (nr, draw_indexed_polyedge)(nr, pe); \
04305     else DRIVER_ACTION (nr, draw_3d_polyedge)(nr, pe)
04306 
04307 #define HII_Draw_3D_Polyedge_From_Tristrip(nr, pe, ts) \
04308     DRIVER_ACTION (nr, draw_3d_polyedge_from_tristrip)(nr, pe, ts)
04309 
04310 
04311 /* internal raster drawing */
04312 
04313 #define HII_Draw_DC_Bit_Rasters(nr, start, end, rowbytes, rasters) \
04314     DRIVER_ACTION (nr, draw_dc_bit_rasters)(nr, start, end, rowbytes, rasters)
04315 
04316 #define HII_Draw_DC_Gray8_Rasters(nr, start, end, rowbytes, rasters) \
04317     DRIVER_ACTION (nr, draw_dc_gray8_rasters)(nr, start, end, rowbytes, rasters)
04318 
04319 #define HII_Draw_DC_Mapped8_Rasters(nr, start, end, rowbytes, rasters) \
04320     DRIVER_ACTION (nr, draw_dc_mapped8_rasters)(nr, start, end, rowbytes, rasters)
04321 
04322 #define HII_Draw_DC_Mapped16_Rasters(nr, start, end, rowbytes, rasters) \
04323     DRIVER_ACTION (nr, draw_dc_mapped16_rasters)(nr, start, end, rowbytes, rasters)
04324 
04325 #define HII_Draw_DC_RGB32_Rasters(nr, start, end, rowbytes, rasters) \
04326     DRIVER_ACTION (nr, draw_dc_rgb32_rasters)(nr, start, end, rowbytes, rasters)    
04327 
04328 /* internal span routines */
04329 
04330 #define HII_Draw_DC_Spans(nr, sr, spans, num_spans, top) \
04331     DRIVER_ACTION (nr, draw_dc_spans)(nr, sr, spans, num_spans, top)
04332 
04333 #define HII_Draw_DC_Colorized_Spans(nr, sr, spans, num_spans, top) \
04334     DRIVER_ACTION (nr, draw_dc_colorized_spans)(nr, sr, spans, num_spans, top)
04335 
04336 #define HII_Draw_DC_Gouraud_Spans(nr, sr, spans, num_spans, top) \
04337     DRIVER_ACTION (nr, draw_dc_gouraud_spans)(nr, sr, spans, num_spans, top)
04338 
04339 #define HII_Draw_DC_Reshaded_Spans(nr, sr, spans, num_spans, top, param_flags) \
04340     DRIVER_ACTION (nr, draw_dc_reshaded_spans)(nr, sr, spans, num_spans, top, param_flags)
04341 
04342 /* internal shading */
04343 
04344 #define HII_Compute_Shading(nr, lir, material, location, color, plane, aligner, params, param_width, param_flags, result, specular_result) \
04345     DRIVER_ACTION (nr, compute_shading)(nr, lir, material, location, color, plane, aligner, params, param_width, param_flags, result, specular_result)
04346 
04347 /* buffer activity */
04348 
04349 #define HII_Create_Frame_Buffer(nr, width, height, format, image, driver_specific) \
04350     DRIVER_ACTION (nr, create_frame_buffer) (nr, width, height, format, image, driver_specific)
04351 
04352 #define HII_Display_Frame_Buffer(nr, start, end, image, hoffset, voffset, driver_specific) \
04353     DRIVER_ACTION (nr, display_frame_buffer) (nr, start, end, image, hoffset, voffset, driver_specific)
04354 
04355 #define HII_Destroy_Frame_Buffer(nr, image, driver_specific) \
04356     DRIVER_ACTION (nr, destroy_frame_buffer) (nr, image, driver_specific)
04357 
04358 /* occlusion query */
04359 
04360 #define HII_Begin_Occlusion_Query(nr, disable_write)  \
04361     ((nr)->display_context->actions.begin_occlusion_query) ? \
04362         DRIVER_ACTION (nr, begin_occlusion_query)(nr, disable_write) : (void *)null
04363 
04364 #define HII_End_Occlusion_Query(nr, vid)  \
04365     ((nr)->display_context->actions.end_occlusion_query) ? \
04366         DRIVER_ACTION (nr, end_occlusion_query)(nr, (vid)) : (void)(nr)
04367 
04368 #define HII_Get_Occlusion_Query(nr, vid)  \
04369     (((nr)->display_context->actions.get_occlusion_query) ? \
04370         DRIVER_ACTION (nr, get_occlusion_query)(nr, vid) : 0)
04371 
04372 #define HII_Delete_Occlusion_Query(nr, vid)  \
04373     ((nr)->display_context->actions.delete_occlusion_query) ? \
04374         DRIVER_ACTION (nr, delete_occlusion_query)(nr, vid) : (void)(nr)
04375 
04376 #define HII_Occlusion_Query_Available(nr)  \
04377     ((nr)->display_context->actions.begin_occlusion_query) ? true : false 
04378  
04379 
04380 /* depth peeling */
04381 
04382 #define HII_Depth_Peeling(dc)  \
04383     (*(dc)->actions.depth_peeling)(dc)
04384 
04385 
04386 /* segment [tree] display lists */
04387 
04388 #define HII_Begin_Display_List(nr, dl, mm, compile_only)  \
04389     (((nr)->display_context->actions.begin_display_list) ? \
04390         DRIVER_ACTION (nr, begin_display_list)(nr, dl, mm, compile_only) : (void)0)
04391 
04392 #define HII_Check_Display_List(nr, dl, mm)  \
04393     (((nr)->display_context->actions.check_display_list) ? \
04394         DRIVER_ACTION (nr, check_display_list)(nr, dl, mm) : (void)0)
04395 
04396 #define HII_End_Display_List(nr, dl, compile_only)  \
04397     (((nr)->display_context->actions.end_display_list) ? \
04398         DRIVER_ACTION (nr, end_display_list)(nr, dl, compile_only) : (void)0)
04399 
04400 /* except for deferred geometry (e.g. depth peeling), execute is normally 
04401  * implicit as part of begin/end */
04402 #define HII_Execute_Display_List(nr, dl)  \
04403     (((nr)->display_context->actions.execute_display_list) ? \
04404         DRIVER_ACTION (nr, execute_display_list)(nr, dl) : (void)0)
04405 
04406 
04407 /* color bashing */
04408 
04409 #define HII_Bash_Text_Color(nr, rgb) \
04410     SEMI_PROTECT (\
04411         HT_Net_Rendition alter      *_wnr_; \
04412         HT_Text_Rendition alter     *_xr_; \
04413         HT_Material_Rendition alter *_mat_; \
04414         _wnr_ = HD_Push_Text_Rendition (nr); \
04415         _xr_ = (HT_Text_Rendition alter *)_wnr_->text_rendition; \
04416         HD_Figure_Driver_Color (nr, (rgb), &_xr_->color); \
04417         _mat_ = (HT_Material_Rendition alter *) _xr_->material_rendition; \
04418         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04419 
04420 #define HII_Bash_Text_Contrast_Color(nr, rgb) \
04421     SEMI_PROTECT (\
04422         HT_Net_Rendition alter      *_wnr_; \
04423         HT_Text_Rendition alter     *_xr_; \
04424         _wnr_ = HD_Push_Text_Rendition (nr); \
04425         _xr_ = (HT_Text_Rendition alter *)_wnr_->text_rendition; \
04426         HD_Figure_Driver_Color (nr, (rgb), &_xr_->contrast_color);)
04427 
04428 
04429 #define HII_Bash_Line_Color(nr, rgb) \
04430     SEMI_PROTECT (\
04431         HT_Net_Rendition alter  *_wnr_; \
04432         HT_Line_Rendition alter *_lr_; \
04433         HT_Material_Rendition alter *_mat_; \
04434         _wnr_ = HD_Push_Line_Rendition (nr); \
04435         _lr_ = (HT_Line_Rendition alter *)_wnr_->line_rendition; \
04436         HD_Figure_Driver_Color (nr, (rgb), &_lr_->color); \
04437         _mat_ = (HT_Material_Rendition alter *) _lr_->material_rendition; \
04438         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04439 
04440 #define HII_Bash_Line_Contrast_Color(nr, rgb) \
04441     SEMI_PROTECT (\
04442         HT_Net_Rendition alter  *_wnr_; \
04443         HT_Line_Rendition alter *_lr_; \
04444         _wnr_ = HD_Push_Line_Rendition (nr); \
04445         _lr_ = (HT_Line_Rendition alter *)_wnr_->line_rendition; \
04446         HD_Figure_Driver_Color (nr, (rgb), &_lr_->contrast_color);)
04447 
04448 #define HII_Bash_Marker_Color(nr, rgb) \
04449     SEMI_PROTECT (\
04450         HT_Net_Rendition alter  *_wnr_; \
04451         HT_Marker_Rendition alter *_kr_; \
04452         HT_Material_Rendition alter *_mat_; \
04453         _wnr_ = HD_Push_Marker_Rendition (nr); \
04454         _kr_ = (HT_Marker_Rendition alter *)_wnr_->marker_rendition; \
04455         HD_Figure_Driver_Color (nr, (rgb), &_kr_->color); \
04456         _mat_ = (HT_Material_Rendition alter *) _kr_->material_rendition; \
04457         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04458 
04459 #define HII_Bash_Marker_Contrast_Color(nr, rgb) \
04460     SEMI_PROTECT (\
04461         HT_Net_Rendition alter  *_wnr_; \
04462         HT_Marker_Rendition alter *_kr_; \
04463         _wnr_ = HD_Push_Marker_Rendition (nr); \
04464         _kr_ = (HT_Marker_Rendition alter *)_wnr_->marker_rendition; \
04465         HD_Figure_Driver_Color (nr, (rgb), &_kr_->contrast_color);)
04466 
04467 #define HII_Bash_Vertex_Color(nr, rgb) \
04468     SEMI_PROTECT (\
04469         HT_Net_Rendition alter  *_wnr_; \
04470         HT_Marker_Rendition alter *_kr_; \
04471         HT_Material_Rendition alter *_mat_; \
04472         _wnr_ = HD_Push_Vertex_Rendition (nr); \
04473         _kr_ = (HT_Marker_Rendition alter *)_wnr_->vertex_rendition; \
04474         HD_Figure_Driver_Color (nr, (rgb), &_kr_->color); \
04475         _mat_ = (HT_Material_Rendition alter *) _kr_->material_rendition; \
04476         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04477 
04478 #define HII_Bash_Vertex_Contrast_Color(nr, rgb) \
04479     SEMI_PROTECT (\
04480         HT_Net_Rendition alter  *_wnr_; \
04481         HT_Marker_Rendition alter *_kr_; \
04482         _wnr_ = HD_Push_Vertex_Rendition (nr); \
04483         _kr_ = (HT_Marker_Rendition alter *)_wnr_->vertex_rendition; \
04484         HD_Figure_Driver_Color (nr, (rgb), &_kr_->contrast_color); )
04485 
04486 #define HII_Bash_Face_Color(nr, rgb) \
04487     SEMI_PROTECT (\
04488         HT_Net_Rendition alter  *_wnr_; \
04489         HT_Face_Rendition alter *_fr_; \
04490         HT_Material_Rendition alter *_mat_; \
04491         _wnr_ = HD_Push_Face_Rendition (nr); \
04492         _fr_ = (HT_Face_Rendition alter *)_wnr_->face_rendition; \
04493         HD_Figure_Driver_Color (nr, (rgb), &_fr_->color); \
04494         _mat_ = (HT_Material_Rendition alter *) _fr_->material_rendition; \
04495         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04496 
04497 #define HII_Bash_Face_Contrast_Color(nr, rgb) \
04498     SEMI_PROTECT (\
04499         HT_Net_Rendition alter  *_wnr_; \
04500         HT_Face_Rendition alter *_fr_; \
04501         _wnr_ = HD_Push_Face_Rendition (nr); \
04502         _fr_ = (HT_Face_Rendition alter *)_wnr_->face_rendition; \
04503         HD_Figure_Driver_Color (nr, (rgb), &_fr_->contrast_color);)
04504 
04505 #define HII_Bash_Face_Back_Color(nr, rgb) \
04506     SEMI_PROTECT (\
04507         HT_Net_Rendition alter  *_wnr_; \
04508         HT_Face_Rendition alter *_fr_; \
04509         HT_Material_Rendition alter *_mat_; \
04510         _wnr_ = HD_Push_Face_Rendition (nr); \
04511         _fr_ = (HT_Face_Rendition alter *)_wnr_->face_rendition; \
04512         HD_Figure_Driver_Color (nr, (rgb), &_fr_->back_color); \
04513         _mat_ = (HT_Material_Rendition alter *) _fr_->back_material_rendition; \
04514         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04515 
04516 #define HII_Bash_Simple_Reflection_Face_Color(nr, rgb) \
04517     SEMI_PROTECT (\
04518         HT_Net_Rendition alter  *_wnr_; \
04519         HT_Face_Rendition alter *_fr_; \
04520         HT_Material_Rendition alter *_mat_; \
04521         _wnr_ = HD_Push_Simple_Reflection_Face_Rendition (nr); \
04522         _fr_ = (HT_Face_Rendition alter *)_wnr_->simple_reflection_face_rendition; \
04523         HD_Figure_Driver_Color (nr, (rgb), &_fr_->color); \
04524         _mat_ = (HT_Material_Rendition alter *) _fr_->material_rendition; \
04525         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04526 
04527 #define HII_Bash_Cut_Face_Color(nr, rgb) \
04528     SEMI_PROTECT (\
04529         HT_Net_Rendition alter  *_wnr_; \
04530         HT_Face_Rendition alter *_fr_; \
04531         HT_Material_Rendition alter *_mat_; \
04532         _wnr_ = HD_Push_Cut_Face_Rendition (nr); \
04533         _fr_ = (HT_Face_Rendition alter *)_wnr_->cut_face_rendition; \
04534         HD_Figure_Driver_Color (nr, (rgb), &_fr_->color); \
04535         _mat_ = (HT_Material_Rendition alter *) _fr_->material_rendition; \
04536         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04537 
04538 #define HII_Bash_Face_Mirror_Color(nr, rgb) \
04539     SEMI_PROTECT (\
04540         HT_Net_Rendition alter  *_wnr_; \
04541         HT_Face_Rendition alter *_fr_; \
04542         HT_Material_Rendition alter *_mat_; \
04543         _wnr_ = HD_Push_Face_Rendition (nr); \
04544         _fr_ = (HT_Face_Rendition alter *)_wnr_->face_rendition; \
04545         HD_Figure_Driver_Color (nr, (rgb), &_fr_->color); \
04546         _mat_ = (HT_Material_Rendition alter *) _fr_->material_rendition; \
04547         COPY_RGB(*(rgb), _mat_->color[MAT_MIRROR]);)
04548 
04549 
04550 #define HII_Bash_Edge_Color(nr, rgb) \
04551     SEMI_PROTECT (\
04552         HT_Net_Rendition alter  *_wnr_; \
04553         HT_Line_Rendition alter *_lr_; \
04554         HT_Material_Rendition alter *_mat_; \
04555         _wnr_ = HD_Push_Edge_Rendition (nr); \
04556         _lr_ = (HT_Line_Rendition alter *)_wnr_->edge_rendition; \
04557         HD_Figure_Driver_Color (nr, (rgb), &_lr_->color); \
04558         _mat_ = (HT_Material_Rendition alter *) _lr_->material_rendition; \
04559         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04560 
04561 #define HII_Bash_Edge_Contrast_Color(nr, rgb) \
04562     SEMI_PROTECT (\
04563         HT_Net_Rendition alter  *_wnr_; \
04564         HT_Line_Rendition alter *_lr_; \
04565         _wnr_ = HD_Push_Edge_Rendition (nr); \
04566         _lr_ = (HT_Line_Rendition alter *)_wnr_->edge_rendition; \
04567         HD_Figure_Driver_Color (nr, (rgb), &_lr_->contrast_color);)
04568 
04569 #define HII_Bash_Cut_Edge_Color(nr, rgb) \
04570     SEMI_PROTECT (\
04571         HT_Net_Rendition alter  *_wnr_; \
04572         HT_Line_Rendition alter *_lr_; \
04573         HT_Material_Rendition alter *_mat_; \
04574         _wnr_ = HD_Push_Cut_Edge_Rendition (nr); \
04575         _lr_ = (HT_Line_Rendition alter *)_wnr_->cut_edge_rendition; \
04576         HD_Figure_Driver_Color (nr, (rgb), &_lr_->color); \
04577         _mat_ = (HT_Material_Rendition alter *) _lr_->material_rendition; \
04578         COPY_RGB(*(rgb), _mat_->diffuse_color);)
04579 
04580 
04581 /* base_ambient ??? */
04582 #define HII_Bash_Ambient_Color(nr, rgb) \
04583     SEMI_PROTECT (\
04584         HT_Net_Rendition alter  *_wnr_; \
04585         HT_Misc_Rendition alter *_mr_; \
04586         _wnr_ = HD_Push_Misc_Rendition (nr); \
04587         _mr_ = (HT_Misc_Rendition alter *)(nr)->misc_rendition; \
04588         COPY_RGB(*(rgb), _mr_->ambient);)
04589 
04590 
04591 /* param matr is a material rendition
04592    returns true if there is anything about the material rendition that should 
04593    trigger transparency deferral */
04594 #define HAS_TRANSPARENCY(matr) \
04595     ((matr)->opacity != 1.0f || \
04596      (matr)->diffuse_textures && \
04597      BIT ((matr)->diffuse_textures->texture->flags, TF_TRANSPARENCY) && \
04598      !BIT ((matr)->diffuse_textures->texture->bool_flags, TBF_DECAL))
04599 
04600 #define DRIVER_DEFINED
04601 #endif
Main Index
HOOPS/3dGS I.M. Interface

     << Back      Full Index      Forward >>