HOOPS/3dGS I.M. Interface

     << Back      Full Index      Forward >>


hidden.h

00001 /*
00002  * Copyright (c) 1998 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: hidden_8h-source.html,v 1.29 2008-03-10 07:09:28 stage Exp $
00013  */
00014 
00015 #ifndef HIDDEN_DEFINED
00016 
00017 #ifndef DATABASE_DEFINED    
00018 #include "database.h"
00019 #endif
00020 
00021 #define PIXEL_ERR               0.2f    /* The basic fudge factor */
00022 
00023 
00024 typedef short HT_Hidden_Flags;
00025 #define HF_NONE                         (HT_Hidden_Flags)0x0000
00026 #define HF_SLABBED                      (HT_Hidden_Flags)0x0001
00027 #define HF_CHOPPED_START                (HT_Hidden_Flags)0x0002
00028 #define HF_CHOPPED_END                  (HT_Hidden_Flags)0x0004
00029 #define HF_CHOPPED_MIDDLE               (HT_Hidden_Flags)0x0008
00030 #define HF_CHOPPED_ANY                  (HF_CHOPPED_START|HF_CHOPPED_MIDDLE|HF_CHOPPED_END)
00031 #define HF_CHOPPED_NEAR_START           (HT_Hidden_Flags)0x0020
00032 #define HF_CHOPPED_NEAR_END             (HT_Hidden_Flags)0x0040
00033 
00034 #define SLABBED_SIZE(s_item, s_count) \
00035     ((((s_item) + (1<<ALIGNMENT) - 1) & ~((1<<ALIGNMENT) - 1))*s_count)
00036 
00037 #define SLABBED_ADVANCE(s_data, s_item) \
00038     ((s_data)+=SLABBED_SIZE((s_item), 1))
00039 
00040 struct HT_Hidden_Slab {
00041 
00042     unsigned char               *data;
00043     HT_Hidden_Slab              *next;
00044     HT_Hidden_Slab              *prev;
00045     int                         size;   
00046     HT_Reference_Count          refcount;
00047 };
00048 
00049 struct HT_Hidden_Payload {
00050 
00051     HT_Hidden_Payload           *next;
00052     HT_Net_Rendition const      *net_rendition;     /* for this geometry */
00053     HT_Extra_Info alter         *extra_info;        /* if relevant */
00054     HT_DC_Point alter           *points;            /* null for unusual items */    
00055     HT_Hidden_Slab              *slab;
00056 
00057     HT_Plane                    plane;          /* plane equation (screen space) */
00058 
00059     float                       zmin, zmax;     
00060     float                       xmin, xmax;         
00061     float                       ymin, ymax;     
00062 
00063     int                         count;          /* number of points */
00064     short                       type;           /* of the geometry */
00065     HT_Reference_Count          refcount;
00066 
00067 };
00068 
00069 
00070 struct HT_Hidden {
00071 
00072     HT_Hidden alter                 *next, *prev, *should_follow;
00073     HT_Hidden_Payload alter         *payload;
00074     HT_Integer32                    values; /* used for priority cull pixels and should_follow at different times */
00075     HT_Hidden_Flags                 flags;          
00076 };
00077 
00078 
00079 /* given an HT_Tristrip, this structure contains the necessary information
00080    to address an individual triangle within it */
00081 struct HT_Triangle_Within_Tristrip {
00082     /* index of the substrip that this triangle comes from.  0 <= which_strip < ts->strips */
00083     unsigned short  which_strip;        
00084     /* offset from substrip's first vertex index to triangle's first index.  0 <= strip_offset < ts->lengths[which_strip] */
00085     unsigned short  strip_offset;       
00086     /* offset from vertex_indices to substrip's first vertex index.  0 <= strip_start < ts->total */
00087     int     strip_start;        
00088 };
00089 
00090 
00091 
00092 typedef short HT_Hidden_Tristrip_Flags;
00093 #define HTS_NONE                    (HT_Hidden_Tristrip_Flags)0x0000
00094 #define HTS_NEED_WORLD_POINTS       (HT_Hidden_Tristrip_Flags)0x0001  
00095 #define HTS_INCOMPATIBLE            (HT_Hidden_Tristrip_Flags)0x0002  
00096 #define HTS_ENVIRONMENT_MAP         (HT_Hidden_Tristrip_Flags)0x0004  
00097 
00098 struct HT_Hidden_Tristrip {
00099 
00100     HT_Net_Rendition const          *net_rendition;     /* for this geometry */
00101     HT_Net_Rendition const          *back_nr;   
00102     HT_Tristrip const               *tristrips;
00103     float                           *zvals;
00104     HT_Triangle_Within_Tristrip     *triangles;
00105     HT_RGBAS32                      *lit_colors;    /* allocated to size 2*max_count */
00106     HT_Parameter                    *params;
00107     int                             *facings;   
00108     
00109     float                           next_z;         /* Only for hidden tristrip */  
00110     HT_Integer32                    interpolation_case;
00111     int                             max_count;      /* face_count or point count, whichever is greater */
00112     int                             triangle_count;
00113     int                             next_to_draw;
00114     HT_Hidden_Tristrip_Flags        flags;          
00115 };
00116 
00117 
00118 struct HT_Hidden_Tristrip_Heap {
00119     HT_Hidden_Tristrip          **data; 
00120     int                         allocated;
00121     int                         used;
00122 };
00123 
00124 
00125 #define HIDDEN_CACHE_BATCH 1024
00126 
00127 typedef short HT_Hidden_Cache_Flags;
00128 #define HCF_UNIFORM_RGBA_MULTIPLE    (HT_Hidden_Cache_Flags)0x0001
00129 
00130 struct HT_Hidden_Cache {
00131     HT_Net_Rendition const      *nr;
00132 
00133     HT_DC_Point alter           *points;
00134     HT_RGBAS32 alter            *rgbas;
00135     HT_RGBA alter               *rgba_colors;
00136     HT_Plane alter              *planes;
00137     HT_Parameter alter          *params;
00138 
00139     HT_Integer32                param_flags;
00140     HT_Integer32                param_width;
00141     HT_Info_Contents            info_contents; 
00142     HT_Integer32                interpolation_case;
00143 
00144     int                         used;
00145     int                         allocated_param_width;
00146 
00147     HT_Hidden_Cache_Flags       flags;
00148 
00149 };
00150 
00151 
00152 
00153 
00154 struct HT_Cut_Polygon_Edge_Info {
00155     bool                        *edge_to_here;
00156 };
00157 
00158 struct HT_Interpolated_Info {
00159     HT_RGBAS32 alter            *rgbas;
00160     HT_RGBA alter               *rgba_colors;
00161     HT_Plane alter              *planes;
00162     HT_Parameter alter          *params;
00163     HT_Integer32                param_width;
00164     HT_Integer32                param_flags;
00165     HT_Info_Contents            contents; /* last because size may break alignment */
00166 };
00167 
00168 struct HT_Hidden_Text_Info {
00169     HT_Text const               *text;  
00170     HT_KName                    kname;
00171     float                       current_Aheight;
00172     float                       current_Aheight_fixup;
00173 };
00174 
00175 struct HT_Image_Info {
00176     void const                  * const *rasters;   
00177     HT_Driver_Color const *contrast_color;  
00178     HT_Image const              *db_image;  
00179     int                         hoffset;
00180     HT_Image_Format             format;
00181     int                         row_bytes;
00182     int                         pattern;
00183     int                         utility;
00184 };
00185 
00186 struct HT_Stencil_Info {
00187     HT_Stencil_Bitmap           *stencil;
00188     int                         utility;
00189 };
00190 
00191 
00192 struct HT_Inclusion_Info {
00193     HT_Hidden alter             *root;
00194     HT_Hidden alter             *previous;
00195     int                         count;
00196 };
00197 
00198 
00199 
00200 union HT_Extra_Info {
00201     HT_Interpolated_Info        interpolated_info;
00202     HT_Cut_Polygon_Edge_Info    cut_polygon_edge_info;
00203     HT_Image_Info               image_info;
00204     HT_Stencil_Info             stencil_info;
00205     HT_Hidden_Text_Info         text_info;
00206     HT_Inclusion_Info           inclusion_info;
00207 };
00208 
00209 
00210 
00211 /*
00212  * this ordering is important! - Find Next To Draw & All In Back use it
00213  * to decide who should be in front when everything else is equal.
00214  */
00215 #define HIDDEN_TRIANGLE                 (char)1
00216 #define HIDDEN_FACE                     (char)2
00217 #define HIDDEN_POLYGON                  (char)3
00218 #define HIDDEN_CUT_POLYGON              (char)4
00219 #define HIDDEN_POLYGONAL_TYPE(type)     ((char)(type) <= (char)HIDDEN_CUT_POLYGON)
00220 #define HIDDEN_LINE                     (char)5
00221 #define HIDDEN_POLYGLINAL_TYPE(type)    ((char)(type) <= (char)HIDDEN_LINE)
00222 #define HIDDEN_IMAGE                    (char)6
00223 #define HIDDEN_MARKER                   (char)7
00224 #define HIDDEN_DC_QUAD                  (char)8
00225 #define HIDDEN_TEXT                     (char)9
00226 #define HIDDEN_DOT                      (char)10
00227 #define HIDDEN_TRISTRIP                 (char)11
00228 
00229 /* only for Priority */
00230 #define HIDDEN_INCLUSION                (char)12
00231 
00232 #define FORWARD_FACING(hidden)  (!HIDDEN_POLYGLINAL_TYPE((hidden)->payload->type))
00233 
00234 struct HT_Line_Equation {
00235     float               x0, y0, z0, xd, yd, zd;
00236 };
00237 
00238 struct HT_Half_Plane {
00239     HT_DC_Point alter       *start;             /* start point of edge */
00240     HT_DC_Point alter       *end;
00241     float                   x, y, z;    /* intersection point on plane */
00242     float                   t;          /* of intersection point with respect to
00243                                            planes' intersection line equation */
00244     HT_Line_Equation        equation;   /* edge equation */
00245 };
00246 
00247 struct HT_Half_Plane_Pair {
00248     HT_Half_Plane       tlow_hplane,   /* half plane with poly towards +"t" */
00249                         thigh_hplane;  /* half plane with poly towards -"t" */
00250     bool                nonsimple;     /* true if more than 2 crossings found */
00251 };
00252 
00253 struct HT_Cutting_Info {
00254     HT_Half_Plane_Pair  poly0,
00255                         poly1;
00256     HT_Line_Equation    planei;         /* planes' intersection */
00257 };
00258 
00259 
00260 #define HIDDEN_DEFINED
00261 #endif
Main Index
HOOPS/3dGS I.M. Interface

     << Back      Full Index      Forward >>