Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

vp_compAC00G.c

Go to the documentation of this file.
00001 /*
00002  * DO NOT EDIT THIS FILE! It was created automatically by m4.
00003  */
00004 
00005 /*
00006  * Copyright (c) 1994 The Board of Trustees of The Leland Stanford
00007  * Junior University.  All rights reserved.
00008  * 
00009  * Permission to use, copy, modify and distribute this software and its
00010  * documentation for any purpose is hereby granted without fee, provided
00011  * that the above copyright notice and this permission notice appear in
00012  * all copies of this software and that you do not sell the software.
00013  * Commercial licensing is available by contacting the author.
00014  * 
00015  * THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
00016  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
00017  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00018  * 
00019  * Author:
00020  *    Phil Lacroute
00021  *    Computer Systems Laboratory
00022  *    Electrical Engineering Dept.
00023  *    Stanford University
00024  */
00025 /*
00026  * vp_compA.m4
00027  *
00028  * Compositing routine for affine viewing transformations.
00029  *
00030  * Copyright (c) 1994 The Board of Trustees of The Leland Stanford
00031  * Junior University.  All rights reserved.
00032  *
00033  * Permission to use, copy, modify and distribute this software and its
00034  * documentation for any purpose is hereby granted without fee, provided
00035  * that the above copyright notice and this permission notice appear in
00036  * all copies of this software and that you do not sell the software.
00037  * Commercial licensing is available by contacting the author.
00038  * 
00039  * THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
00040  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
00041  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00042  *
00043  * Author:
00044  *    Phil Lacroute
00045  *    Computer Systems Laboratory
00046  *    Electrical Engineering Dept.
00047  *    Stanford University
00048  */
00049 
00050 /*
00051  * $Date: 2001/12/17 16:16:20 $
00052  * $Revision: 1.1 $
00053  */
00054 
00055 #include "vp_global.h"
00056 
00057 
00058 
00059     
00060     
00061     
00062     
00063     
00064 
00065     
00066     
00067     
00068     
00069 #define COMPUTE_SHADOW_BUFFER
00070     
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 #define MULTIPLE_MATERIALS
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 
00122     
00123     
00124     
00125     
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 #define RLEVOLUME
00134         
00135         
00136         
00137         
00138         
00139         
00140         
00141 
00142 
00143 
00144 
00145 #undef INDEX_VOLUME
00146 
00147 
00148 
00149     
00150     
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 /* codes indicating the types of a pair of runs in adjacent scanlines */
00160 #define ALL_ZERO        0       /* both runs are runs of zeros */
00161 #define TOP_NONZERO     1       /* run for top scanline has nonzero data */
00162 #define BOT_NONZERO     2       /* run for bottom scanline has nonzero data */
00163 #define ALL_NONZERO     3       /* both runs have nonzero data */
00164 
00165 /* codes indicating the types for the current left and right voxel pairs */
00166 #define ALL_ZERO__ALL_ZERO              ((ALL_ZERO << 2) | ALL_ZERO)
00167 #define ALL_ZERO__TOP_NONZERO           ((ALL_ZERO << 2) | TOP_NONZERO)
00168 #define ALL_ZERO__BOT_NONZERO           ((ALL_ZERO << 2) | BOT_NONZERO)
00169 #define ALL_ZERO__ALL_NONZERO           ((ALL_ZERO << 2) | ALL_NONZERO)
00170 #define TOP_NONZERO__ALL_ZERO           ((TOP_NONZERO << 2) | ALL_ZERO)
00171 #define TOP_NONZERO__TOP_NONZERO        ((TOP_NONZERO << 2) | TOP_NONZERO)
00172 #define TOP_NONZERO__BOT_NONZERO        ((TOP_NONZERO << 2) | BOT_NONZERO)
00173 #define TOP_NONZERO__ALL_NONZERO        ((TOP_NONZERO << 2) | ALL_NONZERO)
00174 #define BOT_NONZERO__ALL_ZERO           ((BOT_NONZERO << 2) | ALL_ZERO)
00175 #define BOT_NONZERO__TOP_NONZERO        ((BOT_NONZERO << 2) | TOP_NONZERO)
00176 #define BOT_NONZERO__BOT_NONZERO        ((BOT_NONZERO << 2) | BOT_NONZERO)
00177 #define BOT_NONZERO__ALL_NONZERO        ((BOT_NONZERO << 2) | ALL_NONZERO)
00178 #define ALL_NONZERO__ALL_ZERO           ((ALL_NONZERO << 2) | ALL_ZERO)
00179 #define ALL_NONZERO__TOP_NONZERO        ((ALL_NONZERO << 2) | TOP_NONZERO)
00180 #define ALL_NONZERO__BOT_NONZERO        ((ALL_NONZERO << 2) | BOT_NONZERO)
00181 #define ALL_NONZERO__ALL_NONZERO        ((ALL_NONZERO << 2) | ALL_NONZERO)
00182 
00183 #ifdef SKIP_ERT
00184 #define PIXEL_IS_OPAQUE(ipixel) 0
00185 #else
00186 #define PIXEL_IS_OPAQUE(ipixel) ((ipixel)->lnk != 0)
00187 #endif
00188 
00189 #ifdef STATISTICS
00190 extern int vpResampleCount;
00191 extern int vpCompositeCount;
00192 extern int vpERTSkipCount;
00193 extern int vpERTSkipAgainCount;
00194 extern int vpERTUpdateCount;
00195 extern int vpSpecialZeroSkipCount;
00196 extern int vpRunFragmentCount;
00197 #define COUNT_RESAMPLE          vpResampleCount++
00198 #define COUNT_COMPOSITE         vpCompositeCount++
00199 #define COUNT_ERT_SKIP          vpERTSkipCount++
00200 #define COUNT_ERT_SKIP_AGAIN    vpERTSkipAgainCount++
00201 #define COUNT_ERT_UPDATE        vpERTUpdateCount++
00202 #define COUNT_SPECIAL_ZERO_SKIP vpSpecialZeroSkipCount++
00203 #define COUNT_RUN_FRAGMENT      vpRunFragmentCount++
00204 #else
00205 #define COUNT_RESAMPLE
00206 #define COUNT_COMPOSITE
00207 #define COUNT_ERT_SKIP
00208 #define COUNT_ERT_SKIP_AGAIN
00209 #define COUNT_ERT_UPDATE
00210 #define COUNT_SPECIAL_ZERO_SKIP
00211 #define COUNT_RUN_FRAGMENT
00212 #endif /* STATISTICS */
00213 
00214 /*
00215  * VPCompAC00G
00216  *
00217  * Compositing routine for run-length encoded volume data slices.
00218  * Decode and resample one slice of volume data, and composite
00219  * it into the intermediate image.  The resampling filter is a bilirp.
00220  */
00221 
00222 void
00223 VPCompAC00G (vpc, icount, jcount, k, slice_depth_cueing_dbl, intimage,
00224           weightTLdbl, weightBLdbl, weightTRdbl, weightBRdbl,
00225           run_lengths, voxel_data )
00226 vpContext *vpc;                 /* context */
00227 int icount;                     /* slice size */
00228 int jcount;
00229 int k;                          /* slice number */
00230 double slice_depth_cueing_dbl;  /* depth cueing factor for slice */
00231 GrayIntPixel *intimage;         /* intermediate image pixels */
00232 double weightTLdbl;             /* resampling weights */
00233 double weightBLdbl;
00234 double weightTRdbl;
00235 double weightBRdbl;
00236 
00237                 unsigned char *run_lengths;     /* run lengths for slice */
00238                 void *voxel_data;               /* voxel data for slice */
00239 
00240 {
00241     int i, j;                   /* voxel index in rotated object space */
00242     GrayIntPixel *ipixel;       /* current intermediate image pixel */
00243     GrayIntPixel *ipixel2;      /* another intermediate image pixel */
00244     int update_interval;        /* # of pixels to skip when updating links */
00245     float iopc;                 /* intermediate pixel opacity (0-1) */
00246     float iopc_inv;             /* 1-iopc */
00247     float acc_opc;              /* accumulator for resampled voxel opacity */
00248     float top_opc, bot_opc;     /* voxel opacity (top and bottom scanlines) */
00249 #ifdef NO_REUSE_VOXEL
00250 #define voxels_loaded   0
00251 #define CLEAR_VOXELS_LOADED
00252 #define SET_VOXELS_LOADED
00253 #else
00254     int voxels_loaded;          /* if true, top/bot_opc contain valid
00255                                    data loaded during the last resample */
00256 #define CLEAR_VOXELS_LOADED     voxels_loaded = 0
00257 #define SET_VOXELS_LOADED       voxels_loaded = 1
00258 #endif
00259     float wgtTL, wgtBL,         /* weights in the range 0..1 which give the */
00260           wgtTR, wgtBR;         /*   fractional contribution of the */
00261                                 /*   neighboring voxels to the current */
00262                                 /*   intermediate image pixel */
00263     unsigned char *topRLElen;   /* length of current run in top scanline */
00264     unsigned char *botRLElen;   /* length of current run in bottom scanline */
00265     char *topRLEdata;           /* data for current run in top scanline */
00266     char *botRLEdata;           /* data for current run in bottom scanline */
00267     int toprun_count;           /* number of voxels left in top run */
00268     int botrun_count;           /* number of voxels left in bottom run */
00269     int last_run_state;         /* run state code for last resample */
00270     int run_state;              /* run state code for this resample */
00271     int final_run_state;        /* run state code for end of scanline */
00272     float min_opacity;          /* low opacity threshold */
00273     float max_opacity;          /* high opacity threshold */
00274     float slice_depth_cueing;   /* depth cueing factor for slice */
00275     float *opac_correct;        /* opacity correction table */
00276     int ert_skip_count;         /* number of pixels to skip for ERT */
00277     int intermediate_width;     /* width of intermediate image in pixels */
00278     int count;                  /* voxels left in current run */
00279     float *shade_table;         /* shade lookup table */
00280     int norm_offset;            /* byte offset to shade table index in voxel */
00281     int shade_index;            /* shade index */
00282     float shade_factor;         /* attenuation factor for color
00283                                    (voxel opacity * depth cueing) */
00284 
00285 #ifdef MULTIPLE_MATERIALS
00286     float *weight_table;        /* weight lookup table */
00287     int wgt_offset;             /* byte offset to weight table index */
00288     int weight_index;           /* weight index */
00289     int m, num_materials;
00290     float weight1, weight2;
00291 #endif /* MULTIPLE_MATERIALS */
00292 
00293 #ifdef GRAYSCALE
00294     float acc_clr;              /* accumulator for resampled color */
00295     float top_clr, bot_clr;     /* voxel color (top and bottom scanlines) */
00296 #endif /* GRAYSCALE */
00297 
00298 #ifdef RGB
00299     float acc_rclr;             /* accumulator for resampled color */
00300     float acc_gclr;
00301     float acc_bclr;
00302     float top_rclr;             /* voxel color (top and bottom scanlines) */
00303     float bot_rclr;
00304     float top_gclr;
00305     float bot_gclr;
00306     float top_bclr;
00307     float bot_bclr;
00308 #endif
00309 
00310 #ifdef RLEVOLUME
00311     int voxel_istride;          /* size of a voxel in bytes */
00312 #endif
00313 
00314 #ifdef RAWVOLUME
00315     int use_octree;             /* if true then use the min-max octree */
00316     MMOctreeLevel level_stack[VP_MAX_OCTREE_LEVELS];
00317                                 /* stack for traversal of min-max octree */
00318     int scans_left;             /* scanlines until next octree traversal */
00319     int best_view_axis;         /* viewing axis */
00320     unsigned char runlen_buf1[VP_MAX_VOLUME_DIM]; /* buffers for run lengths */
00321     unsigned char runlen_buf2[VP_MAX_VOLUME_DIM];
00322     unsigned char *top_len_base;/* first run length for top scanline */
00323     unsigned char *bot_len_base;/* first run length for bottom scanline */
00324     int opac_param;             /* parameter to opacity transfer function */
00325     float opacity;              /* voxel opacity */
00326     int opacity_int;            /* voxel opacity truncated to an integer */
00327     int param0_offset;          /* offset to first parameter in voxel */
00328     int param0_size;            /* size of first parameter in bytes */
00329     float *param0_table;        /* lookup table for first parameter */
00330     int param1_offset;          /* offset to second parameter in voxel */
00331     int param1_size;            /* size of second parameter in bytes */
00332     float *param1_table;        /* lookup table for second parameter */
00333     int param2_offset;          /* offset to third parameter in voxel */
00334     int param2_size;            /* size of third parameter in bytes */
00335     float *param2_table;        /* lookup table for third parameter */
00336 #endif /* RAWVOLUME */
00337 
00338 #ifdef INDEX_VOLUME
00339     unsigned char *scanline_topRLElen; /* first topRLElen in scanline */
00340     unsigned char *scanline_botRLElen; /* first botRLElen in scanline */
00341     char *scanline_topRLEdata;  /* first topRLEdata in scanline */
00342     char *scanline_botRLEdata;  /* first botRLEdata in scanline */
00343     VoxelLocation *top_voxel_index; /* voxel indexes for top scanline */
00344     VoxelLocation *bot_voxel_index; /* voxel indexes for bot scanline */
00345     VoxelLocation *vindex;
00346     int next_i;                 /* i coordinate of voxel to skip to */
00347     int next_scan;              /* true if skipped to next scanline */
00348 #endif /* INDEX_VOLUME */
00349 
00350 #ifdef CALLBACK
00351                                 /* shading callback function */
00352 #ifdef GRAYSCALE
00353     void (*shade_func) ANSI_ARGS((void *, float *, void *));
00354 #endif
00355 #ifdef RGB
00356     void (*shade_func) ANSI_ARGS((void *, float *, float *, float *, void *));
00357 #endif
00358     void *client_data;          /* client data handle */
00359 #endif /* CALLBACK */
00360 
00361 #ifdef USE_SHADOW_BUFFER
00362     float *shadow_table;        /* color lookup table for shadows */
00363     int shadow_width;           /* width of shadow buffer */
00364     GrayIntPixel *shadow_pixel; /* current shadow buffer pixel */
00365 #ifdef GRAYSCALE
00366     float top_sclr, bot_sclr;   /* shadow color (top and bottom scanlines) */
00367 #endif /* GRAYSCALE */
00368 #ifdef RGB
00369     float top_rsclr;            /* shadow color (top and bottom scanlines) */
00370     float bot_rsclr;
00371     float top_gsclr;
00372     float bot_gsclr;
00373     float top_bsclr;
00374     float bot_bsclr;
00375 #endif
00376 #endif /* SHADOW_BUFFER */
00377 
00378 #ifdef DEBUG
00379     float trace_opcTL, trace_opcBL, trace_opcTR, trace_opcBR;
00380     float trace_rsclrTL, trace_rsclrBL, trace_rsclrTR, trace_rsclrBR;
00381     float trace_rclrTL, trace_rclrBL, trace_rclrTR, trace_rclrBR;
00382     float trace_gclrTL, trace_gclrBL, trace_gclrTR, trace_gclrBR;
00383     float trace_bclrTL, trace_bclrBL, trace_bclrTR, trace_bclrBR;
00384     GrayIntPixel *trace_pixel_ptr;
00385 
00386 #ifdef COMPUTE_SHADOW_BUFFER
00387     int slice_u_int, shadow_slice_u_int;
00388     int slice_v_int, shadow_slice_v_int;
00389 #endif
00390 #endif /* DEBUG */
00391 
00392     DECLARE_HIRES_TIME(t0);
00393     DECLARE_HIRES_TIME(t1);
00394 
00395     /*******************************************************************
00396      * Copy parameters from the rendering context into local variables.
00397      *******************************************************************/
00398 
00399     GET_HIRES_TIME(vpc, t0);
00400 
00401     wgtTL = weightTLdbl;
00402     wgtBL = weightBLdbl;
00403     wgtTR = weightTRdbl;
00404     wgtBR = weightBRdbl;
00405     slice_depth_cueing = slice_depth_cueing_dbl;
00406     min_opacity = vpc->min_opacity;
00407     max_opacity = vpc->max_opacity;
00408 #ifdef USE_SHADOW_BUFFER
00409     opac_correct = vpc->shadow_opac_correct;
00410 #else
00411     opac_correct = vpc->affine_opac_correct;
00412 #endif
00413 #ifdef COMPUTE_SHADOW_BUFFER
00414     intermediate_width = vpc->shadow_width;
00415 #else
00416     intermediate_width = vpc->intermediate_width;
00417 #endif
00418 #ifdef USE_SHADOW_BUFFER
00419     shadow_table = vpc->shadow_color_table;
00420     shadow_width = vpc->shadow_width;
00421     shadow_pixel = shadow_buffer;
00422 #endif
00423     ipixel = intimage;
00424     shade_table = vpc->shade_color_table;
00425     norm_offset = vpc->field_offset[vpc->color_field];
00426 
00427 #ifdef MULTIPLE_MATERIALS
00428     weight_table = vpc->shade_weight_table;
00429     wgt_offset = vpc->field_offset[vpc->weight_field];
00430     num_materials = vpc->num_materials;
00431 #endif /* MULTIPLE_MATERIALS */
00432 
00433 #ifdef RLEVOLUME
00434     topRLEdata = voxel_data;
00435     botRLEdata = voxel_data;
00436     topRLElen = run_lengths;
00437     botRLElen = run_lengths;
00438     voxel_istride = vpc->rle_bytes_per_voxel;
00439 #endif /* RLEVOLUME */
00440 
00441 #ifdef RAWVOLUME
00442     ASSERT(vpc->num_clsfy_params > 0);
00443     ASSERT(vpc->num_clsfy_params < 3);
00444     param0_offset = vpc->field_offset[vpc->param_field[0]];
00445     param0_size = vpc->field_size[vpc->param_field[0]];
00446     param0_table = vpc->clsfy_table[0];
00447     if (vpc->num_clsfy_params > 1) {
00448         param1_offset = vpc->field_offset[vpc->param_field[1]];
00449         param1_size = vpc->field_size[vpc->param_field[1]];
00450         param1_table = vpc->clsfy_table[1];
00451     } else {
00452         param1_offset = 0;
00453         param1_size = 0;
00454         param1_table = NULL;
00455     }
00456     if (vpc->num_clsfy_params > 2) {
00457         param2_offset = vpc->field_offset[vpc->param_field[2]];
00458         param2_size = vpc->field_size[vpc->param_field[2]];
00459         param2_table = vpc->clsfy_table[2];
00460     } else {
00461         param2_offset = 0;
00462         param2_size = 0;
00463         param2_table = NULL;
00464     }
00465     if (vpc->mm_octree == NULL) {
00466         use_octree = 0;
00467     } else {
00468         use_octree = 1;
00469         best_view_axis = vpc->best_view_axis;
00470         VPInitOctreeLevelStack(vpc, level_stack, best_view_axis, k);
00471         scans_left = 0;
00472         bot_len_base = runlen_buf1;
00473     }
00474 #endif /* RAWVOLUME */
00475 
00476 #ifdef CALLBACK
00477     shade_func = vpc->shade_func;
00478     client_data = vpc->client_data;
00479     ASSERT(shade_func != NULL);
00480 #endif
00481 
00482 #ifdef DEBUG
00483     trace_pixel_ptr = 0;
00484     if (vpc->trace_u >= 0 && vpc->trace_v >= 0) {
00485 #ifdef GRAYSCALE
00486         trace_pixel_ptr = &vpc->int_image.gray_intim[vpc->trace_u + 
00487                       vpc->trace_v*vpc->intermediate_width];
00488 #endif
00489 #ifdef RGB
00490         trace_pixel_ptr = &vpc->int_image.rgb_intim[vpc->trace_u + 
00491                       vpc->trace_v*vpc->intermediate_width];
00492 #endif
00493 #ifdef COMPUTE_SHADOW_BUFFER
00494         slice_u_int = (int)ceil(vpc->shear_i * vpc->trace_shadow_k +
00495                                 vpc->trans_i) - 1;
00496         shadow_slice_u_int = (int)ceil(vpc->shadow_shear_i * 
00497                              vpc->trace_shadow_k + vpc->shadow_trans_i) - 1;
00498         slice_v_int = (int)ceil(vpc->shear_j * vpc->trace_shadow_k
00499                                 + vpc->trans_j) - 1;
00500         shadow_slice_v_int = (int)ceil(vpc->shadow_shear_j *
00501                              vpc->trace_shadow_k + vpc->shadow_trans_j) - 1;
00502         trace_pixel_ptr = &vpc->shadow_buffer[vpc->trace_u +
00503                 shadow_slice_u_int - slice_u_int + 
00504                 (vpc->trace_v + shadow_slice_v_int -
00505                 slice_v_int)*vpc->shadow_width];
00506 #endif
00507     }
00508 #endif /* DEBUG */
00509 
00510     /*******************************************************************
00511      * Loop over voxel scanlines.
00512      *******************************************************************/
00513 
00514     for (j = 0; j <= jcount; j++) {
00515 
00516         /***************************************************************
00517          * Initialize counters and flags.
00518          ***************************************************************/
00519 
00520         i = icount;
00521         CLEAR_VOXELS_LOADED;
00522         last_run_state = ALL_ZERO;
00523 
00524 #ifdef RAWVOLUME
00525         botRLEdata = (char *)voxel_data + j*voxel_jstride;
00526         topRLEdata = botRLEdata - voxel_jstride;
00527         if (!use_octree) {
00528             if (j == 0) {
00529                 run_state = BOT_NONZERO;
00530                 toprun_count = icount+2;
00531                 botrun_count = icount;
00532             } else if (j == jcount) {
00533                 run_state = TOP_NONZERO;
00534                 toprun_count = icount;
00535                 botrun_count = icount+2;
00536             } else {
00537                 run_state = ALL_NONZERO;
00538                 toprun_count = icount;
00539                 botrun_count = icount;
00540             }
00541         } else
00542 #endif /* RAWVOLUME */
00543         if (j == 0) {
00544             run_state = BOT_NONZERO;
00545             toprun_count = icount+2;
00546             botrun_count = 0;
00547         } else if (j == jcount) {
00548             run_state = TOP_NONZERO;
00549             toprun_count = 0;
00550             botrun_count = icount+2;
00551         } else {
00552             run_state = ALL_NONZERO;
00553             toprun_count = 0;
00554             botrun_count = 0;
00555         }
00556 
00557 #ifdef INDEX_VOLUME
00558         scanline_topRLElen = topRLElen;
00559         scanline_botRLElen = botRLElen;
00560         scanline_topRLEdata = topRLEdata;
00561         scanline_botRLEdata = botRLEdata;
00562         if (j == 0) {
00563             top_voxel_index = voxel_index;
00564             bot_voxel_index = voxel_index;
00565         } else {
00566             top_voxel_index = bot_voxel_index;
00567             bot_voxel_index += icount;
00568         }
00569 #endif /* INDEX_VOLUME */
00570 
00571         /***************************************************************
00572          * If the volume is not run-length encoded, use the min-max
00573          * to find run lengths for the current voxel scanline.
00574          ***************************************************************/
00575 
00576 #ifdef RAWVOLUME
00577         if (use_octree) {
00578             top_len_base = bot_len_base;
00579             if (scans_left == 0) {
00580                 if (bot_len_base == runlen_buf1)
00581                     bot_len_base = runlen_buf2;
00582                 else
00583                     bot_len_base = runlen_buf1;
00584 
00585                 GET_HIRES_TIME(vpc, t1);
00586                 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00587                 COPY_HIRES_TIME(t0, t1);
00588 
00589                 scans_left = VPComputeScanRuns(vpc, level_stack, bot_len_base,
00590                                                best_view_axis, j, icount);
00591 
00592                 GET_HIRES_TIME(vpc, t1);
00593                 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_OCTREE, t0, t1);
00594                 COPY_HIRES_TIME(t0, t1);
00595             }
00596 #ifdef DEBUG
00597             if (j > 0)
00598                 VPCheckRuns(vpc, top_len_base, best_view_axis, k, j-1);
00599             if (j < jcount)
00600                 VPCheckRuns(vpc, bot_len_base, best_view_axis, k, j);
00601 #endif
00602             scans_left--;
00603             topRLElen = top_len_base;
00604             botRLElen = bot_len_base;
00605         }
00606 #endif /* RAWVOLUME */
00607 
00608         /***************************************************************
00609          * Loop over runs in the voxel scanline.
00610          ***************************************************************/
00611 
00612         Debug((vpc, VPDEBUG_COMPOSITE, "StartIScan(u=%d,v=%d)\n",
00613                (((int)ipixel - (int)vpc->int_image.gray_intim) /
00614                 sizeof(GrayIntPixel)) % vpc->intermediate_width,
00615                (((int)ipixel - (int)vpc->int_image.gray_intim) /
00616                 sizeof(GrayIntPixel)) / vpc->intermediate_width));
00617 
00618 #ifdef UNROLL_RUN_LOOP
00619         while (i > 0) {
00620 #else
00621         while (i >= 0) {
00622 #endif
00623             /***********************************************************
00624              * Skip over any empty runs at beginning of scanline.
00625              ***********************************************************/
00626 
00627             if (last_run_state == ALL_ZERO) {
00628 #ifndef UNROLL_RUN_LOOP
00629                 if (i == 0) {
00630                     Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
00631                     ipixel += 1;
00632                     final_run_state = ALL_ZERO;
00633                     i = -1;
00634                     break;      /* scanline is done */
00635                 }
00636 #endif
00637 
00638                 /* check if this is the start of a new run */
00639                 while (toprun_count == 0) {
00640                     toprun_count = *topRLElen++;
00641                     run_state ^= 1;
00642                 }
00643                 while (botrun_count == 0) {
00644                     botrun_count = *botRLElen++;
00645                     run_state ^= 2;
00646                 }
00647                 if (run_state == ALL_ZERO) {
00648                     COUNT_SPECIAL_ZERO_SKIP;
00649 
00650                     /* find the union of the two runs of voxels */
00651                     count = MIN(toprun_count, botrun_count);
00652                     toprun_count -= count;
00653                     botrun_count -= count;
00654                     ipixel += count;
00655                     ;
00656                     ;
00657                     i -= count;
00658                     ASSERT(i >= 0);
00659                     Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(%d)\n", count));
00660                     continue;
00661                 }
00662             }
00663 
00664 #ifndef SKIP_ERT
00665             /***********************************************************
00666              * Skip over opaque pixels (early-ray termination).
00667              ***********************************************************/
00668 
00669             if ((ert_skip_count = ipixel->lnk) != 0) {
00670 
00671                 GET_HIRES_TIME(vpc, t1);
00672                 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00673                 COPY_HIRES_TIME(t0, t1);
00674 
00675                 COUNT_ERT_SKIP;
00676 
00677 #ifndef UNROLL_RUN_LOOP
00678                 if (i == 0) {
00679                     ipixel += 1;
00680                     final_run_state = last_run_state;
00681                     i = -1;
00682                     Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
00683                     break;      /* scanline is done */
00684                 }
00685 #endif
00686 
00687                 /* find out how many pixels to skip */
00688                 if (ert_skip_count < i &&
00689                                 (count = ipixel[ert_skip_count].lnk) != 0) {
00690                     /* follow pointer chain */
00691                     do {
00692                         COUNT_ERT_SKIP_AGAIN;
00693                         ert_skip_count += count;
00694                     } while (ert_skip_count < i &&
00695                                  (count = ipixel[ert_skip_count].lnk) != 0);
00696 
00697                     /* update some of the lnk pointers in the run of opaque
00698                        pixels; the more links we update the longer it will
00699                        take to perform the update, but we will potentially
00700                        save time in future slices by not having to follow
00701                        long pointer chains */
00702                     ipixel2 = ipixel;
00703                     update_interval = 1;
00704                     count = ert_skip_count - 1;
00705                     while (count > 0) {
00706                         COUNT_ERT_UPDATE;
00707                         ipixel2 += update_interval;
00708                         if (count > 255)
00709                             ipixel2->lnk = 255;
00710                         else
00711                             ipixel2->lnk = count;
00712                         update_interval *= 2;
00713                         count -= update_interval;
00714                     }
00715 
00716                     /* update the current link */
00717                     COUNT_ERT_UPDATE;
00718                     if (ert_skip_count > 255)
00719                         ert_skip_count = 255;
00720                     ipixel->lnk = ert_skip_count;
00721                 }
00722 
00723                 /* skip over the opaque pixels */
00724                 if (ert_skip_count > i)
00725                     ert_skip_count = i;
00726                 Debug((vpc, VPDEBUG_COMPOSITE,"ERTSkip(%d)\n",ert_skip_count));
00727                 ipixel += ert_skip_count;
00728                 CLEAR_VOXELS_LOADED;
00729 
00730 #ifdef INDEX_VOLUME
00731                 /* compute i coordinate of voxel to skip to */
00732                 next_i = icount - i + ert_skip_count;
00733                 if (next_i == icount) {
00734                     next_i--;
00735                     next_scan = 1;
00736                 } else {
00737                     next_scan = 0;
00738                 }
00739 
00740                 /* skip over voxels in top scanline */
00741                 vindex = &top_voxel_index[next_i];
00742                 toprun_count = vindex->run_count;
00743                 topRLElen = scanline_topRLElen + vindex->len_offset;
00744                 if (vindex->data_offset & INDEX_RUN_IS_ZERO) {
00745                     run_state &= ~1;
00746                     topRLEdata = scanline_topRLEdata +
00747                         (vindex->data_offset & ~INDEX_RUN_IS_ZERO);
00748                 } else {
00749                     run_state |= 1;
00750                     topRLEdata = scanline_topRLEdata + vindex->data_offset;
00751                 }
00752 
00753                 /* skip over voxels in bottom scanline */
00754                 vindex = &bot_voxel_index[next_i];
00755                 botrun_count = vindex->run_count;
00756                 botRLElen = scanline_botRLElen + vindex->len_offset;
00757                 if (vindex->data_offset & INDEX_RUN_IS_ZERO) {
00758                     run_state &= ~2;
00759                     botRLEdata = scanline_botRLEdata +
00760                         (vindex->data_offset & ~INDEX_RUN_IS_ZERO);
00761                 } else {
00762                     run_state |= 2;
00763                     botRLEdata = scanline_botRLEdata + vindex->data_offset;
00764                 }
00765 
00766                 /* special case to skip over last voxel in scanline */
00767                 if (next_scan) {
00768                     /* advance to beginning of next top scanline */
00769                     while (toprun_count == 0) {
00770                         toprun_count = *topRLElen++;
00771                         run_state ^= 1;
00772                     }
00773                     toprun_count--;
00774                     if (run_state & 1) {
00775                         topRLEdata += 1 * voxel_istride;
00776                     } else {
00777                         ;
00778                     }
00779 
00780                     /* advance to beginning of next bottom scanline */
00781                     while (botrun_count == 0) {
00782                         botrun_count = *botRLElen++;
00783                         run_state ^= 2;
00784                     }
00785                     botrun_count--;
00786                     if (run_state & 2) {
00787                         botRLEdata += 1 * voxel_istride;
00788                     } else {
00789                         ;
00790                     }
00791                 }
00792 
00793 #else /* !INDEX_VOLUME */
00794                 /* skip over voxels in top scanline */
00795                 count = ert_skip_count;
00796                 for (;;) {
00797                     if (toprun_count >= count) {
00798                         toprun_count -= count;
00799                         if (run_state & 1) {
00800                             topRLEdata += count * voxel_istride;
00801                         } else {
00802                             ;
00803                         }
00804                         break;
00805                     } else {
00806                         count -= toprun_count;
00807                         if (run_state & 1) {
00808                             topRLEdata += toprun_count * voxel_istride;
00809                         } else {
00810                             ;
00811                         }
00812                         toprun_count = *topRLElen++;
00813                         if (toprun_count == 0)
00814                             toprun_count = *topRLElen++;
00815                         else
00816                             run_state ^= 1;
00817                     }
00818                 }
00819 
00820                 /* skip over voxels in bottom scanline */
00821                 count = ert_skip_count;
00822                 for (;;) {
00823                     if (botrun_count >= count) {
00824                         botrun_count -= count;
00825                         if (run_state & 2) {
00826                             botRLEdata += count * voxel_istride;
00827                         } else {
00828                             ;
00829                         }
00830                         break;
00831                     } else {
00832                         count -= botrun_count;
00833                         if (run_state & 2) {
00834                             botRLEdata += botrun_count * voxel_istride;
00835                         } else {
00836                             ;
00837                         }
00838                         botrun_count = *botRLElen++;
00839                         if (botrun_count == 0)
00840                             botrun_count = *botRLElen++;
00841                         else
00842                             run_state ^= 2;
00843                     }
00844                 }
00845 #endif /* INDEX_VOLUME */
00846                 i -= ert_skip_count;
00847                 last_run_state = run_state;
00848                 if (i == 0) {
00849 #ifdef UNROLL_RUN_LOOP
00850                     break;
00851 #else
00852                     if (last_run_state == ALL_ZERO) {
00853                         ipixel += 1;
00854                         final_run_state = ALL_ZERO;
00855                         i = -1;
00856                         Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
00857                         break;  /* scanline is done */
00858                     }
00859                     if (ipixel->lnk != 0) {
00860                         ipixel += 1;
00861                         final_run_state = last_run_state;
00862                         i = -1;
00863                         Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
00864                         break;  /* scanline is done */
00865                     }
00866 #endif /* UNROLL_RUN_LOOP */
00867                 }
00868 
00869                 GET_HIRES_TIME(vpc, t1);
00870                 STORE_HIRES_TIME(vpc, VPTIMER_ERT, t0, t1);
00871                 COPY_HIRES_TIME(t0, t1);
00872             }
00873             ASSERT(ipixel->opcflt < max_opacity);
00874 #endif /* SKIP_ERT */
00875 
00876             /***********************************************************
00877              * Compute the length of the current run.
00878              ***********************************************************/
00879 
00880 #ifndef UNROLL_RUN_LOOP
00881             if (i == 0) {
00882                 final_run_state = last_run_state;
00883                 run_state = ALL_ZERO;
00884                 i = -1;
00885                 count = 1;
00886                 Debug((vpc, VPDEBUG_COMPOSITE, "Run(1)End\n"));
00887             } else {
00888 #endif
00889                 /* check if this is the start of a new run */
00890                 while (toprun_count == 0) {
00891                     toprun_count = *topRLElen++;
00892                     run_state ^= 1;
00893                 }
00894                 while (botrun_count == 0) {
00895                     botrun_count = *botRLElen++;
00896                     run_state ^= 2;
00897                 }
00898 
00899                 /* find the union of the two runs of voxels */
00900                 count = MIN(toprun_count, botrun_count);
00901                 toprun_count -= count;
00902                 botrun_count -= count;
00903                 i -= count;
00904                 Debug((vpc, VPDEBUG_COMPOSITE, "Run(%d)\n", count));
00905                 ASSERT(i >= 0);
00906 #ifndef UNROLL_RUN_LOOP
00907             }
00908 #endif
00909             COUNT_RUN_FRAGMENT;
00910 
00911             /***********************************************************
00912              * composite the voxels in the current run.
00913              ***********************************************************/
00914 
00915             GET_HIRES_TIME(vpc, t1);
00916             STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00917             COPY_HIRES_TIME(t0, t1);
00918 
00919 #ifdef SKIP_COMPOSITE
00920             switch (run_state) {
00921             case ALL_ZERO:
00922                 ipixel += count;
00923                 ;
00924                 ;
00925                 count = 0;
00926                 break;
00927             case TOP_NONZERO:
00928                 ipixel += count;
00929                 topRLEdata += count * voxel_istride;
00930                 ;
00931                 count = 0;
00932                 break;
00933             case BOT_NONZERO:
00934                 ipixel += count;
00935                 ;
00936                 botRLEdata += count * voxel_istride;
00937                 count = 0;
00938                 break;
00939             case ALL_NONZERO:
00940                 ipixel += count;
00941                 topRLEdata += count * voxel_istride;
00942                 botRLEdata += count * voxel_istride;
00943                 count = 0;
00944                 break;
00945             }
00946 #else /* !SKIP_COMPOSITE */
00947 #ifdef UNROLL_RUN_LOOP
00948             /* this run contains pixels, so process them */
00949             switch ((last_run_state << 2) | run_state) {
00950             case ALL_ZERO__ALL_ZERO:
00951                 /* no voxels contribute to the pixels in this run */
00952                 ipixel += count;
00953                 ;
00954                 ;
00955                 count = 0;
00956                 break;
00957             case TOP_NONZERO__ALL_ZERO:
00958                 /* only the top-left voxel contributes to the first
00959                    pixel of the run, and the rest are zero */
00960                 if (!voxels_loaded) {
00961                     
00962     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
00963     
00964     ;
00965                 }
00966                 
00967 #ifdef DEBUG
00968     if (ipixel == trace_pixel_ptr) {
00969         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
00970         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
00971         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
00972         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
00973         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
00974     }
00975 #endif
00976 ;
00977                 
00978        acc_opc = top_opc * wgtTL;
00979        ;
00980        
00981 #ifdef DEBUG
00982     if (ipixel == trace_pixel_ptr) {
00983         trace_opcTL = top_opc;
00984         
00985         
00986     }
00987 #endif
00988 ;
00989                 
00990         COUNT_RESAMPLE;
00991         if (acc_opc > min_opacity) {
00992             COUNT_COMPOSITE;
00993             iopc = ipixel->opcflt;
00994 #           ifndef SKIP_ERT
00995                 ASSERT(iopc < max_opacity);
00996 #           endif
00997             iopc_inv = (float)1. - iopc;
00998             ;
00999             iopc += acc_opc * iopc_inv;
01000             ipixel->opcflt = iopc;
01001             
01002 #ifdef DEBUG
01003     if (ipixel == trace_pixel_ptr) {
01004 #ifdef COMPUTE_SHADOW_BUFFER
01005         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01006 #else
01007         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01008 #endif
01009         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01010         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01011         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01012         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01013         printf("  %3.0f %3.0f\n", iopc*255., 
01014                0);
01015         
01016         
01017     }
01018 #endif /* DEBUG */
01019 ;
01020 #           ifndef SKIP_ERT
01021                 if (iopc >= max_opacity) {
01022                     ASSERT(ipixel->lnk == 0);
01023                     ipixel->lnk = 1;
01024                 }
01025 #           endif
01026         };
01027                 ipixel += count;
01028                 ;
01029                 ;
01030                 count = 0;
01031                 break;
01032             case BOT_NONZERO__ALL_ZERO:
01033                 /* only the bottom left voxel contributes to the first
01034                    pixel of the run, and the rest are zero */
01035                 if (!voxels_loaded) {
01036                     
01037     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01038     
01039     ;
01040                 }
01041                 
01042 #ifdef DEBUG
01043     if (ipixel == trace_pixel_ptr) {
01044         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01045         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01046         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01047         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01048         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01049     }
01050 #endif
01051 ;
01052                 
01053        acc_opc = bot_opc * wgtBL;
01054        ;
01055        
01056 #ifdef DEBUG
01057     if (ipixel == trace_pixel_ptr) {
01058         trace_opcBL = bot_opc;
01059         
01060         
01061     }
01062 #endif
01063 ;
01064                 
01065         COUNT_RESAMPLE;
01066         if (acc_opc > min_opacity) {
01067             COUNT_COMPOSITE;
01068             iopc = ipixel->opcflt;
01069 #           ifndef SKIP_ERT
01070                 ASSERT(iopc < max_opacity);
01071 #           endif
01072             iopc_inv = (float)1. - iopc;
01073             ;
01074             iopc += acc_opc * iopc_inv;
01075             ipixel->opcflt = iopc;
01076             
01077 #ifdef DEBUG
01078     if (ipixel == trace_pixel_ptr) {
01079 #ifdef COMPUTE_SHADOW_BUFFER
01080         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01081 #else
01082         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01083 #endif
01084         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01085         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01086         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01087         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01088         printf("  %3.0f %3.0f\n", iopc*255., 
01089                0);
01090         
01091         
01092     }
01093 #endif /* DEBUG */
01094 ;
01095 #           ifndef SKIP_ERT
01096                 if (iopc >= max_opacity) {
01097                     ASSERT(ipixel->lnk == 0);
01098                     ipixel->lnk = 1;
01099                 }
01100 #           endif
01101         };
01102                 ipixel += count;
01103                 ;
01104                 ;
01105                 count = 0;
01106                 break;
01107             case ALL_NONZERO__ALL_ZERO:
01108                 /* the top and bottom left voxels contribute to the
01109                    first pixel of the run, and the rest are zero */
01110                 if (!voxels_loaded) {
01111                     
01112     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01113     
01114     ;
01115                     
01116     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01117     
01118     ;
01119                 }
01120                 
01121 #ifdef DEBUG
01122     if (ipixel == trace_pixel_ptr) {
01123         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01124         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01125         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01126         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01127         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01128     }
01129 #endif
01130 ;
01131                 
01132        acc_opc = top_opc * wgtTL;
01133        ;
01134        
01135 #ifdef DEBUG
01136     if (ipixel == trace_pixel_ptr) {
01137         trace_opcTL = top_opc;
01138         
01139         
01140     }
01141 #endif
01142 ;
01143                 
01144        acc_opc += bot_opc * wgtBL;
01145        ;
01146        
01147 #ifdef DEBUG
01148     if (ipixel == trace_pixel_ptr) {
01149         trace_opcBL = bot_opc;
01150         
01151         
01152     }
01153 #endif
01154 ;
01155                 
01156         COUNT_RESAMPLE;
01157         if (acc_opc > min_opacity) {
01158             COUNT_COMPOSITE;
01159             iopc = ipixel->opcflt;
01160 #           ifndef SKIP_ERT
01161                 ASSERT(iopc < max_opacity);
01162 #           endif
01163             iopc_inv = (float)1. - iopc;
01164             ;
01165             iopc += acc_opc * iopc_inv;
01166             ipixel->opcflt = iopc;
01167             
01168 #ifdef DEBUG
01169     if (ipixel == trace_pixel_ptr) {
01170 #ifdef COMPUTE_SHADOW_BUFFER
01171         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01172 #else
01173         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01174 #endif
01175         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01176         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01177         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01178         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01179         printf("  %3.0f %3.0f\n", iopc*255., 
01180                0);
01181         
01182         
01183     }
01184 #endif /* DEBUG */
01185 ;
01186 #           ifndef SKIP_ERT
01187                 if (iopc >= max_opacity) {
01188                     ASSERT(ipixel->lnk == 0);
01189                     ipixel->lnk = 1;
01190                 }
01191 #           endif
01192         };
01193                 ipixel += count;
01194                 ;
01195                 ;
01196                 count = 0;
01197                 break;
01198             case ALL_ZERO__TOP_NONZERO:
01199                 /* first pixel: only the top-right voxel contributes */
01200                 
01201     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01202     
01203     ;
01204                 
01205 #ifdef DEBUG
01206     if (ipixel == trace_pixel_ptr) {
01207         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01208         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01209         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01210         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01211         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01212     }
01213 #endif
01214 ;
01215                 
01216        acc_opc = top_opc * wgtTR;
01217        ;
01218        
01219 #ifdef DEBUG
01220     if (ipixel == trace_pixel_ptr) {
01221         trace_opcTR = top_opc;
01222         
01223         
01224     }
01225 #endif
01226 ;
01227                 
01228         COUNT_RESAMPLE;
01229         if (acc_opc > min_opacity) {
01230             COUNT_COMPOSITE;
01231             iopc = ipixel->opcflt;
01232 #           ifndef SKIP_ERT
01233                 ASSERT(iopc < max_opacity);
01234 #           endif
01235             iopc_inv = (float)1. - iopc;
01236             ;
01237             iopc += acc_opc * iopc_inv;
01238             ipixel->opcflt = iopc;
01239             
01240 #ifdef DEBUG
01241     if (ipixel == trace_pixel_ptr) {
01242 #ifdef COMPUTE_SHADOW_BUFFER
01243         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01244 #else
01245         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01246 #endif
01247         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01248         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01249         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01250         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01251         printf("  %3.0f %3.0f\n", iopc*255., 
01252                0);
01253         
01254         
01255     }
01256 #endif /* DEBUG */
01257 ;
01258 #           ifndef SKIP_ERT
01259                 if (iopc >= max_opacity) {
01260                     ASSERT(ipixel->lnk == 0);
01261                     ipixel->lnk = 1;
01262                 }
01263 #           endif
01264         };
01265                 ipixel += 1;
01266                 topRLEdata += 1 * voxel_istride;
01267                 ;
01268                 count--;
01269                 SET_VOXELS_LOADED;
01270 
01271                 /* do the rest of the pixels in this run;
01272                    the top-left and top-right voxels contribute */
01273                 while (count > 0) {
01274                     if (PIXEL_IS_OPAQUE(ipixel))
01275                         break;
01276                     if (!voxels_loaded) {
01277                         
01278     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01279     
01280     ;
01281                     }
01282                     
01283 #ifdef DEBUG
01284     if (ipixel == trace_pixel_ptr) {
01285         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01286         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01287         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01288         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01289         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01290     }
01291 #endif
01292 ;
01293                     
01294        acc_opc = top_opc * wgtTL;
01295        ;
01296        
01297 #ifdef DEBUG
01298     if (ipixel == trace_pixel_ptr) {
01299         trace_opcTL = top_opc;
01300         
01301         
01302     }
01303 #endif
01304 ;
01305                     
01306     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01307     
01308     ;
01309                     
01310        acc_opc += top_opc * wgtTR;
01311        ;
01312        
01313 #ifdef DEBUG
01314     if (ipixel == trace_pixel_ptr) {
01315         trace_opcTR = top_opc;
01316         
01317         
01318     }
01319 #endif
01320 ;
01321                     
01322         COUNT_RESAMPLE;
01323         if (acc_opc > min_opacity) {
01324             COUNT_COMPOSITE;
01325             iopc = ipixel->opcflt;
01326 #           ifndef SKIP_ERT
01327                 ASSERT(iopc < max_opacity);
01328 #           endif
01329             iopc_inv = (float)1. - iopc;
01330             ;
01331             iopc += acc_opc * iopc_inv;
01332             ipixel->opcflt = iopc;
01333             
01334 #ifdef DEBUG
01335     if (ipixel == trace_pixel_ptr) {
01336 #ifdef COMPUTE_SHADOW_BUFFER
01337         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01338 #else
01339         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01340 #endif
01341         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01342         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01343         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01344         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01345         printf("  %3.0f %3.0f\n", iopc*255., 
01346                0);
01347         
01348         
01349     }
01350 #endif /* DEBUG */
01351 ;
01352 #           ifndef SKIP_ERT
01353                 if (iopc >= max_opacity) {
01354                     ASSERT(ipixel->lnk == 0);
01355                     ipixel->lnk = 1;
01356                 }
01357 #           endif
01358         };
01359                     ipixel += 1;
01360                     topRLEdata += 1 * voxel_istride;
01361                     ;
01362                     count--;
01363                     SET_VOXELS_LOADED;
01364                 }
01365                 break;
01366             case TOP_NONZERO__TOP_NONZERO:
01367                 /* do the pixels in this run; the top-left and
01368                    top-right voxels contribute */
01369                 while (count > 0) {
01370                     if (PIXEL_IS_OPAQUE(ipixel))
01371                         break;
01372                     if (!voxels_loaded) {
01373                         
01374     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01375     
01376     ;
01377                     }
01378                     
01379 #ifdef DEBUG
01380     if (ipixel == trace_pixel_ptr) {
01381         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01382         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01383         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01384         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01385         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01386     }
01387 #endif
01388 ;
01389                     
01390        acc_opc = top_opc * wgtTL;
01391        ;
01392        
01393 #ifdef DEBUG
01394     if (ipixel == trace_pixel_ptr) {
01395         trace_opcTL = top_opc;
01396         
01397         
01398     }
01399 #endif
01400 ;
01401                     
01402     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01403     
01404     ;
01405                     
01406        acc_opc += top_opc * wgtTR;
01407        ;
01408        
01409 #ifdef DEBUG
01410     if (ipixel == trace_pixel_ptr) {
01411         trace_opcTR = top_opc;
01412         
01413         
01414     }
01415 #endif
01416 ;
01417                     
01418         COUNT_RESAMPLE;
01419         if (acc_opc > min_opacity) {
01420             COUNT_COMPOSITE;
01421             iopc = ipixel->opcflt;
01422 #           ifndef SKIP_ERT
01423                 ASSERT(iopc < max_opacity);
01424 #           endif
01425             iopc_inv = (float)1. - iopc;
01426             ;
01427             iopc += acc_opc * iopc_inv;
01428             ipixel->opcflt = iopc;
01429             
01430 #ifdef DEBUG
01431     if (ipixel == trace_pixel_ptr) {
01432 #ifdef COMPUTE_SHADOW_BUFFER
01433         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01434 #else
01435         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01436 #endif
01437         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01438         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01439         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01440         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01441         printf("  %3.0f %3.0f\n", iopc*255., 
01442                0);
01443         
01444         
01445     }
01446 #endif /* DEBUG */
01447 ;
01448 #           ifndef SKIP_ERT
01449                 if (iopc >= max_opacity) {
01450                     ASSERT(ipixel->lnk == 0);
01451                     ipixel->lnk = 1;
01452                 }
01453 #           endif
01454         };
01455                     ipixel += 1;
01456                     topRLEdata += 1 * voxel_istride;
01457                     ;
01458                     count--;
01459                     SET_VOXELS_LOADED;
01460                 }
01461                 break;
01462             case BOT_NONZERO__TOP_NONZERO:
01463                 /* first pixel: bottom-left and top-right voxels
01464                    contribute */
01465                 if (!voxels_loaded) {
01466                     
01467     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01468     
01469     ;
01470                 }
01471                 
01472 #ifdef DEBUG
01473     if (ipixel == trace_pixel_ptr) {
01474         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01475         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01476         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01477         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01478         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01479     }
01480 #endif
01481 ;
01482                 
01483        acc_opc = bot_opc * wgtBL;
01484        ;
01485        
01486 #ifdef DEBUG
01487     if (ipixel == trace_pixel_ptr) {
01488         trace_opcBL = bot_opc;
01489         
01490         
01491     }
01492 #endif
01493 ;
01494                 
01495     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01496     
01497     ;
01498                 
01499        acc_opc += top_opc * wgtTR;
01500        ;
01501        
01502 #ifdef DEBUG
01503     if (ipixel == trace_pixel_ptr) {
01504         trace_opcTR = top_opc;
01505         
01506         
01507     }
01508 #endif
01509 ;
01510                 
01511         COUNT_RESAMPLE;
01512         if (acc_opc > min_opacity) {
01513             COUNT_COMPOSITE;
01514             iopc = ipixel->opcflt;
01515 #           ifndef SKIP_ERT
01516                 ASSERT(iopc < max_opacity);
01517 #           endif
01518             iopc_inv = (float)1. - iopc;
01519             ;
01520             iopc += acc_opc * iopc_inv;
01521             ipixel->opcflt = iopc;
01522             
01523 #ifdef DEBUG
01524     if (ipixel == trace_pixel_ptr) {
01525 #ifdef COMPUTE_SHADOW_BUFFER
01526         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01527 #else
01528         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01529 #endif
01530         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01531         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01532         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01533         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01534         printf("  %3.0f %3.0f\n", iopc*255., 
01535                0);
01536         
01537         
01538     }
01539 #endif /* DEBUG */
01540 ;
01541 #           ifndef SKIP_ERT
01542                 if (iopc >= max_opacity) {
01543                     ASSERT(ipixel->lnk == 0);
01544                     ipixel->lnk = 1;
01545                 }
01546 #           endif
01547         };
01548                 ipixel += 1;
01549                 topRLEdata += 1 * voxel_istride;
01550                 ;
01551                 count--;
01552                 SET_VOXELS_LOADED;
01553 
01554                 /* do the rest of the pixels in this run;
01555                    the top-left and top-right voxels contribute */
01556                 while (count > 0) {
01557                     if (PIXEL_IS_OPAQUE(ipixel))
01558                         break;
01559                     if (!voxels_loaded) {
01560                         
01561     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01562     
01563     ;
01564                     }
01565                     
01566 #ifdef DEBUG
01567     if (ipixel == trace_pixel_ptr) {
01568         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01569         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01570         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01571         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01572         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01573     }
01574 #endif
01575 ;
01576                     
01577        acc_opc = top_opc * wgtTL;
01578        ;
01579        
01580 #ifdef DEBUG
01581     if (ipixel == trace_pixel_ptr) {
01582         trace_opcTL = top_opc;
01583         
01584         
01585     }
01586 #endif
01587 ;
01588                     
01589     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01590     
01591     ;
01592                     
01593        acc_opc += top_opc * wgtTR;
01594        ;
01595        
01596 #ifdef DEBUG
01597     if (ipixel == trace_pixel_ptr) {
01598         trace_opcTR = top_opc;
01599         
01600         
01601     }
01602 #endif
01603 ;
01604                     
01605         COUNT_RESAMPLE;
01606         if (acc_opc > min_opacity) {
01607             COUNT_COMPOSITE;
01608             iopc = ipixel->opcflt;
01609 #           ifndef SKIP_ERT
01610                 ASSERT(iopc < max_opacity);
01611 #           endif
01612             iopc_inv = (float)1. - iopc;
01613             ;
01614             iopc += acc_opc * iopc_inv;
01615             ipixel->opcflt = iopc;
01616             
01617 #ifdef DEBUG
01618     if (ipixel == trace_pixel_ptr) {
01619 #ifdef COMPUTE_SHADOW_BUFFER
01620         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01621 #else
01622         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01623 #endif
01624         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01625         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01626         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01627         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01628         printf("  %3.0f %3.0f\n", iopc*255., 
01629                0);
01630         
01631         
01632     }
01633 #endif /* DEBUG */
01634 ;
01635 #           ifndef SKIP_ERT
01636                 if (iopc >= max_opacity) {
01637                     ASSERT(ipixel->lnk == 0);
01638                     ipixel->lnk = 1;
01639                 }
01640 #           endif
01641         };
01642                     ipixel += 1;
01643                     topRLEdata += 1 * voxel_istride;
01644                     ;
01645                     count--;
01646                     SET_VOXELS_LOADED;
01647                 }
01648                 break;
01649             case ALL_NONZERO__TOP_NONZERO:
01650                 /* first pixel: top-left, bottom-left and top-right voxels
01651                    contribute */
01652                 if (!voxels_loaded) {
01653                     
01654     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01655     
01656     ;
01657                     
01658     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01659     
01660     ;
01661                 }
01662                 
01663 #ifdef DEBUG
01664     if (ipixel == trace_pixel_ptr) {
01665         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01666         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01667         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01668         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01669         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01670     }
01671 #endif
01672 ;
01673                 
01674        acc_opc = top_opc * wgtTL;
01675        ;
01676        
01677 #ifdef DEBUG
01678     if (ipixel == trace_pixel_ptr) {
01679         trace_opcTL = top_opc;
01680         
01681         
01682     }
01683 #endif
01684 ;
01685                 
01686        acc_opc += bot_opc * wgtBL;
01687        ;
01688        
01689 #ifdef DEBUG
01690     if (ipixel == trace_pixel_ptr) {
01691         trace_opcBL = bot_opc;
01692         
01693         
01694     }
01695 #endif
01696 ;
01697                 
01698     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01699     
01700     ;
01701                 
01702        acc_opc += top_opc * wgtTR;
01703        ;
01704        
01705 #ifdef DEBUG
01706     if (ipixel == trace_pixel_ptr) {
01707         trace_opcTR = top_opc;
01708         
01709         
01710     }
01711 #endif
01712 ;
01713                 
01714         COUNT_RESAMPLE;
01715         if (acc_opc > min_opacity) {
01716             COUNT_COMPOSITE;
01717             iopc = ipixel->opcflt;
01718 #           ifndef SKIP_ERT
01719                 ASSERT(iopc < max_opacity);
01720 #           endif
01721             iopc_inv = (float)1. - iopc;
01722             ;
01723             iopc += acc_opc * iopc_inv;
01724             ipixel->opcflt = iopc;
01725             
01726 #ifdef DEBUG
01727     if (ipixel == trace_pixel_ptr) {
01728 #ifdef COMPUTE_SHADOW_BUFFER
01729         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01730 #else
01731         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01732 #endif
01733         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01734         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01735         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01736         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01737         printf("  %3.0f %3.0f\n", iopc*255., 
01738                0);
01739         
01740         
01741     }
01742 #endif /* DEBUG */
01743 ;
01744 #           ifndef SKIP_ERT
01745                 if (iopc >= max_opacity) {
01746                     ASSERT(ipixel->lnk == 0);
01747                     ipixel->lnk = 1;
01748                 }
01749 #           endif
01750         };
01751                 ipixel += 1;
01752                 topRLEdata += 1 * voxel_istride;
01753                 ;
01754                 count--;
01755                 SET_VOXELS_LOADED;
01756 
01757                 /* do the rest of the pixels in this run;
01758                    the top-left and top-right voxels contribute */
01759                 while (count > 0) {
01760                     if (PIXEL_IS_OPAQUE(ipixel))
01761                         break;
01762                     if (!voxels_loaded) {
01763                         
01764     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01765     
01766     ;
01767                     }
01768                     
01769 #ifdef DEBUG
01770     if (ipixel == trace_pixel_ptr) {
01771         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01772         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01773         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01774         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01775         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01776     }
01777 #endif
01778 ;
01779                     
01780        acc_opc = top_opc * wgtTL;
01781        ;
01782        
01783 #ifdef DEBUG
01784     if (ipixel == trace_pixel_ptr) {
01785         trace_opcTL = top_opc;
01786         
01787         
01788     }
01789 #endif
01790 ;
01791                     
01792     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01793     
01794     ;
01795                     
01796        acc_opc += top_opc * wgtTR;
01797        ;
01798        
01799 #ifdef DEBUG
01800     if (ipixel == trace_pixel_ptr) {
01801         trace_opcTR = top_opc;
01802         
01803         
01804     }
01805 #endif
01806 ;
01807                     
01808         COUNT_RESAMPLE;
01809         if (acc_opc > min_opacity) {
01810             COUNT_COMPOSITE;
01811             iopc = ipixel->opcflt;
01812 #           ifndef SKIP_ERT
01813                 ASSERT(iopc < max_opacity);
01814 #           endif
01815             iopc_inv = (float)1. - iopc;
01816             ;
01817             iopc += acc_opc * iopc_inv;
01818             ipixel->opcflt = iopc;
01819             
01820 #ifdef DEBUG
01821     if (ipixel == trace_pixel_ptr) {
01822 #ifdef COMPUTE_SHADOW_BUFFER
01823         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01824 #else
01825         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01826 #endif
01827         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01828         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01829         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01830         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01831         printf("  %3.0f %3.0f\n", iopc*255., 
01832                0);
01833         
01834         
01835     }
01836 #endif /* DEBUG */
01837 ;
01838 #           ifndef SKIP_ERT
01839                 if (iopc >= max_opacity) {
01840                     ASSERT(ipixel->lnk == 0);
01841                     ipixel->lnk = 1;
01842                 }
01843 #           endif
01844         };
01845                     ipixel += 1;
01846                     topRLEdata += 1 * voxel_istride;
01847                     ;
01848                     count--;
01849                     SET_VOXELS_LOADED;
01850                 }
01851                 break;
01852             case ALL_ZERO__BOT_NONZERO:
01853                 /* first pixel: only the bottom-right voxel contributes */
01854                 
01855     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
01856     
01857     ;
01858                 
01859 #ifdef DEBUG
01860     if (ipixel == trace_pixel_ptr) {
01861         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01862         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01863         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01864         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01865         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01866     }
01867 #endif
01868 ;
01869                 
01870        acc_opc = bot_opc * wgtBR;
01871        ;
01872        
01873 #ifdef DEBUG
01874     if (ipixel == trace_pixel_ptr) {
01875         trace_opcBR = bot_opc;
01876         
01877         
01878     }
01879 #endif
01880 ;
01881                 
01882         COUNT_RESAMPLE;
01883         if (acc_opc > min_opacity) {
01884             COUNT_COMPOSITE;
01885             iopc = ipixel->opcflt;
01886 #           ifndef SKIP_ERT
01887                 ASSERT(iopc < max_opacity);
01888 #           endif
01889             iopc_inv = (float)1. - iopc;
01890             ;
01891             iopc += acc_opc * iopc_inv;
01892             ipixel->opcflt = iopc;
01893             
01894 #ifdef DEBUG
01895     if (ipixel == trace_pixel_ptr) {
01896 #ifdef COMPUTE_SHADOW_BUFFER
01897         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01898 #else
01899         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01900 #endif
01901         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01902         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01903         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01904         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01905         printf("  %3.0f %3.0f\n", iopc*255., 
01906                0);
01907         
01908         
01909     }
01910 #endif /* DEBUG */
01911 ;
01912 #           ifndef SKIP_ERT
01913                 if (iopc >= max_opacity) {
01914                     ASSERT(ipixel->lnk == 0);
01915                     ipixel->lnk = 1;
01916                 }
01917 #           endif
01918         };      
01919                 ipixel += 1;
01920                 ;
01921                 botRLEdata += 1 * voxel_istride;
01922                 count--;
01923                 SET_VOXELS_LOADED;
01924 
01925                 /* do the rest of the pixels in this run;
01926                    bottom-left and bottom-right voxels contribute */
01927                 while (count > 0) {
01928                     if (PIXEL_IS_OPAQUE(ipixel))
01929                         break;
01930                     if (!voxels_loaded) {
01931                         
01932     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01933     
01934     ;
01935                     }
01936                     
01937 #ifdef DEBUG
01938     if (ipixel == trace_pixel_ptr) {
01939         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01940         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01941         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01942         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01943         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01944     }
01945 #endif
01946 ;
01947                     
01948        acc_opc = bot_opc * wgtBL;
01949        ;
01950        
01951 #ifdef DEBUG
01952     if (ipixel == trace_pixel_ptr) {
01953         trace_opcBL = bot_opc;
01954         
01955         
01956     }
01957 #endif
01958 ;
01959                     
01960     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
01961     
01962     ;
01963                     
01964        acc_opc += bot_opc * wgtBR;
01965        ;
01966        
01967 #ifdef DEBUG
01968     if (ipixel == trace_pixel_ptr) {
01969         trace_opcBR = bot_opc;
01970         
01971         
01972     }
01973 #endif
01974 ;
01975                     
01976         COUNT_RESAMPLE;
01977         if (acc_opc > min_opacity) {
01978             COUNT_COMPOSITE;
01979             iopc = ipixel->opcflt;
01980 #           ifndef SKIP_ERT
01981                 ASSERT(iopc < max_opacity);
01982 #           endif
01983             iopc_inv = (float)1. - iopc;
01984             ;
01985             iopc += acc_opc * iopc_inv;
01986             ipixel->opcflt = iopc;
01987             
01988 #ifdef DEBUG
01989     if (ipixel == trace_pixel_ptr) {
01990 #ifdef COMPUTE_SHADOW_BUFFER
01991         printf("{%3d}  %3d %3d", k, icount-i-count, j);
01992 #else
01993         printf("[%3d]  %3d %3d", k, icount-i-count, j);
01994 #endif
01995         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01996         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01997         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01998         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01999         printf("  %3.0f %3.0f\n", iopc*255., 
02000                0);
02001         
02002         
02003     }
02004 #endif /* DEBUG */
02005 ;
02006 #           ifndef SKIP_ERT
02007                 if (iopc >= max_opacity) {
02008                     ASSERT(ipixel->lnk == 0);
02009                     ipixel->lnk = 1;
02010                 }
02011 #           endif
02012         };
02013                     ipixel += 1;
02014                     ;
02015                     botRLEdata += 1 * voxel_istride;
02016                     count--;
02017                     SET_VOXELS_LOADED;
02018                 }
02019                 break;
02020             case TOP_NONZERO__BOT_NONZERO:
02021                 /* first pixel: top-left and bottom-right voxels contribute */
02022                 if (!voxels_loaded) {
02023                     
02024     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02025     
02026     ;
02027                 }
02028                 
02029 #ifdef DEBUG
02030     if (ipixel == trace_pixel_ptr) {
02031         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02032         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02033         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02034         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02035         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02036     }
02037 #endif
02038 ;
02039                 
02040        acc_opc = top_opc * wgtTL;
02041        ;
02042        
02043 #ifdef DEBUG
02044     if (ipixel == trace_pixel_ptr) {
02045         trace_opcTL = top_opc;
02046         
02047         
02048     }
02049 #endif
02050 ;
02051                 
02052     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02053     
02054     ;
02055                 
02056        acc_opc += bot_opc * wgtBR;
02057        ;
02058        
02059 #ifdef DEBUG
02060     if (ipixel == trace_pixel_ptr) {
02061         trace_opcBR = bot_opc;
02062         
02063         
02064     }
02065 #endif
02066 ;
02067                 
02068         COUNT_RESAMPLE;
02069         if (acc_opc > min_opacity) {
02070             COUNT_COMPOSITE;
02071             iopc = ipixel->opcflt;
02072 #           ifndef SKIP_ERT
02073                 ASSERT(iopc < max_opacity);
02074 #           endif
02075             iopc_inv = (float)1. - iopc;
02076             ;
02077             iopc += acc_opc * iopc_inv;
02078             ipixel->opcflt = iopc;
02079             
02080 #ifdef DEBUG
02081     if (ipixel == trace_pixel_ptr) {
02082 #ifdef COMPUTE_SHADOW_BUFFER
02083         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02084 #else
02085         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02086 #endif
02087         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02088         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02089         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02090         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02091         printf("  %3.0f %3.0f\n", iopc*255., 
02092                0);
02093         
02094         
02095     }
02096 #endif /* DEBUG */
02097 ;
02098 #           ifndef SKIP_ERT
02099                 if (iopc >= max_opacity) {
02100                     ASSERT(ipixel->lnk == 0);
02101                     ipixel->lnk = 1;
02102                 }
02103 #           endif
02104         };
02105                 ipixel += 1;
02106                 ;
02107                 botRLEdata += 1 * voxel_istride;
02108                 count--;
02109                 SET_VOXELS_LOADED;
02110 
02111                 /* do the rest of the pixels in this run;
02112                    bottom-left and bottom-right voxels contribute */
02113                 while (count > 0) {
02114                     if (PIXEL_IS_OPAQUE(ipixel))
02115                         break;
02116                     if (!voxels_loaded) {
02117                         
02118     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02119     
02120     ;
02121                     }
02122                     
02123 #ifdef DEBUG
02124     if (ipixel == trace_pixel_ptr) {
02125         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02126         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02127         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02128         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02129         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02130     }
02131 #endif
02132 ;
02133                     
02134        acc_opc = bot_opc * wgtBL;
02135        ;
02136        
02137 #ifdef DEBUG
02138     if (ipixel == trace_pixel_ptr) {
02139         trace_opcBL = bot_opc;
02140         
02141         
02142     }
02143 #endif
02144 ;
02145                     
02146     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02147     
02148     ;
02149                     
02150        acc_opc += bot_opc * wgtBR;
02151        ;
02152        
02153 #ifdef DEBUG
02154     if (ipixel == trace_pixel_ptr) {
02155         trace_opcBR = bot_opc;
02156         
02157         
02158     }
02159 #endif
02160 ;
02161                     
02162         COUNT_RESAMPLE;
02163         if (acc_opc > min_opacity) {
02164             COUNT_COMPOSITE;
02165             iopc = ipixel->opcflt;
02166 #           ifndef SKIP_ERT
02167                 ASSERT(iopc < max_opacity);
02168 #           endif
02169             iopc_inv = (float)1. - iopc;
02170             ;
02171             iopc += acc_opc * iopc_inv;
02172             ipixel->opcflt = iopc;
02173             
02174 #ifdef DEBUG
02175     if (ipixel == trace_pixel_ptr) {
02176 #ifdef COMPUTE_SHADOW_BUFFER
02177         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02178 #else
02179         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02180 #endif
02181         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02182         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02183         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02184         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02185         printf("  %3.0f %3.0f\n", iopc*255., 
02186                0);
02187         
02188         
02189     }
02190 #endif /* DEBUG */
02191 ;
02192 #           ifndef SKIP_ERT
02193                 if (iopc >= max_opacity) {
02194                     ASSERT(ipixel->lnk == 0);
02195                     ipixel->lnk = 1;
02196                 }
02197 #           endif
02198         };
02199                     ipixel += 1;
02200                     ;
02201                     botRLEdata += 1 * voxel_istride;
02202                     count--;
02203                     SET_VOXELS_LOADED;
02204                 }
02205                 break;
02206             case BOT_NONZERO__BOT_NONZERO:
02207                 /* do the pixels in this run; bottom-left and
02208                    bottom-right voxels contribute */
02209                 while (count > 0) {
02210                     if (PIXEL_IS_OPAQUE(ipixel))
02211                         break;
02212                     if (!voxels_loaded) {
02213                         
02214     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02215     
02216     ;
02217                     }
02218                     
02219 #ifdef DEBUG
02220     if (ipixel == trace_pixel_ptr) {
02221         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02222         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02223         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02224         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02225         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02226     }
02227 #endif
02228 ;
02229                     
02230        acc_opc = bot_opc * wgtBL;
02231        ;
02232        
02233 #ifdef DEBUG
02234     if (ipixel == trace_pixel_ptr) {
02235         trace_opcBL = bot_opc;
02236         
02237         
02238     }
02239 #endif
02240 ;
02241                     
02242     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02243     
02244     ;
02245                     
02246        acc_opc += bot_opc * wgtBR;
02247        ;
02248        
02249 #ifdef DEBUG
02250     if (ipixel == trace_pixel_ptr) {
02251         trace_opcBR = bot_opc;
02252         
02253         
02254     }
02255 #endif
02256 ;
02257                     
02258         COUNT_RESAMPLE;
02259         if (acc_opc > min_opacity) {
02260             COUNT_COMPOSITE;
02261             iopc = ipixel->opcflt;
02262 #           ifndef SKIP_ERT
02263                 ASSERT(iopc < max_opacity);
02264 #           endif
02265             iopc_inv = (float)1. - iopc;
02266             ;
02267             iopc += acc_opc * iopc_inv;
02268             ipixel->opcflt = iopc;
02269             
02270 #ifdef DEBUG
02271     if (ipixel == trace_pixel_ptr) {
02272 #ifdef COMPUTE_SHADOW_BUFFER
02273         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02274 #else
02275         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02276 #endif
02277         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02278         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02279         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02280         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02281         printf("  %3.0f %3.0f\n", iopc*255., 
02282                0);
02283         
02284         
02285     }
02286 #endif /* DEBUG */
02287 ;
02288 #           ifndef SKIP_ERT
02289                 if (iopc >= max_opacity) {
02290                     ASSERT(ipixel->lnk == 0);
02291                     ipixel->lnk = 1;
02292                 }
02293 #           endif
02294         };
02295                     ipixel += 1;
02296                     ;
02297                     botRLEdata += 1 * voxel_istride;
02298                     count--;
02299                     SET_VOXELS_LOADED;
02300                 }
02301                 break;
02302             case ALL_NONZERO__BOT_NONZERO:
02303                 /* first pixel: top-left, bottom-left and bottom-right
02304                    voxels contribute */
02305                 if (!voxels_loaded) {
02306                     
02307     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02308     
02309     ;
02310                     
02311     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02312     
02313     ;
02314                 }
02315                 
02316 #ifdef DEBUG
02317     if (ipixel == trace_pixel_ptr) {
02318         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02319         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02320         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02321         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02322         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02323     }
02324 #endif
02325 ;
02326                 
02327        acc_opc = top_opc * wgtTL;
02328        ;
02329        
02330 #ifdef DEBUG
02331     if (ipixel == trace_pixel_ptr) {
02332         trace_opcTL = top_opc;
02333         
02334         
02335     }
02336 #endif
02337 ;
02338                 
02339        acc_opc += bot_opc * wgtBL;
02340        ;
02341        
02342 #ifdef DEBUG
02343     if (ipixel == trace_pixel_ptr) {
02344         trace_opcBL = bot_opc;
02345         
02346         
02347     }
02348 #endif
02349 ;
02350                 
02351     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02352     
02353     ;
02354                 
02355        acc_opc += bot_opc * wgtBR;
02356        ;
02357        
02358 #ifdef DEBUG
02359     if (ipixel == trace_pixel_ptr) {
02360         trace_opcBR = bot_opc;
02361         
02362         
02363     }
02364 #endif
02365 ;
02366                 
02367         COUNT_RESAMPLE;
02368         if (acc_opc > min_opacity) {
02369             COUNT_COMPOSITE;
02370             iopc = ipixel->opcflt;
02371 #           ifndef SKIP_ERT
02372                 ASSERT(iopc < max_opacity);
02373 #           endif
02374             iopc_inv = (float)1. - iopc;
02375             ;
02376             iopc += acc_opc * iopc_inv;
02377             ipixel->opcflt = iopc;
02378             
02379 #ifdef DEBUG
02380     if (ipixel == trace_pixel_ptr) {
02381 #ifdef COMPUTE_SHADOW_BUFFER
02382         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02383 #else
02384         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02385 #endif
02386         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02387         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02388         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02389         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02390         printf("  %3.0f %3.0f\n", iopc*255., 
02391                0);
02392         
02393         
02394     }
02395 #endif /* DEBUG */
02396 ;
02397 #           ifndef SKIP_ERT
02398                 if (iopc >= max_opacity) {
02399                     ASSERT(ipixel->lnk == 0);
02400                     ipixel->lnk = 1;
02401                 }
02402 #           endif
02403         };
02404                 ipixel += 1;
02405                 ;
02406                 botRLEdata += 1 * voxel_istride;
02407                 count--;
02408                 SET_VOXELS_LOADED;
02409 
02410                 /* do the rest of the pixels in this run;
02411                    bottom-left and bottom-right voxels contribute */
02412                 while (count > 0) {
02413                     if (PIXEL_IS_OPAQUE(ipixel))
02414                         break;
02415                     if (!voxels_loaded) {
02416                         
02417     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02418     
02419     ;
02420                     }
02421                     
02422 #ifdef DEBUG
02423     if (ipixel == trace_pixel_ptr) {
02424         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02425         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02426         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02427         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02428         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02429     }
02430 #endif
02431 ;
02432                     
02433        acc_opc = bot_opc * wgtBL;
02434        ;
02435        
02436 #ifdef DEBUG
02437     if (ipixel == trace_pixel_ptr) {
02438         trace_opcBL = bot_opc;
02439         
02440         
02441     }
02442 #endif
02443 ;
02444                     
02445     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02446     
02447     ;
02448                     
02449        acc_opc += bot_opc * wgtBR;
02450        ;
02451        
02452 #ifdef DEBUG
02453     if (ipixel == trace_pixel_ptr) {
02454         trace_opcBR = bot_opc;
02455         
02456         
02457     }
02458 #endif
02459 ;
02460                     
02461         COUNT_RESAMPLE;
02462         if (acc_opc > min_opacity) {
02463             COUNT_COMPOSITE;
02464             iopc = ipixel->opcflt;
02465 #           ifndef SKIP_ERT
02466                 ASSERT(iopc < max_opacity);
02467 #           endif
02468             iopc_inv = (float)1. - iopc;
02469             ;
02470             iopc += acc_opc * iopc_inv;
02471             ipixel->opcflt = iopc;
02472             
02473 #ifdef DEBUG
02474     if (ipixel == trace_pixel_ptr) {
02475 #ifdef COMPUTE_SHADOW_BUFFER
02476         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02477 #else
02478         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02479 #endif
02480         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02481         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02482         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02483         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02484         printf("  %3.0f %3.0f\n", iopc*255., 
02485                0);
02486         
02487         
02488     }
02489 #endif /* DEBUG */
02490 ;
02491 #           ifndef SKIP_ERT
02492                 if (iopc >= max_opacity) {
02493                     ASSERT(ipixel->lnk == 0);
02494                     ipixel->lnk = 1;
02495                 }
02496 #           endif
02497         };
02498                     ipixel += 1;
02499                     ;
02500                     botRLEdata += 1 * voxel_istride;
02501                     count--;
02502                     SET_VOXELS_LOADED;
02503                 }
02504                 break;
02505             case ALL_ZERO__ALL_NONZERO:
02506                 /* first pixel: top-right and bottom-right voxels contribute */
02507                 
02508     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02509     
02510     ;
02511                 
02512     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02513     
02514     ;
02515                 
02516 #ifdef DEBUG
02517     if (ipixel == trace_pixel_ptr) {
02518         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02519         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02520         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02521         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02522         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02523     }
02524 #endif
02525 ;
02526                 
02527        acc_opc = top_opc * wgtTR;
02528        ;
02529        
02530 #ifdef DEBUG
02531     if (ipixel == trace_pixel_ptr) {
02532         trace_opcTR = top_opc;
02533         
02534         
02535     }
02536 #endif
02537 ;
02538                 
02539        acc_opc += bot_opc * wgtBR;
02540        ;
02541        
02542 #ifdef DEBUG
02543     if (ipixel == trace_pixel_ptr) {
02544         trace_opcBR = bot_opc;
02545         
02546         
02547     }
02548 #endif
02549 ;
02550                 
02551         COUNT_RESAMPLE;
02552         if (acc_opc > min_opacity) {
02553             COUNT_COMPOSITE;
02554             iopc = ipixel->opcflt;
02555 #           ifndef SKIP_ERT
02556                 ASSERT(iopc < max_opacity);
02557 #           endif
02558             iopc_inv = (float)1. - iopc;
02559             ;
02560             iopc += acc_opc * iopc_inv;
02561             ipixel->opcflt = iopc;
02562             
02563 #ifdef DEBUG
02564     if (ipixel == trace_pixel_ptr) {
02565 #ifdef COMPUTE_SHADOW_BUFFER
02566         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02567 #else
02568         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02569 #endif
02570         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02571         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02572         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02573         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02574         printf("  %3.0f %3.0f\n", iopc*255., 
02575                0);
02576         
02577         
02578     }
02579 #endif /* DEBUG */
02580 ;
02581 #           ifndef SKIP_ERT
02582                 if (iopc >= max_opacity) {
02583                     ASSERT(ipixel->lnk == 0);
02584                     ipixel->lnk = 1;
02585                 }
02586 #           endif
02587         };
02588                 ipixel += 1;
02589                 topRLEdata += 1 * voxel_istride;
02590                 botRLEdata += 1 * voxel_istride;
02591                 count--;
02592                 SET_VOXELS_LOADED;
02593 
02594                 /* do the rest of the pixels in this run;
02595                    all four voxels contribute */
02596                 while (count > 0) {
02597                     if (PIXEL_IS_OPAQUE(ipixel))
02598                         break;
02599                     if (!voxels_loaded) {
02600                         
02601     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02602     
02603     ;
02604                         
02605     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02606     
02607     ;
02608                     }
02609                     
02610 #ifdef DEBUG
02611     if (ipixel == trace_pixel_ptr) {
02612         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02613         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02614         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02615         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02616         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02617     }
02618 #endif
02619 ;
02620                     
02621        acc_opc = top_opc * wgtTL;
02622        ;
02623        
02624 #ifdef DEBUG
02625     if (ipixel == trace_pixel_ptr) {
02626         trace_opcTL = top_opc;
02627         
02628         
02629     }
02630 #endif
02631 ;
02632                     
02633        acc_opc += bot_opc * wgtBL;
02634        ;
02635        
02636 #ifdef DEBUG
02637     if (ipixel == trace_pixel_ptr) {
02638         trace_opcBL = bot_opc;
02639         
02640         
02641     }
02642 #endif
02643 ;
02644                     
02645     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02646     
02647     ;
02648                     
02649     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02650     
02651     ;
02652                     
02653        acc_opc += top_opc * wgtTR;
02654        ;
02655        
02656 #ifdef DEBUG
02657     if (ipixel == trace_pixel_ptr) {
02658         trace_opcTR = top_opc;
02659         
02660         
02661     }
02662 #endif
02663 ;
02664                     
02665        acc_opc += bot_opc * wgtBR;
02666        ;
02667        
02668 #ifdef DEBUG
02669     if (ipixel == trace_pixel_ptr) {
02670         trace_opcBR = bot_opc;
02671         
02672         
02673     }
02674 #endif
02675 ;
02676                     
02677         COUNT_RESAMPLE;
02678         if (acc_opc > min_opacity) {
02679             COUNT_COMPOSITE;
02680             iopc = ipixel->opcflt;
02681 #           ifndef SKIP_ERT
02682                 ASSERT(iopc < max_opacity);
02683 #           endif
02684             iopc_inv = (float)1. - iopc;
02685             ;
02686             iopc += acc_opc * iopc_inv;
02687             ipixel->opcflt = iopc;
02688             
02689 #ifdef DEBUG
02690     if (ipixel == trace_pixel_ptr) {
02691 #ifdef COMPUTE_SHADOW_BUFFER
02692         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02693 #else
02694         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02695 #endif
02696         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02697         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02698         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02699         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02700         printf("  %3.0f %3.0f\n", iopc*255., 
02701                0);
02702         
02703         
02704     }
02705 #endif /* DEBUG */
02706 ;
02707 #           ifndef SKIP_ERT
02708                 if (iopc >= max_opacity) {
02709                     ASSERT(ipixel->lnk == 0);
02710                     ipixel->lnk = 1;
02711                 }
02712 #           endif
02713         };
02714                     ipixel += 1;
02715                     topRLEdata += 1 * voxel_istride;
02716                     botRLEdata += 1 * voxel_istride;
02717                     count--;
02718                     SET_VOXELS_LOADED;
02719                 }
02720                 break;
02721             case TOP_NONZERO__ALL_NONZERO:
02722                 /* first pixel: top-left, top-right and bottom-right
02723                    voxels contribute */
02724                 if (!voxels_loaded) {
02725                     
02726     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02727     
02728     ;
02729                 }
02730                 
02731 #ifdef DEBUG
02732     if (ipixel == trace_pixel_ptr) {
02733         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02734         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02735         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02736         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02737         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02738     }
02739 #endif
02740 ;
02741                 
02742        acc_opc = top_opc * wgtTL;
02743        ;
02744        
02745 #ifdef DEBUG
02746     if (ipixel == trace_pixel_ptr) {
02747         trace_opcTL = top_opc;
02748         
02749         
02750     }
02751 #endif
02752 ;
02753                 
02754     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02755     
02756     ;
02757                 
02758     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02759     
02760     ;
02761                 
02762        acc_opc += top_opc * wgtTR;
02763        ;
02764        
02765 #ifdef DEBUG
02766     if (ipixel == trace_pixel_ptr) {
02767         trace_opcTR = top_opc;
02768         
02769         
02770     }
02771 #endif
02772 ;
02773                 
02774        acc_opc += bot_opc * wgtBR;
02775        ;
02776        
02777 #ifdef DEBUG
02778     if (ipixel == trace_pixel_ptr) {
02779         trace_opcBR = bot_opc;
02780         
02781         
02782     }
02783 #endif
02784 ;
02785                 
02786         COUNT_RESAMPLE;
02787         if (acc_opc > min_opacity) {
02788             COUNT_COMPOSITE;
02789             iopc = ipixel->opcflt;
02790 #           ifndef SKIP_ERT
02791                 ASSERT(iopc < max_opacity);
02792 #           endif
02793             iopc_inv = (float)1. - iopc;
02794             ;
02795             iopc += acc_opc * iopc_inv;
02796             ipixel->opcflt = iopc;
02797             
02798 #ifdef DEBUG
02799     if (ipixel == trace_pixel_ptr) {
02800 #ifdef COMPUTE_SHADOW_BUFFER
02801         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02802 #else
02803         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02804 #endif
02805         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02806         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02807         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02808         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02809         printf("  %3.0f %3.0f\n", iopc*255., 
02810                0);
02811         
02812         
02813     }
02814 #endif /* DEBUG */
02815 ;
02816 #           ifndef SKIP_ERT
02817                 if (iopc >= max_opacity) {
02818                     ASSERT(ipixel->lnk == 0);
02819                     ipixel->lnk = 1;
02820                 }
02821 #           endif
02822         };
02823                 ipixel += 1;
02824                 topRLEdata += 1 * voxel_istride;
02825                 botRLEdata += 1 * voxel_istride;
02826                 count--;
02827                 SET_VOXELS_LOADED;
02828                     
02829                 /* do the rest of the pixels in this run;
02830                    all four voxels contribute */
02831                 while (count > 0) {
02832                     if (PIXEL_IS_OPAQUE(ipixel))
02833                         break;
02834                     if (!voxels_loaded) {
02835                         
02836     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02837     
02838     ;
02839                         
02840     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02841     
02842     ;
02843                     }
02844                     
02845 #ifdef DEBUG
02846     if (ipixel == trace_pixel_ptr) {
02847         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02848         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02849         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02850         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02851         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02852     }
02853 #endif
02854 ;
02855                     
02856        acc_opc = top_opc * wgtTL;
02857        ;
02858        
02859 #ifdef DEBUG
02860     if (ipixel == trace_pixel_ptr) {
02861         trace_opcTL = top_opc;
02862         
02863         
02864     }
02865 #endif
02866 ;
02867                     
02868        acc_opc += bot_opc * wgtBL;
02869        ;
02870        
02871 #ifdef DEBUG
02872     if (ipixel == trace_pixel_ptr) {
02873         trace_opcBL = bot_opc;
02874         
02875         
02876     }
02877 #endif
02878 ;
02879                     
02880     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02881     
02882     ;
02883                     
02884     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02885     
02886     ;
02887                     
02888        acc_opc += top_opc * wgtTR;
02889        ;
02890        
02891 #ifdef DEBUG
02892     if (ipixel == trace_pixel_ptr) {
02893         trace_opcTR = top_opc;
02894         
02895         
02896     }
02897 #endif
02898 ;
02899                     
02900        acc_opc += bot_opc * wgtBR;
02901        ;
02902        
02903 #ifdef DEBUG
02904     if (ipixel == trace_pixel_ptr) {
02905         trace_opcBR = bot_opc;
02906         
02907         
02908     }
02909 #endif
02910 ;
02911                     
02912         COUNT_RESAMPLE;
02913         if (acc_opc > min_opacity) {
02914             COUNT_COMPOSITE;
02915             iopc = ipixel->opcflt;
02916 #           ifndef SKIP_ERT
02917                 ASSERT(iopc < max_opacity);
02918 #           endif
02919             iopc_inv = (float)1. - iopc;
02920             ;
02921             iopc += acc_opc * iopc_inv;
02922             ipixel->opcflt = iopc;
02923             
02924 #ifdef DEBUG
02925     if (ipixel == trace_pixel_ptr) {
02926 #ifdef COMPUTE_SHADOW_BUFFER
02927         printf("{%3d}  %3d %3d", k, icount-i-count, j);
02928 #else
02929         printf("[%3d]  %3d %3d", k, icount-i-count, j);
02930 #endif
02931         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02932         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02933         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02934         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02935         printf("  %3.0f %3.0f\n", iopc*255., 
02936                0);
02937         
02938         
02939     }
02940 #endif /* DEBUG */
02941 ;
02942 #           ifndef SKIP_ERT
02943                 if (iopc >= max_opacity) {
02944                     ASSERT(ipixel->lnk == 0);
02945                     ipixel->lnk = 1;
02946                 }
02947 #           endif
02948         };
02949                     ipixel += 1;
02950                     topRLEdata += 1 * voxel_istride;
02951                     botRLEdata += 1 * voxel_istride;
02952                     count--;
02953                     SET_VOXELS_LOADED;
02954                 }
02955                 break;
02956             case BOT_NONZERO__ALL_NONZERO:
02957                 /* first pixel: bottom-left, top-right and bottom-right
02958                    voxels contribute */
02959                 if (!voxels_loaded) {
02960                     
02961     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02962     
02963     ;
02964                 }
02965                 
02966 #ifdef DEBUG
02967     if (ipixel == trace_pixel_ptr) {
02968         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02969         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02970         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02971         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02972         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02973     }
02974 #endif
02975 ;
02976                 
02977        acc_opc = bot_opc * wgtBL;
02978        ;
02979        
02980 #ifdef DEBUG
02981     if (ipixel == trace_pixel_ptr) {
02982         trace_opcBL = bot_opc;
02983         
02984         
02985     }
02986 #endif
02987 ;
02988                 
02989     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02990     
02991     ;
02992                 
02993     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02994     
02995     ;
02996                 
02997        acc_opc += top_opc * wgtTR;
02998        ;
02999        
03000 #ifdef DEBUG
03001     if (ipixel == trace_pixel_ptr) {
03002         trace_opcTR = top_opc;
03003         
03004         
03005     }
03006 #endif
03007 ;
03008                 
03009        acc_opc += bot_opc * wgtBR;
03010        ;
03011        
03012 #ifdef DEBUG
03013     if (ipixel == trace_pixel_ptr) {
03014         trace_opcBR = bot_opc;
03015         
03016         
03017     }
03018 #endif
03019 ;
03020                 
03021         COUNT_RESAMPLE;
03022         if (acc_opc > min_opacity) {
03023             COUNT_COMPOSITE;
03024             iopc = ipixel->opcflt;
03025 #           ifndef SKIP_ERT
03026                 ASSERT(iopc < max_opacity);
03027 #           endif
03028             iopc_inv = (float)1. - iopc;
03029             ;
03030             iopc += acc_opc * iopc_inv;
03031             ipixel->opcflt = iopc;
03032             
03033 #ifdef DEBUG
03034     if (ipixel == trace_pixel_ptr) {
03035 #ifdef COMPUTE_SHADOW_BUFFER
03036         printf("{%3d}  %3d %3d", k, icount-i-count, j);
03037 #else
03038         printf("[%3d]  %3d %3d", k, icount-i-count, j);
03039 #endif
03040         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03041         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03042         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03043         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03044         printf("  %3.0f %3.0f\n", iopc*255., 
03045                0);
03046         
03047         
03048     }
03049 #endif /* DEBUG */
03050 ;
03051 #           ifndef SKIP_ERT
03052                 if (iopc >= max_opacity) {
03053                     ASSERT(ipixel->lnk == 0);
03054                     ipixel->lnk = 1;
03055                 }
03056 #           endif
03057         };
03058                 ipixel += 1;
03059                 topRLEdata += 1 * voxel_istride;
03060                 botRLEdata += 1 * voxel_istride;
03061                 count--;
03062                 SET_VOXELS_LOADED;
03063                     
03064                 /* do the rest of the pixels in this run;
03065                    all four voxels contribute */
03066                 while (count > 0) {
03067                     if (PIXEL_IS_OPAQUE(ipixel))
03068                         break;
03069                     if (!voxels_loaded) {
03070                         
03071     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03072     
03073     ;
03074                         
03075     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03076     
03077     ;
03078                     }
03079                     
03080 #ifdef DEBUG
03081     if (ipixel == trace_pixel_ptr) {
03082         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03083         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03084         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03085         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03086         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03087     }
03088 #endif
03089 ;
03090                     
03091        acc_opc = top_opc * wgtTL;
03092        ;
03093        
03094 #ifdef DEBUG
03095     if (ipixel == trace_pixel_ptr) {
03096         trace_opcTL = top_opc;
03097         
03098         
03099     }
03100 #endif
03101 ;
03102                     
03103        acc_opc += bot_opc * wgtBL;
03104        ;
03105        
03106 #ifdef DEBUG
03107     if (ipixel == trace_pixel_ptr) {
03108         trace_opcBL = bot_opc;
03109         
03110         
03111     }
03112 #endif
03113 ;
03114                     
03115     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03116     
03117     ;
03118                     
03119     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03120     
03121     ;
03122                     
03123        acc_opc += top_opc * wgtTR;
03124        ;
03125        
03126 #ifdef DEBUG
03127     if (ipixel == trace_pixel_ptr) {
03128         trace_opcTR = top_opc;
03129         
03130         
03131     }
03132 #endif
03133 ;
03134                     
03135        acc_opc += bot_opc * wgtBR;
03136        ;
03137        
03138 #ifdef DEBUG
03139     if (ipixel == trace_pixel_ptr) {
03140         trace_opcBR = bot_opc;
03141         
03142         
03143     }
03144 #endif
03145 ;
03146                     
03147         COUNT_RESAMPLE;
03148         if (acc_opc > min_opacity) {
03149             COUNT_COMPOSITE;
03150             iopc = ipixel->opcflt;
03151 #           ifndef SKIP_ERT
03152                 ASSERT(iopc < max_opacity);
03153 #           endif
03154             iopc_inv = (float)1. - iopc;
03155             ;
03156             iopc += acc_opc * iopc_inv;
03157             ipixel->opcflt = iopc;
03158             
03159 #ifdef DEBUG
03160     if (ipixel == trace_pixel_ptr) {
03161 #ifdef COMPUTE_SHADOW_BUFFER
03162         printf("{%3d}  %3d %3d", k, icount-i-count, j);
03163 #else
03164         printf("[%3d]  %3d %3d", k, icount-i-count, j);
03165 #endif
03166         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03167         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03168         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03169         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03170         printf("  %3.0f %3.0f\n", iopc*255., 
03171                0);
03172         
03173         
03174     }
03175 #endif /* DEBUG */
03176 ;
03177 #           ifndef SKIP_ERT
03178                 if (iopc >= max_opacity) {
03179                     ASSERT(ipixel->lnk == 0);
03180                     ipixel->lnk = 1;
03181                 }
03182 #           endif
03183         };
03184                     ipixel += 1;
03185                     topRLEdata += 1 * voxel_istride;
03186                     botRLEdata += 1 * voxel_istride;
03187                     count--;
03188                     SET_VOXELS_LOADED;
03189                 }
03190                 break;
03191             case ALL_NONZERO__ALL_NONZERO:
03192                 /* do the pixels in this run; all four voxels contribute */
03193                 while (count > 0) {
03194                     if (PIXEL_IS_OPAQUE(ipixel))
03195                         break;
03196                     if (!voxels_loaded) {
03197                         
03198     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03199     
03200     ;
03201                         
03202     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03203     
03204     ;
03205                     }
03206                     
03207 #ifdef DEBUG
03208     if (ipixel == trace_pixel_ptr) {
03209         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03210         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03211         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03212         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03213         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03214     }
03215 #endif
03216 ;
03217                     
03218        acc_opc = top_opc * wgtTL;
03219        ;
03220        
03221 #ifdef DEBUG
03222     if (ipixel == trace_pixel_ptr) {
03223         trace_opcTL = top_opc;
03224         
03225         
03226     }
03227 #endif
03228 ;
03229                     
03230        acc_opc += bot_opc * wgtBL;
03231        ;
03232        
03233 #ifdef DEBUG
03234     if (ipixel == trace_pixel_ptr) {
03235         trace_opcBL = bot_opc;
03236         
03237         
03238     }
03239 #endif
03240 ;
03241                     
03242     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03243     
03244     ;
03245                     
03246     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03247     
03248     ;
03249                     
03250        acc_opc += top_opc * wgtTR;
03251        ;
03252        
03253 #ifdef DEBUG
03254     if (ipixel == trace_pixel_ptr) {
03255         trace_opcTR = top_opc;
03256         
03257         
03258     }
03259 #endif
03260 ;
03261                     
03262        acc_opc += bot_opc * wgtBR;
03263        ;
03264        
03265 #ifdef DEBUG
03266     if (ipixel == trace_pixel_ptr) {
03267         trace_opcBR = bot_opc;
03268         
03269         
03270     }
03271 #endif
03272 ;
03273                     
03274         COUNT_RESAMPLE;
03275         if (acc_opc > min_opacity) {
03276             COUNT_COMPOSITE;
03277             iopc = ipixel->opcflt;
03278 #           ifndef SKIP_ERT
03279                 ASSERT(iopc < max_opacity);
03280 #           endif
03281             iopc_inv = (float)1. - iopc;
03282             ;
03283             iopc += acc_opc * iopc_inv;
03284             ipixel->opcflt = iopc;
03285             
03286 #ifdef DEBUG
03287     if (ipixel == trace_pixel_ptr) {
03288 #ifdef COMPUTE_SHADOW_BUFFER
03289         printf("{%3d}  %3d %3d", k, icount-i-count, j);
03290 #else
03291         printf("[%3d]  %3d %3d", k, icount-i-count, j);
03292 #endif
03293         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03294         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03295         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03296         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03297         printf("  %3.0f %3.0f\n", iopc*255., 
03298                0);
03299         
03300         
03301     }
03302 #endif /* DEBUG */
03303 ;
03304 #           ifndef SKIP_ERT
03305                 if (iopc >= max_opacity) {
03306                     ASSERT(ipixel->lnk == 0);
03307                     ipixel->lnk = 1;
03308                 }
03309 #           endif
03310         };
03311                     ipixel += 1;
03312                     topRLEdata += 1 * voxel_istride;
03313                     botRLEdata += 1 * voxel_istride;
03314                     count--;
03315                     SET_VOXELS_LOADED;
03316                 }
03317                 break;
03318             default:
03319                 VPBug("illegal value for run states in compositing loop");
03320             }
03321 #else /* UNROLL_RUN_LOOP */
03322             /* this run contains pixels, so process them */
03323             while (count > 0) {
03324                 if (last_run_state == ALL_ZERO && run_state == ALL_ZERO) {
03325                     ipixel += count;
03326                     if (i != -1) {
03327                         ;
03328                         ;
03329                     }
03330                     count = 0;
03331                     break;
03332                 }
03333                 if (ipixel->lnk != 0)
03334                     break;
03335                 
03336 #ifdef DEBUG
03337     if (ipixel == trace_pixel_ptr) {
03338         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03339         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03340         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03341         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03342         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03343     }
03344 #endif
03345 ;
03346                 
03347        acc_opc = 0;
03348        ;
03349                 if (last_run_state & TOP_NONZERO) {
03350                     if (!voxels_loaded) {
03351                         
03352     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03353     
03354     ;
03355                     }
03356                     
03357        acc_opc += top_opc * wgtTL;
03358        ;
03359        
03360 #ifdef DEBUG
03361     if (ipixel == trace_pixel_ptr) {
03362         trace_opcTL = top_opc;
03363         
03364         
03365     }
03366 #endif
03367 ;
03368                 }
03369                 if (last_run_state & BOT_NONZERO) {
03370                     if (!voxels_loaded) {
03371                         
03372     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03373     
03374     ;
03375                     }
03376                     
03377        acc_opc += bot_opc * wgtBL;
03378        ;
03379        
03380 #ifdef DEBUG
03381     if (ipixel == trace_pixel_ptr) {
03382         trace_opcBL = bot_opc;
03383         
03384         
03385     }
03386 #endif
03387 ;
03388                 }
03389                 if (run_state & TOP_NONZERO) {
03390                     
03391     top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03392     
03393     ;
03394                     
03395        acc_opc += top_opc * wgtTR;
03396        ;
03397        
03398 #ifdef DEBUG
03399     if (ipixel == trace_pixel_ptr) {
03400         trace_opcTR = top_opc;
03401         
03402         
03403     }
03404 #endif
03405 ;
03406                     topRLEdata += 1 * voxel_istride;
03407                 } else {
03408                     if (i != -1) {
03409                         ;
03410                     }
03411                 }
03412                 if (run_state & BOT_NONZERO) {
03413                     
03414     bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03415     
03416     ;
03417                     
03418        acc_opc += bot_opc * wgtBR;
03419        ;
03420        
03421 #ifdef DEBUG
03422     if (ipixel == trace_pixel_ptr) {
03423         trace_opcBR = bot_opc;
03424         
03425         
03426     }
03427 #endif
03428 ;
03429                     botRLEdata += 1 * voxel_istride;
03430                 } else {
03431                     if (i != -1) {
03432                         ;
03433                     }
03434                 }
03435                 
03436         COUNT_RESAMPLE;
03437         if (acc_opc > min_opacity) {
03438             COUNT_COMPOSITE;
03439             iopc = ipixel->opcflt;
03440 #           ifndef SKIP_ERT
03441                 ASSERT(iopc < max_opacity);
03442 #           endif
03443             iopc_inv = (float)1. - iopc;
03444             ;
03445             iopc += acc_opc * iopc_inv;
03446             ipixel->opcflt = iopc;
03447             
03448 #ifdef DEBUG
03449     if (ipixel == trace_pixel_ptr) {
03450 #ifdef COMPUTE_SHADOW_BUFFER
03451         printf("{%3d}  %3d %3d", k, icount-i-count, j);
03452 #else
03453         printf("[%3d]  %3d %3d", k, icount-i-count, j);
03454 #endif
03455         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03456         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03457         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03458         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03459         printf("  %3.0f %3.0f\n", iopc*255., 
03460                0);
03461         
03462         
03463     }
03464 #endif /* DEBUG */
03465 ;
03466 #           ifndef SKIP_ERT
03467                 if (iopc >= max_opacity) {
03468                     ASSERT(ipixel->lnk == 0);
03469                     ipixel->lnk = 1;
03470                 }
03471 #           endif
03472         };
03473                 ipixel += 1;
03474                 count--;
03475                 SET_VOXELS_LOADED;
03476                 last_run_state = run_state;
03477             }
03478 #endif /* UNROLL_RUN_LOOP */
03479 
03480             GET_HIRES_TIME(vpc, t1);
03481             STORE_HIRES_TIME(vpc, VPTIMER_PROCESS_VOXELS, t0, t1);
03482             COPY_HIRES_TIME(t0, t1);
03483 
03484             if (count > 0) {
03485                 Debug((vpc, VPDEBUG_COMPOSITE, "Backup(%d)\n", count));
03486                 toprun_count += count;
03487                 botrun_count += count;
03488                 i += count;
03489             }
03490 #endif /* SKIP_COMPOSITE */
03491 
03492             /***********************************************************
03493              * Go on to next voxel run.
03494              ***********************************************************/
03495 
03496             last_run_state = run_state;
03497         } /* while (i > 0) */
03498 
03499         /***************************************************************
03500          * Finish processing voxel scanline and go on to next one.
03501          ***************************************************************/
03502 
03503 #ifdef UNROLL_RUN_LOOP
03504         ASSERT(i == 0);
03505 #else
03506         ASSERT(i == -1);
03507 #endif
03508 
03509 #ifndef SKIP_COMPOSITE
03510 #ifdef UNROLL_RUN_LOOP
03511         /* do the last pixel (to the right of the last voxel) */
03512         if (last_run_state != ALL_ZERO && !PIXEL_IS_OPAQUE(ipixel)) {
03513             /* last voxels are nonzero and the pixel is not opaque yet
03514                so there is work to be done */
03515             Debug((vpc, VPDEBUG_COMPOSITE, "Run(1)End\n"));
03516             switch (last_run_state) {
03517             case TOP_NONZERO:
03518                 /* only the top-left voxel contributes */
03519                 if (!voxels_loaded) {
03520                     
03521     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03522     
03523     ;
03524                 }
03525                 
03526 #ifdef DEBUG
03527     if (ipixel == trace_pixel_ptr) {
03528         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03529         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03530         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03531         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03532         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03533     }
03534 #endif
03535 ;
03536                 
03537        acc_opc = top_opc * wgtTL;
03538        ;
03539        
03540 #ifdef DEBUG
03541     if (ipixel == trace_pixel_ptr) {
03542         trace_opcTL = top_opc;
03543         
03544         
03545     }
03546 #endif
03547 ;
03548                 
03549         COUNT_RESAMPLE;
03550         if (acc_opc > min_opacity) {
03551             COUNT_COMPOSITE;
03552             iopc = ipixel->opcflt;
03553 #           ifndef SKIP_ERT
03554                 ASSERT(iopc < max_opacity);
03555 #           endif
03556             iopc_inv = (float)1. - iopc;
03557             ;
03558             iopc += acc_opc * iopc_inv;
03559             ipixel->opcflt = iopc;
03560             
03561 #ifdef DEBUG
03562     if (ipixel == trace_pixel_ptr) {
03563 #ifdef COMPUTE_SHADOW_BUFFER
03564         printf("{%3d}  %3d %3d", k, icount-i-count, j);
03565 #else
03566         printf("[%3d]  %3d %3d", k, icount-i-count, j);
03567 #endif
03568         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03569         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03570         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03571         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03572         printf("  %3.0f %3.0f\n", iopc*255., 
03573                0);
03574         
03575         
03576     }
03577 #endif /* DEBUG */
03578 ;
03579 #           ifndef SKIP_ERT
03580                 if (iopc >= max_opacity) {
03581                     ASSERT(ipixel->lnk == 0);
03582                     ipixel->lnk = 1;
03583                 }
03584 #           endif
03585         };
03586                 break;
03587             case BOT_NONZERO:
03588                 /* only the bottom left voxel contributes */
03589                 if (!voxels_loaded) {
03590                     
03591     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03592     
03593     ;
03594                 }
03595                 
03596 #ifdef DEBUG
03597     if (ipixel == trace_pixel_ptr) {
03598         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03599         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03600         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03601         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03602         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03603     }
03604 #endif
03605 ;
03606                 
03607        acc_opc = bot_opc * wgtBL;
03608        ;
03609        
03610 #ifdef DEBUG
03611     if (ipixel == trace_pixel_ptr) {
03612         trace_opcBL = bot_opc;
03613         
03614         
03615     }
03616 #endif
03617 ;
03618                 
03619         COUNT_RESAMPLE;
03620         if (acc_opc > min_opacity) {
03621             COUNT_COMPOSITE;
03622             iopc = ipixel->opcflt;
03623 #           ifndef SKIP_ERT
03624                 ASSERT(iopc < max_opacity);
03625 #           endif
03626             iopc_inv = (float)1. - iopc;
03627             ;
03628             iopc += acc_opc * iopc_inv;
03629             ipixel->opcflt = iopc;
03630             
03631 #ifdef DEBUG
03632     if (ipixel == trace_pixel_ptr) {
03633 #ifdef COMPUTE_SHADOW_BUFFER
03634         printf("{%3d}  %3d %3d", k, icount-i-count, j);
03635 #else
03636         printf("[%3d]  %3d %3d", k, icount-i-count, j);
03637 #endif
03638         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03639         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03640         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03641         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03642         printf("  %3.0f %3.0f\n", iopc*255., 
03643                0);
03644         
03645         
03646     }
03647 #endif /* DEBUG */
03648 ;
03649 #           ifndef SKIP_ERT
03650                 if (iopc >= max_opacity) {
03651                     ASSERT(ipixel->lnk == 0);
03652                     ipixel->lnk = 1;
03653                 }
03654 #           endif
03655         };
03656                 break;
03657             case ALL_NONZERO:
03658                 /* the top and bottom left voxels contribute */
03659                 if (!voxels_loaded) {
03660                     
03661     top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03662     
03663     ;
03664                     
03665     bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03666     
03667     ;
03668                 }
03669                 
03670 #ifdef DEBUG
03671     if (ipixel == trace_pixel_ptr) {
03672         trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03673         trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03674         trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03675         trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03676         trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03677     }
03678 #endif
03679 ;
03680                 
03681        acc_opc = top_opc * wgtTL;
03682        ;
03683        
03684 #ifdef DEBUG
03685     if (ipixel == trace_pixel_ptr) {
03686         trace_opcTL = top_opc;
03687         
03688         
03689     }
03690 #endif
03691 ;
03692                 
03693        acc_opc += bot_opc * wgtBL;
03694        ;
03695        
03696 #ifdef DEBUG
03697     if (ipixel == trace_pixel_ptr) {
03698         trace_opcBL = bot_opc;
03699         
03700         
03701     }
03702 #endif
03703 ;
03704                 
03705         COUNT_RESAMPLE;
03706         if (acc_opc > min_opacity) {
03707             COUNT_COMPOSITE;
03708             iopc = ipixel->opcflt;
03709 #           ifndef SKIP_ERT
03710                 ASSERT(iopc < max_opacity);
03711 #           endif
03712             iopc_inv = (float)1. - iopc;
03713             ;
03714             iopc += acc_opc * iopc_inv;
03715             ipixel->opcflt = iopc;
03716             
03717 #ifdef DEBUG
03718     if (ipixel == trace_pixel_ptr) {
03719 #ifdef COMPUTE_SHADOW_BUFFER
03720         printf("{%3d}  %3d %3d", k, icount-i-count, j);
03721 #else
03722         printf("[%3d]  %3d %3d", k, icount-i-count, j);
03723 #endif
03724         printf("  %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03725         printf("  %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03726         printf("  %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03727         printf("  %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03728         printf("  %3.0f %3.0f\n", iopc*255., 
03729                0);
03730         
03731         
03732     }
03733 #endif /* DEBUG */
03734 ;
03735 #           ifndef SKIP_ERT
03736                 if (iopc >= max_opacity) {
03737                     ASSERT(ipixel->lnk == 0);
03738                     ipixel->lnk = 1;
03739                 }
03740 #           endif
03741         };
03742                 break;
03743             default:
03744                 VPBug("illegal value for run state at end of scanline");
03745             }
03746         } else if (last_run_state == ALL_ZERO) {
03747             Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
03748         } else {
03749             Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
03750         }
03751 #endif /* UNROLL_RUN_LOOP */
03752 #endif /* SKIP_COMPOSITE */
03753 
03754 #ifndef UNROLL_RUN_LOOP
03755         run_state = final_run_state;
03756 #endif
03757         /* skip over any zero-length runs remaining in this scanline */
03758         if (j != 0 && ((run_state & 1) == 0)) {
03759             toprun_count = *topRLElen++;
03760             ASSERT(toprun_count == 0);
03761         }
03762         if (j != jcount && ((run_state & 2) == 0)) {
03763             botrun_count = *botRLElen++;
03764             ASSERT(botrun_count == 0);
03765         }
03766 
03767         /* go to next intermediate image scanline */
03768 #ifdef UNROLL_RUN_LOOP
03769         ipixel += intermediate_width - icount;
03770 #ifdef USE_SHADOW_BUFFER
03771         shadow_pixel += shadow_width - icount;
03772 #endif
03773 #else /* UNROLL_RUN_LOOP */
03774         ipixel += intermediate_width - (icount+1);
03775 #ifdef USE_SHADOW_BUFFER
03776         shadow_pixel += shadow_width - (icount+1);
03777 #endif
03778 #endif /* UNROLL_RUN_LOOP */
03779 
03780         Debug((vpc, VPDEBUG_COMPOSITE, "ScanDone\n"));
03781     } /* for j */
03782 
03783     /***************************************************************
03784      * Finish processing the voxel slice.
03785      ***************************************************************/
03786 
03787     GET_HIRES_TIME(vpc, t1);
03788     STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
03789 
03790     Debug((vpc, VPDEBUG_COMPOSITE, "SliceDone\n"));
03791 }
 

Powered by Plone

This site conforms to the following standards: