00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #include "vp_global.h"
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 #undef UNROLL_RUN_LOOP
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 #define CALLBACK
00094
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 #define RGB
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
00160 #define ALL_ZERO 0
00161 #define TOP_NONZERO 1
00162 #define BOT_NONZERO 2
00163 #define ALL_NONZERO 3
00164
00165
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
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 void
00223 VPCompAC3PB (vpc, icount, jcount, k, slice_depth_cueing_dbl, intimage,
00224 weightTLdbl, weightBLdbl, weightTRdbl, weightBRdbl,
00225 run_lengths, voxel_data )
00226 vpContext *vpc;
00227 int icount;
00228 int jcount;
00229 int k;
00230 double slice_depth_cueing_dbl;
00231 RGBIntPixel *intimage;
00232 double weightTLdbl;
00233 double weightBLdbl;
00234 double weightTRdbl;
00235 double weightBRdbl;
00236
00237 unsigned char *run_lengths;
00238 void *voxel_data;
00239
00240 {
00241 int i, j;
00242 RGBIntPixel *ipixel;
00243 RGBIntPixel *ipixel2;
00244 int update_interval;
00245 float iopc;
00246 float iopc_inv;
00247 float acc_opc;
00248 float top_opc, bot_opc;
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;
00255
00256 #define CLEAR_VOXELS_LOADED voxels_loaded = 0
00257 #define SET_VOXELS_LOADED voxels_loaded = 1
00258 #endif
00259 float wgtTL, wgtBL,
00260 wgtTR, wgtBR;
00261
00262
00263 unsigned char *topRLElen;
00264 unsigned char *botRLElen;
00265 char *topRLEdata;
00266 char *botRLEdata;
00267 int toprun_count;
00268 int botrun_count;
00269 int last_run_state;
00270 int run_state;
00271 int final_run_state;
00272 float min_opacity;
00273 float max_opacity;
00274 float slice_depth_cueing;
00275 float *opac_correct;
00276 int ert_skip_count;
00277 int intermediate_width;
00278 int count;
00279 float *shade_table;
00280 int norm_offset;
00281 int shade_index;
00282 float shade_factor;
00283
00284
00285 #ifdef MULTIPLE_MATERIALS
00286 float *weight_table;
00287 int wgt_offset;
00288 int weight_index;
00289 int m, num_materials;
00290 float weight1, weight2;
00291 #endif
00292
00293 #ifdef GRAYSCALE
00294 float acc_clr;
00295 float top_clr, bot_clr;
00296 #endif
00297
00298 #ifdef RGB
00299 float acc_rclr;
00300 float acc_gclr;
00301 float acc_bclr;
00302 float top_rclr;
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;
00312 #endif
00313
00314 #ifdef RAWVOLUME
00315 int use_octree;
00316 MMOctreeLevel level_stack[VP_MAX_OCTREE_LEVELS];
00317
00318 int scans_left;
00319 int best_view_axis;
00320 unsigned char runlen_buf1[VP_MAX_VOLUME_DIM];
00321 unsigned char runlen_buf2[VP_MAX_VOLUME_DIM];
00322 unsigned char *top_len_base;
00323 unsigned char *bot_len_base;
00324 int opac_param;
00325 float opacity;
00326 int opacity_int;
00327 int param0_offset;
00328 int param0_size;
00329 float *param0_table;
00330 int param1_offset;
00331 int param1_size;
00332 float *param1_table;
00333 int param2_offset;
00334 int param2_size;
00335 float *param2_table;
00336 #endif
00337
00338 #ifdef INDEX_VOLUME
00339 unsigned char *scanline_topRLElen;
00340 unsigned char *scanline_botRLElen;
00341 char *scanline_topRLEdata;
00342 char *scanline_botRLEdata;
00343 VoxelLocation *top_voxel_index;
00344 VoxelLocation *bot_voxel_index;
00345 VoxelLocation *vindex;
00346 int next_i;
00347 int next_scan;
00348 #endif
00349
00350 #ifdef CALLBACK
00351
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;
00359 #endif
00360
00361 #ifdef USE_SHADOW_BUFFER
00362 float *shadow_table;
00363 int shadow_width;
00364 GrayIntPixel *shadow_pixel;
00365 #ifdef GRAYSCALE
00366 float top_sclr, bot_sclr;
00367 #endif
00368 #ifdef RGB
00369 float top_rsclr;
00370 float bot_rsclr;
00371 float top_gsclr;
00372 float bot_gsclr;
00373 float top_bsclr;
00374 float bot_bsclr;
00375 #endif
00376 #endif
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 RGBIntPixel *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
00391
00392 DECLARE_HIRES_TIME(t0);
00393 DECLARE_HIRES_TIME(t1);
00394
00395
00396
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
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
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
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
00509
00510
00511
00512
00513
00514 for (j = 0; j <= jcount; j++) {
00515
00516
00517
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
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
00570
00571
00572
00573
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
00607
00608
00609
00610
00611
00612 Debug((vpc, VPDEBUG_COMPOSITE, "StartIScan(u=%d,v=%d)\n",
00613 (((int)ipixel - (int)vpc->int_image.gray_intim) /
00614 sizeof(RGBIntPixel)) % vpc->intermediate_width,
00615 (((int)ipixel - (int)vpc->int_image.gray_intim) /
00616 sizeof(RGBIntPixel)) / vpc->intermediate_width));
00617
00618 #ifdef UNROLL_RUN_LOOP
00619 while (i > 0) {
00620 #else
00621 while (i >= 0) {
00622 #endif
00623
00624
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;
00635 }
00636 #endif
00637
00638
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
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
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;
00684 }
00685 #endif
00686
00687
00688 if (ert_skip_count < i &&
00689 (count = ipixel[ert_skip_count].lnk) != 0) {
00690
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
00698
00699
00700
00701
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
00717 COUNT_ERT_UPDATE;
00718 if (ert_skip_count > 255)
00719 ert_skip_count = 255;
00720 ipixel->lnk = ert_skip_count;
00721 }
00722
00723
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
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
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
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
00767 if (next_scan) {
00768
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
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
00794
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
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
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;
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;
00865 }
00866 #endif
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
00875
00876
00877
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
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
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
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
00947 #ifdef UNROLL_RUN_LOOP
00948
00949 switch ((last_run_state << 2) | run_state) {
00950 case ALL_ZERO__ALL_ZERO:
00951
00952 ipixel += count;
00953 ;
00954 ;
00955 count = 0;
00956 break;
00957 case TOP_NONZERO__ALL_ZERO:
00958
00959
00960 if (!voxels_loaded) {
00961
00962 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
00963
00964
00965 ;
00966 ;
00967 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
00968 client_data);
00969 shade_factor = top_opc * slice_depth_cueing;
00970
00971 top_rclr *= shade_factor;
00972 top_gclr *= shade_factor;
00973 top_bclr *= shade_factor;
00974 ;
00975 }
00976
00977 #ifdef DEBUG
00978 if (ipixel == trace_pixel_ptr) {
00979 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
00980 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
00981 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
00982 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
00983 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
00984 }
00985 #endif
00986 ;
00987
00988 acc_opc = top_opc * wgtTL;
00989
00990 acc_rclr = top_rclr * wgtTL;
00991 acc_gclr = top_gclr * wgtTL;
00992 acc_bclr = top_bclr * wgtTL;
00993
00994 #ifdef DEBUG
00995 if (ipixel == trace_pixel_ptr) {
00996 trace_opcTL = top_opc;
00997 trace_rclrTL = top_rclr;
00998 trace_gclrTL = top_gclr;
00999 trace_bclrTL = top_bclr;
01000
01001 }
01002 #endif
01003 ;
01004
01005 COUNT_RESAMPLE;
01006 if (acc_opc > min_opacity) {
01007 COUNT_COMPOSITE;
01008 iopc = ipixel->opcflt;
01009 # ifndef SKIP_ERT
01010 ASSERT(iopc < max_opacity);
01011 # endif
01012 iopc_inv = (float)1. - iopc;
01013
01014 ipixel->rclrflt += acc_rclr * iopc_inv;
01015 ipixel->gclrflt += acc_gclr * iopc_inv;
01016 ipixel->bclrflt += acc_bclr * iopc_inv;
01017 iopc += acc_opc * iopc_inv;
01018 ipixel->opcflt = iopc;
01019
01020 #ifdef DEBUG
01021 if (ipixel == trace_pixel_ptr) {
01022 #ifdef COMPUTE_SHADOW_BUFFER
01023 printf("{%3d} %3d %3d", k, icount-i-count, j);
01024 #else
01025 printf("[%3d] %3d %3d", k, icount-i-count, j);
01026 #endif
01027 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01028 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01029 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01030 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01031 printf(" %3.0f %3.0f\n", iopc*255.,
01032 ipixel->rclrflt);
01033
01034
01035 printf(" ");
01036 printf(" %3.0f ",trace_gclrTL);
01037 printf(" %3.0f ",trace_gclrBL);
01038 printf(" %3.0f ",trace_gclrTR);
01039 printf(" %3.0f ",trace_gclrBR);
01040 printf(" %3.0f\n", ipixel->gclrflt);
01041 printf(" ");
01042 printf(" %3.0f ",trace_bclrTL);
01043 printf(" %3.0f ",trace_bclrBL);
01044 printf(" %3.0f ",trace_bclrTR);
01045 printf(" %3.0f ",trace_bclrBR);
01046 printf(" %3.0f\n", ipixel->bclrflt);
01047 }
01048 #endif
01049 ;
01050 # ifndef SKIP_ERT
01051 if (iopc >= max_opacity) {
01052 ASSERT(ipixel->lnk == 0);
01053 ipixel->lnk = 1;
01054 }
01055 # endif
01056 };
01057 ipixel += count;
01058 ;
01059 ;
01060 count = 0;
01061 break;
01062 case BOT_NONZERO__ALL_ZERO:
01063
01064
01065 if (!voxels_loaded) {
01066
01067 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01068
01069
01070 ;
01071 ;
01072 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
01073 client_data);
01074 shade_factor = bot_opc * slice_depth_cueing;
01075
01076 bot_rclr *= shade_factor;
01077 bot_gclr *= shade_factor;
01078 bot_bclr *= shade_factor;
01079 ;
01080 }
01081
01082 #ifdef DEBUG
01083 if (ipixel == trace_pixel_ptr) {
01084 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01085 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01086 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01087 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01088 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01089 }
01090 #endif
01091 ;
01092
01093 acc_opc = bot_opc * wgtBL;
01094
01095 acc_rclr = bot_rclr * wgtBL;
01096 acc_gclr = bot_gclr * wgtBL;
01097 acc_bclr = bot_bclr * wgtBL;
01098
01099 #ifdef DEBUG
01100 if (ipixel == trace_pixel_ptr) {
01101 trace_opcBL = bot_opc;
01102 trace_rclrBL = bot_rclr;
01103 trace_gclrBL = bot_gclr;
01104 trace_bclrBL = bot_bclr;
01105
01106 }
01107 #endif
01108 ;
01109
01110 COUNT_RESAMPLE;
01111 if (acc_opc > min_opacity) {
01112 COUNT_COMPOSITE;
01113 iopc = ipixel->opcflt;
01114 # ifndef SKIP_ERT
01115 ASSERT(iopc < max_opacity);
01116 # endif
01117 iopc_inv = (float)1. - iopc;
01118
01119 ipixel->rclrflt += acc_rclr * iopc_inv;
01120 ipixel->gclrflt += acc_gclr * iopc_inv;
01121 ipixel->bclrflt += acc_bclr * iopc_inv;
01122 iopc += acc_opc * iopc_inv;
01123 ipixel->opcflt = iopc;
01124
01125 #ifdef DEBUG
01126 if (ipixel == trace_pixel_ptr) {
01127 #ifdef COMPUTE_SHADOW_BUFFER
01128 printf("{%3d} %3d %3d", k, icount-i-count, j);
01129 #else
01130 printf("[%3d] %3d %3d", k, icount-i-count, j);
01131 #endif
01132 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01133 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01134 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01135 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01136 printf(" %3.0f %3.0f\n", iopc*255.,
01137 ipixel->rclrflt);
01138
01139
01140 printf(" ");
01141 printf(" %3.0f ",trace_gclrTL);
01142 printf(" %3.0f ",trace_gclrBL);
01143 printf(" %3.0f ",trace_gclrTR);
01144 printf(" %3.0f ",trace_gclrBR);
01145 printf(" %3.0f\n", ipixel->gclrflt);
01146 printf(" ");
01147 printf(" %3.0f ",trace_bclrTL);
01148 printf(" %3.0f ",trace_bclrBL);
01149 printf(" %3.0f ",trace_bclrTR);
01150 printf(" %3.0f ",trace_bclrBR);
01151 printf(" %3.0f\n", ipixel->bclrflt);
01152 }
01153 #endif
01154 ;
01155 # ifndef SKIP_ERT
01156 if (iopc >= max_opacity) {
01157 ASSERT(ipixel->lnk == 0);
01158 ipixel->lnk = 1;
01159 }
01160 # endif
01161 };
01162 ipixel += count;
01163 ;
01164 ;
01165 count = 0;
01166 break;
01167 case ALL_NONZERO__ALL_ZERO:
01168
01169
01170 if (!voxels_loaded) {
01171
01172 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01173
01174
01175 ;
01176 ;
01177 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
01178 client_data);
01179 shade_factor = top_opc * slice_depth_cueing;
01180
01181 top_rclr *= shade_factor;
01182 top_gclr *= shade_factor;
01183 top_bclr *= shade_factor;
01184 ;
01185
01186 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01187
01188
01189 ;
01190 ;
01191 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
01192 client_data);
01193 shade_factor = bot_opc * slice_depth_cueing;
01194
01195 bot_rclr *= shade_factor;
01196 bot_gclr *= shade_factor;
01197 bot_bclr *= shade_factor;
01198 ;
01199 }
01200
01201 #ifdef DEBUG
01202 if (ipixel == trace_pixel_ptr) {
01203 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01204 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01205 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01206 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01207 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01208 }
01209 #endif
01210 ;
01211
01212 acc_opc = top_opc * wgtTL;
01213
01214 acc_rclr = top_rclr * wgtTL;
01215 acc_gclr = top_gclr * wgtTL;
01216 acc_bclr = top_bclr * wgtTL;
01217
01218 #ifdef DEBUG
01219 if (ipixel == trace_pixel_ptr) {
01220 trace_opcTL = top_opc;
01221 trace_rclrTL = top_rclr;
01222 trace_gclrTL = top_gclr;
01223 trace_bclrTL = top_bclr;
01224
01225 }
01226 #endif
01227 ;
01228
01229 acc_opc += bot_opc * wgtBL;
01230
01231 acc_rclr += bot_rclr * wgtBL;
01232 acc_gclr += bot_gclr * wgtBL;
01233 acc_bclr += bot_bclr * wgtBL;
01234
01235 #ifdef DEBUG
01236 if (ipixel == trace_pixel_ptr) {
01237 trace_opcBL = bot_opc;
01238 trace_rclrBL = bot_rclr;
01239 trace_gclrBL = bot_gclr;
01240 trace_bclrBL = bot_bclr;
01241
01242 }
01243 #endif
01244 ;
01245
01246 COUNT_RESAMPLE;
01247 if (acc_opc > min_opacity) {
01248 COUNT_COMPOSITE;
01249 iopc = ipixel->opcflt;
01250 # ifndef SKIP_ERT
01251 ASSERT(iopc < max_opacity);
01252 # endif
01253 iopc_inv = (float)1. - iopc;
01254
01255 ipixel->rclrflt += acc_rclr * iopc_inv;
01256 ipixel->gclrflt += acc_gclr * iopc_inv;
01257 ipixel->bclrflt += acc_bclr * iopc_inv;
01258 iopc += acc_opc * iopc_inv;
01259 ipixel->opcflt = iopc;
01260
01261 #ifdef DEBUG
01262 if (ipixel == trace_pixel_ptr) {
01263 #ifdef COMPUTE_SHADOW_BUFFER
01264 printf("{%3d} %3d %3d", k, icount-i-count, j);
01265 #else
01266 printf("[%3d] %3d %3d", k, icount-i-count, j);
01267 #endif
01268 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01269 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01270 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01271 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01272 printf(" %3.0f %3.0f\n", iopc*255.,
01273 ipixel->rclrflt);
01274
01275
01276 printf(" ");
01277 printf(" %3.0f ",trace_gclrTL);
01278 printf(" %3.0f ",trace_gclrBL);
01279 printf(" %3.0f ",trace_gclrTR);
01280 printf(" %3.0f ",trace_gclrBR);
01281 printf(" %3.0f\n", ipixel->gclrflt);
01282 printf(" ");
01283 printf(" %3.0f ",trace_bclrTL);
01284 printf(" %3.0f ",trace_bclrBL);
01285 printf(" %3.0f ",trace_bclrTR);
01286 printf(" %3.0f ",trace_bclrBR);
01287 printf(" %3.0f\n", ipixel->bclrflt);
01288 }
01289 #endif
01290 ;
01291 # ifndef SKIP_ERT
01292 if (iopc >= max_opacity) {
01293 ASSERT(ipixel->lnk == 0);
01294 ipixel->lnk = 1;
01295 }
01296 # endif
01297 };
01298 ipixel += count;
01299 ;
01300 ;
01301 count = 0;
01302 break;
01303 case ALL_ZERO__TOP_NONZERO:
01304
01305
01306 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01307
01308
01309 ;
01310 ;
01311 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
01312 client_data);
01313 shade_factor = top_opc * slice_depth_cueing;
01314
01315 top_rclr *= shade_factor;
01316 top_gclr *= shade_factor;
01317 top_bclr *= shade_factor;
01318 ;
01319
01320 #ifdef DEBUG
01321 if (ipixel == trace_pixel_ptr) {
01322 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01323 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01324 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01325 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01326 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01327 }
01328 #endif
01329 ;
01330
01331 acc_opc = top_opc * wgtTR;
01332
01333 acc_rclr = top_rclr * wgtTR;
01334 acc_gclr = top_gclr * wgtTR;
01335 acc_bclr = top_bclr * wgtTR;
01336
01337 #ifdef DEBUG
01338 if (ipixel == trace_pixel_ptr) {
01339 trace_opcTR = top_opc;
01340 trace_rclrTR = top_rclr;
01341 trace_gclrTR = top_gclr;
01342 trace_bclrTR = top_bclr;
01343
01344 }
01345 #endif
01346 ;
01347
01348 COUNT_RESAMPLE;
01349 if (acc_opc > min_opacity) {
01350 COUNT_COMPOSITE;
01351 iopc = ipixel->opcflt;
01352 # ifndef SKIP_ERT
01353 ASSERT(iopc < max_opacity);
01354 # endif
01355 iopc_inv = (float)1. - iopc;
01356
01357 ipixel->rclrflt += acc_rclr * iopc_inv;
01358 ipixel->gclrflt += acc_gclr * iopc_inv;
01359 ipixel->bclrflt += acc_bclr * iopc_inv;
01360 iopc += acc_opc * iopc_inv;
01361 ipixel->opcflt = iopc;
01362
01363 #ifdef DEBUG
01364 if (ipixel == trace_pixel_ptr) {
01365 #ifdef COMPUTE_SHADOW_BUFFER
01366 printf("{%3d} %3d %3d", k, icount-i-count, j);
01367 #else
01368 printf("[%3d] %3d %3d", k, icount-i-count, j);
01369 #endif
01370 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01371 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01372 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01373 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01374 printf(" %3.0f %3.0f\n", iopc*255.,
01375 ipixel->rclrflt);
01376
01377
01378 printf(" ");
01379 printf(" %3.0f ",trace_gclrTL);
01380 printf(" %3.0f ",trace_gclrBL);
01381 printf(" %3.0f ",trace_gclrTR);
01382 printf(" %3.0f ",trace_gclrBR);
01383 printf(" %3.0f\n", ipixel->gclrflt);
01384 printf(" ");
01385 printf(" %3.0f ",trace_bclrTL);
01386 printf(" %3.0f ",trace_bclrBL);
01387 printf(" %3.0f ",trace_bclrTR);
01388 printf(" %3.0f ",trace_bclrBR);
01389 printf(" %3.0f\n", ipixel->bclrflt);
01390 }
01391 #endif
01392 ;
01393 # ifndef SKIP_ERT
01394 if (iopc >= max_opacity) {
01395 ASSERT(ipixel->lnk == 0);
01396 ipixel->lnk = 1;
01397 }
01398 # endif
01399 };
01400 ipixel += 1;
01401 topRLEdata += 1 * voxel_istride;
01402 ;
01403 count--;
01404 SET_VOXELS_LOADED;
01405
01406
01407
01408 while (count > 0) {
01409 if (PIXEL_IS_OPAQUE(ipixel))
01410 break;
01411 if (!voxels_loaded) {
01412
01413 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01414
01415
01416 ;
01417 ;
01418 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
01419 client_data);
01420 shade_factor = top_opc * slice_depth_cueing;
01421
01422 top_rclr *= shade_factor;
01423 top_gclr *= shade_factor;
01424 top_bclr *= shade_factor;
01425 ;
01426 }
01427
01428 #ifdef DEBUG
01429 if (ipixel == trace_pixel_ptr) {
01430 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01431 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01432 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01433 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01434 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01435 }
01436 #endif
01437 ;
01438
01439 acc_opc = top_opc * wgtTL;
01440
01441 acc_rclr = top_rclr * wgtTL;
01442 acc_gclr = top_gclr * wgtTL;
01443 acc_bclr = top_bclr * wgtTL;
01444
01445 #ifdef DEBUG
01446 if (ipixel == trace_pixel_ptr) {
01447 trace_opcTL = top_opc;
01448 trace_rclrTL = top_rclr;
01449 trace_gclrTL = top_gclr;
01450 trace_bclrTL = top_bclr;
01451
01452 }
01453 #endif
01454 ;
01455
01456 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01457
01458
01459 ;
01460 ;
01461 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
01462 client_data);
01463 shade_factor = top_opc * slice_depth_cueing;
01464
01465 top_rclr *= shade_factor;
01466 top_gclr *= shade_factor;
01467 top_bclr *= shade_factor;
01468 ;
01469
01470 acc_opc += top_opc * wgtTR;
01471
01472 acc_rclr += top_rclr * wgtTR;
01473 acc_gclr += top_gclr * wgtTR;
01474 acc_bclr += top_bclr * wgtTR;
01475
01476 #ifdef DEBUG
01477 if (ipixel == trace_pixel_ptr) {
01478 trace_opcTR = top_opc;
01479 trace_rclrTR = top_rclr;
01480 trace_gclrTR = top_gclr;
01481 trace_bclrTR = top_bclr;
01482
01483 }
01484 #endif
01485 ;
01486
01487 COUNT_RESAMPLE;
01488 if (acc_opc > min_opacity) {
01489 COUNT_COMPOSITE;
01490 iopc = ipixel->opcflt;
01491 # ifndef SKIP_ERT
01492 ASSERT(iopc < max_opacity);
01493 # endif
01494 iopc_inv = (float)1. - iopc;
01495
01496 ipixel->rclrflt += acc_rclr * iopc_inv;
01497 ipixel->gclrflt += acc_gclr * iopc_inv;
01498 ipixel->bclrflt += acc_bclr * iopc_inv;
01499 iopc += acc_opc * iopc_inv;
01500 ipixel->opcflt = iopc;
01501
01502 #ifdef DEBUG
01503 if (ipixel == trace_pixel_ptr) {
01504 #ifdef COMPUTE_SHADOW_BUFFER
01505 printf("{%3d} %3d %3d", k, icount-i-count, j);
01506 #else
01507 printf("[%3d] %3d %3d", k, icount-i-count, j);
01508 #endif
01509 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01510 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01511 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01512 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01513 printf(" %3.0f %3.0f\n", iopc*255.,
01514 ipixel->rclrflt);
01515
01516
01517 printf(" ");
01518 printf(" %3.0f ",trace_gclrTL);
01519 printf(" %3.0f ",trace_gclrBL);
01520 printf(" %3.0f ",trace_gclrTR);
01521 printf(" %3.0f ",trace_gclrBR);
01522 printf(" %3.0f\n", ipixel->gclrflt);
01523 printf(" ");
01524 printf(" %3.0f ",trace_bclrTL);
01525 printf(" %3.0f ",trace_bclrBL);
01526 printf(" %3.0f ",trace_bclrTR);
01527 printf(" %3.0f ",trace_bclrBR);
01528 printf(" %3.0f\n", ipixel->bclrflt);
01529 }
01530 #endif
01531 ;
01532 # ifndef SKIP_ERT
01533 if (iopc >= max_opacity) {
01534 ASSERT(ipixel->lnk == 0);
01535 ipixel->lnk = 1;
01536 }
01537 # endif
01538 };
01539 ipixel += 1;
01540 topRLEdata += 1 * voxel_istride;
01541 ;
01542 count--;
01543 SET_VOXELS_LOADED;
01544 }
01545 break;
01546 case TOP_NONZERO__TOP_NONZERO:
01547
01548
01549 while (count > 0) {
01550 if (PIXEL_IS_OPAQUE(ipixel))
01551 break;
01552 if (!voxels_loaded) {
01553
01554 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01555
01556
01557 ;
01558 ;
01559 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
01560 client_data);
01561 shade_factor = top_opc * slice_depth_cueing;
01562
01563 top_rclr *= shade_factor;
01564 top_gclr *= shade_factor;
01565 top_bclr *= shade_factor;
01566 ;
01567 }
01568
01569 #ifdef DEBUG
01570 if (ipixel == trace_pixel_ptr) {
01571 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01572 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01573 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01574 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01575 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01576 }
01577 #endif
01578 ;
01579
01580 acc_opc = top_opc * wgtTL;
01581
01582 acc_rclr = top_rclr * wgtTL;
01583 acc_gclr = top_gclr * wgtTL;
01584 acc_bclr = top_bclr * wgtTL;
01585
01586 #ifdef DEBUG
01587 if (ipixel == trace_pixel_ptr) {
01588 trace_opcTL = top_opc;
01589 trace_rclrTL = top_rclr;
01590 trace_gclrTL = top_gclr;
01591 trace_bclrTL = top_bclr;
01592
01593 }
01594 #endif
01595 ;
01596
01597 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01598
01599
01600 ;
01601 ;
01602 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
01603 client_data);
01604 shade_factor = top_opc * slice_depth_cueing;
01605
01606 top_rclr *= shade_factor;
01607 top_gclr *= shade_factor;
01608 top_bclr *= shade_factor;
01609 ;
01610
01611 acc_opc += top_opc * wgtTR;
01612
01613 acc_rclr += top_rclr * wgtTR;
01614 acc_gclr += top_gclr * wgtTR;
01615 acc_bclr += top_bclr * wgtTR;
01616
01617 #ifdef DEBUG
01618 if (ipixel == trace_pixel_ptr) {
01619 trace_opcTR = top_opc;
01620 trace_rclrTR = top_rclr;
01621 trace_gclrTR = top_gclr;
01622 trace_bclrTR = top_bclr;
01623
01624 }
01625 #endif
01626 ;
01627
01628 COUNT_RESAMPLE;
01629 if (acc_opc > min_opacity) {
01630 COUNT_COMPOSITE;
01631 iopc = ipixel->opcflt;
01632 # ifndef SKIP_ERT
01633 ASSERT(iopc < max_opacity);
01634 # endif
01635 iopc_inv = (float)1. - iopc;
01636
01637 ipixel->rclrflt += acc_rclr * iopc_inv;
01638 ipixel->gclrflt += acc_gclr * iopc_inv;
01639 ipixel->bclrflt += acc_bclr * iopc_inv;
01640 iopc += acc_opc * iopc_inv;
01641 ipixel->opcflt = iopc;
01642
01643 #ifdef DEBUG
01644 if (ipixel == trace_pixel_ptr) {
01645 #ifdef COMPUTE_SHADOW_BUFFER
01646 printf("{%3d} %3d %3d", k, icount-i-count, j);
01647 #else
01648 printf("[%3d] %3d %3d", k, icount-i-count, j);
01649 #endif
01650 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01651 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01652 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01653 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01654 printf(" %3.0f %3.0f\n", iopc*255.,
01655 ipixel->rclrflt);
01656
01657
01658 printf(" ");
01659 printf(" %3.0f ",trace_gclrTL);
01660 printf(" %3.0f ",trace_gclrBL);
01661 printf(" %3.0f ",trace_gclrTR);
01662 printf(" %3.0f ",trace_gclrBR);
01663 printf(" %3.0f\n", ipixel->gclrflt);
01664 printf(" ");
01665 printf(" %3.0f ",trace_bclrTL);
01666 printf(" %3.0f ",trace_bclrBL);
01667 printf(" %3.0f ",trace_bclrTR);
01668 printf(" %3.0f ",trace_bclrBR);
01669 printf(" %3.0f\n", ipixel->bclrflt);
01670 }
01671 #endif
01672 ;
01673 # ifndef SKIP_ERT
01674 if (iopc >= max_opacity) {
01675 ASSERT(ipixel->lnk == 0);
01676 ipixel->lnk = 1;
01677 }
01678 # endif
01679 };
01680 ipixel += 1;
01681 topRLEdata += 1 * voxel_istride;
01682 ;
01683 count--;
01684 SET_VOXELS_LOADED;
01685 }
01686 break;
01687 case BOT_NONZERO__TOP_NONZERO:
01688
01689
01690 if (!voxels_loaded) {
01691
01692 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01693
01694
01695 ;
01696 ;
01697 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
01698 client_data);
01699 shade_factor = bot_opc * slice_depth_cueing;
01700
01701 bot_rclr *= shade_factor;
01702 bot_gclr *= shade_factor;
01703 bot_bclr *= shade_factor;
01704 ;
01705 }
01706
01707 #ifdef DEBUG
01708 if (ipixel == trace_pixel_ptr) {
01709 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01710 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01711 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01712 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01713 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01714 }
01715 #endif
01716 ;
01717
01718 acc_opc = bot_opc * wgtBL;
01719
01720 acc_rclr = bot_rclr * wgtBL;
01721 acc_gclr = bot_gclr * wgtBL;
01722 acc_bclr = bot_bclr * wgtBL;
01723
01724 #ifdef DEBUG
01725 if (ipixel == trace_pixel_ptr) {
01726 trace_opcBL = bot_opc;
01727 trace_rclrBL = bot_rclr;
01728 trace_gclrBL = bot_gclr;
01729 trace_bclrBL = bot_bclr;
01730
01731 }
01732 #endif
01733 ;
01734
01735 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01736
01737
01738 ;
01739 ;
01740 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
01741 client_data);
01742 shade_factor = top_opc * slice_depth_cueing;
01743
01744 top_rclr *= shade_factor;
01745 top_gclr *= shade_factor;
01746 top_bclr *= shade_factor;
01747 ;
01748
01749 acc_opc += top_opc * wgtTR;
01750
01751 acc_rclr += top_rclr * wgtTR;
01752 acc_gclr += top_gclr * wgtTR;
01753 acc_bclr += top_bclr * wgtTR;
01754
01755 #ifdef DEBUG
01756 if (ipixel == trace_pixel_ptr) {
01757 trace_opcTR = top_opc;
01758 trace_rclrTR = top_rclr;
01759 trace_gclrTR = top_gclr;
01760 trace_bclrTR = top_bclr;
01761
01762 }
01763 #endif
01764 ;
01765
01766 COUNT_RESAMPLE;
01767 if (acc_opc > min_opacity) {
01768 COUNT_COMPOSITE;
01769 iopc = ipixel->opcflt;
01770 # ifndef SKIP_ERT
01771 ASSERT(iopc < max_opacity);
01772 # endif
01773 iopc_inv = (float)1. - iopc;
01774
01775 ipixel->rclrflt += acc_rclr * iopc_inv;
01776 ipixel->gclrflt += acc_gclr * iopc_inv;
01777 ipixel->bclrflt += acc_bclr * iopc_inv;
01778 iopc += acc_opc * iopc_inv;
01779 ipixel->opcflt = iopc;
01780
01781 #ifdef DEBUG
01782 if (ipixel == trace_pixel_ptr) {
01783 #ifdef COMPUTE_SHADOW_BUFFER
01784 printf("{%3d} %3d %3d", k, icount-i-count, j);
01785 #else
01786 printf("[%3d] %3d %3d", k, icount-i-count, j);
01787 #endif
01788 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01789 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01790 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01791 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01792 printf(" %3.0f %3.0f\n", iopc*255.,
01793 ipixel->rclrflt);
01794
01795
01796 printf(" ");
01797 printf(" %3.0f ",trace_gclrTL);
01798 printf(" %3.0f ",trace_gclrBL);
01799 printf(" %3.0f ",trace_gclrTR);
01800 printf(" %3.0f ",trace_gclrBR);
01801 printf(" %3.0f\n", ipixel->gclrflt);
01802 printf(" ");
01803 printf(" %3.0f ",trace_bclrTL);
01804 printf(" %3.0f ",trace_bclrBL);
01805 printf(" %3.0f ",trace_bclrTR);
01806 printf(" %3.0f ",trace_bclrBR);
01807 printf(" %3.0f\n", ipixel->bclrflt);
01808 }
01809 #endif
01810 ;
01811 # ifndef SKIP_ERT
01812 if (iopc >= max_opacity) {
01813 ASSERT(ipixel->lnk == 0);
01814 ipixel->lnk = 1;
01815 }
01816 # endif
01817 };
01818 ipixel += 1;
01819 topRLEdata += 1 * voxel_istride;
01820 ;
01821 count--;
01822 SET_VOXELS_LOADED;
01823
01824
01825
01826 while (count > 0) {
01827 if (PIXEL_IS_OPAQUE(ipixel))
01828 break;
01829 if (!voxels_loaded) {
01830
01831 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01832
01833
01834 ;
01835 ;
01836 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
01837 client_data);
01838 shade_factor = top_opc * slice_depth_cueing;
01839
01840 top_rclr *= shade_factor;
01841 top_gclr *= shade_factor;
01842 top_bclr *= shade_factor;
01843 ;
01844 }
01845
01846 #ifdef DEBUG
01847 if (ipixel == trace_pixel_ptr) {
01848 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01849 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01850 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01851 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01852 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01853 }
01854 #endif
01855 ;
01856
01857 acc_opc = top_opc * wgtTL;
01858
01859 acc_rclr = top_rclr * wgtTL;
01860 acc_gclr = top_gclr * wgtTL;
01861 acc_bclr = top_bclr * wgtTL;
01862
01863 #ifdef DEBUG
01864 if (ipixel == trace_pixel_ptr) {
01865 trace_opcTL = top_opc;
01866 trace_rclrTL = top_rclr;
01867 trace_gclrTL = top_gclr;
01868 trace_bclrTL = top_bclr;
01869
01870 }
01871 #endif
01872 ;
01873
01874 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01875
01876
01877 ;
01878 ;
01879 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
01880 client_data);
01881 shade_factor = top_opc * slice_depth_cueing;
01882
01883 top_rclr *= shade_factor;
01884 top_gclr *= shade_factor;
01885 top_bclr *= shade_factor;
01886 ;
01887
01888 acc_opc += top_opc * wgtTR;
01889
01890 acc_rclr += top_rclr * wgtTR;
01891 acc_gclr += top_gclr * wgtTR;
01892 acc_bclr += top_bclr * wgtTR;
01893
01894 #ifdef DEBUG
01895 if (ipixel == trace_pixel_ptr) {
01896 trace_opcTR = top_opc;
01897 trace_rclrTR = top_rclr;
01898 trace_gclrTR = top_gclr;
01899 trace_bclrTR = top_bclr;
01900
01901 }
01902 #endif
01903 ;
01904
01905 COUNT_RESAMPLE;
01906 if (acc_opc > min_opacity) {
01907 COUNT_COMPOSITE;
01908 iopc = ipixel->opcflt;
01909 # ifndef SKIP_ERT
01910 ASSERT(iopc < max_opacity);
01911 # endif
01912 iopc_inv = (float)1. - iopc;
01913
01914 ipixel->rclrflt += acc_rclr * iopc_inv;
01915 ipixel->gclrflt += acc_gclr * iopc_inv;
01916 ipixel->bclrflt += acc_bclr * iopc_inv;
01917 iopc += acc_opc * iopc_inv;
01918 ipixel->opcflt = iopc;
01919
01920 #ifdef DEBUG
01921 if (ipixel == trace_pixel_ptr) {
01922 #ifdef COMPUTE_SHADOW_BUFFER
01923 printf("{%3d} %3d %3d", k, icount-i-count, j);
01924 #else
01925 printf("[%3d] %3d %3d", k, icount-i-count, j);
01926 #endif
01927 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01928 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01929 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01930 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01931 printf(" %3.0f %3.0f\n", iopc*255.,
01932 ipixel->rclrflt);
01933
01934
01935 printf(" ");
01936 printf(" %3.0f ",trace_gclrTL);
01937 printf(" %3.0f ",trace_gclrBL);
01938 printf(" %3.0f ",trace_gclrTR);
01939 printf(" %3.0f ",trace_gclrBR);
01940 printf(" %3.0f\n", ipixel->gclrflt);
01941 printf(" ");
01942 printf(" %3.0f ",trace_bclrTL);
01943 printf(" %3.0f ",trace_bclrBL);
01944 printf(" %3.0f ",trace_bclrTR);
01945 printf(" %3.0f ",trace_bclrBR);
01946 printf(" %3.0f\n", ipixel->bclrflt);
01947 }
01948 #endif
01949 ;
01950 # ifndef SKIP_ERT
01951 if (iopc >= max_opacity) {
01952 ASSERT(ipixel->lnk == 0);
01953 ipixel->lnk = 1;
01954 }
01955 # endif
01956 };
01957 ipixel += 1;
01958 topRLEdata += 1 * voxel_istride;
01959 ;
01960 count--;
01961 SET_VOXELS_LOADED;
01962 }
01963 break;
01964 case ALL_NONZERO__TOP_NONZERO:
01965
01966
01967 if (!voxels_loaded) {
01968
01969 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01970
01971
01972 ;
01973 ;
01974 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
01975 client_data);
01976 shade_factor = top_opc * slice_depth_cueing;
01977
01978 top_rclr *= shade_factor;
01979 top_gclr *= shade_factor;
01980 top_bclr *= shade_factor;
01981 ;
01982
01983 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01984
01985
01986 ;
01987 ;
01988 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
01989 client_data);
01990 shade_factor = bot_opc * slice_depth_cueing;
01991
01992 bot_rclr *= shade_factor;
01993 bot_gclr *= shade_factor;
01994 bot_bclr *= shade_factor;
01995 ;
01996 }
01997
01998 #ifdef DEBUG
01999 if (ipixel == trace_pixel_ptr) {
02000 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02001 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02002 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02003 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02004 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02005 }
02006 #endif
02007 ;
02008
02009 acc_opc = top_opc * wgtTL;
02010
02011 acc_rclr = top_rclr * wgtTL;
02012 acc_gclr = top_gclr * wgtTL;
02013 acc_bclr = top_bclr * wgtTL;
02014
02015 #ifdef DEBUG
02016 if (ipixel == trace_pixel_ptr) {
02017 trace_opcTL = top_opc;
02018 trace_rclrTL = top_rclr;
02019 trace_gclrTL = top_gclr;
02020 trace_bclrTL = top_bclr;
02021
02022 }
02023 #endif
02024 ;
02025
02026 acc_opc += bot_opc * wgtBL;
02027
02028 acc_rclr += bot_rclr * wgtBL;
02029 acc_gclr += bot_gclr * wgtBL;
02030 acc_bclr += bot_bclr * wgtBL;
02031
02032 #ifdef DEBUG
02033 if (ipixel == trace_pixel_ptr) {
02034 trace_opcBL = bot_opc;
02035 trace_rclrBL = bot_rclr;
02036 trace_gclrBL = bot_gclr;
02037 trace_bclrBL = bot_bclr;
02038
02039 }
02040 #endif
02041 ;
02042
02043 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02044
02045
02046 ;
02047 ;
02048 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
02049 client_data);
02050 shade_factor = top_opc * slice_depth_cueing;
02051
02052 top_rclr *= shade_factor;
02053 top_gclr *= shade_factor;
02054 top_bclr *= shade_factor;
02055 ;
02056
02057 acc_opc += top_opc * wgtTR;
02058
02059 acc_rclr += top_rclr * wgtTR;
02060 acc_gclr += top_gclr * wgtTR;
02061 acc_bclr += top_bclr * wgtTR;
02062
02063 #ifdef DEBUG
02064 if (ipixel == trace_pixel_ptr) {
02065 trace_opcTR = top_opc;
02066 trace_rclrTR = top_rclr;
02067 trace_gclrTR = top_gclr;
02068 trace_bclrTR = top_bclr;
02069
02070 }
02071 #endif
02072 ;
02073
02074 COUNT_RESAMPLE;
02075 if (acc_opc > min_opacity) {
02076 COUNT_COMPOSITE;
02077 iopc = ipixel->opcflt;
02078 # ifndef SKIP_ERT
02079 ASSERT(iopc < max_opacity);
02080 # endif
02081 iopc_inv = (float)1. - iopc;
02082
02083 ipixel->rclrflt += acc_rclr * iopc_inv;
02084 ipixel->gclrflt += acc_gclr * iopc_inv;
02085 ipixel->bclrflt += acc_bclr * iopc_inv;
02086 iopc += acc_opc * iopc_inv;
02087 ipixel->opcflt = iopc;
02088
02089 #ifdef DEBUG
02090 if (ipixel == trace_pixel_ptr) {
02091 #ifdef COMPUTE_SHADOW_BUFFER
02092 printf("{%3d} %3d %3d", k, icount-i-count, j);
02093 #else
02094 printf("[%3d] %3d %3d", k, icount-i-count, j);
02095 #endif
02096 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02097 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02098 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02099 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02100 printf(" %3.0f %3.0f\n", iopc*255.,
02101 ipixel->rclrflt);
02102
02103
02104 printf(" ");
02105 printf(" %3.0f ",trace_gclrTL);
02106 printf(" %3.0f ",trace_gclrBL);
02107 printf(" %3.0f ",trace_gclrTR);
02108 printf(" %3.0f ",trace_gclrBR);
02109 printf(" %3.0f\n", ipixel->gclrflt);
02110 printf(" ");
02111 printf(" %3.0f ",trace_bclrTL);
02112 printf(" %3.0f ",trace_bclrBL);
02113 printf(" %3.0f ",trace_bclrTR);
02114 printf(" %3.0f ",trace_bclrBR);
02115 printf(" %3.0f\n", ipixel->bclrflt);
02116 }
02117 #endif
02118 ;
02119 # ifndef SKIP_ERT
02120 if (iopc >= max_opacity) {
02121 ASSERT(ipixel->lnk == 0);
02122 ipixel->lnk = 1;
02123 }
02124 # endif
02125 };
02126 ipixel += 1;
02127 topRLEdata += 1 * voxel_istride;
02128 ;
02129 count--;
02130 SET_VOXELS_LOADED;
02131
02132
02133
02134 while (count > 0) {
02135 if (PIXEL_IS_OPAQUE(ipixel))
02136 break;
02137 if (!voxels_loaded) {
02138
02139 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02140
02141
02142 ;
02143 ;
02144 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
02145 client_data);
02146 shade_factor = top_opc * slice_depth_cueing;
02147
02148 top_rclr *= shade_factor;
02149 top_gclr *= shade_factor;
02150 top_bclr *= shade_factor;
02151 ;
02152 }
02153
02154 #ifdef DEBUG
02155 if (ipixel == trace_pixel_ptr) {
02156 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02157 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02158 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02159 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02160 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02161 }
02162 #endif
02163 ;
02164
02165 acc_opc = top_opc * wgtTL;
02166
02167 acc_rclr = top_rclr * wgtTL;
02168 acc_gclr = top_gclr * wgtTL;
02169 acc_bclr = top_bclr * wgtTL;
02170
02171 #ifdef DEBUG
02172 if (ipixel == trace_pixel_ptr) {
02173 trace_opcTL = top_opc;
02174 trace_rclrTL = top_rclr;
02175 trace_gclrTL = top_gclr;
02176 trace_bclrTL = top_bclr;
02177
02178 }
02179 #endif
02180 ;
02181
02182 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02183
02184
02185 ;
02186 ;
02187 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
02188 client_data);
02189 shade_factor = top_opc * slice_depth_cueing;
02190
02191 top_rclr *= shade_factor;
02192 top_gclr *= shade_factor;
02193 top_bclr *= shade_factor;
02194 ;
02195
02196 acc_opc += top_opc * wgtTR;
02197
02198 acc_rclr += top_rclr * wgtTR;
02199 acc_gclr += top_gclr * wgtTR;
02200 acc_bclr += top_bclr * wgtTR;
02201
02202 #ifdef DEBUG
02203 if (ipixel == trace_pixel_ptr) {
02204 trace_opcTR = top_opc;
02205 trace_rclrTR = top_rclr;
02206 trace_gclrTR = top_gclr;
02207 trace_bclrTR = top_bclr;
02208
02209 }
02210 #endif
02211 ;
02212
02213 COUNT_RESAMPLE;
02214 if (acc_opc > min_opacity) {
02215 COUNT_COMPOSITE;
02216 iopc = ipixel->opcflt;
02217 # ifndef SKIP_ERT
02218 ASSERT(iopc < max_opacity);
02219 # endif
02220 iopc_inv = (float)1. - iopc;
02221
02222 ipixel->rclrflt += acc_rclr * iopc_inv;
02223 ipixel->gclrflt += acc_gclr * iopc_inv;
02224 ipixel->bclrflt += acc_bclr * iopc_inv;
02225 iopc += acc_opc * iopc_inv;
02226 ipixel->opcflt = iopc;
02227
02228 #ifdef DEBUG
02229 if (ipixel == trace_pixel_ptr) {
02230 #ifdef COMPUTE_SHADOW_BUFFER
02231 printf("{%3d} %3d %3d", k, icount-i-count, j);
02232 #else
02233 printf("[%3d] %3d %3d", k, icount-i-count, j);
02234 #endif
02235 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02236 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02237 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02238 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02239 printf(" %3.0f %3.0f\n", iopc*255.,
02240 ipixel->rclrflt);
02241
02242
02243 printf(" ");
02244 printf(" %3.0f ",trace_gclrTL);
02245 printf(" %3.0f ",trace_gclrBL);
02246 printf(" %3.0f ",trace_gclrTR);
02247 printf(" %3.0f ",trace_gclrBR);
02248 printf(" %3.0f\n", ipixel->gclrflt);
02249 printf(" ");
02250 printf(" %3.0f ",trace_bclrTL);
02251 printf(" %3.0f ",trace_bclrBL);
02252 printf(" %3.0f ",trace_bclrTR);
02253 printf(" %3.0f ",trace_bclrBR);
02254 printf(" %3.0f\n", ipixel->bclrflt);
02255 }
02256 #endif
02257 ;
02258 # ifndef SKIP_ERT
02259 if (iopc >= max_opacity) {
02260 ASSERT(ipixel->lnk == 0);
02261 ipixel->lnk = 1;
02262 }
02263 # endif
02264 };
02265 ipixel += 1;
02266 topRLEdata += 1 * voxel_istride;
02267 ;
02268 count--;
02269 SET_VOXELS_LOADED;
02270 }
02271 break;
02272 case ALL_ZERO__BOT_NONZERO:
02273
02274
02275 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02276
02277
02278 ;
02279 ;
02280 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02281 client_data);
02282 shade_factor = bot_opc * slice_depth_cueing;
02283
02284 bot_rclr *= shade_factor;
02285 bot_gclr *= shade_factor;
02286 bot_bclr *= shade_factor;
02287 ;
02288
02289 #ifdef DEBUG
02290 if (ipixel == trace_pixel_ptr) {
02291 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02292 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02293 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02294 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02295 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02296 }
02297 #endif
02298 ;
02299
02300 acc_opc = bot_opc * wgtBR;
02301
02302 acc_rclr = bot_rclr * wgtBR;
02303 acc_gclr = bot_gclr * wgtBR;
02304 acc_bclr = bot_bclr * wgtBR;
02305
02306 #ifdef DEBUG
02307 if (ipixel == trace_pixel_ptr) {
02308 trace_opcBR = bot_opc;
02309 trace_rclrBR = bot_rclr;
02310 trace_gclrBR = bot_gclr;
02311 trace_bclrBR = bot_bclr;
02312
02313 }
02314 #endif
02315 ;
02316
02317 COUNT_RESAMPLE;
02318 if (acc_opc > min_opacity) {
02319 COUNT_COMPOSITE;
02320 iopc = ipixel->opcflt;
02321 # ifndef SKIP_ERT
02322 ASSERT(iopc < max_opacity);
02323 # endif
02324 iopc_inv = (float)1. - iopc;
02325
02326 ipixel->rclrflt += acc_rclr * iopc_inv;
02327 ipixel->gclrflt += acc_gclr * iopc_inv;
02328 ipixel->bclrflt += acc_bclr * iopc_inv;
02329 iopc += acc_opc * iopc_inv;
02330 ipixel->opcflt = iopc;
02331
02332 #ifdef DEBUG
02333 if (ipixel == trace_pixel_ptr) {
02334 #ifdef COMPUTE_SHADOW_BUFFER
02335 printf("{%3d} %3d %3d", k, icount-i-count, j);
02336 #else
02337 printf("[%3d] %3d %3d", k, icount-i-count, j);
02338 #endif
02339 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02340 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02341 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02342 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02343 printf(" %3.0f %3.0f\n", iopc*255.,
02344 ipixel->rclrflt);
02345
02346
02347 printf(" ");
02348 printf(" %3.0f ",trace_gclrTL);
02349 printf(" %3.0f ",trace_gclrBL);
02350 printf(" %3.0f ",trace_gclrTR);
02351 printf(" %3.0f ",trace_gclrBR);
02352 printf(" %3.0f\n", ipixel->gclrflt);
02353 printf(" ");
02354 printf(" %3.0f ",trace_bclrTL);
02355 printf(" %3.0f ",trace_bclrBL);
02356 printf(" %3.0f ",trace_bclrTR);
02357 printf(" %3.0f ",trace_bclrBR);
02358 printf(" %3.0f\n", ipixel->bclrflt);
02359 }
02360 #endif
02361 ;
02362 # ifndef SKIP_ERT
02363 if (iopc >= max_opacity) {
02364 ASSERT(ipixel->lnk == 0);
02365 ipixel->lnk = 1;
02366 }
02367 # endif
02368 };
02369 ipixel += 1;
02370 ;
02371 botRLEdata += 1 * voxel_istride;
02372 count--;
02373 SET_VOXELS_LOADED;
02374
02375
02376
02377 while (count > 0) {
02378 if (PIXEL_IS_OPAQUE(ipixel))
02379 break;
02380 if (!voxels_loaded) {
02381
02382 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02383
02384
02385 ;
02386 ;
02387 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02388 client_data);
02389 shade_factor = bot_opc * slice_depth_cueing;
02390
02391 bot_rclr *= shade_factor;
02392 bot_gclr *= shade_factor;
02393 bot_bclr *= shade_factor;
02394 ;
02395 }
02396
02397 #ifdef DEBUG
02398 if (ipixel == trace_pixel_ptr) {
02399 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02400 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02401 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02402 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02403 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02404 }
02405 #endif
02406 ;
02407
02408 acc_opc = bot_opc * wgtBL;
02409
02410 acc_rclr = bot_rclr * wgtBL;
02411 acc_gclr = bot_gclr * wgtBL;
02412 acc_bclr = bot_bclr * wgtBL;
02413
02414 #ifdef DEBUG
02415 if (ipixel == trace_pixel_ptr) {
02416 trace_opcBL = bot_opc;
02417 trace_rclrBL = bot_rclr;
02418 trace_gclrBL = bot_gclr;
02419 trace_bclrBL = bot_bclr;
02420
02421 }
02422 #endif
02423 ;
02424
02425 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02426
02427
02428 ;
02429 ;
02430 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02431 client_data);
02432 shade_factor = bot_opc * slice_depth_cueing;
02433
02434 bot_rclr *= shade_factor;
02435 bot_gclr *= shade_factor;
02436 bot_bclr *= shade_factor;
02437 ;
02438
02439 acc_opc += bot_opc * wgtBR;
02440
02441 acc_rclr += bot_rclr * wgtBR;
02442 acc_gclr += bot_gclr * wgtBR;
02443 acc_bclr += bot_bclr * wgtBR;
02444
02445 #ifdef DEBUG
02446 if (ipixel == trace_pixel_ptr) {
02447 trace_opcBR = bot_opc;
02448 trace_rclrBR = bot_rclr;
02449 trace_gclrBR = bot_gclr;
02450 trace_bclrBR = bot_bclr;
02451
02452 }
02453 #endif
02454 ;
02455
02456 COUNT_RESAMPLE;
02457 if (acc_opc > min_opacity) {
02458 COUNT_COMPOSITE;
02459 iopc = ipixel->opcflt;
02460 # ifndef SKIP_ERT
02461 ASSERT(iopc < max_opacity);
02462 # endif
02463 iopc_inv = (float)1. - iopc;
02464
02465 ipixel->rclrflt += acc_rclr * iopc_inv;
02466 ipixel->gclrflt += acc_gclr * iopc_inv;
02467 ipixel->bclrflt += acc_bclr * iopc_inv;
02468 iopc += acc_opc * iopc_inv;
02469 ipixel->opcflt = iopc;
02470
02471 #ifdef DEBUG
02472 if (ipixel == trace_pixel_ptr) {
02473 #ifdef COMPUTE_SHADOW_BUFFER
02474 printf("{%3d} %3d %3d", k, icount-i-count, j);
02475 #else
02476 printf("[%3d] %3d %3d", k, icount-i-count, j);
02477 #endif
02478 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02479 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02480 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02481 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02482 printf(" %3.0f %3.0f\n", iopc*255.,
02483 ipixel->rclrflt);
02484
02485
02486 printf(" ");
02487 printf(" %3.0f ",trace_gclrTL);
02488 printf(" %3.0f ",trace_gclrBL);
02489 printf(" %3.0f ",trace_gclrTR);
02490 printf(" %3.0f ",trace_gclrBR);
02491 printf(" %3.0f\n", ipixel->gclrflt);
02492 printf(" ");
02493 printf(" %3.0f ",trace_bclrTL);
02494 printf(" %3.0f ",trace_bclrBL);
02495 printf(" %3.0f ",trace_bclrTR);
02496 printf(" %3.0f ",trace_bclrBR);
02497 printf(" %3.0f\n", ipixel->bclrflt);
02498 }
02499 #endif
02500 ;
02501 # ifndef SKIP_ERT
02502 if (iopc >= max_opacity) {
02503 ASSERT(ipixel->lnk == 0);
02504 ipixel->lnk = 1;
02505 }
02506 # endif
02507 };
02508 ipixel += 1;
02509 ;
02510 botRLEdata += 1 * voxel_istride;
02511 count--;
02512 SET_VOXELS_LOADED;
02513 }
02514 break;
02515 case TOP_NONZERO__BOT_NONZERO:
02516
02517 if (!voxels_loaded) {
02518
02519 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02520
02521
02522 ;
02523 ;
02524 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
02525 client_data);
02526 shade_factor = top_opc * slice_depth_cueing;
02527
02528 top_rclr *= shade_factor;
02529 top_gclr *= shade_factor;
02530 top_bclr *= shade_factor;
02531 ;
02532 }
02533
02534 #ifdef DEBUG
02535 if (ipixel == trace_pixel_ptr) {
02536 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02537 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02538 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02539 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02540 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02541 }
02542 #endif
02543 ;
02544
02545 acc_opc = top_opc * wgtTL;
02546
02547 acc_rclr = top_rclr * wgtTL;
02548 acc_gclr = top_gclr * wgtTL;
02549 acc_bclr = top_bclr * wgtTL;
02550
02551 #ifdef DEBUG
02552 if (ipixel == trace_pixel_ptr) {
02553 trace_opcTL = top_opc;
02554 trace_rclrTL = top_rclr;
02555 trace_gclrTL = top_gclr;
02556 trace_bclrTL = top_bclr;
02557
02558 }
02559 #endif
02560 ;
02561
02562 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02563
02564
02565 ;
02566 ;
02567 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02568 client_data);
02569 shade_factor = bot_opc * slice_depth_cueing;
02570
02571 bot_rclr *= shade_factor;
02572 bot_gclr *= shade_factor;
02573 bot_bclr *= shade_factor;
02574 ;
02575
02576 acc_opc += bot_opc * wgtBR;
02577
02578 acc_rclr += bot_rclr * wgtBR;
02579 acc_gclr += bot_gclr * wgtBR;
02580 acc_bclr += bot_bclr * wgtBR;
02581
02582 #ifdef DEBUG
02583 if (ipixel == trace_pixel_ptr) {
02584 trace_opcBR = bot_opc;
02585 trace_rclrBR = bot_rclr;
02586 trace_gclrBR = bot_gclr;
02587 trace_bclrBR = bot_bclr;
02588
02589 }
02590 #endif
02591 ;
02592
02593 COUNT_RESAMPLE;
02594 if (acc_opc > min_opacity) {
02595 COUNT_COMPOSITE;
02596 iopc = ipixel->opcflt;
02597 # ifndef SKIP_ERT
02598 ASSERT(iopc < max_opacity);
02599 # endif
02600 iopc_inv = (float)1. - iopc;
02601
02602 ipixel->rclrflt += acc_rclr * iopc_inv;
02603 ipixel->gclrflt += acc_gclr * iopc_inv;
02604 ipixel->bclrflt += acc_bclr * iopc_inv;
02605 iopc += acc_opc * iopc_inv;
02606 ipixel->opcflt = iopc;
02607
02608 #ifdef DEBUG
02609 if (ipixel == trace_pixel_ptr) {
02610 #ifdef COMPUTE_SHADOW_BUFFER
02611 printf("{%3d} %3d %3d", k, icount-i-count, j);
02612 #else
02613 printf("[%3d] %3d %3d", k, icount-i-count, j);
02614 #endif
02615 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02616 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02617 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02618 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02619 printf(" %3.0f %3.0f\n", iopc*255.,
02620 ipixel->rclrflt);
02621
02622
02623 printf(" ");
02624 printf(" %3.0f ",trace_gclrTL);
02625 printf(" %3.0f ",trace_gclrBL);
02626 printf(" %3.0f ",trace_gclrTR);
02627 printf(" %3.0f ",trace_gclrBR);
02628 printf(" %3.0f\n", ipixel->gclrflt);
02629 printf(" ");
02630 printf(" %3.0f ",trace_bclrTL);
02631 printf(" %3.0f ",trace_bclrBL);
02632 printf(" %3.0f ",trace_bclrTR);
02633 printf(" %3.0f ",trace_bclrBR);
02634 printf(" %3.0f\n", ipixel->bclrflt);
02635 }
02636 #endif
02637 ;
02638 # ifndef SKIP_ERT
02639 if (iopc >= max_opacity) {
02640 ASSERT(ipixel->lnk == 0);
02641 ipixel->lnk = 1;
02642 }
02643 # endif
02644 };
02645 ipixel += 1;
02646 ;
02647 botRLEdata += 1 * voxel_istride;
02648 count--;
02649 SET_VOXELS_LOADED;
02650
02651
02652
02653 while (count > 0) {
02654 if (PIXEL_IS_OPAQUE(ipixel))
02655 break;
02656 if (!voxels_loaded) {
02657
02658 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02659
02660
02661 ;
02662 ;
02663 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02664 client_data);
02665 shade_factor = bot_opc * slice_depth_cueing;
02666
02667 bot_rclr *= shade_factor;
02668 bot_gclr *= shade_factor;
02669 bot_bclr *= shade_factor;
02670 ;
02671 }
02672
02673 #ifdef DEBUG
02674 if (ipixel == trace_pixel_ptr) {
02675 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02676 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02677 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02678 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02679 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02680 }
02681 #endif
02682 ;
02683
02684 acc_opc = bot_opc * wgtBL;
02685
02686 acc_rclr = bot_rclr * wgtBL;
02687 acc_gclr = bot_gclr * wgtBL;
02688 acc_bclr = bot_bclr * wgtBL;
02689
02690 #ifdef DEBUG
02691 if (ipixel == trace_pixel_ptr) {
02692 trace_opcBL = bot_opc;
02693 trace_rclrBL = bot_rclr;
02694 trace_gclrBL = bot_gclr;
02695 trace_bclrBL = bot_bclr;
02696
02697 }
02698 #endif
02699 ;
02700
02701 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02702
02703
02704 ;
02705 ;
02706 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02707 client_data);
02708 shade_factor = bot_opc * slice_depth_cueing;
02709
02710 bot_rclr *= shade_factor;
02711 bot_gclr *= shade_factor;
02712 bot_bclr *= shade_factor;
02713 ;
02714
02715 acc_opc += bot_opc * wgtBR;
02716
02717 acc_rclr += bot_rclr * wgtBR;
02718 acc_gclr += bot_gclr * wgtBR;
02719 acc_bclr += bot_bclr * wgtBR;
02720
02721 #ifdef DEBUG
02722 if (ipixel == trace_pixel_ptr) {
02723 trace_opcBR = bot_opc;
02724 trace_rclrBR = bot_rclr;
02725 trace_gclrBR = bot_gclr;
02726 trace_bclrBR = bot_bclr;
02727
02728 }
02729 #endif
02730 ;
02731
02732 COUNT_RESAMPLE;
02733 if (acc_opc > min_opacity) {
02734 COUNT_COMPOSITE;
02735 iopc = ipixel->opcflt;
02736 # ifndef SKIP_ERT
02737 ASSERT(iopc < max_opacity);
02738 # endif
02739 iopc_inv = (float)1. - iopc;
02740
02741 ipixel->rclrflt += acc_rclr * iopc_inv;
02742 ipixel->gclrflt += acc_gclr * iopc_inv;
02743 ipixel->bclrflt += acc_bclr * iopc_inv;
02744 iopc += acc_opc * iopc_inv;
02745 ipixel->opcflt = iopc;
02746
02747 #ifdef DEBUG
02748 if (ipixel == trace_pixel_ptr) {
02749 #ifdef COMPUTE_SHADOW_BUFFER
02750 printf("{%3d} %3d %3d", k, icount-i-count, j);
02751 #else
02752 printf("[%3d] %3d %3d", k, icount-i-count, j);
02753 #endif
02754 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02755 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02756 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02757 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02758 printf(" %3.0f %3.0f\n", iopc*255.,
02759 ipixel->rclrflt);
02760
02761
02762 printf(" ");
02763 printf(" %3.0f ",trace_gclrTL);
02764 printf(" %3.0f ",trace_gclrBL);
02765 printf(" %3.0f ",trace_gclrTR);
02766 printf(" %3.0f ",trace_gclrBR);
02767 printf(" %3.0f\n", ipixel->gclrflt);
02768 printf(" ");
02769 printf(" %3.0f ",trace_bclrTL);
02770 printf(" %3.0f ",trace_bclrBL);
02771 printf(" %3.0f ",trace_bclrTR);
02772 printf(" %3.0f ",trace_bclrBR);
02773 printf(" %3.0f\n", ipixel->bclrflt);
02774 }
02775 #endif
02776 ;
02777 # ifndef SKIP_ERT
02778 if (iopc >= max_opacity) {
02779 ASSERT(ipixel->lnk == 0);
02780 ipixel->lnk = 1;
02781 }
02782 # endif
02783 };
02784 ipixel += 1;
02785 ;
02786 botRLEdata += 1 * voxel_istride;
02787 count--;
02788 SET_VOXELS_LOADED;
02789 }
02790 break;
02791 case BOT_NONZERO__BOT_NONZERO:
02792
02793
02794 while (count > 0) {
02795 if (PIXEL_IS_OPAQUE(ipixel))
02796 break;
02797 if (!voxels_loaded) {
02798
02799 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02800
02801
02802 ;
02803 ;
02804 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02805 client_data);
02806 shade_factor = bot_opc * slice_depth_cueing;
02807
02808 bot_rclr *= shade_factor;
02809 bot_gclr *= shade_factor;
02810 bot_bclr *= shade_factor;
02811 ;
02812 }
02813
02814 #ifdef DEBUG
02815 if (ipixel == trace_pixel_ptr) {
02816 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02817 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02818 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02819 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02820 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02821 }
02822 #endif
02823 ;
02824
02825 acc_opc = bot_opc * wgtBL;
02826
02827 acc_rclr = bot_rclr * wgtBL;
02828 acc_gclr = bot_gclr * wgtBL;
02829 acc_bclr = bot_bclr * wgtBL;
02830
02831 #ifdef DEBUG
02832 if (ipixel == trace_pixel_ptr) {
02833 trace_opcBL = bot_opc;
02834 trace_rclrBL = bot_rclr;
02835 trace_gclrBL = bot_gclr;
02836 trace_bclrBL = bot_bclr;
02837
02838 }
02839 #endif
02840 ;
02841
02842 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02843
02844
02845 ;
02846 ;
02847 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02848 client_data);
02849 shade_factor = bot_opc * slice_depth_cueing;
02850
02851 bot_rclr *= shade_factor;
02852 bot_gclr *= shade_factor;
02853 bot_bclr *= shade_factor;
02854 ;
02855
02856 acc_opc += bot_opc * wgtBR;
02857
02858 acc_rclr += bot_rclr * wgtBR;
02859 acc_gclr += bot_gclr * wgtBR;
02860 acc_bclr += bot_bclr * wgtBR;
02861
02862 #ifdef DEBUG
02863 if (ipixel == trace_pixel_ptr) {
02864 trace_opcBR = bot_opc;
02865 trace_rclrBR = bot_rclr;
02866 trace_gclrBR = bot_gclr;
02867 trace_bclrBR = bot_bclr;
02868
02869 }
02870 #endif
02871 ;
02872
02873 COUNT_RESAMPLE;
02874 if (acc_opc > min_opacity) {
02875 COUNT_COMPOSITE;
02876 iopc = ipixel->opcflt;
02877 # ifndef SKIP_ERT
02878 ASSERT(iopc < max_opacity);
02879 # endif
02880 iopc_inv = (float)1. - iopc;
02881
02882 ipixel->rclrflt += acc_rclr * iopc_inv;
02883 ipixel->gclrflt += acc_gclr * iopc_inv;
02884 ipixel->bclrflt += acc_bclr * iopc_inv;
02885 iopc += acc_opc * iopc_inv;
02886 ipixel->opcflt = iopc;
02887
02888 #ifdef DEBUG
02889 if (ipixel == trace_pixel_ptr) {
02890 #ifdef COMPUTE_SHADOW_BUFFER
02891 printf("{%3d} %3d %3d", k, icount-i-count, j);
02892 #else
02893 printf("[%3d] %3d %3d", k, icount-i-count, j);
02894 #endif
02895 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02896 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02897 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02898 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02899 printf(" %3.0f %3.0f\n", iopc*255.,
02900 ipixel->rclrflt);
02901
02902
02903 printf(" ");
02904 printf(" %3.0f ",trace_gclrTL);
02905 printf(" %3.0f ",trace_gclrBL);
02906 printf(" %3.0f ",trace_gclrTR);
02907 printf(" %3.0f ",trace_gclrBR);
02908 printf(" %3.0f\n", ipixel->gclrflt);
02909 printf(" ");
02910 printf(" %3.0f ",trace_bclrTL);
02911 printf(" %3.0f ",trace_bclrBL);
02912 printf(" %3.0f ",trace_bclrTR);
02913 printf(" %3.0f ",trace_bclrBR);
02914 printf(" %3.0f\n", ipixel->bclrflt);
02915 }
02916 #endif
02917 ;
02918 # ifndef SKIP_ERT
02919 if (iopc >= max_opacity) {
02920 ASSERT(ipixel->lnk == 0);
02921 ipixel->lnk = 1;
02922 }
02923 # endif
02924 };
02925 ipixel += 1;
02926 ;
02927 botRLEdata += 1 * voxel_istride;
02928 count--;
02929 SET_VOXELS_LOADED;
02930 }
02931 break;
02932 case ALL_NONZERO__BOT_NONZERO:
02933
02934
02935 if (!voxels_loaded) {
02936
02937 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02938
02939
02940 ;
02941 ;
02942 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
02943 client_data);
02944 shade_factor = top_opc * slice_depth_cueing;
02945
02946 top_rclr *= shade_factor;
02947 top_gclr *= shade_factor;
02948 top_bclr *= shade_factor;
02949 ;
02950
02951 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02952
02953
02954 ;
02955 ;
02956 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
02957 client_data);
02958 shade_factor = bot_opc * slice_depth_cueing;
02959
02960 bot_rclr *= shade_factor;
02961 bot_gclr *= shade_factor;
02962 bot_bclr *= shade_factor;
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 = top_opc * wgtTL;
02978
02979 acc_rclr = top_rclr * wgtTL;
02980 acc_gclr = top_gclr * wgtTL;
02981 acc_bclr = top_bclr * wgtTL;
02982
02983 #ifdef DEBUG
02984 if (ipixel == trace_pixel_ptr) {
02985 trace_opcTL = top_opc;
02986 trace_rclrTL = top_rclr;
02987 trace_gclrTL = top_gclr;
02988 trace_bclrTL = top_bclr;
02989
02990 }
02991 #endif
02992 ;
02993
02994 acc_opc += bot_opc * wgtBL;
02995
02996 acc_rclr += bot_rclr * wgtBL;
02997 acc_gclr += bot_gclr * wgtBL;
02998 acc_bclr += bot_bclr * wgtBL;
02999
03000 #ifdef DEBUG
03001 if (ipixel == trace_pixel_ptr) {
03002 trace_opcBL = bot_opc;
03003 trace_rclrBL = bot_rclr;
03004 trace_gclrBL = bot_gclr;
03005 trace_bclrBL = bot_bclr;
03006
03007 }
03008 #endif
03009 ;
03010
03011 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03012
03013
03014 ;
03015 ;
03016 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03017 client_data);
03018 shade_factor = bot_opc * slice_depth_cueing;
03019
03020 bot_rclr *= shade_factor;
03021 bot_gclr *= shade_factor;
03022 bot_bclr *= shade_factor;
03023 ;
03024
03025 acc_opc += bot_opc * wgtBR;
03026
03027 acc_rclr += bot_rclr * wgtBR;
03028 acc_gclr += bot_gclr * wgtBR;
03029 acc_bclr += bot_bclr * wgtBR;
03030
03031 #ifdef DEBUG
03032 if (ipixel == trace_pixel_ptr) {
03033 trace_opcBR = bot_opc;
03034 trace_rclrBR = bot_rclr;
03035 trace_gclrBR = bot_gclr;
03036 trace_bclrBR = bot_bclr;
03037
03038 }
03039 #endif
03040 ;
03041
03042 COUNT_RESAMPLE;
03043 if (acc_opc > min_opacity) {
03044 COUNT_COMPOSITE;
03045 iopc = ipixel->opcflt;
03046 # ifndef SKIP_ERT
03047 ASSERT(iopc < max_opacity);
03048 # endif
03049 iopc_inv = (float)1. - iopc;
03050
03051 ipixel->rclrflt += acc_rclr * iopc_inv;
03052 ipixel->gclrflt += acc_gclr * iopc_inv;
03053 ipixel->bclrflt += acc_bclr * iopc_inv;
03054 iopc += acc_opc * iopc_inv;
03055 ipixel->opcflt = iopc;
03056
03057 #ifdef DEBUG
03058 if (ipixel == trace_pixel_ptr) {
03059 #ifdef COMPUTE_SHADOW_BUFFER
03060 printf("{%3d} %3d %3d", k, icount-i-count, j);
03061 #else
03062 printf("[%3d] %3d %3d", k, icount-i-count, j);
03063 #endif
03064 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03065 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03066 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03067 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03068 printf(" %3.0f %3.0f\n", iopc*255.,
03069 ipixel->rclrflt);
03070
03071
03072 printf(" ");
03073 printf(" %3.0f ",trace_gclrTL);
03074 printf(" %3.0f ",trace_gclrBL);
03075 printf(" %3.0f ",trace_gclrTR);
03076 printf(" %3.0f ",trace_gclrBR);
03077 printf(" %3.0f\n", ipixel->gclrflt);
03078 printf(" ");
03079 printf(" %3.0f ",trace_bclrTL);
03080 printf(" %3.0f ",trace_bclrBL);
03081 printf(" %3.0f ",trace_bclrTR);
03082 printf(" %3.0f ",trace_bclrBR);
03083 printf(" %3.0f\n", ipixel->bclrflt);
03084 }
03085 #endif
03086 ;
03087 # ifndef SKIP_ERT
03088 if (iopc >= max_opacity) {
03089 ASSERT(ipixel->lnk == 0);
03090 ipixel->lnk = 1;
03091 }
03092 # endif
03093 };
03094 ipixel += 1;
03095 ;
03096 botRLEdata += 1 * voxel_istride;
03097 count--;
03098 SET_VOXELS_LOADED;
03099
03100
03101
03102 while (count > 0) {
03103 if (PIXEL_IS_OPAQUE(ipixel))
03104 break;
03105 if (!voxels_loaded) {
03106
03107 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03108
03109
03110 ;
03111 ;
03112 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03113 client_data);
03114 shade_factor = bot_opc * slice_depth_cueing;
03115
03116 bot_rclr *= shade_factor;
03117 bot_gclr *= shade_factor;
03118 bot_bclr *= shade_factor;
03119 ;
03120 }
03121
03122 #ifdef DEBUG
03123 if (ipixel == trace_pixel_ptr) {
03124 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03125 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03126 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03127 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03128 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03129 }
03130 #endif
03131 ;
03132
03133 acc_opc = bot_opc * wgtBL;
03134
03135 acc_rclr = bot_rclr * wgtBL;
03136 acc_gclr = bot_gclr * wgtBL;
03137 acc_bclr = bot_bclr * wgtBL;
03138
03139 #ifdef DEBUG
03140 if (ipixel == trace_pixel_ptr) {
03141 trace_opcBL = bot_opc;
03142 trace_rclrBL = bot_rclr;
03143 trace_gclrBL = bot_gclr;
03144 trace_bclrBL = bot_bclr;
03145
03146 }
03147 #endif
03148 ;
03149
03150 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03151
03152
03153 ;
03154 ;
03155 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03156 client_data);
03157 shade_factor = bot_opc * slice_depth_cueing;
03158
03159 bot_rclr *= shade_factor;
03160 bot_gclr *= shade_factor;
03161 bot_bclr *= shade_factor;
03162 ;
03163
03164 acc_opc += bot_opc * wgtBR;
03165
03166 acc_rclr += bot_rclr * wgtBR;
03167 acc_gclr += bot_gclr * wgtBR;
03168 acc_bclr += bot_bclr * wgtBR;
03169
03170 #ifdef DEBUG
03171 if (ipixel == trace_pixel_ptr) {
03172 trace_opcBR = bot_opc;
03173 trace_rclrBR = bot_rclr;
03174 trace_gclrBR = bot_gclr;
03175 trace_bclrBR = bot_bclr;
03176
03177 }
03178 #endif
03179 ;
03180
03181 COUNT_RESAMPLE;
03182 if (acc_opc > min_opacity) {
03183 COUNT_COMPOSITE;
03184 iopc = ipixel->opcflt;
03185 # ifndef SKIP_ERT
03186 ASSERT(iopc < max_opacity);
03187 # endif
03188 iopc_inv = (float)1. - iopc;
03189
03190 ipixel->rclrflt += acc_rclr * iopc_inv;
03191 ipixel->gclrflt += acc_gclr * iopc_inv;
03192 ipixel->bclrflt += acc_bclr * iopc_inv;
03193 iopc += acc_opc * iopc_inv;
03194 ipixel->opcflt = iopc;
03195
03196 #ifdef DEBUG
03197 if (ipixel == trace_pixel_ptr) {
03198 #ifdef COMPUTE_SHADOW_BUFFER
03199 printf("{%3d} %3d %3d", k, icount-i-count, j);
03200 #else
03201 printf("[%3d] %3d %3d", k, icount-i-count, j);
03202 #endif
03203 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03204 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03205 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03206 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03207 printf(" %3.0f %3.0f\n", iopc*255.,
03208 ipixel->rclrflt);
03209
03210
03211 printf(" ");
03212 printf(" %3.0f ",trace_gclrTL);
03213 printf(" %3.0f ",trace_gclrBL);
03214 printf(" %3.0f ",trace_gclrTR);
03215 printf(" %3.0f ",trace_gclrBR);
03216 printf(" %3.0f\n", ipixel->gclrflt);
03217 printf(" ");
03218 printf(" %3.0f ",trace_bclrTL);
03219 printf(" %3.0f ",trace_bclrBL);
03220 printf(" %3.0f ",trace_bclrTR);
03221 printf(" %3.0f ",trace_bclrBR);
03222 printf(" %3.0f\n", ipixel->bclrflt);
03223 }
03224 #endif
03225 ;
03226 # ifndef SKIP_ERT
03227 if (iopc >= max_opacity) {
03228 ASSERT(ipixel->lnk == 0);
03229 ipixel->lnk = 1;
03230 }
03231 # endif
03232 };
03233 ipixel += 1;
03234 ;
03235 botRLEdata += 1 * voxel_istride;
03236 count--;
03237 SET_VOXELS_LOADED;
03238 }
03239 break;
03240 case ALL_ZERO__ALL_NONZERO:
03241
03242
03243 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03244
03245
03246 ;
03247 ;
03248 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
03249 client_data);
03250 shade_factor = top_opc * slice_depth_cueing;
03251
03252 top_rclr *= shade_factor;
03253 top_gclr *= shade_factor;
03254 top_bclr *= shade_factor;
03255 ;
03256
03257 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03258
03259
03260 ;
03261 ;
03262 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03263 client_data);
03264 shade_factor = bot_opc * slice_depth_cueing;
03265
03266 bot_rclr *= shade_factor;
03267 bot_gclr *= shade_factor;
03268 bot_bclr *= shade_factor;
03269 ;
03270
03271 #ifdef DEBUG
03272 if (ipixel == trace_pixel_ptr) {
03273 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03274 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03275 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03276 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03277 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03278 }
03279 #endif
03280 ;
03281
03282 acc_opc = top_opc * wgtTR;
03283
03284 acc_rclr = top_rclr * wgtTR;
03285 acc_gclr = top_gclr * wgtTR;
03286 acc_bclr = top_bclr * wgtTR;
03287
03288 #ifdef DEBUG
03289 if (ipixel == trace_pixel_ptr) {
03290 trace_opcTR = top_opc;
03291 trace_rclrTR = top_rclr;
03292 trace_gclrTR = top_gclr;
03293 trace_bclrTR = top_bclr;
03294
03295 }
03296 #endif
03297 ;
03298
03299 acc_opc += bot_opc * wgtBR;
03300
03301 acc_rclr += bot_rclr * wgtBR;
03302 acc_gclr += bot_gclr * wgtBR;
03303 acc_bclr += bot_bclr * wgtBR;
03304
03305 #ifdef DEBUG
03306 if (ipixel == trace_pixel_ptr) {
03307 trace_opcBR = bot_opc;
03308 trace_rclrBR = bot_rclr;
03309 trace_gclrBR = bot_gclr;
03310 trace_bclrBR = bot_bclr;
03311
03312 }
03313 #endif
03314 ;
03315
03316 COUNT_RESAMPLE;
03317 if (acc_opc > min_opacity) {
03318 COUNT_COMPOSITE;
03319 iopc = ipixel->opcflt;
03320 # ifndef SKIP_ERT
03321 ASSERT(iopc < max_opacity);
03322 # endif
03323 iopc_inv = (float)1. - iopc;
03324
03325 ipixel->rclrflt += acc_rclr * iopc_inv;
03326 ipixel->gclrflt += acc_gclr * iopc_inv;
03327 ipixel->bclrflt += acc_bclr * iopc_inv;
03328 iopc += acc_opc * iopc_inv;
03329 ipixel->opcflt = iopc;
03330
03331 #ifdef DEBUG
03332 if (ipixel == trace_pixel_ptr) {
03333 #ifdef COMPUTE_SHADOW_BUFFER
03334 printf("{%3d} %3d %3d", k, icount-i-count, j);
03335 #else
03336 printf("[%3d] %3d %3d", k, icount-i-count, j);
03337 #endif
03338 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03339 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03340 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03341 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03342 printf(" %3.0f %3.0f\n", iopc*255.,
03343 ipixel->rclrflt);
03344
03345
03346 printf(" ");
03347 printf(" %3.0f ",trace_gclrTL);
03348 printf(" %3.0f ",trace_gclrBL);
03349 printf(" %3.0f ",trace_gclrTR);
03350 printf(" %3.0f ",trace_gclrBR);
03351 printf(" %3.0f\n", ipixel->gclrflt);
03352 printf(" ");
03353 printf(" %3.0f ",trace_bclrTL);
03354 printf(" %3.0f ",trace_bclrBL);
03355 printf(" %3.0f ",trace_bclrTR);
03356 printf(" %3.0f ",trace_bclrBR);
03357 printf(" %3.0f\n", ipixel->bclrflt);
03358 }
03359 #endif
03360 ;
03361 # ifndef SKIP_ERT
03362 if (iopc >= max_opacity) {
03363 ASSERT(ipixel->lnk == 0);
03364 ipixel->lnk = 1;
03365 }
03366 # endif
03367 };
03368 ipixel += 1;
03369 topRLEdata += 1 * voxel_istride;
03370 botRLEdata += 1 * voxel_istride;
03371 count--;
03372 SET_VOXELS_LOADED;
03373
03374
03375
03376 while (count > 0) {
03377 if (PIXEL_IS_OPAQUE(ipixel))
03378 break;
03379 if (!voxels_loaded) {
03380
03381 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03382
03383
03384 ;
03385 ;
03386 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
03387 client_data);
03388 shade_factor = top_opc * slice_depth_cueing;
03389
03390 top_rclr *= shade_factor;
03391 top_gclr *= shade_factor;
03392 top_bclr *= shade_factor;
03393 ;
03394
03395 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03396
03397
03398 ;
03399 ;
03400 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03401 client_data);
03402 shade_factor = bot_opc * slice_depth_cueing;
03403
03404 bot_rclr *= shade_factor;
03405 bot_gclr *= shade_factor;
03406 bot_bclr *= shade_factor;
03407 ;
03408 }
03409
03410 #ifdef DEBUG
03411 if (ipixel == trace_pixel_ptr) {
03412 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03413 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03414 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03415 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03416 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03417 }
03418 #endif
03419 ;
03420
03421 acc_opc = top_opc * wgtTL;
03422
03423 acc_rclr = top_rclr * wgtTL;
03424 acc_gclr = top_gclr * wgtTL;
03425 acc_bclr = top_bclr * wgtTL;
03426
03427 #ifdef DEBUG
03428 if (ipixel == trace_pixel_ptr) {
03429 trace_opcTL = top_opc;
03430 trace_rclrTL = top_rclr;
03431 trace_gclrTL = top_gclr;
03432 trace_bclrTL = top_bclr;
03433
03434 }
03435 #endif
03436 ;
03437
03438 acc_opc += bot_opc * wgtBL;
03439
03440 acc_rclr += bot_rclr * wgtBL;
03441 acc_gclr += bot_gclr * wgtBL;
03442 acc_bclr += bot_bclr * wgtBL;
03443
03444 #ifdef DEBUG
03445 if (ipixel == trace_pixel_ptr) {
03446 trace_opcBL = bot_opc;
03447 trace_rclrBL = bot_rclr;
03448 trace_gclrBL = bot_gclr;
03449 trace_bclrBL = bot_bclr;
03450
03451 }
03452 #endif
03453 ;
03454
03455 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03456
03457
03458 ;
03459 ;
03460 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
03461 client_data);
03462 shade_factor = top_opc * slice_depth_cueing;
03463
03464 top_rclr *= shade_factor;
03465 top_gclr *= shade_factor;
03466 top_bclr *= shade_factor;
03467 ;
03468
03469 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03470
03471
03472 ;
03473 ;
03474 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03475 client_data);
03476 shade_factor = bot_opc * slice_depth_cueing;
03477
03478 bot_rclr *= shade_factor;
03479 bot_gclr *= shade_factor;
03480 bot_bclr *= shade_factor;
03481 ;
03482
03483 acc_opc += top_opc * wgtTR;
03484
03485 acc_rclr += top_rclr * wgtTR;
03486 acc_gclr += top_gclr * wgtTR;
03487 acc_bclr += top_bclr * wgtTR;
03488
03489 #ifdef DEBUG
03490 if (ipixel == trace_pixel_ptr) {
03491 trace_opcTR = top_opc;
03492 trace_rclrTR = top_rclr;
03493 trace_gclrTR = top_gclr;
03494 trace_bclrTR = top_bclr;
03495
03496 }
03497 #endif
03498 ;
03499
03500 acc_opc += bot_opc * wgtBR;
03501
03502 acc_rclr += bot_rclr * wgtBR;
03503 acc_gclr += bot_gclr * wgtBR;
03504 acc_bclr += bot_bclr * wgtBR;
03505
03506 #ifdef DEBUG
03507 if (ipixel == trace_pixel_ptr) {
03508 trace_opcBR = bot_opc;
03509 trace_rclrBR = bot_rclr;
03510 trace_gclrBR = bot_gclr;
03511 trace_bclrBR = bot_bclr;
03512
03513 }
03514 #endif
03515 ;
03516
03517 COUNT_RESAMPLE;
03518 if (acc_opc > min_opacity) {
03519 COUNT_COMPOSITE;
03520 iopc = ipixel->opcflt;
03521 # ifndef SKIP_ERT
03522 ASSERT(iopc < max_opacity);
03523 # endif
03524 iopc_inv = (float)1. - iopc;
03525
03526 ipixel->rclrflt += acc_rclr * iopc_inv;
03527 ipixel->gclrflt += acc_gclr * iopc_inv;
03528 ipixel->bclrflt += acc_bclr * iopc_inv;
03529 iopc += acc_opc * iopc_inv;
03530 ipixel->opcflt = iopc;
03531
03532 #ifdef DEBUG
03533 if (ipixel == trace_pixel_ptr) {
03534 #ifdef COMPUTE_SHADOW_BUFFER
03535 printf("{%3d} %3d %3d", k, icount-i-count, j);
03536 #else
03537 printf("[%3d] %3d %3d", k, icount-i-count, j);
03538 #endif
03539 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03540 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03541 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03542 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03543 printf(" %3.0f %3.0f\n", iopc*255.,
03544 ipixel->rclrflt);
03545
03546
03547 printf(" ");
03548 printf(" %3.0f ",trace_gclrTL);
03549 printf(" %3.0f ",trace_gclrBL);
03550 printf(" %3.0f ",trace_gclrTR);
03551 printf(" %3.0f ",trace_gclrBR);
03552 printf(" %3.0f\n", ipixel->gclrflt);
03553 printf(" ");
03554 printf(" %3.0f ",trace_bclrTL);
03555 printf(" %3.0f ",trace_bclrBL);
03556 printf(" %3.0f ",trace_bclrTR);
03557 printf(" %3.0f ",trace_bclrBR);
03558 printf(" %3.0f\n", ipixel->bclrflt);
03559 }
03560 #endif
03561 ;
03562 # ifndef SKIP_ERT
03563 if (iopc >= max_opacity) {
03564 ASSERT(ipixel->lnk == 0);
03565 ipixel->lnk = 1;
03566 }
03567 # endif
03568 };
03569 ipixel += 1;
03570 topRLEdata += 1 * voxel_istride;
03571 botRLEdata += 1 * voxel_istride;
03572 count--;
03573 SET_VOXELS_LOADED;
03574 }
03575 break;
03576 case TOP_NONZERO__ALL_NONZERO:
03577
03578
03579 if (!voxels_loaded) {
03580
03581 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03582
03583
03584 ;
03585 ;
03586 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
03587 client_data);
03588 shade_factor = top_opc * slice_depth_cueing;
03589
03590 top_rclr *= shade_factor;
03591 top_gclr *= shade_factor;
03592 top_bclr *= shade_factor;
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 = top_opc * wgtTL;
03608
03609 acc_rclr = top_rclr * wgtTL;
03610 acc_gclr = top_gclr * wgtTL;
03611 acc_bclr = top_bclr * wgtTL;
03612
03613 #ifdef DEBUG
03614 if (ipixel == trace_pixel_ptr) {
03615 trace_opcTL = top_opc;
03616 trace_rclrTL = top_rclr;
03617 trace_gclrTL = top_gclr;
03618 trace_bclrTL = top_bclr;
03619
03620 }
03621 #endif
03622 ;
03623
03624 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03625
03626
03627 ;
03628 ;
03629 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
03630 client_data);
03631 shade_factor = top_opc * slice_depth_cueing;
03632
03633 top_rclr *= shade_factor;
03634 top_gclr *= shade_factor;
03635 top_bclr *= shade_factor;
03636 ;
03637
03638 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03639
03640
03641 ;
03642 ;
03643 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03644 client_data);
03645 shade_factor = bot_opc * slice_depth_cueing;
03646
03647 bot_rclr *= shade_factor;
03648 bot_gclr *= shade_factor;
03649 bot_bclr *= shade_factor;
03650 ;
03651
03652 acc_opc += top_opc * wgtTR;
03653
03654 acc_rclr += top_rclr * wgtTR;
03655 acc_gclr += top_gclr * wgtTR;
03656 acc_bclr += top_bclr * wgtTR;
03657
03658 #ifdef DEBUG
03659 if (ipixel == trace_pixel_ptr) {
03660 trace_opcTR = top_opc;
03661 trace_rclrTR = top_rclr;
03662 trace_gclrTR = top_gclr;
03663 trace_bclrTR = top_bclr;
03664
03665 }
03666 #endif
03667 ;
03668
03669 acc_opc += bot_opc * wgtBR;
03670
03671 acc_rclr += bot_rclr * wgtBR;
03672 acc_gclr += bot_gclr * wgtBR;
03673 acc_bclr += bot_bclr * wgtBR;
03674
03675 #ifdef DEBUG
03676 if (ipixel == trace_pixel_ptr) {
03677 trace_opcBR = bot_opc;
03678 trace_rclrBR = bot_rclr;
03679 trace_gclrBR = bot_gclr;
03680 trace_bclrBR = bot_bclr;
03681
03682 }
03683 #endif
03684 ;
03685
03686 COUNT_RESAMPLE;
03687 if (acc_opc > min_opacity) {
03688 COUNT_COMPOSITE;
03689 iopc = ipixel->opcflt;
03690 # ifndef SKIP_ERT
03691 ASSERT(iopc < max_opacity);
03692 # endif
03693 iopc_inv = (float)1. - iopc;
03694
03695 ipixel->rclrflt += acc_rclr * iopc_inv;
03696 ipixel->gclrflt += acc_gclr * iopc_inv;
03697 ipixel->bclrflt += acc_bclr * iopc_inv;
03698 iopc += acc_opc * iopc_inv;
03699 ipixel->opcflt = iopc;
03700
03701 #ifdef DEBUG
03702 if (ipixel == trace_pixel_ptr) {
03703 #ifdef COMPUTE_SHADOW_BUFFER
03704 printf("{%3d} %3d %3d", k, icount-i-count, j);
03705 #else
03706 printf("[%3d] %3d %3d", k, icount-i-count, j);
03707 #endif
03708 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03709 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03710 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03711 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03712 printf(" %3.0f %3.0f\n", iopc*255.,
03713 ipixel->rclrflt);
03714
03715
03716 printf(" ");
03717 printf(" %3.0f ",trace_gclrTL);
03718 printf(" %3.0f ",trace_gclrBL);
03719 printf(" %3.0f ",trace_gclrTR);
03720 printf(" %3.0f ",trace_gclrBR);
03721 printf(" %3.0f\n", ipixel->gclrflt);
03722 printf(" ");
03723 printf(" %3.0f ",trace_bclrTL);
03724 printf(" %3.0f ",trace_bclrBL);
03725 printf(" %3.0f ",trace_bclrTR);
03726 printf(" %3.0f ",trace_bclrBR);
03727 printf(" %3.0f\n", ipixel->bclrflt);
03728 }
03729 #endif
03730 ;
03731 # ifndef SKIP_ERT
03732 if (iopc >= max_opacity) {
03733 ASSERT(ipixel->lnk == 0);
03734 ipixel->lnk = 1;
03735 }
03736 # endif
03737 };
03738 ipixel += 1;
03739 topRLEdata += 1 * voxel_istride;
03740 botRLEdata += 1 * voxel_istride;
03741 count--;
03742 SET_VOXELS_LOADED;
03743
03744
03745
03746 while (count > 0) {
03747 if (PIXEL_IS_OPAQUE(ipixel))
03748 break;
03749 if (!voxels_loaded) {
03750
03751 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03752
03753
03754 ;
03755 ;
03756 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
03757 client_data);
03758 shade_factor = top_opc * slice_depth_cueing;
03759
03760 top_rclr *= shade_factor;
03761 top_gclr *= shade_factor;
03762 top_bclr *= shade_factor;
03763 ;
03764
03765 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03766
03767
03768 ;
03769 ;
03770 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03771 client_data);
03772 shade_factor = bot_opc * slice_depth_cueing;
03773
03774 bot_rclr *= shade_factor;
03775 bot_gclr *= shade_factor;
03776 bot_bclr *= shade_factor;
03777 ;
03778 }
03779
03780 #ifdef DEBUG
03781 if (ipixel == trace_pixel_ptr) {
03782 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03783 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03784 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03785 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03786 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03787 }
03788 #endif
03789 ;
03790
03791 acc_opc = top_opc * wgtTL;
03792
03793 acc_rclr = top_rclr * wgtTL;
03794 acc_gclr = top_gclr * wgtTL;
03795 acc_bclr = top_bclr * wgtTL;
03796
03797 #ifdef DEBUG
03798 if (ipixel == trace_pixel_ptr) {
03799 trace_opcTL = top_opc;
03800 trace_rclrTL = top_rclr;
03801 trace_gclrTL = top_gclr;
03802 trace_bclrTL = top_bclr;
03803
03804 }
03805 #endif
03806 ;
03807
03808 acc_opc += bot_opc * wgtBL;
03809
03810 acc_rclr += bot_rclr * wgtBL;
03811 acc_gclr += bot_gclr * wgtBL;
03812 acc_bclr += bot_bclr * wgtBL;
03813
03814 #ifdef DEBUG
03815 if (ipixel == trace_pixel_ptr) {
03816 trace_opcBL = bot_opc;
03817 trace_rclrBL = bot_rclr;
03818 trace_gclrBL = bot_gclr;
03819 trace_bclrBL = bot_bclr;
03820
03821 }
03822 #endif
03823 ;
03824
03825 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03826
03827
03828 ;
03829 ;
03830 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
03831 client_data);
03832 shade_factor = top_opc * slice_depth_cueing;
03833
03834 top_rclr *= shade_factor;
03835 top_gclr *= shade_factor;
03836 top_bclr *= shade_factor;
03837 ;
03838
03839 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03840
03841
03842 ;
03843 ;
03844 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03845 client_data);
03846 shade_factor = bot_opc * slice_depth_cueing;
03847
03848 bot_rclr *= shade_factor;
03849 bot_gclr *= shade_factor;
03850 bot_bclr *= shade_factor;
03851 ;
03852
03853 acc_opc += top_opc * wgtTR;
03854
03855 acc_rclr += top_rclr * wgtTR;
03856 acc_gclr += top_gclr * wgtTR;
03857 acc_bclr += top_bclr * wgtTR;
03858
03859 #ifdef DEBUG
03860 if (ipixel == trace_pixel_ptr) {
03861 trace_opcTR = top_opc;
03862 trace_rclrTR = top_rclr;
03863 trace_gclrTR = top_gclr;
03864 trace_bclrTR = top_bclr;
03865
03866 }
03867 #endif
03868 ;
03869
03870 acc_opc += bot_opc * wgtBR;
03871
03872 acc_rclr += bot_rclr * wgtBR;
03873 acc_gclr += bot_gclr * wgtBR;
03874 acc_bclr += bot_bclr * wgtBR;
03875
03876 #ifdef DEBUG
03877 if (ipixel == trace_pixel_ptr) {
03878 trace_opcBR = bot_opc;
03879 trace_rclrBR = bot_rclr;
03880 trace_gclrBR = bot_gclr;
03881 trace_bclrBR = bot_bclr;
03882
03883 }
03884 #endif
03885 ;
03886
03887 COUNT_RESAMPLE;
03888 if (acc_opc > min_opacity) {
03889 COUNT_COMPOSITE;
03890 iopc = ipixel->opcflt;
03891 # ifndef SKIP_ERT
03892 ASSERT(iopc < max_opacity);
03893 # endif
03894 iopc_inv = (float)1. - iopc;
03895
03896 ipixel->rclrflt += acc_rclr * iopc_inv;
03897 ipixel->gclrflt += acc_gclr * iopc_inv;
03898 ipixel->bclrflt += acc_bclr * iopc_inv;
03899 iopc += acc_opc * iopc_inv;
03900 ipixel->opcflt = iopc;
03901
03902 #ifdef DEBUG
03903 if (ipixel == trace_pixel_ptr) {
03904 #ifdef COMPUTE_SHADOW_BUFFER
03905 printf("{%3d} %3d %3d", k, icount-i-count, j);
03906 #else
03907 printf("[%3d] %3d %3d", k, icount-i-count, j);
03908 #endif
03909 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03910 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03911 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03912 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03913 printf(" %3.0f %3.0f\n", iopc*255.,
03914 ipixel->rclrflt);
03915
03916
03917 printf(" ");
03918 printf(" %3.0f ",trace_gclrTL);
03919 printf(" %3.0f ",trace_gclrBL);
03920 printf(" %3.0f ",trace_gclrTR);
03921 printf(" %3.0f ",trace_gclrBR);
03922 printf(" %3.0f\n", ipixel->gclrflt);
03923 printf(" ");
03924 printf(" %3.0f ",trace_bclrTL);
03925 printf(" %3.0f ",trace_bclrBL);
03926 printf(" %3.0f ",trace_bclrTR);
03927 printf(" %3.0f ",trace_bclrBR);
03928 printf(" %3.0f\n", ipixel->bclrflt);
03929 }
03930 #endif
03931 ;
03932 # ifndef SKIP_ERT
03933 if (iopc >= max_opacity) {
03934 ASSERT(ipixel->lnk == 0);
03935 ipixel->lnk = 1;
03936 }
03937 # endif
03938 };
03939 ipixel += 1;
03940 topRLEdata += 1 * voxel_istride;
03941 botRLEdata += 1 * voxel_istride;
03942 count--;
03943 SET_VOXELS_LOADED;
03944 }
03945 break;
03946 case BOT_NONZERO__ALL_NONZERO:
03947
03948
03949 if (!voxels_loaded) {
03950
03951 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03952
03953
03954 ;
03955 ;
03956 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
03957 client_data);
03958 shade_factor = bot_opc * slice_depth_cueing;
03959
03960 bot_rclr *= shade_factor;
03961 bot_gclr *= shade_factor;
03962 bot_bclr *= shade_factor;
03963 ;
03964 }
03965
03966 #ifdef DEBUG
03967 if (ipixel == trace_pixel_ptr) {
03968 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03969 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03970 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03971 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03972 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03973 }
03974 #endif
03975 ;
03976
03977 acc_opc = bot_opc * wgtBL;
03978
03979 acc_rclr = bot_rclr * wgtBL;
03980 acc_gclr = bot_gclr * wgtBL;
03981 acc_bclr = bot_bclr * wgtBL;
03982
03983 #ifdef DEBUG
03984 if (ipixel == trace_pixel_ptr) {
03985 trace_opcBL = bot_opc;
03986 trace_rclrBL = bot_rclr;
03987 trace_gclrBL = bot_gclr;
03988 trace_bclrBL = bot_bclr;
03989
03990 }
03991 #endif
03992 ;
03993
03994 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03995
03996
03997 ;
03998 ;
03999 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
04000 client_data);
04001 shade_factor = top_opc * slice_depth_cueing;
04002
04003 top_rclr *= shade_factor;
04004 top_gclr *= shade_factor;
04005 top_bclr *= shade_factor;
04006 ;
04007
04008 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
04009
04010
04011 ;
04012 ;
04013 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
04014 client_data);
04015 shade_factor = bot_opc * slice_depth_cueing;
04016
04017 bot_rclr *= shade_factor;
04018 bot_gclr *= shade_factor;
04019 bot_bclr *= shade_factor;
04020 ;
04021
04022 acc_opc += top_opc * wgtTR;
04023
04024 acc_rclr += top_rclr * wgtTR;
04025 acc_gclr += top_gclr * wgtTR;
04026 acc_bclr += top_bclr * wgtTR;
04027
04028 #ifdef DEBUG
04029 if (ipixel == trace_pixel_ptr) {
04030 trace_opcTR = top_opc;
04031 trace_rclrTR = top_rclr;
04032 trace_gclrTR = top_gclr;
04033 trace_bclrTR = top_bclr;
04034
04035 }
04036 #endif
04037 ;
04038
04039 acc_opc += bot_opc * wgtBR;
04040
04041 acc_rclr += bot_rclr * wgtBR;
04042 acc_gclr += bot_gclr * wgtBR;
04043 acc_bclr += bot_bclr * wgtBR;
04044
04045 #ifdef DEBUG
04046 if (ipixel == trace_pixel_ptr) {
04047 trace_opcBR = bot_opc;
04048 trace_rclrBR = bot_rclr;
04049 trace_gclrBR = bot_gclr;
04050 trace_bclrBR = bot_bclr;
04051
04052 }
04053 #endif
04054 ;
04055
04056 COUNT_RESAMPLE;
04057 if (acc_opc > min_opacity) {
04058 COUNT_COMPOSITE;
04059 iopc = ipixel->opcflt;
04060 # ifndef SKIP_ERT
04061 ASSERT(iopc < max_opacity);
04062 # endif
04063 iopc_inv = (float)1. - iopc;
04064
04065 ipixel->rclrflt += acc_rclr * iopc_inv;
04066 ipixel->gclrflt += acc_gclr * iopc_inv;
04067 ipixel->bclrflt += acc_bclr * iopc_inv;
04068 iopc += acc_opc * iopc_inv;
04069 ipixel->opcflt = iopc;
04070
04071 #ifdef DEBUG
04072 if (ipixel == trace_pixel_ptr) {
04073 #ifdef COMPUTE_SHADOW_BUFFER
04074 printf("{%3d} %3d %3d", k, icount-i-count, j);
04075 #else
04076 printf("[%3d] %3d %3d", k, icount-i-count, j);
04077 #endif
04078 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04079 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04080 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04081 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04082 printf(" %3.0f %3.0f\n", iopc*255.,
04083 ipixel->rclrflt);
04084
04085
04086 printf(" ");
04087 printf(" %3.0f ",trace_gclrTL);
04088 printf(" %3.0f ",trace_gclrBL);
04089 printf(" %3.0f ",trace_gclrTR);
04090 printf(" %3.0f ",trace_gclrBR);
04091 printf(" %3.0f\n", ipixel->gclrflt);
04092 printf(" ");
04093 printf(" %3.0f ",trace_bclrTL);
04094 printf(" %3.0f ",trace_bclrBL);
04095 printf(" %3.0f ",trace_bclrTR);
04096 printf(" %3.0f ",trace_bclrBR);
04097 printf(" %3.0f\n", ipixel->bclrflt);
04098 }
04099 #endif
04100 ;
04101 # ifndef SKIP_ERT
04102 if (iopc >= max_opacity) {
04103 ASSERT(ipixel->lnk == 0);
04104 ipixel->lnk = 1;
04105 }
04106 # endif
04107 };
04108 ipixel += 1;
04109 topRLEdata += 1 * voxel_istride;
04110 botRLEdata += 1 * voxel_istride;
04111 count--;
04112 SET_VOXELS_LOADED;
04113
04114
04115
04116 while (count > 0) {
04117 if (PIXEL_IS_OPAQUE(ipixel))
04118 break;
04119 if (!voxels_loaded) {
04120
04121 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
04122
04123
04124 ;
04125 ;
04126 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
04127 client_data);
04128 shade_factor = top_opc * slice_depth_cueing;
04129
04130 top_rclr *= shade_factor;
04131 top_gclr *= shade_factor;
04132 top_bclr *= shade_factor;
04133 ;
04134
04135 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
04136
04137
04138 ;
04139 ;
04140 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
04141 client_data);
04142 shade_factor = bot_opc * slice_depth_cueing;
04143
04144 bot_rclr *= shade_factor;
04145 bot_gclr *= shade_factor;
04146 bot_bclr *= shade_factor;
04147 ;
04148 }
04149
04150 #ifdef DEBUG
04151 if (ipixel == trace_pixel_ptr) {
04152 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04153 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04154 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04155 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04156 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04157 }
04158 #endif
04159 ;
04160
04161 acc_opc = top_opc * wgtTL;
04162
04163 acc_rclr = top_rclr * wgtTL;
04164 acc_gclr = top_gclr * wgtTL;
04165 acc_bclr = top_bclr * wgtTL;
04166
04167 #ifdef DEBUG
04168 if (ipixel == trace_pixel_ptr) {
04169 trace_opcTL = top_opc;
04170 trace_rclrTL = top_rclr;
04171 trace_gclrTL = top_gclr;
04172 trace_bclrTL = top_bclr;
04173
04174 }
04175 #endif
04176 ;
04177
04178 acc_opc += bot_opc * wgtBL;
04179
04180 acc_rclr += bot_rclr * wgtBL;
04181 acc_gclr += bot_gclr * wgtBL;
04182 acc_bclr += bot_bclr * wgtBL;
04183
04184 #ifdef DEBUG
04185 if (ipixel == trace_pixel_ptr) {
04186 trace_opcBL = bot_opc;
04187 trace_rclrBL = bot_rclr;
04188 trace_gclrBL = bot_gclr;
04189 trace_bclrBL = bot_bclr;
04190
04191 }
04192 #endif
04193 ;
04194
04195 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
04196
04197
04198 ;
04199 ;
04200 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
04201 client_data);
04202 shade_factor = top_opc * slice_depth_cueing;
04203
04204 top_rclr *= shade_factor;
04205 top_gclr *= shade_factor;
04206 top_bclr *= shade_factor;
04207 ;
04208
04209 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
04210
04211
04212 ;
04213 ;
04214 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
04215 client_data);
04216 shade_factor = bot_opc * slice_depth_cueing;
04217
04218 bot_rclr *= shade_factor;
04219 bot_gclr *= shade_factor;
04220 bot_bclr *= shade_factor;
04221 ;
04222
04223 acc_opc += top_opc * wgtTR;
04224
04225 acc_rclr += top_rclr * wgtTR;
04226 acc_gclr += top_gclr * wgtTR;
04227 acc_bclr += top_bclr * wgtTR;
04228
04229 #ifdef DEBUG
04230 if (ipixel == trace_pixel_ptr) {
04231 trace_opcTR = top_opc;
04232 trace_rclrTR = top_rclr;
04233 trace_gclrTR = top_gclr;
04234 trace_bclrTR = top_bclr;
04235
04236 }
04237 #endif
04238 ;
04239
04240 acc_opc += bot_opc * wgtBR;
04241
04242 acc_rclr += bot_rclr * wgtBR;
04243 acc_gclr += bot_gclr * wgtBR;
04244 acc_bclr += bot_bclr * wgtBR;
04245
04246 #ifdef DEBUG
04247 if (ipixel == trace_pixel_ptr) {
04248 trace_opcBR = bot_opc;
04249 trace_rclrBR = bot_rclr;
04250 trace_gclrBR = bot_gclr;
04251 trace_bclrBR = bot_bclr;
04252
04253 }
04254 #endif
04255 ;
04256
04257 COUNT_RESAMPLE;
04258 if (acc_opc > min_opacity) {
04259 COUNT_COMPOSITE;
04260 iopc = ipixel->opcflt;
04261 # ifndef SKIP_ERT
04262 ASSERT(iopc < max_opacity);
04263 # endif
04264 iopc_inv = (float)1. - iopc;
04265
04266 ipixel->rclrflt += acc_rclr * iopc_inv;
04267 ipixel->gclrflt += acc_gclr * iopc_inv;
04268 ipixel->bclrflt += acc_bclr * iopc_inv;
04269 iopc += acc_opc * iopc_inv;
04270 ipixel->opcflt = iopc;
04271
04272 #ifdef DEBUG
04273 if (ipixel == trace_pixel_ptr) {
04274 #ifdef COMPUTE_SHADOW_BUFFER
04275 printf("{%3d} %3d %3d", k, icount-i-count, j);
04276 #else
04277 printf("[%3d] %3d %3d", k, icount-i-count, j);
04278 #endif
04279 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04280 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04281 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04282 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04283 printf(" %3.0f %3.0f\n", iopc*255.,
04284 ipixel->rclrflt);
04285
04286
04287 printf(" ");
04288 printf(" %3.0f ",trace_gclrTL);
04289 printf(" %3.0f ",trace_gclrBL);
04290 printf(" %3.0f ",trace_gclrTR);
04291 printf(" %3.0f ",trace_gclrBR);
04292 printf(" %3.0f\n", ipixel->gclrflt);
04293 printf(" ");
04294 printf(" %3.0f ",trace_bclrTL);
04295 printf(" %3.0f ",trace_bclrBL);
04296 printf(" %3.0f ",trace_bclrTR);
04297 printf(" %3.0f ",trace_bclrBR);
04298 printf(" %3.0f\n", ipixel->bclrflt);
04299 }
04300 #endif
04301 ;
04302 # ifndef SKIP_ERT
04303 if (iopc >= max_opacity) {
04304 ASSERT(ipixel->lnk == 0);
04305 ipixel->lnk = 1;
04306 }
04307 # endif
04308 };
04309 ipixel += 1;
04310 topRLEdata += 1 * voxel_istride;
04311 botRLEdata += 1 * voxel_istride;
04312 count--;
04313 SET_VOXELS_LOADED;
04314 }
04315 break;
04316 case ALL_NONZERO__ALL_NONZERO:
04317
04318 while (count > 0) {
04319 if (PIXEL_IS_OPAQUE(ipixel))
04320 break;
04321 if (!voxels_loaded) {
04322
04323 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
04324
04325
04326 ;
04327 ;
04328 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
04329 client_data);
04330 shade_factor = top_opc * slice_depth_cueing;
04331
04332 top_rclr *= shade_factor;
04333 top_gclr *= shade_factor;
04334 top_bclr *= shade_factor;
04335 ;
04336
04337 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
04338
04339
04340 ;
04341 ;
04342 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
04343 client_data);
04344 shade_factor = bot_opc * slice_depth_cueing;
04345
04346 bot_rclr *= shade_factor;
04347 bot_gclr *= shade_factor;
04348 bot_bclr *= shade_factor;
04349 ;
04350 }
04351
04352 #ifdef DEBUG
04353 if (ipixel == trace_pixel_ptr) {
04354 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04355 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04356 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04357 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04358 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04359 }
04360 #endif
04361 ;
04362
04363 acc_opc = top_opc * wgtTL;
04364
04365 acc_rclr = top_rclr * wgtTL;
04366 acc_gclr = top_gclr * wgtTL;
04367 acc_bclr = top_bclr * wgtTL;
04368
04369 #ifdef DEBUG
04370 if (ipixel == trace_pixel_ptr) {
04371 trace_opcTL = top_opc;
04372 trace_rclrTL = top_rclr;
04373 trace_gclrTL = top_gclr;
04374 trace_bclrTL = top_bclr;
04375
04376 }
04377 #endif
04378 ;
04379
04380 acc_opc += bot_opc * wgtBL;
04381
04382 acc_rclr += bot_rclr * wgtBL;
04383 acc_gclr += bot_gclr * wgtBL;
04384 acc_bclr += bot_bclr * wgtBL;
04385
04386 #ifdef DEBUG
04387 if (ipixel == trace_pixel_ptr) {
04388 trace_opcBL = bot_opc;
04389 trace_rclrBL = bot_rclr;
04390 trace_gclrBL = bot_gclr;
04391 trace_bclrBL = bot_bclr;
04392
04393 }
04394 #endif
04395 ;
04396
04397 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
04398
04399
04400 ;
04401 ;
04402 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
04403 client_data);
04404 shade_factor = top_opc * slice_depth_cueing;
04405
04406 top_rclr *= shade_factor;
04407 top_gclr *= shade_factor;
04408 top_bclr *= shade_factor;
04409 ;
04410
04411 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
04412
04413
04414 ;
04415 ;
04416 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
04417 client_data);
04418 shade_factor = bot_opc * slice_depth_cueing;
04419
04420 bot_rclr *= shade_factor;
04421 bot_gclr *= shade_factor;
04422 bot_bclr *= shade_factor;
04423 ;
04424
04425 acc_opc += top_opc * wgtTR;
04426
04427 acc_rclr += top_rclr * wgtTR;
04428 acc_gclr += top_gclr * wgtTR;
04429 acc_bclr += top_bclr * wgtTR;
04430
04431 #ifdef DEBUG
04432 if (ipixel == trace_pixel_ptr) {
04433 trace_opcTR = top_opc;
04434 trace_rclrTR = top_rclr;
04435 trace_gclrTR = top_gclr;
04436 trace_bclrTR = top_bclr;
04437
04438 }
04439 #endif
04440 ;
04441
04442 acc_opc += bot_opc * wgtBR;
04443
04444 acc_rclr += bot_rclr * wgtBR;
04445 acc_gclr += bot_gclr * wgtBR;
04446 acc_bclr += bot_bclr * wgtBR;
04447
04448 #ifdef DEBUG
04449 if (ipixel == trace_pixel_ptr) {
04450 trace_opcBR = bot_opc;
04451 trace_rclrBR = bot_rclr;
04452 trace_gclrBR = bot_gclr;
04453 trace_bclrBR = bot_bclr;
04454
04455 }
04456 #endif
04457 ;
04458
04459 COUNT_RESAMPLE;
04460 if (acc_opc > min_opacity) {
04461 COUNT_COMPOSITE;
04462 iopc = ipixel->opcflt;
04463 # ifndef SKIP_ERT
04464 ASSERT(iopc < max_opacity);
04465 # endif
04466 iopc_inv = (float)1. - iopc;
04467
04468 ipixel->rclrflt += acc_rclr * iopc_inv;
04469 ipixel->gclrflt += acc_gclr * iopc_inv;
04470 ipixel->bclrflt += acc_bclr * iopc_inv;
04471 iopc += acc_opc * iopc_inv;
04472 ipixel->opcflt = iopc;
04473
04474 #ifdef DEBUG
04475 if (ipixel == trace_pixel_ptr) {
04476 #ifdef COMPUTE_SHADOW_BUFFER
04477 printf("{%3d} %3d %3d", k, icount-i-count, j);
04478 #else
04479 printf("[%3d] %3d %3d", k, icount-i-count, j);
04480 #endif
04481 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04482 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04483 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04484 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04485 printf(" %3.0f %3.0f\n", iopc*255.,
04486 ipixel->rclrflt);
04487
04488
04489 printf(" ");
04490 printf(" %3.0f ",trace_gclrTL);
04491 printf(" %3.0f ",trace_gclrBL);
04492 printf(" %3.0f ",trace_gclrTR);
04493 printf(" %3.0f ",trace_gclrBR);
04494 printf(" %3.0f\n", ipixel->gclrflt);
04495 printf(" ");
04496 printf(" %3.0f ",trace_bclrTL);
04497 printf(" %3.0f ",trace_bclrBL);
04498 printf(" %3.0f ",trace_bclrTR);
04499 printf(" %3.0f ",trace_bclrBR);
04500 printf(" %3.0f\n", ipixel->bclrflt);
04501 }
04502 #endif
04503 ;
04504 # ifndef SKIP_ERT
04505 if (iopc >= max_opacity) {
04506 ASSERT(ipixel->lnk == 0);
04507 ipixel->lnk = 1;
04508 }
04509 # endif
04510 };
04511 ipixel += 1;
04512 topRLEdata += 1 * voxel_istride;
04513 botRLEdata += 1 * voxel_istride;
04514 count--;
04515 SET_VOXELS_LOADED;
04516 }
04517 break;
04518 default:
04519 VPBug("illegal value for run states in compositing loop");
04520 }
04521 #else
04522
04523 while (count > 0) {
04524 if (last_run_state == ALL_ZERO && run_state == ALL_ZERO) {
04525 ipixel += count;
04526 if (i != -1) {
04527 ;
04528 ;
04529 }
04530 count = 0;
04531 break;
04532 }
04533 if (ipixel->lnk != 0)
04534 break;
04535
04536 #ifdef DEBUG
04537 if (ipixel == trace_pixel_ptr) {
04538 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04539 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04540 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04541 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04542 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04543 }
04544 #endif
04545 ;
04546
04547 acc_opc = 0;
04548 acc_rclr = acc_gclr = acc_bclr = 0;
04549 if (last_run_state & TOP_NONZERO) {
04550 if (!voxels_loaded) {
04551
04552 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
04553
04554
04555 ;
04556 ;
04557 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
04558 client_data);
04559 shade_factor = top_opc * slice_depth_cueing;
04560
04561 top_rclr *= shade_factor;
04562 top_gclr *= shade_factor;
04563 top_bclr *= shade_factor;
04564 ;
04565 }
04566
04567 acc_opc += top_opc * wgtTL;
04568
04569 acc_rclr += top_rclr * wgtTL;
04570 acc_gclr += top_gclr * wgtTL;
04571 acc_bclr += top_bclr * wgtTL;
04572
04573 #ifdef DEBUG
04574 if (ipixel == trace_pixel_ptr) {
04575 trace_opcTL = top_opc;
04576 trace_rclrTL = top_rclr;
04577 trace_gclrTL = top_gclr;
04578 trace_bclrTL = top_bclr;
04579
04580 }
04581 #endif
04582 ;
04583 }
04584 if (last_run_state & BOT_NONZERO) {
04585 if (!voxels_loaded) {
04586
04587 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
04588
04589
04590 ;
04591 ;
04592 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
04593 client_data);
04594 shade_factor = bot_opc * slice_depth_cueing;
04595
04596 bot_rclr *= shade_factor;
04597 bot_gclr *= shade_factor;
04598 bot_bclr *= shade_factor;
04599 ;
04600 }
04601
04602 acc_opc += bot_opc * wgtBL;
04603
04604 acc_rclr += bot_rclr * wgtBL;
04605 acc_gclr += bot_gclr * wgtBL;
04606 acc_bclr += bot_bclr * wgtBL;
04607
04608 #ifdef DEBUG
04609 if (ipixel == trace_pixel_ptr) {
04610 trace_opcBL = bot_opc;
04611 trace_rclrBL = bot_rclr;
04612 trace_gclrBL = bot_gclr;
04613 trace_bclrBL = bot_bclr;
04614
04615 }
04616 #endif
04617 ;
04618 }
04619 if (run_state & TOP_NONZERO) {
04620
04621 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
04622
04623
04624 ;
04625 ;
04626 shade_func(topRLEdata, &(top_rclr), &(top_gclr), &(top_bclr),
04627 client_data);
04628 shade_factor = top_opc * slice_depth_cueing;
04629
04630 top_rclr *= shade_factor;
04631 top_gclr *= shade_factor;
04632 top_bclr *= shade_factor;
04633 ;
04634
04635 acc_opc += top_opc * wgtTR;
04636
04637 acc_rclr += top_rclr * wgtTR;
04638 acc_gclr += top_gclr * wgtTR;
04639 acc_bclr += top_bclr * wgtTR;
04640
04641 #ifdef DEBUG
04642 if (ipixel == trace_pixel_ptr) {
04643 trace_opcTR = top_opc;
04644 trace_rclrTR = top_rclr;
04645 trace_gclrTR = top_gclr;
04646 trace_bclrTR = top_bclr;
04647
04648 }
04649 #endif
04650 ;
04651 topRLEdata += 1 * voxel_istride;
04652 } else {
04653 if (i != -1) {
04654 ;
04655 }
04656 }
04657 if (run_state & BOT_NONZERO) {
04658
04659 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
04660
04661
04662 ;
04663 ;
04664 shade_func(botRLEdata, &(bot_rclr), &(bot_gclr), &(bot_bclr),
04665 client_data);
04666 shade_factor = bot_opc * slice_depth_cueing;
04667
04668 bot_rclr *= shade_factor;
04669 bot_gclr *= shade_factor;
04670 bot_bclr *= shade_factor;
04671 ;
04672
04673 acc_opc += bot_opc * wgtBR;
04674
04675 acc_rclr += bot_rclr * wgtBR;
04676 acc_gclr += bot_gclr * wgtBR;
04677 acc_bclr += bot_bclr * wgtBR;
04678
04679 #ifdef DEBUG
04680 if (ipixel == trace_pixel_ptr) {
04681 trace_opcBR = bot_opc;
04682 trace_rclrBR = bot_rclr;
04683 trace_gclrBR = bot_gclr;
04684 trace_bclrBR = bot_bclr;
04685
04686 }
04687 #endif
04688 ;
04689 botRLEdata += 1 * voxel_istride;
04690 } else {
04691 if (i != -1) {
04692 ;
04693 }
04694 }
04695
04696 COUNT_RESAMPLE;
04697 if (acc_opc > min_opacity) {
04698 COUNT_COMPOSITE;
04699 iopc = ipixel->opcflt;
04700 # ifndef SKIP_ERT
04701 ASSERT(iopc < max_opacity);
04702 # endif
04703 iopc_inv = (float)1. - iopc;
04704
04705 ipixel->rclrflt += acc_rclr * iopc_inv;
04706 ipixel->gclrflt += acc_gclr * iopc_inv;
04707 ipixel->bclrflt += acc_bclr * iopc_inv;
04708 iopc += acc_opc * iopc_inv;
04709 ipixel->opcflt = iopc;
04710
04711 #ifdef DEBUG
04712 if (ipixel == trace_pixel_ptr) {
04713 #ifdef COMPUTE_SHADOW_BUFFER
04714 printf("{%3d} %3d %3d", k, icount-i-count, j);
04715 #else
04716 printf("[%3d] %3d %3d", k, icount-i-count, j);
04717 #endif
04718 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04719 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04720 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04721 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04722 printf(" %3.0f %3.0f\n", iopc*255.,
04723 ipixel->rclrflt);
04724
04725
04726 printf(" ");
04727 printf(" %3.0f ",trace_gclrTL);
04728 printf(" %3.0f ",trace_gclrBL);
04729 printf(" %3.0f ",trace_gclrTR);
04730 printf(" %3.0f ",trace_gclrBR);
04731 printf(" %3.0f\n", ipixel->gclrflt);
04732 printf(" ");
04733 printf(" %3.0f ",trace_bclrTL);
04734 printf(" %3.0f ",trace_bclrBL);
04735 printf(" %3.0f ",trace_bclrTR);
04736 printf(" %3.0f ",trace_bclrBR);
04737 printf(" %3.0f\n", ipixel->bclrflt);
04738 }
04739 #endif
04740 ;
04741 # ifndef SKIP_ERT
04742 if (iopc >= max_opacity) {
04743 ASSERT(ipixel->lnk == 0);
04744 ipixel->lnk = 1;
04745 }
04746 # endif
04747 };
04748 ipixel += 1;
04749 count--;
04750 SET_VOXELS_LOADED;
04751 last_run_state = run_state;
04752 }
04753 #endif
04754
04755 GET_HIRES_TIME(vpc, t1);
04756 STORE_HIRES_TIME(vpc, VPTIMER_PROCESS_VOXELS, t0, t1);
04757 COPY_HIRES_TIME(t0, t1);
04758
04759 if (count > 0) {
04760 Debug((vpc, VPDEBUG_COMPOSITE, "Backup(%d)\n", count));
04761 toprun_count += count;
04762 botrun_count += count;
04763 i += count;
04764 }
04765 #endif
04766
04767
04768
04769
04770
04771 last_run_state = run_state;
04772 }
04773
04774
04775
04776
04777
04778 #ifdef UNROLL_RUN_LOOP
04779 ASSERT(i == 0);
04780 #else
04781 ASSERT(i == -1);
04782 #endif
04783
04784 #ifndef SKIP_COMPOSITE
04785 #ifdef UNROLL_RUN_LOOP
04786
04787 if (last_run_state != ALL_ZERO && !PIXEL_IS_OPAQUE(ipixel)) {
04788
04789
04790 Debug((vpc, VPDEBUG_COMPOSITE, "Run(1)End\n"));
04791 switch (last_run_state) {
04792 case TOP_NONZERO:
04793
04794 if (!voxels_loaded) {
04795
04796 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
04797
04798
04799 ;
04800 ;
04801 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
04802 client_data);
04803 shade_factor = top_opc * slice_depth_cueing;
04804
04805 top_rclr *= shade_factor;
04806 top_gclr *= shade_factor;
04807 top_bclr *= shade_factor;
04808 ;
04809 }
04810
04811 #ifdef DEBUG
04812 if (ipixel == trace_pixel_ptr) {
04813 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04814 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04815 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04816 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04817 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04818 }
04819 #endif
04820 ;
04821
04822 acc_opc = top_opc * wgtTL;
04823
04824 acc_rclr = top_rclr * wgtTL;
04825 acc_gclr = top_gclr * wgtTL;
04826 acc_bclr = top_bclr * wgtTL;
04827
04828 #ifdef DEBUG
04829 if (ipixel == trace_pixel_ptr) {
04830 trace_opcTL = top_opc;
04831 trace_rclrTL = top_rclr;
04832 trace_gclrTL = top_gclr;
04833 trace_bclrTL = top_bclr;
04834
04835 }
04836 #endif
04837 ;
04838
04839 COUNT_RESAMPLE;
04840 if (acc_opc > min_opacity) {
04841 COUNT_COMPOSITE;
04842 iopc = ipixel->opcflt;
04843 # ifndef SKIP_ERT
04844 ASSERT(iopc < max_opacity);
04845 # endif
04846 iopc_inv = (float)1. - iopc;
04847
04848 ipixel->rclrflt += acc_rclr * iopc_inv;
04849 ipixel->gclrflt += acc_gclr * iopc_inv;
04850 ipixel->bclrflt += acc_bclr * iopc_inv;
04851 iopc += acc_opc * iopc_inv;
04852 ipixel->opcflt = iopc;
04853
04854 #ifdef DEBUG
04855 if (ipixel == trace_pixel_ptr) {
04856 #ifdef COMPUTE_SHADOW_BUFFER
04857 printf("{%3d} %3d %3d", k, icount-i-count, j);
04858 #else
04859 printf("[%3d] %3d %3d", k, icount-i-count, j);
04860 #endif
04861 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04862 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04863 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04864 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04865 printf(" %3.0f %3.0f\n", iopc*255.,
04866 ipixel->rclrflt);
04867
04868
04869 printf(" ");
04870 printf(" %3.0f ",trace_gclrTL);
04871 printf(" %3.0f ",trace_gclrBL);
04872 printf(" %3.0f ",trace_gclrTR);
04873 printf(" %3.0f ",trace_gclrBR);
04874 printf(" %3.0f\n", ipixel->gclrflt);
04875 printf(" ");
04876 printf(" %3.0f ",trace_bclrTL);
04877 printf(" %3.0f ",trace_bclrBL);
04878 printf(" %3.0f ",trace_bclrTR);
04879 printf(" %3.0f ",trace_bclrBR);
04880 printf(" %3.0f\n", ipixel->bclrflt);
04881 }
04882 #endif
04883 ;
04884 # ifndef SKIP_ERT
04885 if (iopc >= max_opacity) {
04886 ASSERT(ipixel->lnk == 0);
04887 ipixel->lnk = 1;
04888 }
04889 # endif
04890 };
04891 break;
04892 case BOT_NONZERO:
04893
04894 if (!voxels_loaded) {
04895
04896 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
04897
04898
04899 ;
04900 ;
04901 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
04902 client_data);
04903 shade_factor = bot_opc * slice_depth_cueing;
04904
04905 bot_rclr *= shade_factor;
04906 bot_gclr *= shade_factor;
04907 bot_bclr *= shade_factor;
04908 ;
04909 }
04910
04911 #ifdef DEBUG
04912 if (ipixel == trace_pixel_ptr) {
04913 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04914 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04915 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04916 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04917 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04918 }
04919 #endif
04920 ;
04921
04922 acc_opc = bot_opc * wgtBL;
04923
04924 acc_rclr = bot_rclr * wgtBL;
04925 acc_gclr = bot_gclr * wgtBL;
04926 acc_bclr = bot_bclr * wgtBL;
04927
04928 #ifdef DEBUG
04929 if (ipixel == trace_pixel_ptr) {
04930 trace_opcBL = bot_opc;
04931 trace_rclrBL = bot_rclr;
04932 trace_gclrBL = bot_gclr;
04933 trace_bclrBL = bot_bclr;
04934
04935 }
04936 #endif
04937 ;
04938
04939 COUNT_RESAMPLE;
04940 if (acc_opc > min_opacity) {
04941 COUNT_COMPOSITE;
04942 iopc = ipixel->opcflt;
04943 # ifndef SKIP_ERT
04944 ASSERT(iopc < max_opacity);
04945 # endif
04946 iopc_inv = (float)1. - iopc;
04947
04948 ipixel->rclrflt += acc_rclr * iopc_inv;
04949 ipixel->gclrflt += acc_gclr * iopc_inv;
04950 ipixel->bclrflt += acc_bclr * iopc_inv;
04951 iopc += acc_opc * iopc_inv;
04952 ipixel->opcflt = iopc;
04953
04954 #ifdef DEBUG
04955 if (ipixel == trace_pixel_ptr) {
04956 #ifdef COMPUTE_SHADOW_BUFFER
04957 printf("{%3d} %3d %3d", k, icount-i-count, j);
04958 #else
04959 printf("[%3d] %3d %3d", k, icount-i-count, j);
04960 #endif
04961 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04962 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04963 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04964 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04965 printf(" %3.0f %3.0f\n", iopc*255.,
04966 ipixel->rclrflt);
04967
04968
04969 printf(" ");
04970 printf(" %3.0f ",trace_gclrTL);
04971 printf(" %3.0f ",trace_gclrBL);
04972 printf(" %3.0f ",trace_gclrTR);
04973 printf(" %3.0f ",trace_gclrBR);
04974 printf(" %3.0f\n", ipixel->gclrflt);
04975 printf(" ");
04976 printf(" %3.0f ",trace_bclrTL);
04977 printf(" %3.0f ",trace_bclrBL);
04978 printf(" %3.0f ",trace_bclrTR);
04979 printf(" %3.0f ",trace_bclrBR);
04980 printf(" %3.0f\n", ipixel->bclrflt);
04981 }
04982 #endif
04983 ;
04984 # ifndef SKIP_ERT
04985 if (iopc >= max_opacity) {
04986 ASSERT(ipixel->lnk == 0);
04987 ipixel->lnk = 1;
04988 }
04989 # endif
04990 };
04991 break;
04992 case ALL_NONZERO:
04993
04994 if (!voxels_loaded) {
04995
04996 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
04997
04998
04999 ;
05000 ;
05001 shade_func(topRLEdata - voxel_istride, &(top_rclr), &(top_gclr), &(top_bclr),
05002 client_data);
05003 shade_factor = top_opc * slice_depth_cueing;
05004
05005 top_rclr *= shade_factor;
05006 top_gclr *= shade_factor;
05007 top_bclr *= shade_factor;
05008 ;
05009
05010 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
05011
05012
05013 ;
05014 ;
05015 shade_func(botRLEdata - voxel_istride, &(bot_rclr), &(bot_gclr), &(bot_bclr),
05016 client_data);
05017 shade_factor = bot_opc * slice_depth_cueing;
05018
05019 bot_rclr *= shade_factor;
05020 bot_gclr *= shade_factor;
05021 bot_bclr *= shade_factor;
05022 ;
05023 }
05024
05025 #ifdef DEBUG
05026 if (ipixel == trace_pixel_ptr) {
05027 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
05028 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
05029 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
05030 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
05031 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
05032 }
05033 #endif
05034 ;
05035
05036 acc_opc = top_opc * wgtTL;
05037
05038 acc_rclr = top_rclr * wgtTL;
05039 acc_gclr = top_gclr * wgtTL;
05040 acc_bclr = top_bclr * wgtTL;
05041
05042 #ifdef DEBUG
05043 if (ipixel == trace_pixel_ptr) {
05044 trace_opcTL = top_opc;
05045 trace_rclrTL = top_rclr;
05046 trace_gclrTL = top_gclr;
05047 trace_bclrTL = top_bclr;
05048
05049 }
05050 #endif
05051 ;
05052
05053 acc_opc += bot_opc * wgtBL;
05054
05055 acc_rclr += bot_rclr * wgtBL;
05056 acc_gclr += bot_gclr * wgtBL;
05057 acc_bclr += bot_bclr * wgtBL;
05058
05059 #ifdef DEBUG
05060 if (ipixel == trace_pixel_ptr) {
05061 trace_opcBL = bot_opc;
05062 trace_rclrBL = bot_rclr;
05063 trace_gclrBL = bot_gclr;
05064 trace_bclrBL = bot_bclr;
05065
05066 }
05067 #endif
05068 ;
05069
05070 COUNT_RESAMPLE;
05071 if (acc_opc > min_opacity) {
05072 COUNT_COMPOSITE;
05073 iopc = ipixel->opcflt;
05074 # ifndef SKIP_ERT
05075 ASSERT(iopc < max_opacity);
05076 # endif
05077 iopc_inv = (float)1. - iopc;
05078
05079 ipixel->rclrflt += acc_rclr * iopc_inv;
05080 ipixel->gclrflt += acc_gclr * iopc_inv;
05081 ipixel->bclrflt += acc_bclr * iopc_inv;
05082 iopc += acc_opc * iopc_inv;
05083 ipixel->opcflt = iopc;
05084
05085 #ifdef DEBUG
05086 if (ipixel == trace_pixel_ptr) {
05087 #ifdef COMPUTE_SHADOW_BUFFER
05088 printf("{%3d} %3d %3d", k, icount-i-count, j);
05089 #else
05090 printf("[%3d] %3d %3d", k, icount-i-count, j);
05091 #endif
05092 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05093 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05094 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05095 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05096 printf(" %3.0f %3.0f\n", iopc*255.,
05097 ipixel->rclrflt);
05098
05099
05100 printf(" ");
05101 printf(" %3.0f ",trace_gclrTL);
05102 printf(" %3.0f ",trace_gclrBL);
05103 printf(" %3.0f ",trace_gclrTR);
05104 printf(" %3.0f ",trace_gclrBR);
05105 printf(" %3.0f\n", ipixel->gclrflt);
05106 printf(" ");
05107 printf(" %3.0f ",trace_bclrTL);
05108 printf(" %3.0f ",trace_bclrBL);
05109 printf(" %3.0f ",trace_bclrTR);
05110 printf(" %3.0f ",trace_bclrBR);
05111 printf(" %3.0f\n", ipixel->bclrflt);
05112 }
05113 #endif
05114 ;
05115 # ifndef SKIP_ERT
05116 if (iopc >= max_opacity) {
05117 ASSERT(ipixel->lnk == 0);
05118 ipixel->lnk = 1;
05119 }
05120 # endif
05121 };
05122 break;
05123 default:
05124 VPBug("illegal value for run state at end of scanline");
05125 }
05126 } else if (last_run_state == ALL_ZERO) {
05127 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
05128 } else {
05129 Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
05130 }
05131 #endif
05132 #endif
05133
05134 #ifndef UNROLL_RUN_LOOP
05135 run_state = final_run_state;
05136 #endif
05137
05138 if (j != 0 && ((run_state & 1) == 0)) {
05139 toprun_count = *topRLElen++;
05140 ASSERT(toprun_count == 0);
05141 }
05142 if (j != jcount && ((run_state & 2) == 0)) {
05143 botrun_count = *botRLElen++;
05144 ASSERT(botrun_count == 0);
05145 }
05146
05147
05148 #ifdef UNROLL_RUN_LOOP
05149 ipixel += intermediate_width - icount;
05150 #ifdef USE_SHADOW_BUFFER
05151 shadow_pixel += shadow_width - icount;
05152 #endif
05153 #else
05154 ipixel += intermediate_width - (icount+1);
05155 #ifdef USE_SHADOW_BUFFER
05156 shadow_pixel += shadow_width - (icount+1);
05157 #endif
05158 #endif
05159
05160 Debug((vpc, VPDEBUG_COMPOSITE, "ScanDone\n"));
05161 }
05162
05163
05164
05165
05166
05167 GET_HIRES_TIME(vpc, t1);
05168 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
05169
05170 Debug((vpc, VPDEBUG_COMPOSITE, "SliceDone\n"));
05171 }